emacs-diffs
[Top][All Lists]
Advanced

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

master 1ce0d8d9ef: Keep tooltip position in sync with monitor changes


From: Po Lu
Subject: master 1ce0d8d9ef: Keep tooltip position in sync with monitor changes
Date: Sun, 12 Jun 2022 21:42:24 -0400 (EDT)

branch: master
commit 1ce0d8d9efee60d7bc6d4b81c7e7d6be508c0b7b
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Keep tooltip position in sync with monitor changes
    
    * src/xterm.c (x_dnd_update_tooltip_now): New function.
    (x_monitors_changed_cb):
    (handle_one_xevent): Call that function on monitor change.
---
 src/xterm.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/src/xterm.c b/src/xterm.c
index b1e877566f..4bc4c53eea 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -15322,6 +15322,31 @@ x_dnd_update_tooltip_position (int root_x, int root_y)
     }
 }
 
+static void
+x_dnd_update_tooltip_now (void)
+{
+  int root_x, root_y;
+  Window root, child;
+  int win_x, win_y;
+  unsigned int mask;
+  Bool rc;
+  struct x_display_info *dpyinfo;
+
+  if (!x_dnd_in_progress || !x_dnd_update_tooltip)
+    return;
+
+  dpyinfo = FRAME_DISPLAY_INFO (XFRAME (x_dnd_frame));
+
+  rc = XQueryPointer (dpyinfo->display,
+                     dpyinfo->root_window,
+                     &root, &child, &root_x,
+                     &root_y, &win_x, &win_y,
+                     &mask);
+
+  if (rc)
+    x_dnd_update_tooltip_position (root_x, root_y);
+}
+
 /* Get the window underneath the pointer, see if it moved, and update
    the DND state accordingly.  */
 static void
@@ -15702,6 +15727,8 @@ x_monitors_changed_cb (GdkScreen *gscr, gpointer 
user_data)
 
   if (x_dnd_in_progress && x_dnd_update_tooltip)
     x_dnd_monitors = current_monitors;
+
+  x_dnd_update_tooltip_now ();
 }
 #endif
 
@@ -21520,6 +21547,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 
          if (x_dnd_in_progress && x_dnd_update_tooltip)
            x_dnd_monitors = current_monitors;
+
+         x_dnd_update_tooltip_now ();
        }
 #endif
     OTHER:



reply via email to

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