[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master e781cbb2d3: Minor fixes to DND support
From: |
Po Lu |
Subject: |
master e781cbb2d3: Minor fixes to DND support |
Date: |
Thu, 17 Mar 2022 20:23:48 -0400 (EDT) |
branch: master
commit e781cbb2d3ec3b4cfd35cd29ccba8e1c265fad4a
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Minor fixes to DND support
* src/xterm.c (x_dnd_begin_drag_and_drop): Free targets
afterwards.
(handle_one_xevent): Only calculate dnd_grab if DND is in
progress.
---
src/xterm.c | 86 +++++++++++++++++++++++++++++++++----------------------------
1 file changed, 46 insertions(+), 40 deletions(-)
diff --git a/src/xterm.c b/src/xterm.c
index 6485374e2a..eb2ecf7d65 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1157,6 +1157,7 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time,
Atom xaction,
x_dnd_in_progress = false;
x_dnd_frame = NULL;
+ x_set_dnd_targets (NULL, 0);
}
FRAME_DISPLAY_INFO (f)->grabbed = 0;
@@ -1167,6 +1168,8 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time,
Atom xaction,
}
}
+ x_set_dnd_targets (NULL, 0);
+
#ifdef USE_GTK
current_hold_quit = NULL;
#endif
@@ -12077,30 +12080,31 @@ handle_one_xevent (struct x_display_info *dpyinfo,
bool tool_bar_p = false;
bool dnd_grab = false;
- for (int i = 1; i < 8; ++i)
- {
- if (i != event->xbutton.button
- && event->xbutton.state & (Button1Mask << (i - 1)))
- dnd_grab = true;
- }
-
if (x_dnd_in_progress
- && dpyinfo == FRAME_DISPLAY_INFO (x_dnd_frame)
- && !dnd_grab
- && event->xbutton.type == ButtonRelease)
+ && dpyinfo == FRAME_DISPLAY_INFO (x_dnd_frame))
{
- x_dnd_in_progress = false;
+ for (int i = 1; i < 8; ++i)
+ {
+ if (i != event->xbutton.button
+ && event->xbutton.state & (Button1Mask << (i - 1)))
+ dnd_grab = true;
+ }
- if (x_dnd_last_seen_window != None
- && x_dnd_last_protocol_version != -1)
- x_dnd_send_drop (x_dnd_frame, x_dnd_last_seen_window,
- x_dnd_selection_timestamp,
- x_dnd_last_protocol_version);
+ if (dnd_grab && event->xbutton.type == ButtonRelease)
+ {
+ x_dnd_in_progress = false;
+
+ if (x_dnd_last_seen_window != None
+ && x_dnd_last_protocol_version != -1)
+ x_dnd_send_drop (x_dnd_frame, x_dnd_last_seen_window,
+ x_dnd_selection_timestamp,
+ x_dnd_last_protocol_version);
- x_dnd_last_protocol_version = -1;
- x_dnd_last_seen_window = None;
- x_dnd_frame = NULL;
- x_set_dnd_targets (NULL, 0);
+ x_dnd_last_protocol_version = -1;
+ x_dnd_last_seen_window = None;
+ x_dnd_frame = NULL;
+ x_set_dnd_targets (NULL, 0);
+ }
goto OTHER;
}
@@ -13053,31 +13057,33 @@ handle_one_xevent (struct x_display_info *dpyinfo,
XButtonEvent bv;
bool dnd_grab = false;
- for (int i = 0; i < xev->buttons.mask_len * 8; ++i)
- {
- if (i != xev->detail && XIMaskIsSet (xev->buttons.mask, i))
- dnd_grab = true;
- }
-
if (x_dnd_in_progress
- && dpyinfo == FRAME_DISPLAY_INFO (x_dnd_frame)
- && !dnd_grab
- && xev->evtype == XI_ButtonRelease)
+ && dpyinfo == FRAME_DISPLAY_INFO (x_dnd_frame))
{
- x_dnd_in_progress = false;
+ for (int i = 0; i < xev->buttons.mask_len * 8; ++i)
+ {
+ if (i != xev->detail && XIMaskIsSet (xev->buttons.mask,
i))
+ dnd_grab = true;
+ }
- if (x_dnd_last_seen_window != None
- && x_dnd_last_protocol_version != -1)
- x_dnd_send_drop (x_dnd_frame, x_dnd_last_seen_window,
- x_dnd_selection_timestamp,
- x_dnd_last_protocol_version);
+ if (!dnd_grab
+ && xev->evtype == XI_ButtonRelease)
+ {
+ x_dnd_in_progress = false;
- x_dnd_last_protocol_version = -1;
- x_dnd_last_seen_window = None;
- x_dnd_frame = NULL;
- x_set_dnd_targets (NULL, 0);
+ if (x_dnd_last_seen_window != None
+ && x_dnd_last_protocol_version != -1)
+ x_dnd_send_drop (x_dnd_frame, x_dnd_last_seen_window,
+ x_dnd_selection_timestamp,
+ x_dnd_last_protocol_version);
- goto XI_OTHER;
+ x_dnd_last_protocol_version = -1;
+ x_dnd_last_seen_window = None;
+ x_dnd_frame = NULL;
+ x_set_dnd_targets (NULL, 0);
+
+ goto XI_OTHER;
+ }
}
if (x_dnd_in_progress)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master e781cbb2d3: Minor fixes to DND support,
Po Lu <=