]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix an infinite loop if the window manager pings Emacs during DND
authorPo Lu <luangruo@yahoo.com>
Thu, 24 Mar 2022 03:41:29 +0000 (11:41 +0800)
committerPo Lu <luangruo@yahoo.com>
Thu, 24 Mar 2022 03:41:29 +0000 (11:41 +0800)
* src/xterm.c (handle_one_xevent): Work around _NET_WM_PING
infinite loop during drag and drop.

src/xterm.c

index 0543f152edadbdd2c341848656d00195421ecdc6..fcc1f55ccb6a6e9e96274e2bad769e96f4623a4b 100644 (file)
@@ -11014,7 +11014,19 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 
                send_event.xclient.window = dpyinfo->root_window;
                XSendEvent (dpyinfo->display, dpyinfo->root_window, False,
-                           SubstructureRedirectMask | SubstructureNotifyMask,
+                           /* FIXME: handling window stacking changes
+                              during drag-and-drop requires Emacs to
+                              select for SubstructureNotifyMask,
+                              which in turn causes the message to be
+                              sent to Emacs itself using the event
+                              mask specified by the EWMH.  To avoid
+                              an infinite loop, just use
+                              SubstructureRedirectMask when a
+                              drag-and-drop operation is in
+                              progress.  */
+                           ((x_dnd_in_progress || x_dnd_waiting_for_finish)
+                            ? SubstructureRedirectMask
+                            : SubstructureRedirectMask | SubstructureNotifyMask),
                            &send_event);
 
                *finish = X_EVENT_DROP;