else
w32_clip_to_row (w, row, hdc);
- if (p->bx >= 0)
+ if (p->bx >= 0 && !p->overlay_p)
{
w32_fill_area (f, hdc, face->background,
p->bx, p->by, p->nx, p->ny);
}
- if (p->which != NO_FRINGE_BITMAP)
+ if (p->which)
{
HBITMAP pixmap = fringe_bmp[p->which];
HDC compat_hdc;
HANDLE horig_obj;
compat_hdc = CreateCompatibleDC (hdc);
+
SaveDC (hdc);
horig_obj = SelectObject (compat_hdc, pixmap);
- SetTextColor (hdc, face->background);
- SetBkColor (hdc, face->foreground);
- BitBlt (hdc, p->x, p->y, p->wd, p->h,
- compat_hdc, 0, p->dh,
- SRCCOPY);
+ /* Paint overlays transparently. */
+ if (p->overlay_p)
+ {
+ HBRUSH h_brush, h_orig_brush;
+
+ SetTextColor (hdc, BLACK_PIX_DEFAULT (f));
+ SetBkColor (hdc, WHITE_PIX_DEFAULT (f));
+ h_brush = CreateSolidBrush (face->foreground);
+ h_orig_brush = SelectObject (hdc, h_brush);
+
+ BitBlt (hdc, p->x, p->y, p->wd, p->h,
+ compat_hdc, 0, p->dh,
+ DSTINVERT);
+ BitBlt (hdc, p->x, p->y, p->wd, p->h,
+ compat_hdc, 0, p->dh,
+ 0x2E064A);
+ BitBlt (hdc, p->x, p->y, p->wd, p->h,
+ compat_hdc, 0, p->dh,
+ DSTINVERT);
+
+ SelectObject (hdc, h_orig_brush);
+ DeleteObject (h_brush);
+ }
+ else
+ {
+ SetTextColor (hdc, face->background);
+ SetBkColor (hdc, (p->cursor_p
+ ? f->output_data.w32->cursor_pixel
+ : face->foreground));
+
+ BitBlt (hdc, p->x, p->y, p->wd, p->h,
+ compat_hdc, 0, p->dh,
+ SRCCOPY);
+ }
SelectObject (compat_hdc, horig_obj);
DeleteDC (compat_hdc);
release_frame_dc (f, hdc);
}
+static void
+w32_define_fringe_bitmap (which, bits, h, wd)
+ int which;
+ unsigned short *bits;
+ int h, wd;
+{
+ fringe_bmp[which] = CreateBitmap (wd, h, 1, 1, bits);
+}
+
+static void
+w32_destroy_fringe_bitmap (which)
+ int which;
+{
+ if (fringe_bmp[which])
+ DeleteObject (fringe_bmp[which]);
+ fringe_bmp[which] = 0;
+}
+
+
\f
/* This is called when starting Emacs and when restarting after
suspend. When starting Emacs, no window is mapped. And nothing
This routine is called by the SIGIO handler.
We return as soon as there are no more events to be read.
- Events representing keys are stored in buffer BUFP,
- which can hold up to NUMCHARS characters.
We return the number of characters stored into the buffer,
thus pretending to be `read'.
*/
int
-w32_read_socket (bufp, numchars, expected)
- /* register */ struct input_event *bufp;
- /* register */ int numchars;
+w32_read_socket (sd, expected, hold_quit)
+ register int sd;
int expected;
+ struct input_event *hold_quit;
{
int count = 0;
int check_visibility = 0;
/* So people can tell when we have read the available input. */
input_signal_count++;
- if (numchars <= 0)
- abort (); /* Don't think this happens. */
-
/* TODO: tool-bars, ghostscript integration, mouse
cursors. */
while (get_next_msg (&msg, FALSE))
{
+ struct input_event inev;
+ int do_help = 0;
+
+ EVENT_INIT (inev);
+ inev.kind = NO_EVENT;
+ inev.arg = Qnil;
+
switch (msg.msg.message)
{
case WM_PAINT:
visibility changes properly. */
if (f->iconified)
{
- bufp->kind = DEICONIFY_EVENT;
- XSETFRAME (bufp->frame_or_window, f);
- bufp->arg = Qnil;
- bufp++;
- count++;
- numchars--;
+ inev.kind = DEICONIFY_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
}
else if (! NILP (Vframe_list)
&& ! NILP (XCDR (Vframe_list)))
if (f)
{
- if (numchars == 0)
- abort ();
-
- bufp->kind = LANGUAGE_CHANGE_EVENT;
- XSETFRAME (bufp->frame_or_window, f);
- bufp->arg = Qnil;
- bufp->code = msg.msg.wParam;
- bufp->modifiers = msg.msg.lParam & 0xffff;
- bufp++;
- count++;
- numchars--;
+ inev.kind = LANGUAGE_CHANGE_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
+ inev.code = msg.msg.wParam;
+ inev.modifiers = msg.msg.lParam & 0xffff;
}
break;
{
if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
{
- dpyinfo->mouse_face_hidden = 1;
clear_mouse_face (dpyinfo);
+ dpyinfo->mouse_face_hidden = 1;
}
if (temp_index == sizeof temp_buffer / sizeof (short))
temp_index = 0;
temp_buffer[temp_index++] = msg.msg.wParam;
- bufp->kind = NON_ASCII_KEYSTROKE_EVENT;
- bufp->code = msg.msg.wParam;
- bufp->modifiers = msg.dwModifiers;
- XSETFRAME (bufp->frame_or_window, f);
- bufp->arg = Qnil;
- bufp->timestamp = msg.msg.time;
- bufp++;
- numchars--;
- count++;
+ inev.kind = NON_ASCII_KEYSTROKE_EVENT;
+ inev.code = msg.msg.wParam;
+ inev.modifiers = msg.dwModifiers;
+ XSETFRAME (inev.frame_or_window, f);
+ inev.timestamp = msg.msg.time;
}
break;
{
if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
{
- dpyinfo->mouse_face_hidden = 1;
clear_mouse_face (dpyinfo);
+ dpyinfo->mouse_face_hidden = 1;
}
if (temp_index == sizeof temp_buffer / sizeof (short))
temp_index = 0;
temp_buffer[temp_index++] = msg.msg.wParam;
- bufp->kind = ASCII_KEYSTROKE_EVENT;
- bufp->code = msg.msg.wParam;
- bufp->modifiers = msg.dwModifiers;
- XSETFRAME (bufp->frame_or_window, f);
- bufp->arg = Qnil;
- bufp->timestamp = msg.msg.time;
- bufp++;
- numchars--;
- count++;
+ inev.kind = ASCII_KEYSTROKE_EVENT;
+ inev.code = msg.msg.wParam;
+ inev.modifiers = msg.dwModifiers;
+ XSETFRAME (inev.frame_or_window, f);
+ inev.timestamp = msg.msg.time;
}
break;
iff it is active. */
if (WINDOWP(window)
&& !EQ (window, last_window)
- && !EQ (window, selected_window)
- && numchars > 0)
+ && !EQ (window, selected_window))
{
- bufp->kind = SELECT_WINDOW_EVENT;
- bufp->frame_or_window = window;
- bufp->arg = Qnil;
- ++bufp, ++count, --numchars;
+ inev.kind = SELECT_WINDOW_EVENT;
+ inev.frame_or_window = window;
}
last_window=window;
has changed, generate a HELP_EVENT. */
if (help_echo_string != previous_help_echo_string ||
(!NILP (help_echo_string) && !STRINGP (help_echo_string) && f->mouse_moved))
- {
- Lisp_Object frame;
- int n;
-
- if (help_echo_string == Qnil)
- {
- help_echo_object = help_echo_window = Qnil;
- help_echo_pos = -1;
- }
+ do_help = 1;
- if (f)
- XSETFRAME (frame, f);
- else
- frame = Qnil;
-
- any_help_event_p = 1;
- n = gen_help_event (bufp, numchars, help_echo_string, frame,
- help_echo_window, help_echo_object,
- help_echo_pos);
- bufp += n, count += n, numchars -= n;
- }
break;
case WM_LBUTTONDOWN:
{
/* If we decide we want to generate an event to be seen
by the rest of Emacs, we put it here. */
- struct input_event emacs_event;
int tool_bar_p = 0;
int button;
int up;
- emacs_event.kind = NO_EVENT;
-
if (dpyinfo->grabbed && last_mouse_frame
&& FRAME_LIVE_P (last_mouse_frame))
f = last_mouse_frame;
if (f)
{
- construct_mouse_click (&emacs_event, &msg, f);
+ construct_mouse_click (&inev, &msg, f);
/* Is this in the tool-bar? */
if (WINDOWP (f->tool_bar_window)
&& WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)))
{
Lisp_Object window;
- int x = XFASTINT (emacs_event.x);
- int y = XFASTINT (emacs_event.y);
+ int x = XFASTINT (inev.x);
+ int y = XFASTINT (inev.y);
window = window_from_coordinates (f, x, y, 0, 0, 0, 1);
if (EQ (window, f->tool_bar_window))
{
- w32_handle_tool_bar_click (f, &emacs_event);
+ w32_handle_tool_bar_click (f, &inev);
tool_bar_p = 1;
}
}
- if (!tool_bar_p)
- if (!dpyinfo->w32_focus_frame
- || f == dpyinfo->w32_focus_frame
- && (numchars >= 1))
- {
- construct_mouse_click (bufp, &msg, f);
- bufp++;
- count++;
- numchars--;
- }
+ if (tool_bar_p
+ || (dpyinfo->w32_focus_frame
+ && f != dpyinfo->w32_focus_frame))
+ inev.kind = NO_EVENT;
}
parse_button (msg.msg.message, HIWORD (msg.msg.wParam),
if (f)
{
- if ((!dpyinfo->w32_focus_frame
- || f == dpyinfo->w32_focus_frame)
- && (numchars >= 1))
+ if (!dpyinfo->w32_focus_frame
+ || f == dpyinfo->w32_focus_frame)
{
/* Emit an Emacs wheel-up/down event. */
- construct_mouse_wheel (bufp, &msg, f);
- bufp++;
- count++;
- numchars--;
+ construct_mouse_wheel (&inev, &msg, f);
}
/* Ignore any mouse motion that happened before this
event; any subsequent mouse-movement Emacs events
f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
if (f)
- {
- construct_drag_n_drop (bufp, &msg, f);
- bufp++;
- count++;
- numchars--;
- }
+ construct_drag_n_drop (&inev, &msg, f);
break;
case WM_VSCROLL:
struct scroll_bar *bar =
x_window_to_scroll_bar ((HWND)msg.msg.lParam);
- if (bar && numchars >= 1)
- {
- if (w32_scroll_bar_handle_click (bar, &msg, bufp))
- {
- bufp++;
- count++;
- numchars--;
- }
- }
+ if (bar)
+ w32_scroll_bar_handle_click (bar, &msg, &inev);
break;
}
f->async_visible = 0;
f->async_iconified = 1;
- bufp->kind = ICONIFY_EVENT;
- XSETFRAME (bufp->frame_or_window, f);
- bufp->arg = Qnil;
- bufp++;
- count++;
- numchars--;
+ inev.kind = ICONIFY_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
break;
case SIZE_MAXIMIZED:
f->left_pos = x;
f->top_pos = y;
- bufp->kind = DEICONIFY_EVENT;
- XSETFRAME (bufp->frame_or_window, f);
- bufp->arg = Qnil;
- bufp++;
- count++;
- numchars--;
+ inev.kind = DEICONIFY_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
}
else if (! NILP (Vframe_list)
&& ! NILP (XCDR (Vframe_list)))
Otherwise, the startup message is cleared when
the mouse leaves the frame. */
if (any_help_event_p)
- {
- Lisp_Object frame;
- int n;
-
- XSETFRAME (frame, f);
- help_echo_string = Qnil;
- n = gen_help_event (bufp, numchars,
- Qnil, frame, Qnil, Qnil, 0);
- bufp += n, count += n, numchars -= n;
- }
+ do_help = -1;
}
break;
Otherwise, the startup message is cleared when
the mouse leaves the frame. */
if (any_help_event_p)
- {
- Lisp_Object frame;
- int n;
-
- XSETFRAME (frame, f);
- help_echo_string = Qnil;
- n = gen_help_event (bufp, numchars,
- Qnil, frame, Qnil, Qnil, 0);
- bufp += n, count += n, numchars -=n;
- }
+ do_help = -1;
}
dpyinfo->grabbed = 0;
if (f)
{
- if (numchars == 0)
- abort ();
-
- bufp->kind = DELETE_WINDOW_EVENT;
- XSETFRAME (bufp->frame_or_window, f);
- bufp->arg = Qnil;
- bufp++;
- count++;
- numchars--;
+ inev.kind = DELETE_WINDOW_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
}
break;
if (f)
{
- if (numchars == 0)
- abort ();
-
- bufp->kind = MENU_BAR_ACTIVATE_EVENT;
- XSETFRAME (bufp->frame_or_window, f);
- bufp->arg = Qnil;
- bufp++;
- count++;
- numchars--;
+ inev.kind = MENU_BAR_ACTIVATE_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
}
break;
}
break;
}
+
+ if (inev.kind != NO_EVENT)
+ {
+ kbd_buffer_store_event_hold (&inev, hold_quit);
+ count++;
+ }
+
+ if (do_help
+ && !(hold_quit && hold_quit->kind != NO_EVENT))
+ {
+ Lisp_Object frame;
+
+ if (f)
+ XSETFRAME (frame, f);
+ else
+ frame = Qnil;
+
+ if (do_help > 0)
+ {
+ if (help_echo_string == Qnil)
+ {
+ help_echo_object = help_echo_window = Qnil;
+ help_echo_pos = -1;
+ }
+
+ any_help_event_p = 1;
+ gen_help_event (help_echo_string, frame, help_echo_window,
+ help_echo_object, help_echo_pos);
+ }
+ else
+ {
+ help_echo_string = Qnil;
+ gen_help_event (Qnil, frame, Qnil, Qnil, 0);
+ }
+ count++;
+ }
}
/* If the focus was just given to an autoraising frame,
cursor remains invisible. */
if (w32_use_visible_system_caret)
{
+ /* Call to erase_phys_cursor here seems to use the
+ wrong values of w->phys_cursor, as they have been
+ overwritten before this function was called. */
if (w->phys_cursor_type != NO_CURSOR)
erase_phys_cursor (w);
horizontally reflected compared to how they appear on X, so we
need to bitswap and convert to unsigned shorts before creating
the bitmaps. */
- {
- int i, j;
-
- for (i = NO_FRINGE_BITMAP + 1; i < MAX_FRINGE_BITMAPS; i++)
- {
- int h = fringe_bitmaps[i].height;
- int wd = fringe_bitmaps[i].width;
- unsigned short *w32bits
- = (unsigned short *)alloca (h * sizeof (unsigned short));
- unsigned short *wb = w32bits;
- unsigned char *bits = fringe_bitmaps[i].bits;
- for (j = 0; j < h; j++)
- {
- static unsigned char swap_nibble[16]
- = { 0x0, 0x8, 0x4, 0xc, /* 0000 1000 0100 1100 */
- 0x2, 0xa, 0x6, 0xe, /* 0010 1010 0110 1110 */
- 0x1, 0x9, 0x5, 0xd, /* 0001 1001 0101 1101 */
- 0x3, 0xb, 0x7, 0xf }; /* 0011 1011 0111 1111 */
-
- unsigned char b = *bits++;
- *wb++ = (unsigned short)((swap_nibble[b & 0xf]<<4)
- | (swap_nibble[(b>>4) & 0xf]));
- }
- fringe_bmp[i] = CreateBitmap (wd, h, 1, 1, w32bits);
- }
- }
+ w32_init_fringe ();
#ifndef F_SETOWN_BUG
#ifdef F_SETOWN
xfree (dpyinfo->font_table);
xfree (dpyinfo->w32_id_name);
- /* Destroy row bitmaps. */
- {
- int i;
-
- for (i = NO_FRINGE_BITMAP + 1; i < MAX_FRINGE_BITMAPS; i++)
- DeleteObject (fringe_bmp[i]);
- }
+ w32_reset_fringes ();
}
\f
/* Set up use of W32. */
w32_get_glyph_overhangs,
x_fix_overlapping_area,
w32_draw_fringe_bitmap,
+ w32_define_fringe_bitmap,
+ w32_destroy_fringe_bitmap,
w32_per_char_metric,
w32_encode_char,
NULL, /* w32_compute_glyph_string_overhangs */