diff options
| author | Po Lu | 2022-06-18 10:14:24 +0800 |
|---|---|---|
| committer | Po Lu | 2022-06-18 10:14:24 +0800 |
| commit | 95370484d4750717ea32a94a3785be3cd18b9427 (patch) | |
| tree | 513ce3a9a56c30111e04f785c78e8841c4db46ca /src | |
| parent | 0d103e6f79d374766b64e56fb05e440076f4df5c (diff) | |
| download | emacs-95370484d4750717ea32a94a3785be3cd18b9427.tar.gz emacs-95370484d4750717ea32a94a3785be3cd18b9427.zip | |
Fix specifying named action lists in `x-begin-drag'
* src/xfns.c (Fx_begin_drag): Record original value of `targets'
separately. Pass that as the selection targets list instead.
* src/xterm.c (x_dnd_delete_action_list): New function.
(x_dnd_begin_drag_and_drop): Bind it if there are multiple
actions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfns.c | 5 | ||||
| -rw-r--r-- | src/xterm.c | 39 |
2 files changed, 29 insertions, 15 deletions
diff --git a/src/xfns.c b/src/xfns.c index 3df91679afd..1372809da68 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -6899,7 +6899,7 @@ that mouse buttons are being held down, such as immediately after a | |||
| 6899 | int ntargets = 0, nnames = 0; | 6899 | int ntargets = 0, nnames = 0; |
| 6900 | char *target_names[2048]; | 6900 | char *target_names[2048]; |
| 6901 | Atom *target_atoms; | 6901 | Atom *target_atoms; |
| 6902 | Lisp_Object lval, original, tem, t1, t2; | 6902 | Lisp_Object lval, original, targets_arg, tem, t1, t2; |
| 6903 | Atom xaction; | 6903 | Atom xaction; |
| 6904 | Atom action_list[2048]; | 6904 | Atom action_list[2048]; |
| 6905 | char *name_list[2048]; | 6905 | char *name_list[2048]; |
| @@ -6908,6 +6908,7 @@ that mouse buttons are being held down, such as immediately after a | |||
| 6908 | 6908 | ||
| 6909 | CHECK_LIST (targets); | 6909 | CHECK_LIST (targets); |
| 6910 | original = targets; | 6910 | original = targets; |
| 6911 | targets_arg = targets; | ||
| 6911 | 6912 | ||
| 6912 | for (; CONSP (targets); targets = XCDR (targets)) | 6913 | for (; CONSP (targets); targets = XCDR (targets)) |
| 6913 | { | 6914 | { |
| @@ -6995,7 +6996,7 @@ that mouse buttons are being held down, such as immediately after a | |||
| 6995 | xaction, return_frame, action_list, | 6996 | xaction, return_frame, action_list, |
| 6996 | (const char **) &name_list, nnames, | 6997 | (const char **) &name_list, nnames, |
| 6997 | !NILP (allow_current_frame), target_atoms, | 6998 | !NILP (allow_current_frame), target_atoms, |
| 6998 | ntargets, original, !NILP (follow_tooltip)); | 6999 | ntargets, targets_arg, !NILP (follow_tooltip)); |
| 6999 | 7000 | ||
| 7000 | SAFE_FREE (); | 7001 | SAFE_FREE (); |
| 7001 | return lval; | 7002 | return lval; |
diff --git a/src/xterm.c b/src/xterm.c index fe7b6ffe212..67bb2651727 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -11094,6 +11094,30 @@ x_clear_dnd_action (void) | |||
| 11094 | x_dnd_action_symbol = Qnil; | 11094 | x_dnd_action_symbol = Qnil; |
| 11095 | } | 11095 | } |
| 11096 | 11096 | ||
| 11097 | /* Delete action descriptions from F after drag-and-drop. */ | ||
| 11098 | static void | ||
| 11099 | x_dnd_delete_action_list (Lisp_Object frame) | ||
| 11100 | { | ||
| 11101 | struct frame *f; | ||
| 11102 | |||
| 11103 | /* Delete those two properties, since some clients look at them and | ||
| 11104 | not the action to decide whether or not the user should be | ||
| 11105 | prompted to select an action. This can be called with FRAME no | ||
| 11106 | longer alive (or its display dead). */ | ||
| 11107 | |||
| 11108 | f = XFRAME (frame); | ||
| 11109 | |||
| 11110 | if (!FRAME_LIVE_P (f) || !FRAME_DISPLAY_INFO (f)->display) | ||
| 11111 | return; | ||
| 11112 | |||
| 11113 | block_input (); | ||
| 11114 | XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | ||
| 11115 | FRAME_DISPLAY_INFO (f)->Xatom_XdndActionList); | ||
| 11116 | XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | ||
| 11117 | FRAME_DISPLAY_INFO (f)->Xatom_XdndActionDescription); | ||
| 11118 | unblock_input (); | ||
| 11119 | } | ||
| 11120 | |||
| 11097 | /* This function is defined far away from the rest of the XDND code so | 11121 | /* This function is defined far away from the rest of the XDND code so |
| 11098 | it can utilize `x_any_window_to_frame'. */ | 11122 | it can utilize `x_any_window_to_frame'. */ |
| 11099 | 11123 | ||
| @@ -11262,6 +11286,8 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, | |||
| 11262 | = xm_side_effect_from_action (FRAME_DISPLAY_INFO (f), | 11286 | = xm_side_effect_from_action (FRAME_DISPLAY_INFO (f), |
| 11263 | ask_action_list[0]); | 11287 | ask_action_list[0]); |
| 11264 | 11288 | ||
| 11289 | record_unwind_protect (x_dnd_delete_action_list, frame); | ||
| 11290 | |||
| 11265 | ask_actions = NULL; | 11291 | ask_actions = NULL; |
| 11266 | end = 0; | 11292 | end = 0; |
| 11267 | count = SPECPDL_INDEX (); | 11293 | count = SPECPDL_INDEX (); |
| @@ -11306,19 +11332,6 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, | |||
| 11306 | 11332 | ||
| 11307 | unbind_to (count, Qnil); | 11333 | unbind_to (count, Qnil); |
| 11308 | } | 11334 | } |
| 11309 | else | ||
| 11310 | { | ||
| 11311 | /* Delete those two properties, since some clients look at them | ||
| 11312 | and not the action to decide whether or not the user should | ||
| 11313 | be prompted to select an action. */ | ||
| 11314 | |||
| 11315 | block_input (); | ||
| 11316 | XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | ||
| 11317 | FRAME_DISPLAY_INFO (f)->Xatom_XdndActionList); | ||
| 11318 | XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | ||
| 11319 | FRAME_DISPLAY_INFO (f)->Xatom_XdndActionDescription); | ||
| 11320 | unblock_input (); | ||
| 11321 | } | ||
| 11322 | 11335 | ||
| 11323 | if (follow_tooltip) | 11336 | if (follow_tooltip) |
| 11324 | { | 11337 | { |