diff options
| author | Dmitry Antipov | 2013-09-18 13:23:10 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-09-18 13:23:10 +0400 |
| commit | 18da0d8ad4e5036185acbad3238cbfe2aaf3ca66 (patch) | |
| tree | 7dc7f25186e10dd1c767d1dbf26268b8c70e1a51 | |
| parent | 7a0c745ad134aff0bb8f4258ea607137a819b58d (diff) | |
| download | emacs-18da0d8ad4e5036185acbad3238cbfe2aaf3ca66.tar.gz emacs-18da0d8ad4e5036185acbad3238cbfe2aaf3ca66.zip | |
* frame.c (x_redo_mouse_highlight): New function
to factor out common code used in W32 and X ports.
* dispextern.h (x_redo_mouse_highlight): Add prototype.
* xterm.h (struct x_display_info):
* w32term.h (struct w32_display_info):
* nsterm.h (struct ns_display_info): New members
last_mouse_motion_frame, last_mouse_motion_x and
last_mouse_motion_y, going to replace static variables below.
* xterm.c (last_mouse_motion_event, last_mouse_motion_frame)
(redo_mouse_highlight): Remove.
(note_mouse_movement, syms_of_xterm): Adjust user.
(handle_one_xevent): Likewise. Use x_redo_mouse_highlight.
* w32term.c (last_mouse_motion_event, last_mouse_motion_frame)
(redo_mouse_highlight): Remove.
(note_mouse_movement, syms_of_w32term): Adjust user.
(w32_read_socket): Likewise. Use x_redo_mouse_highlight.
* nsterm.m (last_mouse_motion_position, last_mouse_motion_frame):
Remove.
(note_mouse_movement, mouseMoved, syms_of_nsterm):
* nsfns.m (compute_tip_xy): Adjust user.
| -rw-r--r-- | src/ChangeLog | 23 | ||||
| -rw-r--r-- | src/dispextern.h | 1 | ||||
| -rw-r--r-- | src/frame.c | 13 | ||||
| -rw-r--r-- | src/nsfns.m | 4 | ||||
| -rw-r--r-- | src/nsterm.h | 9 | ||||
| -rw-r--r-- | src/nsterm.m | 22 | ||||
| -rw-r--r-- | src/w32term.c | 31 | ||||
| -rw-r--r-- | src/w32term.h | 8 | ||||
| -rw-r--r-- | src/xterm.c | 35 | ||||
| -rw-r--r-- | src/xterm.h | 8 |
10 files changed, 90 insertions, 64 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b5bdf1dca70..55345027811 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,28 @@ | |||
| 1 | 2013-09-18 Dmitry Antipov <dmantipov@yandex.ru> | 1 | 2013-09-18 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 2 | ||
| 3 | * frame.c (x_redo_mouse_highlight): New function | ||
| 4 | to factor out common code used in W32 and X ports. | ||
| 5 | * dispextern.h (x_redo_mouse_highlight): Add prototype. | ||
| 6 | * xterm.h (struct x_display_info): | ||
| 7 | * w32term.h (struct w32_display_info): | ||
| 8 | * nsterm.h (struct ns_display_info): New members | ||
| 9 | last_mouse_motion_frame, last_mouse_motion_x and | ||
| 10 | last_mouse_motion_y, going to replace static variables below. | ||
| 11 | * xterm.c (last_mouse_motion_event, last_mouse_motion_frame) | ||
| 12 | (redo_mouse_highlight): Remove. | ||
| 13 | (note_mouse_movement, syms_of_xterm): Adjust user. | ||
| 14 | (handle_one_xevent): Likewise. Use x_redo_mouse_highlight. | ||
| 15 | * w32term.c (last_mouse_motion_event, last_mouse_motion_frame) | ||
| 16 | (redo_mouse_highlight): Remove. | ||
| 17 | (note_mouse_movement, syms_of_w32term): Adjust user. | ||
| 18 | (w32_read_socket): Likewise. Use x_redo_mouse_highlight. | ||
| 19 | * nsterm.m (last_mouse_motion_position, last_mouse_motion_frame): | ||
| 20 | Remove. | ||
| 21 | (note_mouse_movement, mouseMoved, syms_of_nsterm): | ||
| 22 | * nsfns.m (compute_tip_xy): Adjust user. | ||
| 23 | |||
| 24 | 2013-09-18 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 25 | |||
| 3 | * frame.c (x_mouse_grabbed): New function. | 26 | * frame.c (x_mouse_grabbed): New function. |
| 4 | * dispextern.h (x_mouse_grabbed): Add prototype. | 27 | * dispextern.h (x_mouse_grabbed): Add prototype. |
| 5 | (last_mouse_frame): Remove declaration. | 28 | (last_mouse_frame): Remove declaration. |
diff --git a/src/dispextern.h b/src/dispextern.h index c8af00ad915..7244c84893d 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -3545,6 +3545,7 @@ extern Lisp_Object x_default_parameter (struct frame *, Lisp_Object, | |||
| 3545 | enum resource_types); | 3545 | enum resource_types); |
| 3546 | extern char *x_get_string_resource (XrmDatabase, const char *, | 3546 | extern char *x_get_string_resource (XrmDatabase, const char *, |
| 3547 | const char *); | 3547 | const char *); |
| 3548 | extern void x_redo_mouse_highlight (Display_Info *); | ||
| 3548 | 3549 | ||
| 3549 | #endif /* HAVE_WINDOW_SYSTEM */ | 3550 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 3550 | 3551 | ||
diff --git a/src/frame.c b/src/frame.c index a31bf35aa6b..997cc9c73ae 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -3442,6 +3442,19 @@ bool x_mouse_grabbed (Display_Info *dpyinfo) | |||
| 3442 | && FRAME_LIVE_P (dpyinfo->last_mouse_frame)); | 3442 | && FRAME_LIVE_P (dpyinfo->last_mouse_frame)); |
| 3443 | } | 3443 | } |
| 3444 | 3444 | ||
| 3445 | /* Re-highlight something with mouse-face properties | ||
| 3446 | on DPYINFO using saved frame and mouse position. */ | ||
| 3447 | |||
| 3448 | void | ||
| 3449 | x_redo_mouse_highlight (Display_Info *dpyinfo) | ||
| 3450 | { | ||
| 3451 | if (dpyinfo->last_mouse_motion_frame | ||
| 3452 | && FRAME_LIVE_P (dpyinfo->last_mouse_motion_frame)) | ||
| 3453 | note_mouse_highlight (dpyinfo->last_mouse_motion_frame, | ||
| 3454 | dpyinfo->last_mouse_motion_x, | ||
| 3455 | dpyinfo->last_mouse_motion_y); | ||
| 3456 | } | ||
| 3457 | |||
| 3445 | /* Subroutines of creating an X frame. */ | 3458 | /* Subroutines of creating an X frame. */ |
| 3446 | 3459 | ||
| 3447 | /* Make sure that Vx_resource_name is set to a reasonable value. | 3460 | /* Make sure that Vx_resource_name is set to a reasonable value. |
diff --git a/src/nsfns.m b/src/nsfns.m index 408e6d2176e..93b7d12becb 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -2564,6 +2564,7 @@ compute_tip_xy (struct frame *f, | |||
| 2564 | { | 2564 | { |
| 2565 | Lisp_Object left, top; | 2565 | Lisp_Object left, top; |
| 2566 | EmacsView *view = FRAME_NS_VIEW (f); | 2566 | EmacsView *view = FRAME_NS_VIEW (f); |
| 2567 | struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); | ||
| 2567 | NSPoint pt; | 2568 | NSPoint pt; |
| 2568 | 2569 | ||
| 2569 | /* Start with user-specified or mouse position. */ | 2570 | /* Start with user-specified or mouse position. */ |
| @@ -2572,7 +2573,8 @@ compute_tip_xy (struct frame *f, | |||
| 2572 | 2573 | ||
| 2573 | if (!INTEGERP (left) || !INTEGERP (top)) | 2574 | if (!INTEGERP (left) || !INTEGERP (top)) |
| 2574 | { | 2575 | { |
| 2575 | pt = last_mouse_motion_position; | 2576 | pt.x = dpyinfo->last_mouse_motion_x; |
| 2577 | pt.y = dpyinfo->last_mouse_motion_y; | ||
| 2576 | /* Convert to screen coordinates */ | 2578 | /* Convert to screen coordinates */ |
| 2577 | pt = [view convertPoint: pt toView: nil]; | 2579 | pt = [view convertPoint: pt toView: nil]; |
| 2578 | pt = [[view window] convertBaseToScreen: pt]; | 2580 | pt = [[view window] convertBaseToScreen: pt]; |
diff --git a/src/nsterm.h b/src/nsterm.h index 373e06cefd2..7a626c75fe6 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -600,6 +600,14 @@ struct ns_display_info | |||
| 600 | 600 | ||
| 601 | /* The frame where the mouse was last time we reported a mouse event. */ | 601 | /* The frame where the mouse was last time we reported a mouse event. */ |
| 602 | struct frame *last_mouse_frame; | 602 | struct frame *last_mouse_frame; |
| 603 | |||
| 604 | /* The frame where the mouse was last time we reported a mouse motion. */ | ||
| 605 | struct frame *last_mouse_motion_frame; | ||
| 606 | |||
| 607 | /* Position where the mouse was last time we reported a motion. | ||
| 608 | This is a position on last_mouse_motion_frame. */ | ||
| 609 | int last_mouse_motion_x; | ||
| 610 | int last_mouse_motion_y; | ||
| 603 | }; | 611 | }; |
| 604 | 612 | ||
| 605 | /* This is a chain of structures for all the NS displays currently in use. */ | 613 | /* This is a chain of structures for all the NS displays currently in use. */ |
| @@ -869,7 +877,6 @@ extern int ns_select (int nfds, fd_set *readfds, fd_set *writefds, | |||
| 869 | sigset_t const *sigmask); | 877 | sigset_t const *sigmask); |
| 870 | extern unsigned long ns_get_rgb_color (struct frame *f, | 878 | extern unsigned long ns_get_rgb_color (struct frame *f, |
| 871 | float r, float g, float b, float a); | 879 | float r, float g, float b, float a); |
| 872 | extern NSPoint last_mouse_motion_position; | ||
| 873 | 880 | ||
| 874 | /* From nsterm.m, needed in nsfont.m. */ | 881 | /* From nsterm.m, needed in nsfont.m. */ |
| 875 | #ifdef __OBJC__ | 882 | #ifdef __OBJC__ |
diff --git a/src/nsterm.m b/src/nsterm.m index d41bd856b0c..dc27fd09e30 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -191,10 +191,8 @@ Lisp_Object ns_display_name_list; | |||
| 191 | long context_menu_value = 0; | 191 | long context_menu_value = 0; |
| 192 | 192 | ||
| 193 | /* display update */ | 193 | /* display update */ |
| 194 | NSPoint last_mouse_motion_position; | ||
| 195 | static NSRect last_mouse_glyph; | 194 | static NSRect last_mouse_glyph; |
| 196 | static Time last_mouse_movement_time = 0; | 195 | static Time last_mouse_movement_time = 0; |
| 197 | static Lisp_Object last_mouse_motion_frame; | ||
| 198 | static EmacsScroller *last_mouse_scroll_bar = nil; | 196 | static EmacsScroller *last_mouse_scroll_bar = nil; |
| 199 | static struct frame *ns_updating_frame; | 197 | static struct frame *ns_updating_frame; |
| 200 | static NSView *focus_view = NULL; | 198 | static NSView *focus_view = NULL; |
| @@ -1742,7 +1740,7 @@ note_mouse_movement (struct frame *frame, CGFloat x, CGFloat y) | |||
| 1742 | { | 1740 | { |
| 1743 | // NSTRACE (note_mouse_movement); | 1741 | // NSTRACE (note_mouse_movement); |
| 1744 | 1742 | ||
| 1745 | XSETFRAME (last_mouse_motion_frame, frame); | 1743 | FRAME_DISPLAY_INFO (frame)->last_mouse_motion_frame = frame; |
| 1746 | 1744 | ||
| 1747 | /* Note, this doesn't get called for enter/leave, since we don't have a | 1745 | /* Note, this doesn't get called for enter/leave, since we don't have a |
| 1748 | position. Those are taken care of in the corresponding NSView methods. */ | 1746 | position. Those are taken care of in the corresponding NSView methods. */ |
| @@ -5448,13 +5446,16 @@ not_in_argv (NSString *arg) | |||
| 5448 | - (void)mouseMoved: (NSEvent *)e | 5446 | - (void)mouseMoved: (NSEvent *)e |
| 5449 | { | 5447 | { |
| 5450 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe); | 5448 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe); |
| 5449 | struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe); | ||
| 5451 | Lisp_Object frame; | 5450 | Lisp_Object frame; |
| 5451 | NSPoint pt; | ||
| 5452 | 5452 | ||
| 5453 | // NSTRACE (mouseMoved); | 5453 | // NSTRACE (mouseMoved); |
| 5454 | 5454 | ||
| 5455 | last_mouse_movement_time = EV_TIMESTAMP (e); | 5455 | last_mouse_movement_time = EV_TIMESTAMP (e); |
| 5456 | last_mouse_motion_position | 5456 | pt = [self convertPoint: [e locationInWindow] fromView: nil]; |
| 5457 | = [self convertPoint: [e locationInWindow] fromView: nil]; | 5457 | dpyinfo->last_mouse_motion_x = pt.x; |
| 5458 | dpyinfo->last_mouse_motion_y = pt.y; | ||
| 5458 | 5459 | ||
| 5459 | /* update any mouse face */ | 5460 | /* update any mouse face */ |
| 5460 | if (hlinfo->mouse_face_hidden) | 5461 | if (hlinfo->mouse_face_hidden) |
| @@ -5471,9 +5472,8 @@ not_in_argv (NSString *arg) | |||
| 5471 | { | 5472 | { |
| 5472 | NSTRACE (mouse_autoselect_window); | 5473 | NSTRACE (mouse_autoselect_window); |
| 5473 | static Lisp_Object last_mouse_window; | 5474 | static Lisp_Object last_mouse_window; |
| 5474 | Lisp_Object window = window_from_coordinates | 5475 | Lisp_Object window |
| 5475 | (emacsframe, last_mouse_motion_position.x, | 5476 | = window_from_coordinates (emacsframe, pt.x, pt.y, 0, 0); |
| 5476 | last_mouse_motion_position.y, 0, 0); | ||
| 5477 | 5477 | ||
| 5478 | if (WINDOWP (window) | 5478 | if (WINDOWP (window) |
| 5479 | && !EQ (window, last_mouse_window) | 5479 | && !EQ (window, last_mouse_window) |
| @@ -5491,8 +5491,7 @@ not_in_argv (NSString *arg) | |||
| 5491 | last_mouse_window = window; | 5491 | last_mouse_window = window; |
| 5492 | } | 5492 | } |
| 5493 | 5493 | ||
| 5494 | if (!note_mouse_movement (emacsframe, last_mouse_motion_position.x, | 5494 | if (!note_mouse_movement (emacsframe, pt.x, pt.y)) |
| 5495 | last_mouse_motion_position.y)) | ||
| 5496 | help_echo_string = previous_help_echo_string; | 5495 | help_echo_string = previous_help_echo_string; |
| 5497 | 5496 | ||
| 5498 | XSETFRAME (frame, emacsframe); | 5497 | XSETFRAME (frame, emacsframe); |
| @@ -7416,9 +7415,6 @@ allowing it to be used at a lower level for accented character entry."); | |||
| 7416 | staticpro (&ns_display_name_list); | 7415 | staticpro (&ns_display_name_list); |
| 7417 | ns_display_name_list = Qnil; | 7416 | ns_display_name_list = Qnil; |
| 7418 | 7417 | ||
| 7419 | staticpro (&last_mouse_motion_frame); | ||
| 7420 | last_mouse_motion_frame = Qnil; | ||
| 7421 | |||
| 7422 | DEFVAR_LISP ("ns-auto-hide-menu-bar", ns_auto_hide_menu_bar, | 7418 | DEFVAR_LISP ("ns-auto-hide-menu-bar", ns_auto_hide_menu_bar, |
| 7423 | doc: /* Non-nil means that the menu bar is hidden, but appears when the mouse is near. | 7419 | doc: /* Non-nil means that the menu bar is hidden, but appears when the mouse is near. |
| 7424 | Only works on OSX 10.6 or later. */); | 7420 | Only works on OSX 10.6 or later. */); |
diff --git a/src/w32term.c b/src/w32term.c index 97dda0e8c55..7c0a3987d1e 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -3304,22 +3304,22 @@ queue_notifications (struct input_event *event, W32Msg *msg, struct frame *f, | |||
| 3304 | the mainstream emacs code by setting mouse_moved. If not, ask for | 3304 | the mainstream emacs code by setting mouse_moved. If not, ask for |
| 3305 | another motion event, so we can check again the next time it moves. */ | 3305 | another motion event, so we can check again the next time it moves. */ |
| 3306 | 3306 | ||
| 3307 | static MSG last_mouse_motion_event; | ||
| 3308 | static Lisp_Object last_mouse_motion_frame; | ||
| 3309 | |||
| 3310 | static int | 3307 | static int |
| 3311 | note_mouse_movement (struct frame *frame, MSG *msg) | 3308 | note_mouse_movement (struct frame *frame, MSG *msg) |
| 3312 | { | 3309 | { |
| 3310 | struct w32_display_info *dpyinfo; | ||
| 3313 | int mouse_x = LOWORD (msg->lParam); | 3311 | int mouse_x = LOWORD (msg->lParam); |
| 3314 | int mouse_y = HIWORD (msg->lParam); | 3312 | int mouse_y = HIWORD (msg->lParam); |
| 3315 | 3313 | ||
| 3316 | last_mouse_movement_time = msg->time; | 3314 | if (!FRAME_W32_OUTPUT (frame)) |
| 3317 | memcpy (&last_mouse_motion_event, msg, sizeof (last_mouse_motion_event)); | ||
| 3318 | XSETFRAME (last_mouse_motion_frame, frame); | ||
| 3319 | |||
| 3320 | if (!FRAME_X_OUTPUT (frame)) | ||
| 3321 | return 0; | 3315 | return 0; |
| 3322 | 3316 | ||
| 3317 | dpyinfo = FRAME_DISPLAY_INFO (frame); | ||
| 3318 | last_mouse_movement_time = msg->time; | ||
| 3319 | dpyinfo->last_mouse_motion_frame = frame; | ||
| 3320 | dpyinfo->last_mouse_motion_x = mouse_x; | ||
| 3321 | dpyinfo->last_mouse_motion_y = mouse_y; | ||
| 3322 | |||
| 3323 | if (msg->hwnd != FRAME_W32_WINDOW (frame)) | 3323 | if (msg->hwnd != FRAME_W32_WINDOW (frame)) |
| 3324 | { | 3324 | { |
| 3325 | frame->mouse_moved = 1; | 3325 | frame->mouse_moved = 1; |
| @@ -3364,16 +3364,6 @@ static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *, | |||
| 3364 | static void x_check_fullscreen (struct frame *); | 3364 | static void x_check_fullscreen (struct frame *); |
| 3365 | 3365 | ||
| 3366 | static void | 3366 | static void |
| 3367 | redo_mouse_highlight (void) | ||
| 3368 | { | ||
| 3369 | if (!NILP (last_mouse_motion_frame) | ||
| 3370 | && FRAME_LIVE_P (XFRAME (last_mouse_motion_frame))) | ||
| 3371 | note_mouse_highlight (XFRAME (last_mouse_motion_frame), | ||
| 3372 | LOWORD (last_mouse_motion_event.lParam), | ||
| 3373 | HIWORD (last_mouse_motion_event.lParam)); | ||
| 3374 | } | ||
| 3375 | |||
| 3376 | static void | ||
| 3377 | w32_define_cursor (Window window, Cursor cursor) | 3367 | w32_define_cursor (Window window, Cursor cursor) |
| 3378 | { | 3368 | { |
| 3379 | PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0); | 3369 | PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0); |
| @@ -4683,7 +4673,7 @@ w32_read_socket (struct terminal *terminal, | |||
| 4683 | if (!msg.msg.wParam && msg.msg.hwnd == tip_window) | 4673 | if (!msg.msg.wParam && msg.msg.hwnd == tip_window) |
| 4684 | { | 4674 | { |
| 4685 | tip_window = NULL; | 4675 | tip_window = NULL; |
| 4686 | redo_mouse_highlight (); | 4676 | x_redo_mouse_highlight (dpyinfo); |
| 4687 | } | 4677 | } |
| 4688 | 4678 | ||
| 4689 | /* If window has been obscured or exposed by another window | 4679 | /* If window has been obscured or exposed by another window |
| @@ -6649,9 +6639,6 @@ X toolkit. Possible values are: gtk, motif, xaw, or xaw3d. | |||
| 6649 | With MS Windows or Nextstep, the value is t. */); | 6639 | With MS Windows or Nextstep, the value is t. */); |
| 6650 | Vx_toolkit_scroll_bars = Qt; | 6640 | Vx_toolkit_scroll_bars = Qt; |
| 6651 | 6641 | ||
| 6652 | staticpro (&last_mouse_motion_frame); | ||
| 6653 | last_mouse_motion_frame = Qnil; | ||
| 6654 | |||
| 6655 | /* Tell Emacs about this window system. */ | 6642 | /* Tell Emacs about this window system. */ |
| 6656 | Fprovide (Qw32, Qnil); | 6643 | Fprovide (Qw32, Qnil); |
| 6657 | } | 6644 | } |
diff --git a/src/w32term.h b/src/w32term.h index d29cab35ded..ef7f0842680 100644 --- a/src/w32term.h +++ b/src/w32term.h | |||
| @@ -185,6 +185,14 @@ struct w32_display_info | |||
| 185 | 185 | ||
| 186 | /* The frame where the mouse was last time we reported a mouse event. */ | 186 | /* The frame where the mouse was last time we reported a mouse event. */ |
| 187 | struct frame *last_mouse_frame; | 187 | struct frame *last_mouse_frame; |
| 188 | |||
| 189 | /* The frame where the mouse was last time we reported a mouse motion. */ | ||
| 190 | struct frame *last_mouse_motion_frame; | ||
| 191 | |||
| 192 | /* Position where the mouse was last time we reported a motion. | ||
| 193 | This is a position on last_mouse_motion_frame. */ | ||
| 194 | int last_mouse_motion_x; | ||
| 195 | int last_mouse_motion_y; | ||
| 188 | }; | 196 | }; |
| 189 | 197 | ||
| 190 | /* This is a chain of structures for all the displays currently in use. */ | 198 | /* This is a chain of structures for all the displays currently in use. */ |
diff --git a/src/xterm.c b/src/xterm.c index 7d8c40b8cf0..9e10037685b 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -3860,19 +3860,20 @@ construct_mouse_click (struct input_event *result, | |||
| 3860 | the mainstream emacs code by setting mouse_moved. If not, ask for | 3860 | the mainstream emacs code by setting mouse_moved. If not, ask for |
| 3861 | another motion event, so we can check again the next time it moves. */ | 3861 | another motion event, so we can check again the next time it moves. */ |
| 3862 | 3862 | ||
| 3863 | static XMotionEvent last_mouse_motion_event; | ||
| 3864 | static Lisp_Object last_mouse_motion_frame; | ||
| 3865 | |||
| 3866 | static int | 3863 | static int |
| 3867 | note_mouse_movement (struct frame *frame, const XMotionEvent *event) | 3864 | note_mouse_movement (struct frame *frame, const XMotionEvent *event) |
| 3868 | { | 3865 | { |
| 3869 | last_mouse_movement_time = event->time; | 3866 | struct x_display_info *dpyinfo; |
| 3870 | last_mouse_motion_event = *event; | ||
| 3871 | XSETFRAME (last_mouse_motion_frame, frame); | ||
| 3872 | 3867 | ||
| 3873 | if (!FRAME_X_OUTPUT (frame)) | 3868 | if (!FRAME_X_OUTPUT (frame)) |
| 3874 | return 0; | 3869 | return 0; |
| 3875 | 3870 | ||
| 3871 | dpyinfo = FRAME_DISPLAY_INFO (frame); | ||
| 3872 | last_mouse_movement_time = event->time; | ||
| 3873 | dpyinfo->last_mouse_motion_frame = frame; | ||
| 3874 | dpyinfo->last_mouse_motion_x = event->x; | ||
| 3875 | dpyinfo->last_mouse_motion_y = event->y; | ||
| 3876 | |||
| 3876 | if (event->window != FRAME_X_WINDOW (frame)) | 3877 | if (event->window != FRAME_X_WINDOW (frame)) |
| 3877 | { | 3878 | { |
| 3878 | frame->mouse_moved = 1; | 3879 | frame->mouse_moved = 1; |
| @@ -3902,23 +3903,6 @@ note_mouse_movement (struct frame *frame, const XMotionEvent *event) | |||
| 3902 | return 0; | 3903 | return 0; |
| 3903 | } | 3904 | } |
| 3904 | 3905 | ||
| 3905 | |||
| 3906 | /************************************************************************ | ||
| 3907 | Mouse Face | ||
| 3908 | ************************************************************************/ | ||
| 3909 | |||
| 3910 | static void | ||
| 3911 | redo_mouse_highlight (void) | ||
| 3912 | { | ||
| 3913 | if (!NILP (last_mouse_motion_frame) | ||
| 3914 | && FRAME_LIVE_P (XFRAME (last_mouse_motion_frame))) | ||
| 3915 | note_mouse_highlight (XFRAME (last_mouse_motion_frame), | ||
| 3916 | last_mouse_motion_event.x, | ||
| 3917 | last_mouse_motion_event.y); | ||
| 3918 | } | ||
| 3919 | |||
| 3920 | |||
| 3921 | |||
| 3922 | /* Return the current position of the mouse. | 3906 | /* Return the current position of the mouse. |
| 3923 | *FP should be a frame which indicates which display to ask about. | 3907 | *FP should be a frame which indicates which display to ask about. |
| 3924 | 3908 | ||
| @@ -6223,7 +6207,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 6223 | if (event->xunmap.window == tip_window) | 6207 | if (event->xunmap.window == tip_window) |
| 6224 | { | 6208 | { |
| 6225 | tip_window = 0; | 6209 | tip_window = 0; |
| 6226 | redo_mouse_highlight (); | 6210 | x_redo_mouse_highlight (dpyinfo); |
| 6227 | } | 6211 | } |
| 6228 | 6212 | ||
| 6229 | f = x_top_window_to_frame (dpyinfo, event->xunmap.window); | 6213 | f = x_top_window_to_frame (dpyinfo, event->xunmap.window); |
| @@ -10705,9 +10689,6 @@ With MS Windows or Nextstep, the value is t. */); | |||
| 10705 | Vx_toolkit_scroll_bars = Qnil; | 10689 | Vx_toolkit_scroll_bars = Qnil; |
| 10706 | #endif | 10690 | #endif |
| 10707 | 10691 | ||
| 10708 | staticpro (&last_mouse_motion_frame); | ||
| 10709 | last_mouse_motion_frame = Qnil; | ||
| 10710 | |||
| 10711 | Qmodifier_value = intern_c_string ("modifier-value"); | 10692 | Qmodifier_value = intern_c_string ("modifier-value"); |
| 10712 | Qalt = intern_c_string ("alt"); | 10693 | Qalt = intern_c_string ("alt"); |
| 10713 | Fput (Qalt, Qmodifier_value, make_number (alt_modifier)); | 10694 | Fput (Qalt, Qmodifier_value, make_number (alt_modifier)); |
diff --git a/src/xterm.h b/src/xterm.h index f1bfc883a64..9f01a840e53 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -308,9 +308,17 @@ struct x_display_info | |||
| 308 | /* The frame where the mouse was last time we reported a mouse event. */ | 308 | /* The frame where the mouse was last time we reported a mouse event. */ |
| 309 | struct frame *last_mouse_frame; | 309 | struct frame *last_mouse_frame; |
| 310 | 310 | ||
| 311 | /* The frame where the mouse was last time we reported a mouse motion. */ | ||
| 312 | struct frame *last_mouse_motion_frame; | ||
| 313 | |||
| 311 | /* Time of last user interaction as returned in X events on this display. */ | 314 | /* Time of last user interaction as returned in X events on this display. */ |
| 312 | Time last_user_time; | 315 | Time last_user_time; |
| 313 | 316 | ||
| 317 | /* Position where the mouse was last time we reported a motion. | ||
| 318 | This is a position on last_mouse_motion_frame. */ | ||
| 319 | int last_mouse_motion_x; | ||
| 320 | int last_mouse_motion_y; | ||
| 321 | |||
| 314 | /* The gray pixmap. */ | 322 | /* The gray pixmap. */ |
| 315 | Pixmap gray; | 323 | Pixmap gray; |
| 316 | 324 | ||