diff options
| author | Po Lu | 2022-06-24 16:41:12 +0800 |
|---|---|---|
| committer | Po Lu | 2022-06-24 16:41:12 +0800 |
| commit | c148bfc229e4d305a8e45595b1b0aa8ae21ef7de (patch) | |
| tree | 6a9042c19e71b378218d1562cfbb0955deb882fe /src | |
| parent | 9f3ce27e56f5fa1053f2abcbcbd375cc0a75f283 (diff) | |
| download | emacs-c148bfc229e4d305a8e45595b1b0aa8ae21ef7de.tar.gz emacs-c148bfc229e4d305a8e45595b1b0aa8ae21ef7de.zip | |
Fix handling of mouse motion across screens during drag-and-drop
* src/xterm.c (x_dnd_fill_empty_target): New function.
(handle_one_xevent): Fill empty target if the event didn't come
from the same screen.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/src/xterm.c b/src/xterm.c index 414a9c0ebed..d03b9a6d618 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -3894,6 +3894,18 @@ x_dnd_send_unsupported_drop (struct x_display_info *dpyinfo, Window target_windo | |||
| 3894 | } | 3894 | } |
| 3895 | 3895 | ||
| 3896 | static Window | 3896 | static Window |
| 3897 | x_dnd_fill_empty_target (int *proto_out, int *motif_out, | ||
| 3898 | Window *toplevel_out, bool *was_frame) | ||
| 3899 | { | ||
| 3900 | *proto_out = -1; | ||
| 3901 | *motif_out = XM_DRAG_STYLE_NONE; | ||
| 3902 | *toplevel_out = None; | ||
| 3903 | *was_frame = false; | ||
| 3904 | |||
| 3905 | return None; | ||
| 3906 | } | ||
| 3907 | |||
| 3908 | static Window | ||
| 3897 | x_dnd_get_target_window (struct x_display_info *dpyinfo, | 3909 | x_dnd_get_target_window (struct x_display_info *dpyinfo, |
| 3898 | int root_x, int root_y, int *proto_out, | 3910 | int root_x, int root_y, int *proto_out, |
| 3899 | int *motif_out, Window *toplevel_out, | 3911 | int *motif_out, Window *toplevel_out, |
| @@ -18111,12 +18123,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 18111 | } | 18123 | } |
| 18112 | } | 18124 | } |
| 18113 | 18125 | ||
| 18114 | target = x_dnd_get_target_window (dpyinfo, | 18126 | if (event->xmotion.same_screen) |
| 18115 | event->xmotion.x_root, | 18127 | target = x_dnd_get_target_window (dpyinfo, |
| 18116 | event->xmotion.y_root, | 18128 | event->xmotion.x_root, |
| 18117 | &target_proto, | 18129 | event->xmotion.y_root, |
| 18118 | &motif_style, &toplevel, | 18130 | &target_proto, |
| 18119 | &was_frame); | 18131 | &motif_style, &toplevel, |
| 18132 | &was_frame); | ||
| 18133 | else | ||
| 18134 | target = x_dnd_fill_empty_target (&target_proto, &motif_style, | ||
| 18135 | &toplevel, &was_frame); | ||
| 18120 | 18136 | ||
| 18121 | if (toplevel != x_dnd_last_seen_toplevel) | 18137 | if (toplevel != x_dnd_last_seen_toplevel) |
| 18122 | { | 18138 | { |
| @@ -19837,13 +19853,19 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 19837 | } | 19853 | } |
| 19838 | } | 19854 | } |
| 19839 | 19855 | ||
| 19840 | target = x_dnd_get_target_window (dpyinfo, | 19856 | if (xev->root == dpyinfo->root_window) |
| 19841 | xev->root_x, | 19857 | target = x_dnd_get_target_window (dpyinfo, |
| 19842 | xev->root_y, | 19858 | xev->root_x, |
| 19843 | &target_proto, | 19859 | xev->root_y, |
| 19844 | &motif_style, | 19860 | &target_proto, |
| 19845 | &toplevel, | 19861 | &motif_style, |
| 19846 | &was_frame); | 19862 | &toplevel, |
| 19863 | &was_frame); | ||
| 19864 | else | ||
| 19865 | target = x_dnd_fill_empty_target (&target_proto, | ||
| 19866 | &motif_style, | ||
| 19867 | &toplevel, | ||
| 19868 | &was_frame); | ||
| 19847 | 19869 | ||
| 19848 | if (toplevel != x_dnd_last_seen_toplevel) | 19870 | if (toplevel != x_dnd_last_seen_toplevel) |
| 19849 | { | 19871 | { |