diff options
| author | Po Lu | 2022-04-05 16:19:02 +0800 |
|---|---|---|
| committer | Po Lu | 2022-04-05 16:19:02 +0800 |
| commit | be89d888de10964c2195b6e2e6bc26845ad7cebb (patch) | |
| tree | 9a54bc45b432ea4b628f730f29cc7799365a7712 | |
| parent | 7f6c9253838baba7cdd38573179bc0d3a724e25b (diff) | |
| download | emacs-be89d888de10964c2195b6e2e6bc26845ad7cebb.tar.gz emacs-be89d888de10964c2195b6e2e6bc26845ad7cebb.zip | |
Allow dropping text to the root window
* src/xterm.c (x_dnd_send_unsupported_drop): Allow dropping to
the root window.
(handle_one_xevent): Send unsupported drops to the last toplevel
instead of the target window.
| -rw-r--r-- | src/xterm.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/src/xterm.c b/src/xterm.c index 77861c3fc0b..922aafbbdf1 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -2806,7 +2806,10 @@ x_dnd_send_unsupported_drop (struct x_display_info *dpyinfo, Window target_windo | |||
| 2806 | XSETFRAME (frame, x_dnd_frame); | 2806 | XSETFRAME (frame, x_dnd_frame); |
| 2807 | 2807 | ||
| 2808 | x_catch_errors (dpyinfo->display); | 2808 | x_catch_errors (dpyinfo->display); |
| 2809 | |||
| 2809 | child = dpyinfo->root_window; | 2810 | child = dpyinfo->root_window; |
| 2811 | dest_x = root_x; | ||
| 2812 | dest_y = root_y; | ||
| 2810 | 2813 | ||
| 2811 | while (XTranslateCoordinates (dpyinfo->display, child, | 2814 | while (XTranslateCoordinates (dpyinfo->display, child, |
| 2812 | child, root_x, root_y, &dest_x, | 2815 | child, root_x, root_y, &dest_x, |
| @@ -2821,27 +2824,24 @@ x_dnd_send_unsupported_drop (struct x_display_info *dpyinfo, Window target_windo | |||
| 2821 | root_y = dest_y; | 2824 | root_y = dest_y; |
| 2822 | } | 2825 | } |
| 2823 | 2826 | ||
| 2824 | if (child != dpyinfo->root_window) | 2827 | x_own_selection (QPRIMARY, Qnil, frame); |
| 2825 | { | ||
| 2826 | x_own_selection (QPRIMARY, Qnil, frame); | ||
| 2827 | 2828 | ||
| 2828 | event.xbutton.window = child; | 2829 | event.xbutton.window = child; |
| 2829 | event.xbutton.x = dest_x; | 2830 | event.xbutton.x = dest_x; |
| 2830 | event.xbutton.y = dest_y; | 2831 | event.xbutton.y = dest_y; |
| 2831 | event.xbutton.state = 0; | 2832 | event.xbutton.state = 0; |
| 2832 | event.xbutton.button = 2; | 2833 | event.xbutton.button = 2; |
| 2833 | event.xbutton.same_screen = True; | 2834 | event.xbutton.same_screen = True; |
| 2834 | event.xbutton.time = before + 1; | 2835 | event.xbutton.time = before + 1; |
| 2835 | event.xbutton.time = before + 2; | 2836 | event.xbutton.time = before + 2; |
| 2836 | 2837 | ||
| 2837 | x_set_pending_dnd_time (before); | 2838 | x_set_pending_dnd_time (before); |
| 2838 | 2839 | ||
| 2839 | XSendEvent (dpyinfo->display, child, | 2840 | XSendEvent (dpyinfo->display, child, |
| 2840 | True, ButtonPressMask, &event); | 2841 | True, ButtonPressMask, &event); |
| 2841 | event.xbutton.type = ButtonRelease; | 2842 | event.xbutton.type = ButtonRelease; |
| 2842 | XSendEvent (dpyinfo->display, child, | 2843 | XSendEvent (dpyinfo->display, child, |
| 2843 | True, ButtonReleaseMask, &event); | 2844 | True, ButtonReleaseMask, &event); |
| 2844 | } | ||
| 2845 | 2845 | ||
| 2846 | x_uncatch_errors (); | 2846 | x_uncatch_errors (); |
| 2847 | } | 2847 | } |
| @@ -15443,7 +15443,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 15443 | else | 15443 | else |
| 15444 | { | 15444 | { |
| 15445 | x_set_pending_dnd_time (event->xbutton.time); | 15445 | x_set_pending_dnd_time (event->xbutton.time); |
| 15446 | x_dnd_send_unsupported_drop (dpyinfo, x_dnd_last_seen_window, | 15446 | x_dnd_send_unsupported_drop (dpyinfo, (x_dnd_last_seen_toplevel != None |
| 15447 | ? x_dnd_last_seen_toplevel | ||
| 15448 | : x_dnd_last_seen_window), | ||
| 15447 | event->xbutton.x_root, event->xbutton.y_root, | 15449 | event->xbutton.x_root, event->xbutton.y_root, |
| 15448 | event->xbutton.time); | 15450 | event->xbutton.time); |
| 15449 | } | 15451 | } |
| @@ -16605,7 +16607,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 16605 | else | 16607 | else |
| 16606 | { | 16608 | { |
| 16607 | x_set_pending_dnd_time (xev->time); | 16609 | x_set_pending_dnd_time (xev->time); |
| 16608 | x_dnd_send_unsupported_drop (dpyinfo, x_dnd_last_seen_window, | 16610 | x_dnd_send_unsupported_drop (dpyinfo, (x_dnd_last_seen_toplevel != None |
| 16611 | ? x_dnd_last_seen_toplevel | ||
| 16612 | : x_dnd_last_seen_window), | ||
| 16609 | xev->root_x, xev->root_y, xev->time); | 16613 | xev->root_x, xev->root_y, xev->time); |
| 16610 | } | 16614 | } |
| 16611 | } | 16615 | } |