diff options
| author | Po Lu | 2022-06-13 09:42:12 +0800 |
|---|---|---|
| committer | Po Lu | 2022-06-13 09:42:12 +0800 |
| commit | 1ce0d8d9efee60d7bc6d4b81c7e7d6be508c0b7b (patch) | |
| tree | 855b6c1d2e92c937fe47419363d702fb258cf595 /src | |
| parent | 79f50e913d32cb1d1f7757258240147b9234c4d3 (diff) | |
| download | emacs-1ce0d8d9efee60d7bc6d4b81c7e7d6be508c0b7b.tar.gz emacs-1ce0d8d9efee60d7bc6d4b81c7e7d6be508c0b7b.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/xterm.c b/src/xterm.c index b1e877566fa..4bc4c53eea2 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -15322,6 +15322,31 @@ x_dnd_update_tooltip_position (int root_x, int root_y) | |||
| 15322 | } | 15322 | } |
| 15323 | } | 15323 | } |
| 15324 | 15324 | ||
| 15325 | static void | ||
| 15326 | x_dnd_update_tooltip_now (void) | ||
| 15327 | { | ||
| 15328 | int root_x, root_y; | ||
| 15329 | Window root, child; | ||
| 15330 | int win_x, win_y; | ||
| 15331 | unsigned int mask; | ||
| 15332 | Bool rc; | ||
| 15333 | struct x_display_info *dpyinfo; | ||
| 15334 | |||
| 15335 | if (!x_dnd_in_progress || !x_dnd_update_tooltip) | ||
| 15336 | return; | ||
| 15337 | |||
| 15338 | dpyinfo = FRAME_DISPLAY_INFO (XFRAME (x_dnd_frame)); | ||
| 15339 | |||
| 15340 | rc = XQueryPointer (dpyinfo->display, | ||
| 15341 | dpyinfo->root_window, | ||
| 15342 | &root, &child, &root_x, | ||
| 15343 | &root_y, &win_x, &win_y, | ||
| 15344 | &mask); | ||
| 15345 | |||
| 15346 | if (rc) | ||
| 15347 | x_dnd_update_tooltip_position (root_x, root_y); | ||
| 15348 | } | ||
| 15349 | |||
| 15325 | /* Get the window underneath the pointer, see if it moved, and update | 15350 | /* Get the window underneath the pointer, see if it moved, and update |
| 15326 | the DND state accordingly. */ | 15351 | the DND state accordingly. */ |
| 15327 | static void | 15352 | static void |
| @@ -15702,6 +15727,8 @@ x_monitors_changed_cb (GdkScreen *gscr, gpointer user_data) | |||
| 15702 | 15727 | ||
| 15703 | if (x_dnd_in_progress && x_dnd_update_tooltip) | 15728 | if (x_dnd_in_progress && x_dnd_update_tooltip) |
| 15704 | x_dnd_monitors = current_monitors; | 15729 | x_dnd_monitors = current_monitors; |
| 15730 | |||
| 15731 | x_dnd_update_tooltip_now (); | ||
| 15705 | } | 15732 | } |
| 15706 | #endif | 15733 | #endif |
| 15707 | 15734 | ||
| @@ -21520,6 +21547,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 21520 | 21547 | ||
| 21521 | if (x_dnd_in_progress && x_dnd_update_tooltip) | 21548 | if (x_dnd_in_progress && x_dnd_update_tooltip) |
| 21522 | x_dnd_monitors = current_monitors; | 21549 | x_dnd_monitors = current_monitors; |
| 21550 | |||
| 21551 | x_dnd_update_tooltip_now (); | ||
| 21523 | } | 21552 | } |
| 21524 | #endif | 21553 | #endif |
| 21525 | OTHER: | 21554 | OTHER: |