aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
authorDmitry Antipov2013-09-18 10:48:11 +0400
committerDmitry Antipov2013-09-18 10:48:11 +0400
commit7a0c745ad134aff0bb8f4258ea607137a819b58d (patch)
treeae24a427e9425302a7953eea18b311214c9664b4 /src/xterm.c
parent12679bfd15020087eca82df8dcb5df2c48bcef02 (diff)
downloademacs-7a0c745ad134aff0bb8f4258ea607137a819b58d.tar.gz
emacs-7a0c745ad134aff0bb8f4258ea607137a819b58d.zip
* frame.c (x_mouse_grabbed): New function.
* dispextern.h (x_mouse_grabbed): Add prototype. (last_mouse_frame): Remove declaration. * xterm.h (struct x_display_info): * w32term.h (struct w32_display_info): * nsterm.h (struct ns_display_info): New member last_mouse_frame, going to replace... * xdisp.c (last_mouse_frame): ...global variable. (note_tool_bar_highlight): * w32term.c (w32_mouse_position, w32_read_socket): * xterm.c (XTmouse_position, handle_one_xevent): Use x_mouse_grabbed. * nsterm.m (ns_mouse_position, mouseDown): Adjust user.
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 08a360fd52c..7d8c40b8cf0 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -3945,6 +3945,7 @@ XTmouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
3945 Time *timestamp) 3945 Time *timestamp)
3946{ 3946{
3947 struct frame *f1; 3947 struct frame *f1;
3948 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (*fp);
3948 3949
3949 block_input (); 3950 block_input ();
3950 3951
@@ -4004,22 +4005,24 @@ XTmouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
4004 4005
4005 x_catch_errors (FRAME_X_DISPLAY (*fp)); 4006 x_catch_errors (FRAME_X_DISPLAY (*fp));
4006 4007
4007 if (FRAME_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame 4008 if (x_mouse_grabbed (dpyinfo))
4008 && FRAME_LIVE_P (last_mouse_frame))
4009 { 4009 {
4010 /* If mouse was grabbed on a frame, give coords for that frame 4010 /* If mouse was grabbed on a frame, give coords for that frame
4011 even if the mouse is now outside it. */ 4011 even if the mouse is now outside it. */
4012 XTranslateCoordinates (FRAME_X_DISPLAY (*fp), 4012 XTranslateCoordinates (FRAME_X_DISPLAY (*fp),
4013 4013
4014 /* From-window, to-window. */ 4014 /* From-window. */
4015 root, FRAME_X_WINDOW (last_mouse_frame), 4015 root,
4016
4017 /* To-window. */
4018 FRAME_X_WINDOW (dpyinfo->last_mouse_frame),
4016 4019
4017 /* From-position, to-position. */ 4020 /* From-position, to-position. */
4018 root_x, root_y, &win_x, &win_y, 4021 root_x, root_y, &win_x, &win_y,
4019 4022
4020 /* Child of win. */ 4023 /* Child of win. */
4021 &child); 4024 &child);
4022 f1 = last_mouse_frame; 4025 f1 = dpyinfo->last_mouse_frame;
4023 } 4026 }
4024 else 4027 else
4025 { 4028 {
@@ -4043,7 +4046,7 @@ XTmouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
4043 want the edit window. For non-Gtk+ the innermost 4046 want the edit window. For non-Gtk+ the innermost
4044 window is the edit window. For Gtk+ it might not 4047 window is the edit window. For Gtk+ it might not
4045 be. It might be the tool bar for example. */ 4048 be. It might be the tool bar for example. */
4046 if (x_window_to_frame (FRAME_DISPLAY_INFO (*fp), win)) 4049 if (x_window_to_frame (dpyinfo, win))
4047 break; 4050 break;
4048#endif 4051#endif
4049 win = child; 4052 win = child;
@@ -4065,10 +4068,10 @@ XTmouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
4065#ifdef USE_GTK 4068#ifdef USE_GTK
4066 /* We don't wan't to know the innermost window. We 4069 /* We don't wan't to know the innermost window. We
4067 want the edit window. */ 4070 want the edit window. */
4068 f1 = x_window_to_frame (FRAME_DISPLAY_INFO (*fp), win); 4071 f1 = x_window_to_frame (dpyinfo, win);
4069#else 4072#else
4070 /* Is win one of our frames? */ 4073 /* Is win one of our frames? */
4071 f1 = x_any_window_to_frame (FRAME_DISPLAY_INFO (*fp), win); 4074 f1 = x_any_window_to_frame (dpyinfo, win);
4072#endif 4075#endif
4073 4076
4074#ifdef USE_X_TOOLKIT 4077#ifdef USE_X_TOOLKIT
@@ -6704,11 +6707,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
6704 previous_help_echo_string = help_echo_string; 6707 previous_help_echo_string = help_echo_string;
6705 help_echo_string = Qnil; 6708 help_echo_string = Qnil;
6706 6709
6707 if (dpyinfo->grabbed && last_mouse_frame 6710 f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame
6708 && FRAME_LIVE_P (last_mouse_frame)) 6711 : x_window_to_frame (dpyinfo, event->xmotion.window));
6709 f = last_mouse_frame;
6710 else
6711 f = x_window_to_frame (dpyinfo, event->xmotion.window);
6712 6712
6713 if (hlinfo->mouse_face_hidden) 6713 if (hlinfo->mouse_face_hidden)
6714 { 6714 {
@@ -6845,12 +6845,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
6845 last_mouse_glyph_frame = 0; 6845 last_mouse_glyph_frame = 0;
6846 dpyinfo->last_user_time = event->xbutton.time; 6846 dpyinfo->last_user_time = event->xbutton.time;
6847 6847
6848 if (dpyinfo->grabbed 6848 f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame
6849 && last_mouse_frame 6849 : x_window_to_frame (dpyinfo, event->xbutton.window));
6850 && FRAME_LIVE_P (last_mouse_frame))
6851 f = last_mouse_frame;
6852 else
6853 f = x_window_to_frame (dpyinfo, event->xbutton.window);
6854 6850
6855#ifdef USE_GTK 6851#ifdef USE_GTK
6856 if (f && xg_event_is_for_scrollbar (f, event)) 6852 if (f && xg_event_is_for_scrollbar (f, event))
@@ -6923,7 +6919,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
6923 if (event->type == ButtonPress) 6919 if (event->type == ButtonPress)
6924 { 6920 {
6925 dpyinfo->grabbed |= (1 << event->xbutton.button); 6921 dpyinfo->grabbed |= (1 << event->xbutton.button);
6926 last_mouse_frame = f; 6922 dpyinfo->last_mouse_frame = f;
6927 6923
6928 if (!tool_bar_p) 6924 if (!tool_bar_p)
6929 last_tool_bar_item = -1; 6925 last_tool_bar_item = -1;