extern Lisp_Object Vcommand_line_args, Vsystem_name;
-extern Lisp_Object Qface, Qmouse_face;
-
#ifndef USE_CRT_DLL
extern int errno;
#endif
output_cursor.x, output_cursor.y);
x_draw_vertical_border (w);
+
+ draw_window_fringes (w);
+
UNBLOCK_INPUT;
}
xassert (w);
if (!desired_row->mode_line_p && !w->pseudo_window_p)
- {
- BLOCK_INPUT;
- draw_row_fringe_bitmaps (w, desired_row);
- UNBLOCK_INPUT;
- }
+ desired_row->redraw_fringe_bitmaps_p = 1;
/* When a window has disappeared, make sure that no rest of
full-width rows stays visible in the internal border. Could
struct frame *f = XFRAME (WINDOW_FRAME (w));
HDC hdc;
struct face *face = p->face;
+ int rowY;
hdc = get_frame_dc (f);
/* Must clip because of partially visible lines. */
- w32_clip_to_row (w, row, hdc);
+ rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
+ if (p->y < rowY)
+ {
+ /* Adjust position of "bottom aligned" bitmap on partially
+ visible last row. */
+ int oldY = row->y;
+ int oldVH = row->visible_height;
+ row->visible_height = p->h;
+ row->y -= rowY - p->y;
+ w32_clip_to_row (w, row, hdc);
+ row->y = oldY;
+ row->visible_height = oldVH;
+ }
+ 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
wchar_t * chars;
int nchars;
{
- int charset_dim = w32_font_is_double_byte (s->gc->font) ? 2 : 1;
- if (s->gc->font->bdf)
- w32_BDF_TextOut (s->gc->font->bdf, s->hdc,
+ int charset_dim = w32_font_is_double_byte (s->font) ? 2 : 1;
+ if (s->font->bdf)
+ w32_BDF_TextOut (s->font->bdf, s->hdc,
x, y, (char *) chars, charset_dim,
nchars * charset_dim, 0);
else if (s->first_glyph->font_type == UNICODE_FONT)
static struct scroll_bar *x_window_to_scroll_bar ();
static void x_scroll_bar_report_motion ();
static void x_check_fullscreen P_ ((struct frame *));
-static void x_check_fullscreen_move P_ ((struct frame *));
static int glyph_rect P_ ((struct frame *f, int, int, RECT *));
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 (sd, bufp, numchars, expected)
+w32_read_socket (sd, expected, hold_quit)
register int sd;
- /* register */ struct input_event *bufp;
- /* register */ int numchars;
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;
+ do_help = 1;
- if (help_echo_string == Qnil)
- {
- help_echo_object = help_echo_window = Qnil;
- help_echo_pos = -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 = x_window_to_frame (dpyinfo, msg.msg.hwnd);
if (f)
{
- x_check_fullscreen_move(f);
if (f->want_fullscreen & FULLSCREEN_WAIT)
f->want_fullscreen &= ~(FULLSCREEN_WAIT|FULLSCREEN_BOTH);
}
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);
PostMessage (hwnd, WM_EMACS_TRACK_CARET, 0, 0);
}
+ if (glyph_row->exact_window_width_line_p
+ && w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA])
+ {
+ glyph_row->cursor_in_fringe_p = 1;
+ draw_fringe_bitmap (w, glyph_row, 0);
+ return;
+ }
+
switch (cursor_type)
{
case HOLLOW_BOX_CURSOR:
x_fullscreen_adjust (f, &width, &height, &ign, &ign);
/* We do not need to move the window, it shall be taken care of
- when setting WM manager hints.
- If the frame is visible already, the position is checked by
- x_check_fullscreen_move. */
+ when setting WM manager hints. */
if (FRAME_COLS (f) != width || FRAME_LINES (f) != height)
{
change_frame_size (f, height, width, 0, 1, 0);
}
}
-/* If frame parameters are set after the frame is mapped, we need to move
- the window. This is done in xfns.c.
- Some window managers moves the window to the right position, some
- moves the outer window manager window to the specified position.
- Here we check that we are in the right spot. If not, make a second
- move, assuming we are dealing with the second kind of window manager. */
-static void
-x_check_fullscreen_move (f)
- struct frame *f;
-{
- if (f->want_fullscreen & FULLSCREEN_MOVE_WAIT)
- {
- int expect_top = f->top_pos;
- int expect_left = f->left_pos;
-
- if (f->want_fullscreen & FULLSCREEN_HEIGHT)
- expect_top = 0;
- if (f->want_fullscreen & FULLSCREEN_WIDTH)
- expect_left = 0;
-
- if (expect_top != f->top_pos
- || expect_left != f->left_pos)
- x_set_offset (f, expect_left, expect_top, 1);
-
- /* Just do this once */
- f->want_fullscreen &= ~FULLSCREEN_MOVE_WAIT;
- }
-}
-
-
/* Call this to change the size of frame F's x-window.
If CHANGE_GRAVITY is 1, we change to top-left-corner window gravity
for this size change and subsequent size changes.
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 */
staticpro (&last_mouse_motion_frame);
last_mouse_motion_frame = Qnil;
}
+
+/* arch-tag: 5fa70624-ab86-499c-8a85-473958ee4646
+ (do not change this comment) */