diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 86 |
1 files changed, 46 insertions, 40 deletions
diff --git a/src/xterm.c b/src/xterm.c index 6485374e2ae..eb2ecf7d65a 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, | |||
| 1157 | 1157 | ||
| 1158 | x_dnd_in_progress = false; | 1158 | x_dnd_in_progress = false; |
| 1159 | x_dnd_frame = NULL; | 1159 | x_dnd_frame = NULL; |
| 1160 | x_set_dnd_targets (NULL, 0); | ||
| 1160 | } | 1161 | } |
| 1161 | 1162 | ||
| 1162 | FRAME_DISPLAY_INFO (f)->grabbed = 0; | 1163 | FRAME_DISPLAY_INFO (f)->grabbed = 0; |
| @@ -1167,6 +1168,8 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, | |||
| 1167 | } | 1168 | } |
| 1168 | } | 1169 | } |
| 1169 | 1170 | ||
| 1171 | x_set_dnd_targets (NULL, 0); | ||
| 1172 | |||
| 1170 | #ifdef USE_GTK | 1173 | #ifdef USE_GTK |
| 1171 | current_hold_quit = NULL; | 1174 | current_hold_quit = NULL; |
| 1172 | #endif | 1175 | #endif |
| @@ -12077,30 +12080,31 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 12077 | bool tool_bar_p = false; | 12080 | bool tool_bar_p = false; |
| 12078 | bool dnd_grab = false; | 12081 | bool dnd_grab = false; |
| 12079 | 12082 | ||
| 12080 | for (int i = 1; i < 8; ++i) | ||
| 12081 | { | ||
| 12082 | if (i != event->xbutton.button | ||
| 12083 | && event->xbutton.state & (Button1Mask << (i - 1))) | ||
| 12084 | dnd_grab = true; | ||
| 12085 | } | ||
| 12086 | |||
| 12087 | if (x_dnd_in_progress | 12083 | if (x_dnd_in_progress |
| 12088 | && dpyinfo == FRAME_DISPLAY_INFO (x_dnd_frame) | 12084 | && dpyinfo == FRAME_DISPLAY_INFO (x_dnd_frame)) |
| 12089 | && !dnd_grab | ||
| 12090 | && event->xbutton.type == ButtonRelease) | ||
| 12091 | { | 12085 | { |
| 12092 | x_dnd_in_progress = false; | 12086 | for (int i = 1; i < 8; ++i) |
| 12087 | { | ||
| 12088 | if (i != event->xbutton.button | ||
| 12089 | && event->xbutton.state & (Button1Mask << (i - 1))) | ||
| 12090 | dnd_grab = true; | ||
| 12091 | } | ||
| 12093 | 12092 | ||
| 12094 | if (x_dnd_last_seen_window != None | 12093 | if (dnd_grab && event->xbutton.type == ButtonRelease) |
| 12095 | && x_dnd_last_protocol_version != -1) | 12094 | { |
| 12096 | x_dnd_send_drop (x_dnd_frame, x_dnd_last_seen_window, | 12095 | x_dnd_in_progress = false; |
| 12097 | x_dnd_selection_timestamp, | 12096 | |
| 12098 | x_dnd_last_protocol_version); | 12097 | if (x_dnd_last_seen_window != None |
| 12098 | && x_dnd_last_protocol_version != -1) | ||
| 12099 | x_dnd_send_drop (x_dnd_frame, x_dnd_last_seen_window, | ||
| 12100 | x_dnd_selection_timestamp, | ||
| 12101 | x_dnd_last_protocol_version); | ||
| 12099 | 12102 | ||
| 12100 | x_dnd_last_protocol_version = -1; | 12103 | x_dnd_last_protocol_version = -1; |
| 12101 | x_dnd_last_seen_window = None; | 12104 | x_dnd_last_seen_window = None; |
| 12102 | x_dnd_frame = NULL; | 12105 | x_dnd_frame = NULL; |
| 12103 | x_set_dnd_targets (NULL, 0); | 12106 | x_set_dnd_targets (NULL, 0); |
| 12107 | } | ||
| 12104 | 12108 | ||
| 12105 | goto OTHER; | 12109 | goto OTHER; |
| 12106 | } | 12110 | } |
| @@ -13053,31 +13057,33 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 13053 | XButtonEvent bv; | 13057 | XButtonEvent bv; |
| 13054 | bool dnd_grab = false; | 13058 | bool dnd_grab = false; |
| 13055 | 13059 | ||
| 13056 | for (int i = 0; i < xev->buttons.mask_len * 8; ++i) | ||
| 13057 | { | ||
| 13058 | if (i != xev->detail && XIMaskIsSet (xev->buttons.mask, i)) | ||
| 13059 | dnd_grab = true; | ||
| 13060 | } | ||
| 13061 | |||
| 13062 | if (x_dnd_in_progress | 13060 | if (x_dnd_in_progress |
| 13063 | && dpyinfo == FRAME_DISPLAY_INFO (x_dnd_frame) | 13061 | && dpyinfo == FRAME_DISPLAY_INFO (x_dnd_frame)) |
| 13064 | && !dnd_grab | ||
| 13065 | && xev->evtype == XI_ButtonRelease) | ||
| 13066 | { | 13062 | { |
| 13067 | x_dnd_in_progress = false; | 13063 | for (int i = 0; i < xev->buttons.mask_len * 8; ++i) |
| 13064 | { | ||
| 13065 | if (i != xev->detail && XIMaskIsSet (xev->buttons.mask, i)) | ||
| 13066 | dnd_grab = true; | ||
| 13067 | } | ||
| 13068 | 13068 | ||
| 13069 | if (x_dnd_last_seen_window != None | 13069 | if (!dnd_grab |
| 13070 | && x_dnd_last_protocol_version != -1) | 13070 | && xev->evtype == XI_ButtonRelease) |
| 13071 | x_dnd_send_drop (x_dnd_frame, x_dnd_last_seen_window, | 13071 | { |
| 13072 | x_dnd_selection_timestamp, | 13072 | x_dnd_in_progress = false; |
| 13073 | x_dnd_last_protocol_version); | ||
| 13074 | 13073 | ||
| 13075 | x_dnd_last_protocol_version = -1; | 13074 | if (x_dnd_last_seen_window != None |
| 13076 | x_dnd_last_seen_window = None; | 13075 | && x_dnd_last_protocol_version != -1) |
| 13077 | x_dnd_frame = NULL; | 13076 | x_dnd_send_drop (x_dnd_frame, x_dnd_last_seen_window, |
| 13078 | x_set_dnd_targets (NULL, 0); | 13077 | x_dnd_selection_timestamp, |
| 13078 | x_dnd_last_protocol_version); | ||
| 13079 | 13079 | ||
| 13080 | goto XI_OTHER; | 13080 | x_dnd_last_protocol_version = -1; |
| 13081 | x_dnd_last_seen_window = None; | ||
| 13082 | x_dnd_frame = NULL; | ||
| 13083 | x_set_dnd_targets (NULL, 0); | ||
| 13084 | |||
| 13085 | goto XI_OTHER; | ||
| 13086 | } | ||
| 13081 | } | 13087 | } |
| 13082 | 13088 | ||
| 13083 | if (x_dnd_in_progress) | 13089 | if (x_dnd_in_progress) |