aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-04-09 11:43:23 +0800
committerPo Lu2022-04-09 11:43:23 +0800
commit378b4ccd4bb0d68afc498a0fc9a600bd1337cabb (patch)
treec0abbdc23ffdf85c6f3da95921b620934e4125db /src
parent72782ca182993dac6bd805bb3b54b21b7e7efa7d (diff)
downloademacs-378b4ccd4bb0d68afc498a0fc9a600bd1337cabb.tar.gz
emacs-378b4ccd4bb0d68afc498a0fc9a600bd1337cabb.zip
Fix DND leave events not being sent to toplevel after returning frame
* src/xterm.c (x_dnd_update_state, handle_one_xevent): Make sure to send leave events to the previous toplevel when cancelling to return a frame.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/xterm.c b/src/xterm.c
index d94a3cf91a9..509403fbf2a 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -13303,6 +13303,29 @@ x_dnd_update_state (struct x_display_info *dpyinfo, Time timestamp)
13303 if (x_dnd_return_frame == 2 13303 if (x_dnd_return_frame == 2
13304 && x_any_window_to_frame (dpyinfo, toplevel)) 13304 && x_any_window_to_frame (dpyinfo, toplevel))
13305 { 13305 {
13306 if (x_dnd_last_seen_window != None
13307 && x_dnd_last_protocol_version != -1
13308 && x_dnd_last_seen_window != FRAME_OUTER_WINDOW (x_dnd_frame))
13309 x_dnd_send_leave (x_dnd_frame, x_dnd_last_seen_window);
13310 else if (x_dnd_last_seen_window != None
13311 && XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style)
13312 && x_dnd_last_seen_window != FRAME_OUTER_WINDOW (x_dnd_frame))
13313 {
13314 if (!x_dnd_motif_setup_p)
13315 xm_setup_drag_info (dpyinfo, x_dnd_frame);
13316
13317 lmsg.reason = XM_DRAG_REASON (XM_DRAG_ORIGINATOR_INITIATOR,
13318 XM_DRAG_REASON_TOP_LEVEL_LEAVE);
13319 lmsg.byteorder = XM_TARGETS_TABLE_CUR;
13320 lmsg.zero = 0;
13321 lmsg.timestamp = timestamp;
13322 lmsg.source_window = FRAME_X_WINDOW (x_dnd_frame);
13323
13324 if (x_dnd_motif_setup_p)
13325 xm_send_top_level_leave_message (dpyinfo, FRAME_X_WINDOW (x_dnd_frame),
13326 x_dnd_last_seen_window, &lmsg);
13327 }
13328
13306 x_dnd_end_window = x_dnd_last_seen_window; 13329 x_dnd_end_window = x_dnd_last_seen_window;
13307 x_dnd_last_seen_window = None; 13330 x_dnd_last_seen_window = None;
13308 x_dnd_last_seen_toplevel = None; 13331 x_dnd_last_seen_toplevel = None;
@@ -14949,6 +14972,29 @@ handle_one_xevent (struct x_display_info *dpyinfo,
14949 if (x_dnd_return_frame == 2 14972 if (x_dnd_return_frame == 2
14950 && x_any_window_to_frame (dpyinfo, toplevel)) 14973 && x_any_window_to_frame (dpyinfo, toplevel))
14951 { 14974 {
14975 if (x_dnd_last_seen_window != None
14976 && x_dnd_last_protocol_version != -1
14977 && x_dnd_last_seen_window != FRAME_OUTER_WINDOW (x_dnd_frame))
14978 x_dnd_send_leave (x_dnd_frame, x_dnd_last_seen_window);
14979 else if (x_dnd_last_seen_window != None
14980 && XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style)
14981 && x_dnd_last_seen_window != FRAME_OUTER_WINDOW (x_dnd_frame))
14982 {
14983 if (!x_dnd_motif_setup_p)
14984 xm_setup_drag_info (dpyinfo, x_dnd_frame);
14985
14986 lmsg.reason = XM_DRAG_REASON (XM_DRAG_ORIGINATOR_INITIATOR,
14987 XM_DRAG_REASON_TOP_LEVEL_LEAVE);
14988 lmsg.byteorder = XM_TARGETS_TABLE_CUR;
14989 lmsg.zero = 0;
14990 lmsg.timestamp = event->xmotion.time;
14991 lmsg.source_window = FRAME_X_WINDOW (x_dnd_frame);
14992
14993 if (x_dnd_motif_setup_p)
14994 xm_send_top_level_leave_message (dpyinfo, FRAME_X_WINDOW (x_dnd_frame),
14995 x_dnd_last_seen_window, &lmsg);
14996 }
14997
14952 x_dnd_end_window = x_dnd_last_seen_window; 14998 x_dnd_end_window = x_dnd_last_seen_window;
14953 x_dnd_last_seen_window = None; 14999 x_dnd_last_seen_window = None;
14954 x_dnd_last_seen_toplevel = None; 15000 x_dnd_last_seen_toplevel = None;
@@ -16451,6 +16497,29 @@ handle_one_xevent (struct x_display_info *dpyinfo,
16451 if (x_dnd_return_frame == 2 16497 if (x_dnd_return_frame == 2
16452 && x_any_window_to_frame (dpyinfo, toplevel)) 16498 && x_any_window_to_frame (dpyinfo, toplevel))
16453 { 16499 {
16500 if (x_dnd_last_seen_window != None
16501 && x_dnd_last_protocol_version != -1
16502 && x_dnd_last_seen_window != FRAME_OUTER_WINDOW (x_dnd_frame))
16503 x_dnd_send_leave (x_dnd_frame, x_dnd_last_seen_window);
16504 else if (x_dnd_last_seen_window != None
16505 && XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style)
16506 && x_dnd_last_seen_window != FRAME_OUTER_WINDOW (x_dnd_frame))
16507 {
16508 if (!x_dnd_motif_setup_p)
16509 xm_setup_drag_info (dpyinfo, x_dnd_frame);
16510
16511 lmsg.reason = XM_DRAG_REASON (XM_DRAG_ORIGINATOR_INITIATOR,
16512 XM_DRAG_REASON_TOP_LEVEL_LEAVE);
16513 lmsg.byteorder = XM_TARGETS_TABLE_CUR;
16514 lmsg.zero = 0;
16515 lmsg.timestamp = event->xmotion.time;
16516 lmsg.source_window = FRAME_X_WINDOW (x_dnd_frame);
16517
16518 if (x_dnd_motif_setup_p)
16519 xm_send_top_level_leave_message (dpyinfo, FRAME_X_WINDOW (x_dnd_frame),
16520 x_dnd_last_seen_window, &lmsg);
16521 }
16522
16454 x_dnd_end_window = x_dnd_last_seen_window; 16523 x_dnd_end_window = x_dnd_last_seen_window;
16455 x_dnd_last_seen_window = None; 16524 x_dnd_last_seen_window = None;
16456 x_dnd_last_seen_toplevel = None; 16525 x_dnd_last_seen_toplevel = None;