From: Po Lu Date: Sun, 11 Sep 2022 08:50:16 +0000 (+0800) Subject: Make it easier to clear the Motif drag window for debugging X-Git-Tag: emacs-29.0.90~1856^2~609 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a380ce2008e944486946b0083aa58cc8161176c6;p=emacs.git 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. --- 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;