aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/xterm.c49
1 files changed, 17 insertions, 32 deletions
diff --git a/src/xterm.c b/src/xterm.c
index d2b26b9e79e..ac6bb48be1d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2011,21 +2011,6 @@ construct_mouse_click (result, event, f)
2011 ? up_modifier 2011 ? up_modifier
2012 : down_modifier)); 2012 : down_modifier));
2013 2013
2014 /* Notice if the mouse is still grabbed. */
2015 if (event->type == ButtonPress)
2016 {
2017 if (! x_mouse_grabbed)
2018 Vmouse_depressed = Qt;
2019 x_mouse_grabbed |= (1 << event->button);
2020 last_mouse_frame = f;
2021 }
2022 else if (event->type == ButtonRelease)
2023 {
2024 x_mouse_grabbed &= ~(1 << event->button);
2025 if (!x_mouse_grabbed)
2026 Vmouse_depressed = Qnil;
2027 }
2028
2029 { 2014 {
2030 int row, column; 2015 int row, column;
2031 2016
@@ -2061,15 +2046,6 @@ construct_menu_click (result, event, f)
2061 XSET (result->x, Lisp_Int, event->x); 2046 XSET (result->x, Lisp_Int, event->x);
2062 XSET (result->y, Lisp_Int, -1); 2047 XSET (result->y, Lisp_Int, -1);
2063 XSET (result->frame_or_window, Lisp_Frame, f); 2048 XSET (result->frame_or_window, Lisp_Frame, f);
2064
2065 /* Notice if the mouse is still grabbed. */
2066 if (event->type == ButtonPress)
2067 {
2068 if (! x_mouse_grabbed)
2069 Vmouse_depressed = Qt;
2070 x_mouse_grabbed |= (1 << event->button);
2071 last_mouse_frame = f;
2072 }
2073} 2049}
2074 2050
2075/* Function to report a mouse movement to the mainstream Emacs code. 2051/* Function to report a mouse movement to the mainstream Emacs code.
@@ -2538,7 +2514,8 @@ XTmouse_position (f, bar_window, part, x, y, time)
2538 2514
2539 win = root; 2515 win = root;
2540 2516
2541 if (x_mouse_grabbed && FRAME_LIVE_P (last_mouse_frame)) 2517 if (x_mouse_grabbed && last_mouse_frame
2518 && FRAME_LIVE_P (last_mouse_frame))
2542 { 2519 {
2543 /* If mouse was grabbed on a frame, give coords for that frame 2520 /* If mouse was grabbed on a frame, give coords for that frame
2544 even if the mouse is now outside it. */ 2521 even if the mouse is now outside it. */
@@ -4128,7 +4105,8 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
4128#ifdef HAVE_X11 4105#ifdef HAVE_X11
4129 case MotionNotify: 4106 case MotionNotify:
4130 { 4107 {
4131 if (x_mouse_grabbed && FRAME_LIVE_P (last_mouse_frame)) 4108 if (x_mouse_grabbed && last_mouse_frame
4109 && FRAME_LIVE_P (last_mouse_frame))
4132 f = last_mouse_frame; 4110 f = last_mouse_frame;
4133 else 4111 else
4134 f = x_window_to_frame (event.xmotion.window); 4112 f = x_window_to_frame (event.xmotion.window);
@@ -4304,16 +4282,23 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
4304 if (f && event.type == ButtonPress) 4282 if (f && event.type == ButtonPress)
4305 construct_menu_click (&emacs_event, 4283 construct_menu_click (&emacs_event,
4306 &event, f); 4284 &event, f);
4307 else if (f)
4308 {
4309 x_mouse_grabbed &= ~(1 << event.xbutton.button);
4310 if (!x_mouse_grabbed)
4311 Vmouse_depressed = Qnil;
4312 }
4313 } 4285 }
4314#endif /* USE_X_TOOLKIT */ 4286#endif /* USE_X_TOOLKIT */
4315 } 4287 }
4316 4288
4289 if (event.type == ButtonPress)
4290 {
4291 x_mouse_grabbed |= (1 << event.xbutton.button);
4292 Vmouse_depressed = Qt;
4293 last_mouse_frame = f;
4294 }
4295 else
4296 {
4297 x_mouse_grabbed &= ~(1 << event.xbutton.button);
4298 if (!x_mouse_grabbed)
4299 Vmouse_depressed = Qnil;
4300 }
4301
4317 if (numchars >= 1 && emacs_event.kind != no_event) 4302 if (numchars >= 1 && emacs_event.kind != no_event)
4318 { 4303 {
4319 bcopy (&emacs_event, bufp, sizeof (struct input_event)); 4304 bcopy (&emacs_event, bufp, sizeof (struct input_event));