From cd18cee96ee17562a276ea84bc9313e5bcbccb55 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 6 Jul 2022 09:01:02 +0800 Subject: [PATCH] Don't select for unnecessary properties during DND * src/xterm.c (x_dnd_begin_drag_and_drop): Don't select for property changes when not using toplevels. --- src/xterm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index 8373222cfc3..2643d1120f9 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -11388,6 +11388,7 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, #ifndef USE_GTK struct x_display_info *event_display; #endif + unsigned int additional_mask; base = SPECPDL_INDEX (); @@ -11598,7 +11599,7 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, if (EQ (return_frame, Qnow)) x_dnd_return_frame = 2; - /* Now select for SubstructureNotifyMask and PropertyNotifyMask on + /* Now select for SubstructureNotifyMask and PropertyChangeMask on the root window, so we can get notified when window stacking changes, a common operation during drag-and-drop. */ @@ -11606,11 +11607,15 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, FRAME_DISPLAY_INFO (f)->root_window, &root_window_attrs); + additional_mask = SubstructureNotifyMask; + + if (x_dnd_use_toplevels) + additional_mask |= PropertyChangeMask; + XSelectInput (FRAME_X_DISPLAY (f), FRAME_DISPLAY_INFO (f)->root_window, root_window_attrs.your_event_mask - | SubstructureNotifyMask - | PropertyChangeMask); + | additional_mask); if (EQ (return_frame, Qnow)) x_dnd_update_state (FRAME_DISPLAY_INFO (f), CurrentTime); -- 2.39.5