From a380ce2008e944486946b0083aa58cc8161176c6 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 11 Sep 2022 16:50:16 +0800 Subject: [PATCH] Make it easier to clear the Motif drag window for debugging * src/xterm.c (xm_get_drag_window_1): Add comment explaining side effect of x_special_window_exists_p. (handle_one_xevent): Clear Motif drag window upon DestroyNotify. In addition to debugging, it also reduces syncs necessary to communicate via the Motif protocol after a defective/old client sets the drag window without setting the disconnect mode. --- src/xterm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/xterm.c b/src/xterm.c index 4ac42a91384..12234351a32 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1971,6 +1971,10 @@ xm_get_drag_window_1 (struct x_display_info *dpyinfo) && tmp_data) { drag_window = *(Window *) tmp_data; + + /* This has the side effect of selecting for + StructureNotifyMask, meaning that we will get notifications + once it is deleted. */ rc = x_special_window_exists_p (dpyinfo, drag_window); if (!rc) @@ -20707,6 +20711,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, == dpyinfo->net_supported_window) dpyinfo->net_supported_window = None; + if (event->xdestroywindow.window + == dpyinfo->motif_drag_window) + /* We get DestroyNotify events for the drag window because + x_special_window_exists_p selects for structure + notification. The drag window is not supposed to go away + but not all clients obey that requirement when setting the + drag window property. */ + dpyinfo->motif_drag_window = None; + xft_settings_event (dpyinfo, event); break; -- 2.39.2