aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
authorDmitry Antipov2013-09-18 13:23:10 +0400
committerDmitry Antipov2013-09-18 13:23:10 +0400
commit18da0d8ad4e5036185acbad3238cbfe2aaf3ca66 (patch)
tree7dc7f25186e10dd1c767d1dbf26268b8c70e1a51 /src/xterm.c
parent7a0c745ad134aff0bb8f4258ea607137a819b58d (diff)
downloademacs-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.
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c35
1 files changed, 8 insertions, 27 deletions
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
3863static XMotionEvent last_mouse_motion_event;
3864static Lisp_Object last_mouse_motion_frame;
3865
3866static int 3863static int
3867note_mouse_movement (struct frame *frame, const XMotionEvent *event) 3864note_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
3910static void
3911redo_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));