aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2022-08-14 09:39:08 +0800
committerPo Lu2022-08-14 09:39:08 +0800
commit47e23ad7a82bd707dedcd17425e89e8024b5a763 (patch)
treec3ee641a00233d60714be88bb6acf9ebddce7e55
parent15c20cb4fe9a43a96fc0d80c442741b8d2e21bc7 (diff)
downloademacs-47e23ad7a82bd707dedcd17425e89e8024b5a763.tar.gz
emacs-47e23ad7a82bd707dedcd17425e89e8024b5a763.zip
More fixes to MPX drag-and-drop interaction
* src/xterm.c (x_dnd_begin_drag_and_drop): Also initialize the keyboard device used for drag-and-drop. (handle_one_xevent): Verify deviceid in more places; also test keyboard device before swallowing F1.
-rw-r--r--src/xterm.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/xterm.c b/src/xterm.c
index e48d6fd2513..6cf44e162b1 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1402,6 +1402,9 @@ static bool x_dnd_last_tooltip_valid;
1402/* The master pointer device being used for the drag-and-drop 1402/* The master pointer device being used for the drag-and-drop
1403 operation. */ 1403 operation. */
1404static int x_dnd_pointer_device; 1404static int x_dnd_pointer_device;
1405
1406/* The keyboard device attached to that pointer device. */
1407static int x_dnd_keyboard_device;
1405#endif 1408#endif
1406 1409
1407/* Structure describing a single window that can be the target of 1410/* Structure describing a single window that can be the target of
@@ -11976,6 +11979,9 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction,
11976 struct x_display_info *event_display; 11979 struct x_display_info *event_display;
11977#endif 11980#endif
11978 unsigned int additional_mask; 11981 unsigned int additional_mask;
11982#ifdef HAVE_XINPUT2
11983 struct xi_device_t *device;
11984#endif
11979 11985
11980 base = SPECPDL_INDEX (); 11986 base = SPECPDL_INDEX ();
11981 11987
@@ -12171,6 +12177,14 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction,
12171 /* This returns Bool but cannot actually fail. */ 12177 /* This returns Bool but cannot actually fail. */
12172 XIGetClientPointer (FRAME_X_DISPLAY (f), None, 12178 XIGetClientPointer (FRAME_X_DISPLAY (f), None,
12173 &x_dnd_pointer_device); 12179 &x_dnd_pointer_device);
12180
12181 x_dnd_keyboard_device = -1;
12182
12183 device = xi_device_from_id (FRAME_DISPLAY_INFO (f),
12184 x_dnd_pointer_device);
12185
12186 if (device)
12187 x_dnd_keyboard_device = device->attachment;
12174 } 12188 }
12175 12189
12176#endif 12190#endif
@@ -21000,6 +21014,12 @@ handle_one_xevent (struct x_display_info *dpyinfo,
21000 operation, don't send an event. We only have 21014 operation, don't send an event. We only have
21001 to set the user time. */ 21015 to set the user time. */
21002 if (x_dnd_in_progress 21016 if (x_dnd_in_progress
21017 /* If another master device moved the
21018 pointer, we should put a wheel event on
21019 the keyboard buffer as usual. It will be
21020 run once the drag-and-drop operation
21021 completes. */
21022 && xev->deviceid == x_dnd_pointer_device
21003 && (command_loop_level + minibuf_level 21023 && (command_loop_level + minibuf_level
21004 <= x_dnd_recursion_depth) 21024 <= x_dnd_recursion_depth)
21005 && dpyinfo == FRAME_DISPLAY_INFO (x_dnd_frame)) 21025 && dpyinfo == FRAME_DISPLAY_INFO (x_dnd_frame))
@@ -22306,7 +22326,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
22306 inev.ie.modifiers = x_x_to_emacs_modifiers (dpyinfo, state); 22326 inev.ie.modifiers = x_x_to_emacs_modifiers (dpyinfo, state);
22307 22327
22308#ifdef XK_F1 22328#ifdef XK_F1
22309 if (x_dnd_in_progress && keysym == XK_F1) 22329 if (x_dnd_in_progress
22330 && xev->deviceid == x_dnd_keyboard_device
22331 && keysym == XK_F1)
22310 { 22332 {
22311 x_dnd_xm_use_help = true; 22333 x_dnd_xm_use_help = true;
22312 goto xi_done_keysym; 22334 goto xi_done_keysym;