emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 686f7f8f62: Set WM_TRANSIENT_FOR on tooltip frames


From: Po Lu
Subject: master 686f7f8f62: Set WM_TRANSIENT_FOR on tooltip frames
Date: Fri, 4 Feb 2022 21:52:35 -0500 (EST)

branch: master
commit 686f7f8f628c04e9d574186173165b2b5a9f92e2
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Set WM_TRANSIENT_FOR on tooltip frames
    
    Otherwise the decorations get all messed up on GNOME and some
    other composited desktops.
    
    * src/xfns.c (Fx_show_tip): Set WM_TRANSIENT_FOR to the window
    underneath the tooltip.
---
 src/xfns.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/xfns.c b/src/xfns.c
index 9bbefd79a0..4719c5dac7 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -7734,6 +7734,8 @@ Text larger than the specified size is clipped.  */)
   ptrdiff_t count = SPECPDL_INDEX ();
   ptrdiff_t count_1;
   Lisp_Object window, size, tip_buf;
+  Window child;
+  int dest_x_return, dest_y_return;
   AUTO_STRING (tip, " *tip*");
 
   specbind (Qinhibit_redisplay, Qt);
@@ -7958,6 +7960,27 @@ Text larger than the specified size is clipped.  */)
 
   /* Show tooltip frame.  */
   block_input ();
+  /* If the display is composited, then WM_TRANSIENT_FOR must be set
+     as well, or else the compositing manager won't display
+     decorations correctly, even though the tooltip window is override
+     redirect. See
+     https://specifications.freedesktop.org/wm-spec/1.4/ar01s08.html
+
+     Perhaps WM_TRANSIENT_FOR should be used in place of
+     override-redirect anyway.  The ICCCM only recommends
+     override-redirect if the pointer will be grabbed.  */
+
+  if (XTranslateCoordinates (FRAME_X_DISPLAY (f),
+                            FRAME_DISPLAY_INFO (f)->root_window,
+                            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);
+  else
+    XSetTransientForHint (FRAME_X_DISPLAY (tip_f),
+                         FRAME_X_WINDOW (tip_f), None);
+
 #ifndef USE_XCB
   XMoveResizeWindow (FRAME_X_DISPLAY (tip_f), FRAME_X_WINDOW (tip_f),
                     root_x, root_y, width, height);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]