diff options
| author | Po Lu | 2022-06-12 09:32:30 +0800 |
|---|---|---|
| committer | Po Lu | 2022-06-12 09:32:33 +0800 |
| commit | 0adbb21ece4af494e7050281dc022d5f7a11f196 (patch) | |
| tree | c024eccd21178d0bd5260f5498c6712388ed99f2 /src | |
| parent | 98365c7b1e1e1d3d5f7185f2d4a2baa1c65b4540 (diff) | |
| download | emacs-0adbb21ece4af494e7050281dc022d5f7a11f196.tar.gz emacs-0adbb21ece4af494e7050281dc022d5f7a11f196.zip | |
Don't rely on XdndAware on frames for dropping to work
* src/xterm.c (x_dnd_get_target_window): New parameter
WAS_FRAME. If toplevel is a frame, set it and clear proto and
motif.
(x_dnd_send_enter, x_dnd_send_position, x_dnd_send_leave)
(x_dnd_send_drop): Remove special-cased self dropping code.
(x_dnd_note_self_position, x_dnd_note_self_drop): New functions.
(x_dnd_begin_drag_and_drop, x_dnd_update_state):
(handle_one_xevent): Handle our own frames using those functions
instead.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 258 |
1 files changed, 165 insertions, 93 deletions
diff --git a/src/xterm.c b/src/xterm.c index 3ca91494908..f422fc9d401 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -1189,6 +1189,10 @@ static Window x_dnd_end_window; | |||
| 1189 | did not support XDND. */ | 1189 | did not support XDND. */ |
| 1190 | static int x_dnd_last_protocol_version; | 1190 | static int x_dnd_last_protocol_version; |
| 1191 | 1191 | ||
| 1192 | /* Whether or not the last seen window is actually one of our | ||
| 1193 | frames. */ | ||
| 1194 | static bool x_dnd_last_window_is_frame; | ||
| 1195 | |||
| 1192 | /* The Motif drag and drop protocol style of `x_dnd_last_seen_window'. | 1196 | /* The Motif drag and drop protocol style of `x_dnd_last_seen_window'. |
| 1193 | XM_DRAG_STYLE_NONE means the window does not support the Motif drag | 1197 | XM_DRAG_STYLE_NONE means the window does not support the Motif drag |
| 1194 | or drop protocol. XM_DRAG_STYLE_DROP_ONLY means the window does | 1198 | or drop protocol. XM_DRAG_STYLE_DROP_ONLY means the window does |
| @@ -3560,7 +3564,8 @@ x_dnd_send_unsupported_drop (struct x_display_info *dpyinfo, Window target_windo | |||
| 3560 | static Window | 3564 | static Window |
| 3561 | x_dnd_get_target_window (struct x_display_info *dpyinfo, | 3565 | x_dnd_get_target_window (struct x_display_info *dpyinfo, |
| 3562 | int root_x, int root_y, int *proto_out, | 3566 | int root_x, int root_y, int *proto_out, |
| 3563 | int *motif_out, Window *toplevel_out) | 3567 | int *motif_out, Window *toplevel_out, |
| 3568 | bool *was_frame) | ||
| 3564 | { | 3569 | { |
| 3565 | Window child_return, child, proxy; | 3570 | Window child_return, child, proxy; |
| 3566 | int dest_x_return, dest_y_return, rc, proto, motif; | 3571 | int dest_x_return, dest_y_return, rc, proto, motif; |
| @@ -3571,7 +3576,7 @@ x_dnd_get_target_window (struct x_display_info *dpyinfo, | |||
| 3571 | XWindowAttributes attrs; | 3576 | XWindowAttributes attrs; |
| 3572 | #endif | 3577 | #endif |
| 3573 | int wmstate; | 3578 | int wmstate; |
| 3574 | struct frame *tooltip; | 3579 | struct frame *tooltip, *f; |
| 3575 | bool unrelated; | 3580 | bool unrelated; |
| 3576 | 3581 | ||
| 3577 | child_return = dpyinfo->root_window; | 3582 | child_return = dpyinfo->root_window; |
| @@ -3581,6 +3586,7 @@ x_dnd_get_target_window (struct x_display_info *dpyinfo, | |||
| 3581 | proto = -1; | 3586 | proto = -1; |
| 3582 | *motif_out = XM_DRAG_STYLE_NONE; | 3587 | *motif_out = XM_DRAG_STYLE_NONE; |
| 3583 | *toplevel_out = None; | 3588 | *toplevel_out = None; |
| 3589 | *was_frame = false; | ||
| 3584 | 3590 | ||
| 3585 | if (x_dnd_use_toplevels) | 3591 | if (x_dnd_use_toplevels) |
| 3586 | { | 3592 | { |
| @@ -3593,10 +3599,21 @@ x_dnd_get_target_window (struct x_display_info *dpyinfo, | |||
| 3593 | && FRAME_X_WINDOW (x_dnd_frame) == child) | 3599 | && FRAME_X_WINDOW (x_dnd_frame) == child) |
| 3594 | *motif_out = XM_DRAG_STYLE_NONE; | 3600 | *motif_out = XM_DRAG_STYLE_NONE; |
| 3595 | 3601 | ||
| 3602 | f = x_top_window_to_frame (dpyinfo, child); | ||
| 3603 | |||
| 3596 | *toplevel_out = child; | 3604 | *toplevel_out = child; |
| 3597 | 3605 | ||
| 3598 | if (child != None) | 3606 | if (child != None) |
| 3599 | { | 3607 | { |
| 3608 | if (f) | ||
| 3609 | { | ||
| 3610 | *was_frame = true; | ||
| 3611 | *proto_out = -1; | ||
| 3612 | *motif_out = XM_DRAG_STYLE_NONE; | ||
| 3613 | |||
| 3614 | return child; | ||
| 3615 | } | ||
| 3616 | |||
| 3600 | #ifndef USE_XCB | 3617 | #ifndef USE_XCB |
| 3601 | proxy = x_dnd_get_window_proxy (dpyinfo, child); | 3618 | proxy = x_dnd_get_window_proxy (dpyinfo, child); |
| 3602 | #else | 3619 | #else |
| @@ -3736,6 +3753,18 @@ x_dnd_get_target_window (struct x_display_info *dpyinfo, | |||
| 3736 | break; | 3753 | break; |
| 3737 | } | 3754 | } |
| 3738 | 3755 | ||
| 3756 | f = x_top_window_to_frame (dpyinfo, child_return); | ||
| 3757 | |||
| 3758 | if (f) | ||
| 3759 | { | ||
| 3760 | *proto_out = -1; | ||
| 3761 | *motif_out = XM_DRAG_STYLE_NONE; | ||
| 3762 | *toplevel_out = child_return; | ||
| 3763 | *was_frame = true; | ||
| 3764 | |||
| 3765 | return child_return; | ||
| 3766 | } | ||
| 3767 | |||
| 3739 | if (x_dnd_get_wm_state_and_proto (dpyinfo, child_return, | 3768 | if (x_dnd_get_wm_state_and_proto (dpyinfo, child_return, |
| 3740 | &wmstate, &proto, &motif, | 3769 | &wmstate, &proto, &motif, |
| 3741 | &proxy) | 3770 | &proxy) |
| @@ -3943,9 +3972,6 @@ x_dnd_send_enter (struct frame *f, Window target, int supported) | |||
| 3943 | int i; | 3972 | int i; |
| 3944 | XEvent msg; | 3973 | XEvent msg; |
| 3945 | 3974 | ||
| 3946 | if (x_top_window_to_frame (dpyinfo, target)) | ||
| 3947 | return; | ||
| 3948 | |||
| 3949 | msg.xclient.type = ClientMessage; | 3975 | msg.xclient.type = ClientMessage; |
| 3950 | msg.xclient.message_type = dpyinfo->Xatom_XdndEnter; | 3976 | msg.xclient.message_type = dpyinfo->Xatom_XdndEnter; |
| 3951 | msg.xclient.format = 32; | 3977 | msg.xclient.format = 32; |
| @@ -3980,23 +4006,6 @@ x_dnd_send_position (struct frame *f, Window target, int supported, | |||
| 3980 | { | 4006 | { |
| 3981 | struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); | 4007 | struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); |
| 3982 | XEvent msg; | 4008 | XEvent msg; |
| 3983 | struct frame *target_frame; | ||
| 3984 | int dest_x, dest_y; | ||
| 3985 | Window child_return; | ||
| 3986 | |||
| 3987 | target_frame = x_top_window_to_frame (dpyinfo, target); | ||
| 3988 | |||
| 3989 | if (target_frame && XTranslateCoordinates (dpyinfo->display, | ||
| 3990 | dpyinfo->root_window, | ||
| 3991 | FRAME_X_WINDOW (target_frame), | ||
| 3992 | root_x, root_y, &dest_x, | ||
| 3993 | &dest_y, &child_return)) | ||
| 3994 | { | ||
| 3995 | x_dnd_movement_frame = target_frame; | ||
| 3996 | x_dnd_movement_x = dest_x; | ||
| 3997 | x_dnd_movement_y = dest_y; | ||
| 3998 | return; | ||
| 3999 | } | ||
| 4000 | 4009 | ||
| 4001 | if (target == x_dnd_mouse_rect_target | 4010 | if (target == x_dnd_mouse_rect_target |
| 4002 | && x_dnd_mouse_rect.width | 4011 | && x_dnd_mouse_rect.width |
| @@ -4054,9 +4063,6 @@ x_dnd_send_leave (struct frame *f, Window target) | |||
| 4054 | struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); | 4063 | struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); |
| 4055 | XEvent msg; | 4064 | XEvent msg; |
| 4056 | 4065 | ||
| 4057 | if (x_top_window_to_frame (dpyinfo, target)) | ||
| 4058 | return; | ||
| 4059 | |||
| 4060 | msg.xclient.type = ClientMessage; | 4066 | msg.xclient.type = ClientMessage; |
| 4061 | msg.xclient.message_type = dpyinfo->Xatom_XdndLeave; | 4067 | msg.xclient.message_type = dpyinfo->Xatom_XdndLeave; |
| 4062 | msg.xclient.format = 32; | 4068 | msg.xclient.format = 32; |
| @@ -4076,74 +4082,17 @@ static bool | |||
| 4076 | x_dnd_send_drop (struct frame *f, Window target, Time timestamp, | 4082 | x_dnd_send_drop (struct frame *f, Window target, Time timestamp, |
| 4077 | int supported) | 4083 | int supported) |
| 4078 | { | 4084 | { |
| 4079 | struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); | 4085 | struct x_display_info *dpyinfo; |
| 4080 | XEvent msg; | 4086 | XEvent msg; |
| 4081 | struct input_event ie; | ||
| 4082 | struct frame *self_frame; | ||
| 4083 | int root_x, root_y, win_x, win_y, i; | ||
| 4084 | unsigned int mask; | ||
| 4085 | Window root, child; | ||
| 4086 | Lisp_Object lval; | ||
| 4087 | char **atom_names; | ||
| 4088 | char *name; | ||
| 4089 | |||
| 4090 | self_frame = x_top_window_to_frame (dpyinfo, target); | ||
| 4091 | 4087 | ||
| 4092 | if (self_frame) | 4088 | if (x_dnd_action == None) |
| 4093 | { | ||
| 4094 | if (!x_dnd_allow_current_frame | ||
| 4095 | && self_frame == x_dnd_frame) | ||
| 4096 | return false; | ||
| 4097 | |||
| 4098 | /* Send a special drag-and-drop event when dropping on top of an | ||
| 4099 | Emacs frame to avoid all the overhead involved with sending | ||
| 4100 | client events. */ | ||
| 4101 | EVENT_INIT (ie); | ||
| 4102 | |||
| 4103 | if (XQueryPointer (dpyinfo->display, FRAME_X_WINDOW (self_frame), | ||
| 4104 | &root, &child, &root_x, &root_y, &win_x, &win_y, | ||
| 4105 | &mask)) | ||
| 4106 | { | ||
| 4107 | ie.kind = DRAG_N_DROP_EVENT; | ||
| 4108 | XSETFRAME (ie.frame_or_window, self_frame); | ||
| 4109 | |||
| 4110 | lval = Qnil; | ||
| 4111 | atom_names = alloca (x_dnd_n_targets * sizeof *atom_names); | ||
| 4112 | name = x_get_atom_name (dpyinfo, x_dnd_wanted_action, NULL); | ||
| 4113 | |||
| 4114 | if (!XGetAtomNames (dpyinfo->display, x_dnd_targets, | ||
| 4115 | x_dnd_n_targets, atom_names)) | ||
| 4116 | { | ||
| 4117 | xfree (name); | ||
| 4118 | return false; | ||
| 4119 | } | ||
| 4120 | |||
| 4121 | for (i = x_dnd_n_targets; i != 0; --i) | ||
| 4122 | { | ||
| 4123 | lval = Fcons (intern (atom_names[i - 1]), lval); | ||
| 4124 | XFree (atom_names[i - 1]); | ||
| 4125 | } | ||
| 4126 | |||
| 4127 | lval = Fcons (intern (name), lval); | ||
| 4128 | lval = Fcons (QXdndSelection, lval); | ||
| 4129 | ie.arg = lval; | ||
| 4130 | ie.timestamp = timestamp; | ||
| 4131 | |||
| 4132 | XSETINT (ie.x, win_x); | ||
| 4133 | XSETINT (ie.y, win_y); | ||
| 4134 | |||
| 4135 | xfree (name); | ||
| 4136 | kbd_buffer_store_event (&ie); | ||
| 4137 | |||
| 4138 | return false; | ||
| 4139 | } | ||
| 4140 | } | ||
| 4141 | else if (x_dnd_action == None) | ||
| 4142 | { | 4089 | { |
| 4143 | x_dnd_send_leave (f, target); | 4090 | x_dnd_send_leave (f, target); |
| 4144 | return false; | 4091 | return false; |
| 4145 | } | 4092 | } |
| 4146 | 4093 | ||
| 4094 | dpyinfo = FRAME_DISPLAY_INFO (f); | ||
| 4095 | |||
| 4147 | msg.xclient.type = ClientMessage; | 4096 | msg.xclient.type = ClientMessage; |
| 4148 | msg.xclient.message_type = dpyinfo->Xatom_XdndDrop; | 4097 | msg.xclient.message_type = dpyinfo->Xatom_XdndDrop; |
| 4149 | msg.xclient.format = 32; | 4098 | msg.xclient.format = 32; |
| @@ -4288,6 +4237,92 @@ x_dnd_cleanup_drag_and_drop (void *frame) | |||
| 4288 | x_dnd_frame = NULL; | 4237 | x_dnd_frame = NULL; |
| 4289 | } | 4238 | } |
| 4290 | 4239 | ||
| 4240 | static void | ||
| 4241 | x_dnd_note_self_position (struct x_display_info *dpyinfo, Window target, | ||
| 4242 | unsigned short root_x, unsigned short root_y) | ||
| 4243 | { | ||
| 4244 | struct frame *f; | ||
| 4245 | int dest_x, dest_y; | ||
| 4246 | Window child_return; | ||
| 4247 | |||
| 4248 | f = x_top_window_to_frame (dpyinfo, target); | ||
| 4249 | |||
| 4250 | if (f && XTranslateCoordinates (dpyinfo->display, | ||
| 4251 | dpyinfo->root_window, | ||
| 4252 | FRAME_X_WINDOW (f), | ||
| 4253 | root_x, root_y, &dest_x, | ||
| 4254 | &dest_y, &child_return)) | ||
| 4255 | { | ||
| 4256 | x_dnd_movement_frame = f; | ||
| 4257 | x_dnd_movement_x = dest_x; | ||
| 4258 | x_dnd_movement_y = dest_y; | ||
| 4259 | |||
| 4260 | return; | ||
| 4261 | } | ||
| 4262 | } | ||
| 4263 | |||
| 4264 | static void | ||
| 4265 | x_dnd_note_self_drop (struct x_display_info *dpyinfo, Window target, | ||
| 4266 | unsigned short root_x, unsigned short root_y, | ||
| 4267 | Time timestamp) | ||
| 4268 | { | ||
| 4269 | struct input_event ie; | ||
| 4270 | struct frame *f; | ||
| 4271 | Lisp_Object lval; | ||
| 4272 | char **atom_names; | ||
| 4273 | char *name; | ||
| 4274 | int win_x, win_y, i; | ||
| 4275 | Window dummy; | ||
| 4276 | |||
| 4277 | if (!x_dnd_allow_current_frame | ||
| 4278 | && (FRAME_OUTER_WINDOW (x_dnd_frame) | ||
| 4279 | == target)) | ||
| 4280 | return; | ||
| 4281 | |||
| 4282 | f = x_top_window_to_frame (dpyinfo, target); | ||
| 4283 | |||
| 4284 | if (!f) | ||
| 4285 | return; | ||
| 4286 | |||
| 4287 | if (!XTranslateCoordinates (dpyinfo->display, dpyinfo->root_window, | ||
| 4288 | FRAME_X_WINDOW (f), root_x, root_y, | ||
| 4289 | &win_x, &win_y, &dummy)) | ||
| 4290 | return; | ||
| 4291 | |||
| 4292 | EVENT_INIT (ie); | ||
| 4293 | |||
| 4294 | ie.kind = DRAG_N_DROP_EVENT; | ||
| 4295 | XSETFRAME (ie.frame_or_window, f); | ||
| 4296 | |||
| 4297 | lval = Qnil; | ||
| 4298 | atom_names = alloca (x_dnd_n_targets * sizeof *atom_names); | ||
| 4299 | name = x_get_atom_name (dpyinfo, x_dnd_wanted_action, NULL); | ||
| 4300 | |||
| 4301 | if (!XGetAtomNames (dpyinfo->display, x_dnd_targets, | ||
| 4302 | x_dnd_n_targets, atom_names)) | ||
| 4303 | { | ||
| 4304 | xfree (name); | ||
| 4305 | return; | ||
| 4306 | } | ||
| 4307 | |||
| 4308 | for (i = x_dnd_n_targets; i != 0; --i) | ||
| 4309 | { | ||
| 4310 | lval = Fcons (intern (atom_names[i - 1]), lval); | ||
| 4311 | XFree (atom_names[i - 1]); | ||
| 4312 | } | ||
| 4313 | |||
| 4314 | lval = Fcons (intern (name), lval); | ||
| 4315 | lval = Fcons (QXdndSelection, lval); | ||
| 4316 | ie.arg = lval; | ||
| 4317 | ie.timestamp = timestamp; | ||
| 4318 | |||
| 4319 | XSETINT (ie.x, win_x); | ||
| 4320 | XSETINT (ie.y, win_y); | ||
| 4321 | |||
| 4322 | xfree (name); | ||
| 4323 | kbd_buffer_store_event (&ie); | ||
| 4324 | } | ||
| 4325 | |||
| 4291 | /* Flush display of frame F. */ | 4326 | /* Flush display of frame F. */ |
| 4292 | 4327 | ||
| 4293 | static void | 4328 | static void |
| @@ -10971,12 +11006,14 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, | |||
| 10971 | record_unwind_protect_void (release_xg_select); | 11006 | record_unwind_protect_void (release_xg_select); |
| 10972 | #endif | 11007 | #endif |
| 10973 | 11008 | ||
| 11009 | /* Initialize most of the state for the drag-and-drop operation. */ | ||
| 10974 | x_dnd_in_progress = true; | 11010 | x_dnd_in_progress = true; |
| 10975 | x_dnd_recursion_depth = command_loop_level + minibuf_level; | 11011 | x_dnd_recursion_depth = command_loop_level + minibuf_level; |
| 10976 | x_dnd_frame = f; | 11012 | x_dnd_frame = f; |
| 10977 | x_dnd_last_seen_window = None; | 11013 | x_dnd_last_seen_window = None; |
| 10978 | x_dnd_last_seen_toplevel = None; | 11014 | x_dnd_last_seen_toplevel = None; |
| 10979 | x_dnd_last_protocol_version = -1; | 11015 | x_dnd_last_protocol_version = -1; |
| 11016 | x_dnd_last_window_is_frame = false; | ||
| 10980 | x_dnd_last_motif_style = XM_DRAG_STYLE_NONE; | 11017 | x_dnd_last_motif_style = XM_DRAG_STYLE_NONE; |
| 10981 | x_dnd_mouse_rect_target = None; | 11018 | x_dnd_mouse_rect_target = None; |
| 10982 | x_dnd_action = None; | 11019 | x_dnd_action = None; |
| @@ -15263,6 +15300,7 @@ x_dnd_update_state (struct x_display_info *dpyinfo, Time timestamp) | |||
| 15263 | xm_top_level_enter_message emsg; | 15300 | xm_top_level_enter_message emsg; |
| 15264 | xm_drag_motion_message dmsg; | 15301 | xm_drag_motion_message dmsg; |
| 15265 | xm_drop_start_message dsmsg; | 15302 | xm_drop_start_message dsmsg; |
| 15303 | bool was_frame; | ||
| 15266 | 15304 | ||
| 15267 | if (XQueryPointer (dpyinfo->display, | 15305 | if (XQueryPointer (dpyinfo->display, |
| 15268 | dpyinfo->root_window, | 15306 | dpyinfo->root_window, |
| @@ -15273,7 +15311,8 @@ x_dnd_update_state (struct x_display_info *dpyinfo, Time timestamp) | |||
| 15273 | { | 15311 | { |
| 15274 | target = x_dnd_get_target_window (dpyinfo, root_x, | 15312 | target = x_dnd_get_target_window (dpyinfo, root_x, |
| 15275 | root_y, &target_proto, | 15313 | root_y, &target_proto, |
| 15276 | &motif_style, &toplevel); | 15314 | &motif_style, &toplevel, |
| 15315 | &was_frame); | ||
| 15277 | 15316 | ||
| 15278 | if (toplevel != x_dnd_last_seen_toplevel) | 15317 | if (toplevel != x_dnd_last_seen_toplevel) |
| 15279 | { | 15318 | { |
| @@ -15352,6 +15391,7 @@ x_dnd_update_state (struct x_display_info *dpyinfo, Time timestamp) | |||
| 15352 | x_dnd_last_seen_window = target; | 15391 | x_dnd_last_seen_window = target; |
| 15353 | x_dnd_last_protocol_version = target_proto; | 15392 | x_dnd_last_protocol_version = target_proto; |
| 15354 | x_dnd_last_motif_style = motif_style; | 15393 | x_dnd_last_motif_style = motif_style; |
| 15394 | x_dnd_last_window_is_frame = was_frame; | ||
| 15355 | 15395 | ||
| 15356 | if (target != None && x_dnd_last_protocol_version != -1) | 15396 | if (target != None && x_dnd_last_protocol_version != -1) |
| 15357 | x_dnd_send_enter (x_dnd_frame, target, | 15397 | x_dnd_send_enter (x_dnd_frame, target, |
| @@ -15376,7 +15416,9 @@ x_dnd_update_state (struct x_display_info *dpyinfo, Time timestamp) | |||
| 15376 | } | 15416 | } |
| 15377 | } | 15417 | } |
| 15378 | 15418 | ||
| 15379 | if (x_dnd_last_protocol_version != -1 && target != None) | 15419 | if (x_dnd_last_window_is_frame && target != None) |
| 15420 | x_dnd_note_self_position (dpyinfo, target, root_x, root_y); | ||
| 15421 | else if (x_dnd_last_protocol_version != -1 && target != None) | ||
| 15380 | x_dnd_send_position (x_dnd_frame, target, | 15422 | x_dnd_send_position (x_dnd_frame, target, |
| 15381 | x_dnd_last_protocol_version, | 15423 | x_dnd_last_protocol_version, |
| 15382 | root_x, root_y, | 15424 | root_x, root_y, |
| @@ -17393,6 +17435,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 17393 | xm_top_level_enter_message emsg; | 17435 | xm_top_level_enter_message emsg; |
| 17394 | xm_drag_motion_message dmsg; | 17436 | xm_drag_motion_message dmsg; |
| 17395 | XRectangle *r; | 17437 | XRectangle *r; |
| 17438 | bool was_frame; | ||
| 17396 | 17439 | ||
| 17397 | /* Always clear mouse face. */ | 17440 | /* Always clear mouse face. */ |
| 17398 | clear_mouse_face (hlinfo); | 17441 | clear_mouse_face (hlinfo); |
| @@ -17431,7 +17474,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 17431 | event->xmotion.x_root, | 17474 | event->xmotion.x_root, |
| 17432 | event->xmotion.y_root, | 17475 | event->xmotion.y_root, |
| 17433 | &target_proto, | 17476 | &target_proto, |
| 17434 | &motif_style, &toplevel); | 17477 | &motif_style, &toplevel, |
| 17478 | &was_frame); | ||
| 17435 | 17479 | ||
| 17436 | if (toplevel != x_dnd_last_seen_toplevel) | 17480 | if (toplevel != x_dnd_last_seen_toplevel) |
| 17437 | { | 17481 | { |
| @@ -17531,6 +17575,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 17531 | x_dnd_last_seen_window = target; | 17575 | x_dnd_last_seen_window = target; |
| 17532 | x_dnd_last_protocol_version = target_proto; | 17576 | x_dnd_last_protocol_version = target_proto; |
| 17533 | x_dnd_last_motif_style = motif_style; | 17577 | x_dnd_last_motif_style = motif_style; |
| 17578 | x_dnd_last_window_is_frame = was_frame; | ||
| 17534 | 17579 | ||
| 17535 | if (target != None && x_dnd_last_protocol_version != -1) | 17580 | if (target != None && x_dnd_last_protocol_version != -1) |
| 17536 | x_dnd_send_enter (x_dnd_frame, target, | 17581 | x_dnd_send_enter (x_dnd_frame, target, |
| @@ -17555,7 +17600,11 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 17555 | } | 17600 | } |
| 17556 | } | 17601 | } |
| 17557 | 17602 | ||
| 17558 | if (x_dnd_last_protocol_version != -1 && target != None) | 17603 | if (x_dnd_last_window_is_frame && target != None) |
| 17604 | x_dnd_note_self_position (dpyinfo, target, | ||
| 17605 | event->xbutton.x_root, | ||
| 17606 | event->xbutton.y_root); | ||
| 17607 | else if (x_dnd_last_protocol_version != -1 && target != None) | ||
| 17559 | x_dnd_send_position (x_dnd_frame, target, | 17608 | x_dnd_send_position (x_dnd_frame, target, |
| 17560 | x_dnd_last_protocol_version, | 17609 | x_dnd_last_protocol_version, |
| 17561 | event->xmotion.x_root, | 17610 | event->xmotion.x_root, |
| @@ -18105,6 +18154,14 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 18105 | x_dnd_finish_frame = x_dnd_frame; | 18154 | x_dnd_finish_frame = x_dnd_frame; |
| 18106 | 18155 | ||
| 18107 | if (x_dnd_last_seen_window != None | 18156 | if (x_dnd_last_seen_window != None |
| 18157 | && x_dnd_last_window_is_frame) | ||
| 18158 | { | ||
| 18159 | x_dnd_waiting_for_finish = false; | ||
| 18160 | x_dnd_note_self_drop (dpyinfo, x_dnd_last_seen_window, | ||
| 18161 | event->xbutton.time, event->xbutton.x_root, | ||
| 18162 | event->xbutton.y_root); | ||
| 18163 | } | ||
| 18164 | else if (x_dnd_last_seen_window != None | ||
| 18108 | && x_dnd_last_protocol_version != -1) | 18165 | && x_dnd_last_protocol_version != -1) |
| 18109 | { | 18166 | { |
| 18110 | x_dnd_pending_finish_target = x_dnd_last_seen_window; | 18167 | x_dnd_pending_finish_target = x_dnd_last_seen_window; |
| @@ -18188,6 +18245,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 18188 | x_dnd_last_motif_style = XM_DRAG_STYLE_NONE; | 18245 | x_dnd_last_motif_style = XM_DRAG_STYLE_NONE; |
| 18189 | x_dnd_last_seen_window = None; | 18246 | x_dnd_last_seen_window = None; |
| 18190 | x_dnd_last_seen_toplevel = None; | 18247 | x_dnd_last_seen_toplevel = None; |
| 18248 | x_dnd_last_window_is_frame = false; | ||
| 18191 | x_dnd_frame = NULL; | 18249 | x_dnd_frame = NULL; |
| 18192 | } | 18250 | } |
| 18193 | } | 18251 | } |
| @@ -19096,6 +19154,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 19096 | Window target, toplevel; | 19154 | Window target, toplevel; |
| 19097 | int target_proto, motif_style; | 19155 | int target_proto, motif_style; |
| 19098 | XRectangle *r; | 19156 | XRectangle *r; |
| 19157 | bool was_frame; | ||
| 19099 | 19158 | ||
| 19100 | /* Always clear mouse face. */ | 19159 | /* Always clear mouse face. */ |
| 19101 | clear_mouse_face (hlinfo); | 19160 | clear_mouse_face (hlinfo); |
| @@ -19136,7 +19195,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 19136 | xev->root_y, | 19195 | xev->root_y, |
| 19137 | &target_proto, | 19196 | &target_proto, |
| 19138 | &motif_style, | 19197 | &motif_style, |
| 19139 | &toplevel); | 19198 | &toplevel, |
| 19199 | &was_frame); | ||
| 19140 | 19200 | ||
| 19141 | if (toplevel != x_dnd_last_seen_toplevel) | 19201 | if (toplevel != x_dnd_last_seen_toplevel) |
| 19142 | { | 19202 | { |
| @@ -19238,6 +19298,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 19238 | x_dnd_last_seen_window = target; | 19298 | x_dnd_last_seen_window = target; |
| 19239 | x_dnd_last_protocol_version = target_proto; | 19299 | x_dnd_last_protocol_version = target_proto; |
| 19240 | x_dnd_last_motif_style = motif_style; | 19300 | x_dnd_last_motif_style = motif_style; |
| 19301 | x_dnd_last_window_is_frame = was_frame; | ||
| 19241 | 19302 | ||
| 19242 | if (target != None && x_dnd_last_protocol_version != -1) | 19303 | if (target != None && x_dnd_last_protocol_version != -1) |
| 19243 | x_dnd_send_enter (x_dnd_frame, target, | 19304 | x_dnd_send_enter (x_dnd_frame, target, |
| @@ -19262,7 +19323,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 19262 | } | 19323 | } |
| 19263 | } | 19324 | } |
| 19264 | 19325 | ||
| 19265 | if (x_dnd_last_protocol_version != -1 && target != None) | 19326 | if (x_dnd_last_window_is_frame && target != None) |
| 19327 | x_dnd_note_self_position (dpyinfo, target, | ||
| 19328 | xev->root_x, xev->root_y); | ||
| 19329 | else if (x_dnd_last_protocol_version != -1 && target != None) | ||
| 19266 | { | 19330 | { |
| 19267 | dnd_state = xev->mods.effective; | 19331 | dnd_state = xev->mods.effective; |
| 19268 | 19332 | ||
| @@ -19489,7 +19553,14 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 19489 | x_dnd_finish_frame = x_dnd_frame; | 19553 | x_dnd_finish_frame = x_dnd_frame; |
| 19490 | 19554 | ||
| 19491 | if (x_dnd_last_seen_window != None | 19555 | if (x_dnd_last_seen_window != None |
| 19492 | && x_dnd_last_protocol_version != -1) | 19556 | && x_dnd_last_window_is_frame) |
| 19557 | { | ||
| 19558 | x_dnd_waiting_for_finish = false; | ||
| 19559 | x_dnd_note_self_drop (dpyinfo, x_dnd_last_seen_window, | ||
| 19560 | xev->time, xev->root_x, xev->root_y); | ||
| 19561 | } | ||
| 19562 | else if (x_dnd_last_seen_window != None | ||
| 19563 | && x_dnd_last_protocol_version != -1) | ||
| 19493 | { | 19564 | { |
| 19494 | x_dnd_pending_finish_target = x_dnd_last_seen_window; | 19565 | x_dnd_pending_finish_target = x_dnd_last_seen_window; |
| 19495 | x_dnd_waiting_for_finish_proto = x_dnd_last_protocol_version; | 19566 | x_dnd_waiting_for_finish_proto = x_dnd_last_protocol_version; |
| @@ -19579,6 +19650,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 19579 | x_dnd_last_motif_style = XM_DRAG_STYLE_NONE; | 19650 | x_dnd_last_motif_style = XM_DRAG_STYLE_NONE; |
| 19580 | x_dnd_last_seen_window = None; | 19651 | x_dnd_last_seen_window = None; |
| 19581 | x_dnd_last_seen_toplevel = None; | 19652 | x_dnd_last_seen_toplevel = None; |
| 19653 | x_dnd_last_window_is_frame = false; | ||
| 19582 | x_dnd_frame = NULL; | 19654 | x_dnd_frame = NULL; |
| 19583 | 19655 | ||
| 19584 | goto XI_OTHER; | 19656 | goto XI_OTHER; |