comparison src/xterm.c @ 8430:356e5509efda

(construct_mouse_click, construct_menu_click): Don't update x_mouse_grabbed, Vmouse_depressed, last_mouse_frame here. (XTread_socket): Update them here, so we do it without fail. (XTmouse_position, XTread_socket case MotionNotify): Check last_mouse_frame is nonzero before using it.
author Richard M. Stallman <rms@gnu.org>
date Wed, 03 Aug 1994 07:35:50 +0000
parents 525e990ca9d2
children 85bcdaceeebc
comparison
equal deleted inserted replaced
8429:f4138f5dc0d3 8430:356e5509efda
2009 result->modifiers = (x_x_to_emacs_modifiers (event->state) 2009 result->modifiers = (x_x_to_emacs_modifiers (event->state)
2010 | (event->type == ButtonRelease 2010 | (event->type == ButtonRelease
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
2032 #if 0 2017 #if 0
2033 pixel_to_glyph_coords (f, event->x, event->y, &column, &row, NULL, 0); 2018 pixel_to_glyph_coords (f, event->x, event->y, &column, &row, NULL, 0);
2059 : down_modifier)); 2044 : down_modifier));
2060 2045
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.
2076 The input handler calls this. 2052 The input handler calls this.
2077 2053
2536 int win_x, win_y; 2512 int win_x, win_y;
2537 int parent_x, parent_y; 2513 int parent_x, parent_y;
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. */
2545 XTranslateCoordinates (x_current_display, 2522 XTranslateCoordinates (x_current_display,
2546 2523
4126 #endif /* ! defined (HAVE_X11) */ 4103 #endif /* ! defined (HAVE_X11) */
4127 4104
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);
4135 if (f) 4113 if (f)
4136 note_mouse_movement (f, &event.xmotion); 4114 note_mouse_movement (f, &event.xmotion);
4302 { 4280 {
4303 f = x_any_window_to_frame (event.xbutton.window); 4281 f = x_any_window_to_frame (event.xbutton.window);
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 */
4287 }
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;
4315 } 4300 }
4316 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));