#include "termhooks.h"
#include "termopts.h"
#include "termchar.h"
-#include "gnu.h"
#include "disptab.h"
#include "buffer.h"
#include "window.h"
w32_compute_glyph_string_overhangs (s)
struct glyph_string *s;
{
+ if (s->cmp == NULL
+ && s->first_glyph->type == CHAR_GLYPH)
+ {
+#ifdef USE_FONT_BACKEND
+ if (enable_font_backend)
+ {
+ unsigned *code = alloca (sizeof (unsigned) * s->nchars);
+ struct font *font = (struct font *) s->font_info;
+ struct font_metrics metrics;
+ int i;
+
+ for (i = 0; i < s->nchars; i++)
+ code[i] = s->char2b[i];
+ font->driver->text_extents (font, code, s->nchars, &metrics);
+ s->right_overhang = (metrics.rbearing > metrics.width
+ ? metrics.rbearing - metrics.width : 0);
+ s->left_overhang = metrics.lbearing < 0 ? -metrics.lbearing : 0;
+ }
+#else
/* TODO: Windows does not appear to have a method for
getting this info without getting the ABC widths for each
individual character and working it out manually. */
+#endif
+ }
+ else if (s->cmp)
+ {
+ s->right_overhang = s->cmp->rbearing - s->cmp->pixel_width;
+ s->left_overhang = -s->cmp->lbearing;
+ }
}
|| s->font_not_found_p
|| s->extends_to_end_of_line_p
|| s->font->bdf
+ || cleartype_active
|| force_p)
{
x_clear_glyph_string_rect (s, s->x, s->y + box_line_width,
else
x = s->x;
- if (s->for_overlaps || (s->background_filled_p && s->hl != DRAW_CURSOR))
+ if (s->for_overlaps || (s->background_filled_p && s->hl != DRAW_CURSOR)
+ || cleartype_active)
SetBkMode (s->hdc, TRANSPARENT);
else
SetBkMode (s->hdc, OPAQUE);
if (temp_index == sizeof temp_buffer / sizeof (short))
temp_index = 0;
temp_buffer[temp_index++] = msg.msg.wParam;
+
+ inev.modifiers = msg.dwModifiers;
+ XSETFRAME (inev.frame_or_window, f);
+ inev.timestamp = msg.msg.time;
+
if (msg.msg.message == WM_UNICHAR)
{
- inev.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
inev.code = msg.msg.wParam;
}
+ else if (msg.msg.wParam < 256)
+ {
+ wchar_t code;
+ char dbcs[2];
+ dbcs[0] = 0;
+ dbcs[1] = (char) msg.msg.wParam;
+
+ if (dbcs_lead)
+ {
+ dbcs[0] = dbcs_lead;
+ dbcs_lead = 0;
+ if (!MultiByteToWideChar (CP_ACP, 0, dbcs, 2, &code, 1))
+ {
+ /* Garbage */
+ DebPrint (("Invalid DBCS sequence: %d %d\n",
+ dbcs[0], dbcs[1]));
+ inev.kind = NO_EVENT;
+ break;
+ }
+ }
+ else if (IsDBCSLeadByteEx (CP_ACP, (BYTE) msg.msg.wParam))
+ {
+ dbcs_lead = (char) msg.msg.wParam;
+ inev.kind = NO_EVENT;
+ break;
+ }
+ else
+ {
+ if (!MultiByteToWideChar (CP_ACP, 0, &dbcs[1], 1,
+ &code, 1))
+ {
+ /* What to do with garbage? */
+ DebPrint (("Invalid character: %d\n", dbcs[1]));
+ inev.kind = NO_EVENT;
+ break;
+ }
+ }
+ inev.code = code;
+ }
else
{
- inev.kind = ASCII_KEYSTROKE_EVENT;
- inev.code = msg.msg.wParam;
+ /* Windows shouldn't generate WM_CHAR events above 0xFF
+ in non-Unicode message handlers. */
+ DebPrint (("Non-byte WM_CHAR: %d\n", msg.msg.wParam));
+ inev.kind = NO_EVENT;
+ break;
}
- inev.modifiers = msg.dwModifiers;
- XSETFRAME (inev.frame_or_window, f);
- inev.timestamp = msg.msg.time;
+ inev.kind = inev.code < 128 ? ASCII_KEYSTROKE_EVENT
+ : MULTIBYTE_CHAR_KEYSTROKE_EVENT;
}
break;
w32_destroy_fringe_bitmap,
w32_per_char_metric,
w32_encode_char,
- NULL, /* w32_compute_glyph_string_overhangs */
+ w32_compute_glyph_string_overhangs,
x_draw_glyph_string,
w32_define_frame_cursor,
w32_clear_frame_area,
dpyinfo->resx = GetDeviceCaps (hdc, LOGPIXELSX);
dpyinfo->resy = GetDeviceCaps (hdc, LOGPIXELSY);
dpyinfo->has_palette = GetDeviceCaps (hdc, RASTERCAPS) & RC_PALETTE;
- dpyinfo->image_cache = make_image_cache ();
+ dpyinfo->terminal->image_cache = make_image_cache ();
dpyinfo->height_in = dpyinfo->height / dpyinfo->resx;
dpyinfo->width_in = dpyinfo->width / dpyinfo->resy;
ReleaseDC (GetDesktopWindow (), hdc);
the bitmaps. */
w32_init_fringe (terminal->rif);
-#ifndef F_SETOWN_BUG
#ifdef F_SETOWN
-#ifdef F_SETOWN_SOCK_NEG
- /* stdin is a socket here */
- fcntl (connection, F_SETOWN, -getpid ());
-#else /* ! defined (F_SETOWN_SOCK_NEG) */
fcntl (connection, F_SETOWN, getpid ());
-#endif /* ! defined (F_SETOWN_SOCK_NEG) */
#endif /* ! defined (F_SETOWN) */
-#endif /* F_SETOWN_BUG */
#ifdef SIGIO
if (interrupt_input)