diff options
| author | Po Lu | 2022-03-31 17:30:13 +0800 |
|---|---|---|
| committer | Po Lu | 2022-03-31 17:31:45 +0800 |
| commit | c1792c51de30d161131753181db2cfdc3cd70eaf (patch) | |
| tree | 1fd9730cd136cbf59693f93103e41f8aa5340cee /src | |
| parent | 1d4306a8a770cb73db3b39301ee41e15f9e3656f (diff) | |
| download | emacs-c1792c51de30d161131753181db2cfdc3cd70eaf.tar.gz emacs-c1792c51de30d161131753181db2cfdc3cd70eaf.zip | |
; * src/xterm.c (handle_one_xevent): Respect current window in Motif DND.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 106 |
1 files changed, 55 insertions, 51 deletions
diff --git a/src/xterm.c b/src/xterm.c index bd5d756c8cc..6a19828a36a 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -14166,62 +14166,64 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 14166 | x_dnd_selection_timestamp, | 14166 | x_dnd_selection_timestamp, |
| 14167 | x_dnd_last_protocol_version); | 14167 | x_dnd_last_protocol_version); |
| 14168 | } | 14168 | } |
| 14169 | else if (x_dnd_last_seen_window != None) | ||
| 14170 | { | ||
| 14171 | xm_drag_receiver_info drag_receiver_info; | ||
| 14172 | xm_drag_initiator_info drag_initiator_info; | ||
| 14173 | xm_drop_start_message dmsg; | ||
| 14174 | int idx; | ||
| 14175 | |||
| 14176 | if (!xm_read_drag_receiver_info (dpyinfo, x_dnd_last_seen_window, | ||
| 14177 | &drag_receiver_info) | ||
| 14178 | && drag_receiver_info.protocol_style != XM_DRAG_STYLE_NONE | ||
| 14179 | && (x_dnd_allow_current_frame | ||
| 14180 | || FRAME_OUTER_WINDOW (x_dnd_frame) != x_dnd_last_seen_window)) | ||
| 14181 | { | ||
| 14182 | idx = xm_setup_dnd_targets (dpyinfo, x_dnd_targets, | ||
| 14183 | x_dnd_n_targets); | ||
| 14184 | |||
| 14185 | if (idx != -1) | ||
| 14186 | { | ||
| 14187 | drag_initiator_info.byteorder = XM_TARGETS_TABLE_CUR; | ||
| 14188 | drag_initiator_info.protocol = 0; | ||
| 14189 | drag_initiator_info.table_index = idx; | ||
| 14190 | drag_initiator_info.selection = dpyinfo->Xatom_XdndSelection; | ||
| 14191 | |||
| 14192 | memset (&dmsg, 0, sizeof dmsg); | ||
| 14193 | |||
| 14194 | xm_write_drag_initiator_info (dpyinfo->display, | ||
| 14195 | FRAME_X_WINDOW (x_dnd_frame), | ||
| 14196 | dpyinfo->Xatom_MOTIF_DRAG_INITIATOR_INFO, | ||
| 14197 | dpyinfo->Xatom_MOTIF_DRAG_INITIATOR_INFO, | ||
| 14198 | &drag_initiator_info); | ||
| 14199 | |||
| 14200 | dmsg.reason = XM_DRAG_REASON (XM_DRAG_ORIGINATOR_INITIATOR, | ||
| 14201 | XM_DRAG_REASON_DROP_START); | ||
| 14202 | dmsg.byte_order = XM_TARGETS_TABLE_CUR; | ||
| 14203 | dmsg.side_effects | ||
| 14204 | = XM_DRAG_SIDE_EFFECT (xm_side_effect_from_action (dpyinfo, | ||
| 14205 | x_dnd_wanted_action), | ||
| 14206 | XM_DROP_SITE_VALID, | ||
| 14207 | xm_side_effect_from_action (dpyinfo, | ||
| 14208 | x_dnd_wanted_action), | ||
| 14209 | XM_DROP_ACTION_DROP); | ||
| 14210 | dmsg.timestamp = event->xbutton.time; | ||
| 14211 | dmsg.x = event->xbutton.x_root; | ||
| 14212 | dmsg.y = event->xbutton.y_root; | ||
| 14213 | dmsg.index_atom = dpyinfo->Xatom_MOTIF_DRAG_INITIATOR_INFO; | ||
| 14214 | dmsg.source_window = FRAME_X_WINDOW (x_dnd_frame); | ||
| 14215 | |||
| 14216 | xm_send_drop_message (dpyinfo, FRAME_X_WINDOW (x_dnd_frame), | ||
| 14217 | x_dnd_last_seen_window, &dmsg); | ||
| 14218 | } | ||
| 14219 | } | ||
| 14220 | } | ||
| 14169 | 14221 | ||
| 14170 | x_dnd_last_protocol_version = -1; | 14222 | x_dnd_last_protocol_version = -1; |
| 14171 | x_dnd_last_seen_window = None; | 14223 | x_dnd_last_seen_window = None; |
| 14172 | x_dnd_frame = NULL; | 14224 | x_dnd_frame = NULL; |
| 14173 | x_set_dnd_targets (NULL, 0); | 14225 | x_set_dnd_targets (NULL, 0); |
| 14174 | } | 14226 | } |
| 14175 | else if (x_dnd_last_seen_window != None) | ||
| 14176 | { | ||
| 14177 | xm_drag_receiver_info drag_receiver_info; | ||
| 14178 | xm_drag_initiator_info drag_initiator_info; | ||
| 14179 | xm_drop_start_message dmsg; | ||
| 14180 | int idx; | ||
| 14181 | |||
| 14182 | if (!xm_read_drag_receiver_info (dpyinfo, x_dnd_last_seen_window, | ||
| 14183 | &drag_receiver_info) | ||
| 14184 | && drag_receiver_info.protocol_style != XM_DRAG_STYLE_NONE) | ||
| 14185 | { | ||
| 14186 | idx = xm_setup_dnd_targets (dpyinfo, x_dnd_targets, | ||
| 14187 | x_dnd_n_targets); | ||
| 14188 | |||
| 14189 | if (idx != -1) | ||
| 14190 | { | ||
| 14191 | drag_initiator_info.byteorder = XM_TARGETS_TABLE_CUR; | ||
| 14192 | drag_initiator_info.protocol = 0; | ||
| 14193 | drag_initiator_info.table_index = idx; | ||
| 14194 | drag_initiator_info.selection = dpyinfo->Xatom_XdndSelection; | ||
| 14195 | |||
| 14196 | memset (&dmsg, 0, sizeof dmsg); | ||
| 14197 | |||
| 14198 | xm_write_drag_initiator_info (dpyinfo->display, | ||
| 14199 | FRAME_X_WINDOW (x_dnd_frame), | ||
| 14200 | dpyinfo->Xatom_MOTIF_DRAG_INITIATOR_INFO, | ||
| 14201 | dpyinfo->Xatom_MOTIF_DRAG_INITIATOR_INFO, | ||
| 14202 | &drag_initiator_info); | ||
| 14203 | |||
| 14204 | dmsg.reason = XM_DRAG_REASON (XM_DRAG_ORIGINATOR_INITIATOR, | ||
| 14205 | XM_DRAG_REASON_DROP_START); | ||
| 14206 | dmsg.byte_order = XM_TARGETS_TABLE_CUR; | ||
| 14207 | dmsg.side_effects | ||
| 14208 | = XM_DRAG_SIDE_EFFECT (xm_side_effect_from_action (dpyinfo, | ||
| 14209 | x_dnd_wanted_action), | ||
| 14210 | XM_DROP_SITE_VALID, | ||
| 14211 | xm_side_effect_from_action (dpyinfo, | ||
| 14212 | x_dnd_wanted_action), | ||
| 14213 | XM_DROP_ACTION_DROP); | ||
| 14214 | dmsg.timestamp = event->xbutton.time; | ||
| 14215 | dmsg.x = event->xbutton.x_root; | ||
| 14216 | dmsg.y = event->xbutton.y_root; | ||
| 14217 | dmsg.index_atom = dpyinfo->Xatom_MOTIF_DRAG_INITIATOR_INFO; | ||
| 14218 | dmsg.source_window = FRAME_X_WINDOW (x_dnd_frame); | ||
| 14219 | |||
| 14220 | xm_send_drop_message (dpyinfo, FRAME_X_WINDOW (x_dnd_frame), | ||
| 14221 | x_dnd_last_seen_window, &dmsg); | ||
| 14222 | } | ||
| 14223 | } | ||
| 14224 | } | ||
| 14225 | 14227 | ||
| 14226 | goto OTHER; | 14228 | goto OTHER; |
| 14227 | } | 14229 | } |
| @@ -15224,7 +15226,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 15224 | 15226 | ||
| 15225 | if (!xm_read_drag_receiver_info (dpyinfo, x_dnd_last_seen_window, | 15227 | if (!xm_read_drag_receiver_info (dpyinfo, x_dnd_last_seen_window, |
| 15226 | &drag_receiver_info) | 15228 | &drag_receiver_info) |
| 15227 | && drag_receiver_info.protocol_style != XM_DRAG_STYLE_NONE) | 15229 | && drag_receiver_info.protocol_style != XM_DRAG_STYLE_NONE |
| 15230 | && (x_dnd_allow_current_frame | ||
| 15231 | || FRAME_OUTER_WINDOW (x_dnd_frame) != x_dnd_last_seen_window)) | ||
| 15228 | { | 15232 | { |
| 15229 | idx = xm_setup_dnd_targets (dpyinfo, x_dnd_targets, | 15233 | idx = xm_setup_dnd_targets (dpyinfo, x_dnd_targets, |
| 15230 | x_dnd_n_targets); | 15234 | x_dnd_n_targets); |