#include "fontset.h"
#include "blockinput.h"
+#include "w32heap.h"
#include "w32term.h"
#include <shellapi.h>
}
}
- /* Convert x_2byte_buffer into a buffer of single byte
- characters - possibly containing MBCS runs. */
- bp = x_1byte_buffer;
- for (i = 0; i < len; i++)
- {
- if (BYTE1 (*(x_2byte_buffer + i)))
- *bp++ = BYTE1 (*(x_2byte_buffer + i));
- *bp++ = BYTE2 (*(x_2byte_buffer + i));
- }
- n_chars = bp - x_1byte_buffer;
-
fg = face->foreground;
bg = face->background;
SetBkColor (hdc, bg);
SetTextAlign (hdc, TA_BASELINE | TA_LEFT);
- if (print_via_unicode)
- n_chars = MultiByteToWideChar
- (codepage, 0, x_1byte_buffer, n_chars,
- x_2byte_buffer, FRAME_WINDOW_WIDTH (f));
+ /* On NT, where conversion to Unicode has to happen sometime
+ when using the normal ExtTextOut facility, we might as well
+ take advantage of x_2byte_buffer which is already allocated,
+ to avoid the allocation overhead for implicit conversion. */
+
+ if (!print_via_unicode
+ && codepage == CP_DEFAULT
+ && w32_enable_unicode_output
+ && os_subtype == OS_NT
+ && font && !font->bdf)
+ {
+ print_via_unicode = TRUE;
+ }
+
+ /* Note that we can special-case the conversion to Unicode when
+ the charset is CHARSET_ASCII (an important case) or Latin-1,
+ because x_2byte_buffer in fact already contains the unicode
+ characters. So avoid setting up x_1byte_buffer in that case. */
+ if (!print_via_unicode
+ || (charset != CHARSET_ASCII && charset != charset_latin_iso8859_1))
+ {
+ /* Convert x_2byte_buffer into a buffer of single byte
+ characters - possibly containing MBCS runs. */
+ bp = x_1byte_buffer;
+ for (i = 0; i < len; i++)
+ {
+ if (BYTE1 (*(x_2byte_buffer + i)))
+ *bp++ = BYTE1 (*(x_2byte_buffer + i));
+ *bp++ = BYTE2 (*(x_2byte_buffer + i));
+ }
+ n_chars = bp - x_1byte_buffer;
+ }
+ else
+ n_chars = len;
+
+ if (print_via_unicode
+ && charset != CHARSET_ASCII && charset != charset_latin_iso8859_1)
+ {
+ i = MultiByteToWideChar
+ (codepage, 0, x_1byte_buffer, n_chars,
+ x_2byte_buffer, FRAME_WINDOW_WIDTH (f));
+
+ /* Make sure we don't display nothing if conversion fails. */
+ if (i == 0)
+ print_via_unicode = FALSE;
+ else
+ n_chars = i;
+ }
if (font)
{
if (curs_y == f->phys_cursor_y
&& curs_x <= f->phys_cursor_x
&& curs_x + len > f->phys_cursor_x)
- f->phys_cursor_x = -1;
+ f->phys_cursor_on = 0;
if (updating_frame == 0)
{
if (curs_y == f->phys_cursor_y
&& curs_x <= f->phys_cursor_x
&& f->phys_cursor_x < first_unused)
- f->phys_cursor_x = -1;
+ f->phys_cursor_on = 0;
w32_clear_area (f, NULL,
CHAR_TO_PIXEL_COL (f, curs_x),
if (f == 0)
f = selected_frame;
- f->phys_cursor_x = -1; /* Cursor not visible. */
+ f->phys_cursor_on = 0; /* Cursor not visible. */
curs_x = 0; /* Nominal cursor position is top left. */
curs_y = 0;
abort ();
ht = f->height;
- intborder = f->output_data.w32->internal_border_width;
+ intborder = CHAR_TO_PIXEL_COL (f, FRAME_LEFT_SCROLL_BAR_WIDTH (f));
x_display_cursor (updating_frame, 0);
/* Copy [i,j) upward from [i+distance, j+distance) */
BitBlt (hdc,
intborder, CHAR_TO_PIXEL_ROW (f, i+distance),
- f->width * FONT_WIDTH (f->output_data.w32->font),
- (j-i) * f->output_data.w32->line_height,
+ FRAME_WINDOW_WIDTH (f) * FONT_WIDTH (FRAME_FONT (f)),
+ (j-i) * FRAME_LINE_HEIGHT (f),
hdc,
intborder, CHAR_TO_PIXEL_ROW (f, i),
SRCCOPY);
/* Copy (j, i] downward from (j+distance, i+distance] */
BitBlt (hdc,
intborder, CHAR_TO_PIXEL_ROW (f, j+1+distance),
- f->width * FONT_WIDTH (f->output_data.w32->font),
- (i-j) * f->output_data.w32->line_height,
+ FRAME_WINDOW_WIDTH (f) * FONT_WIDTH (FRAME_FONT (f)),
+ (i-j) * FRAME_LINE_HEIGHT (f),
hdc,
intborder, CHAR_TO_PIXEL_ROW (f, j+1),
SRCCOPY);
w32_clear_area (f, hdc,
intborder,
CHAR_TO_PIXEL_ROW (f, i),
- f->width * FONT_WIDTH (f->output_data.w32->font),
- (j-i) * f->output_data.w32->line_height);
+ FRAME_WINDOW_WIDTH (f) * FONT_WIDTH (FRAME_FONT (f)),
+ (j-i) * FRAME_LINE_HEIGHT (f));
i = j-1;
}
line_dance_in_progress = 0;
right = PIXEL_TO_CHAR_COL (f, right);
/* Clip the rectangle to what can be visible. */
- if (left < 0)
- left = 0;
+ if (left < FRAME_LEFT_SCROLL_BAR_WIDTH (f))
+ left = FRAME_LEFT_SCROLL_BAR_WIDTH (f);
if (top < 0)
top = 0;
- if (right > f->width)
- right = f->width;
+ if (right > f->width + FRAME_LEFT_SCROLL_BAR_WIDTH (f))
+ right = f->width + FRAME_LEFT_SCROLL_BAR_WIDTH (f);
if (bottom > f->height)
bottom = f->height;
hdrop = (HDROP) msg->msg.wParam;
DragQueryPoint (hdrop, &p);
+#if 0
p.x = LOWORD (msg->msg.lParam);
p.y = HIWORD (msg->msg.lParam);
ScreenToClient (msg->msg.hwnd, &p);
+#endif
+
XSETINT (result->x, p.x);
XSETINT (result->y, p.y);
struct frame *f;
{
if (! FRAME_VISIBLE_P (f)
- || f->phys_cursor_x < 0)
+ || !f->phys_cursor_on)
return;
x_display_cursor (f, 0);
- f->phys_cursor_x = -1;
+ f->phys_cursor_on = 0;
}
/* Redraw the glyph at ROW, COLUMN on frame F, in the style
if (! FRAME_VISIBLE_P (f) || FRAME_GARBAGED_P (f))
return;
- if (! on && f->phys_cursor_x < 0)
+ if (! on && ! f->phys_cursor_on)
return;
/* If there is anything wrong with the current cursor state, remove it. */
- if (f->phys_cursor_x >= 0
+ if (f->phys_cursor_on
&& (!on
|| f->phys_cursor_x != curs_x
|| f->phys_cursor_y != curs_y
x_draw_single_glyph (f, f->phys_cursor_y, f->phys_cursor_x,
f->phys_cursor_glyph,
current_glyphs->highlight[f->phys_cursor_y]);
- f->phys_cursor_x = -1;
+ f->phys_cursor_on = 0;
}
/* If we now need a cursor in the new place or in the new form, do it so. */
if (on
- && (f->phys_cursor_x < 0
+ && (! f->phys_cursor_on
|| (f->output_data.w32->current_cursor != bar_cursor)))
{
f->phys_cursor_glyph
f->phys_cursor_x = curs_x;
f->phys_cursor_y = curs_y;
+ f->phys_cursor_on = 1;
f->output_data.w32->current_cursor = bar_cursor;
}
return;
/* If cursor is off and we want it off, return quickly. */
- if (!on && f->phys_cursor_x < 0)
+ if (!on && ! f->phys_cursor_on)
return;
/* If cursor is currently being shown and we don't want it to be
or it is in the wrong place,
or we want a hollow box and it's not so, (pout!)
erase it. */
- if (f->phys_cursor_x >= 0
+ if (f->phys_cursor_on
&& (!on
|| f->phys_cursor_x != curs_x
|| f->phys_cursor_y != curs_y
(mouse_face_here
? 3
: current_glyphs->highlight[f->phys_cursor_y]));
- f->phys_cursor_x = -1;
+ f->phys_cursor_on = 0;
}
/* If we want to show a cursor,
or we want a box cursor and it's not so,
write it in the right place. */
if (on
- && (f->phys_cursor_x < 0
+ && (! f->phys_cursor_on
|| (f->output_data.w32->current_cursor != filled_box_cursor
&& f == FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame)))
{
f->phys_cursor_x = curs_x;
f->phys_cursor_y = curs_y;
+ f->phys_cursor_on = 1;
}
}
if (f->phys_cursor_y >= rows
|| f->phys_cursor_x >= cols)
{
- f->phys_cursor_x = -1;
- f->phys_cursor_y = -1;
+ f->phys_cursor_x = 0;
+ f->phys_cursor_y = 0;
+ f->phys_cursor_on = 0;
}
/* Clear out any recollection of where the mouse highlighting was,