#define SM_CYVIRTUALSCREEN 79
#endif
-/* This is a frame waiting to be autoraised, within w32_read_socket. */
-struct frame *pending_autoraise_frame;
-
/* The handle of the frame that currently owns the system caret. */
HWND w32_system_caret_hwnd;
int w32_system_caret_height;
/* Keyboard code page - may be changed by language-change events. */
int w32_keyboard_codepage;
-/* Mouse movement. */
-
-/* Where the mouse was last time we reported a mouse event. */
-static RECT last_mouse_glyph;
-static struct frame *last_mouse_glyph_frame;
-
-/* The scroll bar in which the last motion event occurred.
-
- If the last motion event occurred in a scroll bar, we set this
- so w32_mouse_position can know whether to report a scroll bar motion or
- an ordinary motion.
-
- If the last motion event didn't occur in a scroll bar, we set this
- to Qnil, to tell w32_mouse_position to return an ordinary motion event. */
-static Lisp_Object last_mouse_scroll_bar;
-static int last_mouse_scroll_bar_pos;
-
-/* This is a hack. We would really prefer that w32_mouse_position would
- return the time associated with the position it returns, but there
- doesn't seem to be any way to wrest the time-stamp from the server
- along with the position query. So, we just keep track of the time
- of the last movement we received, and return that in hopes that
- it's somewhat accurate. */
-static Time last_mouse_movement_time;
-
/* Incremented by w32_read_socket whenever it really tries to read
events. */
static int volatile input_signal_count;
x_lower_frame (old_focus);
if (dpyinfo->w32_focus_frame && dpyinfo->w32_focus_frame->auto_raise)
- pending_autoraise_frame = dpyinfo->w32_focus_frame;
+ dpyinfo->w32_pending_autoraise_frame = dpyinfo->w32_focus_frame;
else
- pending_autoraise_frame = 0;
+ dpyinfo->w32_pending_autoraise_frame = NULL;
}
x_frame_rehighlight (dpyinfo);
the mainstream emacs code by setting mouse_moved. If not, ask for
another motion event, so we can check again the next time it moves. */
-static MSG last_mouse_motion_event;
-static Lisp_Object last_mouse_motion_frame;
-
static int
note_mouse_movement (struct frame *frame, MSG *msg)
{
+ struct w32_display_info *dpyinfo;
int mouse_x = LOWORD (msg->lParam);
int mouse_y = HIWORD (msg->lParam);
-
- last_mouse_movement_time = msg->time;
- memcpy (&last_mouse_motion_event, msg, sizeof (last_mouse_motion_event));
- XSETFRAME (last_mouse_motion_frame, frame);
+ RECT *r;
if (!FRAME_X_OUTPUT (frame))
return 0;
+ dpyinfo = FRAME_DISPLAY_INFO (frame);
+ dpyinfo->last_mouse_movement_time = msg->time;
+ dpyinfo->last_mouse_motion_frame = frame;
+ dpyinfo->last_mouse_motion_x = mouse_x;
+ dpyinfo->last_mouse_motion_y = mouse_y;
+
if (msg->hwnd != FRAME_W32_WINDOW (frame))
{
frame->mouse_moved = 1;
- last_mouse_scroll_bar = Qnil;
+ dpyinfo->last_mouse_scroll_bar = NULL;
note_mouse_highlight (frame, -1, -1);
- last_mouse_glyph_frame = 0;
+ dpyinfo->last_mouse_glyph_frame = NULL;
return 1;
}
/* Has the mouse moved off the glyph it was on at the last sighting? */
- if (frame != last_mouse_glyph_frame
- || mouse_x < last_mouse_glyph.left
- || mouse_x >= last_mouse_glyph.right
- || mouse_y < last_mouse_glyph.top
- || mouse_y >= last_mouse_glyph.bottom)
+ r = &dpyinfo->last_mouse_glyph;
+ if (frame != dpyinfo->last_mouse_glyph_frame
+ || mouse_x < r->left || mouse_x >= r->right
+ || mouse_y < r->top || mouse_y >= r->bottom)
{
frame->mouse_moved = 1;
- last_mouse_scroll_bar = Qnil;
+ dpyinfo->last_mouse_scroll_bar = NULL;
note_mouse_highlight (frame, mouse_x, mouse_y);
/* Remember the mouse position here, as w32_mouse_position only
gets called when mouse tracking is enabled but we also need
to keep track of the mouse for help_echo and highlighting at
other times. */
- remember_mouse_glyph (frame, mouse_x, mouse_y, &last_mouse_glyph);
- last_mouse_glyph_frame = frame;
+ remember_mouse_glyph (frame, mouse_x, mouse_y, r);
+ dpyinfo->last_mouse_glyph_frame = frame;
return 1;
}
unsigned long *);
static void x_check_fullscreen (struct frame *);
-static void
-redo_mouse_highlight (void)
-{
- if (!NILP (last_mouse_motion_frame)
- && FRAME_LIVE_P (XFRAME (last_mouse_motion_frame)))
- note_mouse_highlight (XFRAME (last_mouse_motion_frame),
- LOWORD (last_mouse_motion_event.lParam),
- HIWORD (last_mouse_motion_event.lParam));
-}
-
static void
w32_define_cursor (Window window, Cursor cursor)
{
unsigned long *time)
{
struct frame *f1;
+ struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (*fp);
block_input ();
- if (! NILP (last_mouse_scroll_bar) && insist == 0)
+ if (dpyinfo->last_mouse_scroll_bar && insist == 0)
x_scroll_bar_report_motion (fp, bar_window, part, x, y, time);
else
{
FOR_EACH_FRAME (tail, frame)
XFRAME (frame)->mouse_moved = 0;
- last_mouse_scroll_bar = Qnil;
+ dpyinfo->last_mouse_scroll_bar = NULL;
GetCursorPos (&pt);
/* Now we have a position on the root; find the innermost window
containing the pointer. */
{
- if (FRAME_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame
- && FRAME_LIVE_P (last_mouse_frame))
- {
- /* If mouse was grabbed on a frame, give coords for that frame
- even if the mouse is now outside it. */
- f1 = last_mouse_frame;
- }
- else
- {
- /* Is window under mouse one of our frames? */
- f1 = x_any_window_to_frame (FRAME_DISPLAY_INFO (*fp),
- WindowFromPoint (pt));
- }
+ /* If mouse was grabbed on a frame, give coords for that
+ frame even if the mouse is now outside it. Otherwise
+ check for window under mouse on one of our frames. */
+ f1 = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame
+ : x_any_window_to_frame (dpyinfo, WindowFromPoint (pt)));
/* If not, is it one of our scroll bars? */
if (! f1)
on it, i.e. into the same rectangles that matrices on
the frame are divided into. */
+ dpyinfo = FRAME_DISPLAY_INFO (f1);
ScreenToClient (FRAME_W32_WINDOW (f1), &pt);
- remember_mouse_glyph (f1, pt.x, pt.y, &last_mouse_glyph);
- last_mouse_glyph_frame = f1;
+ remember_mouse_glyph (f1, pt.x, pt.y, &dpyinfo->last_mouse_glyph);
+ dpyinfo->last_mouse_glyph_frame = f1;
*bar_window = Qnil;
*part = 0;
*fp = f1;
XSETINT (*x, pt.x);
XSETINT (*y, pt.y);
- *time = last_mouse_movement_time;
+ *time = dpyinfo->last_mouse_movement_time;
}
}
}
y = si.nPos;
bar->dragging = Qnil;
-
-
- last_mouse_scroll_bar_pos = msg->msg.wParam;
+ FRAME_DISPLAY_INFO (f)->last_mouse_scroll_bar_pos = msg->msg.wParam;
switch (LOWORD (msg->msg.wParam))
{
Lisp_Object *x, Lisp_Object *y,
unsigned long *time)
{
- struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
+ struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (*fp);
+ struct scroll_bar *bar = dpyinfo->last_mouse_scroll_bar;
Window w = SCROLL_BAR_W32_WINDOW (bar);
struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
int pos;
pos = si.nPos;
top_range = si.nMax - si.nPage + 1;
- switch (LOWORD (last_mouse_scroll_bar_pos))
+ switch (LOWORD (dpyinfo->last_mouse_scroll_bar_pos))
{
case SB_THUMBPOSITION:
case SB_THUMBTRACK:
*part = scroll_bar_handle;
if (VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)) <= 0xffff)
- pos = HIWORD (last_mouse_scroll_bar_pos);
+ pos = HIWORD (dpyinfo->last_mouse_scroll_bar_pos);
break;
case SB_LINEDOWN:
*part = scroll_bar_handle;
XSETINT (*y, top_range);
f->mouse_moved = 0;
- last_mouse_scroll_bar = Qnil;
+ dpyinfo->last_mouse_scroll_bar = NULL;
- *time = last_mouse_movement_time;
+ *time = dpyinfo->last_mouse_movement_time;
unblock_input ();
}
previous_help_echo_string = help_echo_string;
help_echo_string = Qnil;
- if (dpyinfo->grabbed && last_mouse_frame
- && FRAME_LIVE_P (last_mouse_frame))
- f = last_mouse_frame;
- else
- f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
+ f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame
+ : x_window_to_frame (dpyinfo, msg.msg.hwnd));
if (hlinfo->mouse_face_hidden)
{
int button;
int up;
- if (dpyinfo->grabbed && last_mouse_frame
- && FRAME_LIVE_P (last_mouse_frame))
- f = last_mouse_frame;
- else
- f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
+ f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame
+ : x_window_to_frame (dpyinfo, msg.msg.hwnd));
if (f)
{
else
{
dpyinfo->grabbed |= (1 << button);
- last_mouse_frame = f;
+ dpyinfo->last_mouse_frame = f;
/* Ignore any mouse motion that happened
before this event; any subsequent mouse-movement
Emacs events should reflect only motion after
case WM_MOUSEWHEEL:
case WM_MOUSEHWHEEL:
{
- if (dpyinfo->grabbed && last_mouse_frame
- && FRAME_LIVE_P (last_mouse_frame))
- f = last_mouse_frame;
- else
- f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
+ f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame
+ : x_window_to_frame (dpyinfo, msg.msg.hwnd));
if (f)
{
ButtonPress. */
f->mouse_moved = 0;
}
- last_mouse_frame = f;
+ dpyinfo->last_mouse_frame = f;
last_tool_bar_item = -1;
}
break;
f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
if (f && !FRAME_ICONIFIED_P (f))
- {
- int x, y;
-
- x_real_positions (f, &x, &y);
- f->left_pos = x;
- f->top_pos = y;
- }
+ x_real_positions (f, &f->left_pos, &f->top_pos);
check_visibility = 1;
break;
if (!msg.msg.wParam && msg.msg.hwnd == tip_window)
{
tip_window = NULL;
- redo_mouse_highlight ();
+ x_redo_mouse_highlight (dpyinfo);
}
/* If window has been obscured or exposed by another window
if (iconified)
{
- int x, y;
-
/* Reset top and left positions of the Window
here since Windows sends a WM_MOVE message
BEFORE telling us the Window is minimized
when the Window is iconified, with 3000,3000
as the co-ords. */
- x_real_positions (f, &x, &y);
- f->left_pos = x;
- f->top_pos = y;
+ x_real_positions (f, &f->left_pos, &f->top_pos);
inev.kind = DEICONIFY_EVENT;
XSETFRAME (inev.frame_or_window, f);
}
/* If the focus was just given to an autoraising frame,
- raise it now. */
- /* ??? This ought to be able to handle more than one such frame. */
- if (pending_autoraise_frame)
+ raise it now. FIXME: handle more than one such frame. */
+ if (dpyinfo->w32_pending_autoraise_frame)
{
- x_raise_frame (pending_autoraise_frame);
- pending_autoraise_frame = 0;
+ x_raise_frame (dpyinfo->w32_pending_autoraise_frame);
+ dpyinfo->w32_pending_autoraise_frame = NULL;
}
/* Check which frames are still visible, if we have enqueued any user
void
x_make_frame_visible (struct frame *f)
{
- Lisp_Object type;
-
block_input ();
- type = x_icon_type (f);
- if (!NILP (type))
- x_bitmap_icon (f, type);
+ x_set_bitmap_icon (f);
if (! FRAME_VISIBLE_P (f))
{
void
x_iconify_frame (struct frame *f)
{
- Lisp_Object type;
-
/* Don't keep the highlight on an invisible frame. */
if (FRAME_DISPLAY_INFO (f)->x_highlight_frame == f)
FRAME_DISPLAY_INFO (f)->x_highlight_frame = 0;
block_input ();
- type = x_icon_type (f);
- if (!NILP (type))
- x_bitmap_icon (f, type);
+ x_set_bitmap_icon (f);
/* Simulate the user minimizing the frame. */
SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MINIMIZE, 0);
terminal->delete_terminal_hook = x_delete_terminal;
terminal->rif = &w32_redisplay_interface;
- terminal->scroll_region_ok = 1; /* We'll scroll partial frames. */
- terminal->char_ins_del_ok = 1;
- terminal->line_ins_del_ok = 1; /* We'll just blt 'em. */
- terminal->fast_clear_end_of_line = 1; /* X does this well. */
- terminal->memory_below_frame = 0; /* We don't remember what scrolls
- off the bottom. */
/* We don't yet support separate terminals on W32, so don't try to share
keyboards between virtual terminals that are on the same physical
terminal like X does. */
- terminal->kboard = xmalloc (sizeof (KBOARD));
- init_kboard (terminal->kboard);
- kset_window_system (terminal->kboard, Qw32);
- terminal->kboard->next_kboard = all_kboards;
- all_kboards = terminal->kboard;
+ terminal->kboard = allocate_kboard (Qw32);
/* Don't let the initial kboard remain current longer than necessary.
That would cause problems if a file loaded on startup tries to
prompt in the mini-buffer. */
staticpro (&w32_display_name_list);
w32_display_name_list = Qnil;
- staticpro (&last_mouse_scroll_bar);
- last_mouse_scroll_bar = Qnil;
-
DEFSYM (Qvendor_specific_keysyms, "vendor-specific-keysyms");
DEFSYM (Qadded, "added");
With MS Windows or Nextstep, the value is t. */);
Vx_toolkit_scroll_bars = Qt;
- staticpro (&last_mouse_motion_frame);
- last_mouse_motion_frame = Qnil;
-
/* Tell Emacs about this window system. */
Fprovide (Qw32, Qnil);
}