]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't allow tooltips to be transient for override redirect windows
authorPo Lu <luangruo@yahoo.com>
Tue, 8 Feb 2022 01:25:24 +0000 (09:25 +0800)
committerPo Lu <luangruo@yahoo.com>
Tue, 8 Feb 2022 01:25:24 +0000 (09:25 +0800)
* src/xfns.c (Fx_show_tip): Delete WM_TRANSIENT_FOR if the child
window is override-redirect.

* src/xterm.c (x_term_init): Intern new atom.
* src/xterm.h (struct x_display_info): New atom
`Xatom_wm_transient_for'.

src/xfns.c
src/xterm.c
src/xterm.h

index 7878ee62f5ee2aa10f6b073d03d9ed0bb0b60109..2fd9ad6b054cae45ccf4b3f040ebda175ca8e099 100644 (file)
@@ -7788,6 +7788,7 @@ Text larger than the specified size is clipped.  */)
   ptrdiff_t count_1;
   Lisp_Object window, size, tip_buf;
   Window child;
+  XWindowAttributes child_attrs;
   int dest_x_return, dest_y_return;
   AUTO_STRING (tip, " *tip*");
 
@@ -8028,11 +8029,24 @@ Text larger than the specified size is clipped.  */)
                             FRAME_DISPLAY_INFO (f)->root_window,
                             root_x, root_y, &dest_x_return,
                             &dest_y_return, &child))
-    XSetTransientForHint (FRAME_X_DISPLAY (tip_f),
-                         FRAME_X_WINDOW (tip_f), child);
+    {
+      /* But only if the child is not override-redirect, which can
+        happen if the pointer is above a menu.  */
+
+      if (XGetWindowAttributes (FRAME_X_DISPLAY (f),
+                               child, &child_attrs)
+         || child_attrs.override_redirect)
+       XDeleteProperty (FRAME_X_DISPLAY (tip_f),
+                        FRAME_X_WINDOW (tip_f),
+                        FRAME_DISPLAY_INFO (tip_f)->Xatom_wm_transient_for);
+      else
+       XSetTransientForHint (FRAME_X_DISPLAY (tip_f),
+                             FRAME_X_WINDOW (tip_f), child);
+    }
   else
-    XSetTransientForHint (FRAME_X_DISPLAY (tip_f),
-                         FRAME_X_WINDOW (tip_f), None);
+    XDeleteProperty (FRAME_X_DISPLAY (tip_f),
+                    FRAME_X_WINDOW (tip_f),
+                    FRAME_DISPLAY_INFO (tip_f)->Xatom_wm_transient_for);
 
 #ifndef USE_XCB
   XMoveResizeWindow (FRAME_X_DISPLAY (tip_f), FRAME_X_WINDOW (tip_f),
index 38f181e5df82dc0f324612ca462a8273f1ce60ce..b49441ddb79627a817ae7e0f2c8e190e4260fafa 100644 (file)
@@ -15984,6 +15984,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
       ATOM_REFS_INIT ("WM_CONFIGURE_DENIED", Xatom_wm_configure_denied)
       ATOM_REFS_INIT ("WM_MOVED", Xatom_wm_window_moved)
       ATOM_REFS_INIT ("WM_CLIENT_LEADER", Xatom_wm_client_leader)
+      ATOM_REFS_INIT ("WM_TRANSIENT_FOR", Xatom_wm_transient_for)
       ATOM_REFS_INIT ("Editres", Xatom_editres)
       ATOM_REFS_INIT ("CLIPBOARD", Xatom_CLIPBOARD)
       ATOM_REFS_INIT ("TIMESTAMP", Xatom_TIMESTAMP)
index 63956fd643475b4b3dbefb999e4f5165f2a88898..854d87c83ce592f4023eeae29168ce29a0940b05 100644 (file)
@@ -364,6 +364,8 @@ struct x_display_info
   Atom Xatom_wm_configure_denied; /* When our config request is denied */
   Atom Xatom_wm_window_moved;     /* When the WM moves us.  */
   Atom Xatom_wm_client_leader;    /* Id of client leader window.  */
+  Atom Xatom_wm_transient_for;    /* Id of whatever window we are
+                                    transient for. */
 
   /* EditRes protocol */
   Atom Xatom_editres;