]> git.eshelyaron.com Git - emacs.git/commitdiff
Make it easier to clear the Motif drag window for debugging
authorPo Lu <luangruo@yahoo.com>
Sun, 11 Sep 2022 08:50:16 +0000 (16:50 +0800)
committerPo Lu <luangruo@yahoo.com>
Sun, 11 Sep 2022 08:50:26 +0000 (16:50 +0800)
* 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

index 4ac42a91384d3eddde670c91fff5d9c4bb30089f..12234351a321e65d27a19dbe9cb0bd8c8c461b3e 100644 (file)
@@ -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;