diff options
author | Po Lu <luangruo@yahoo.com> | 2022-05-09 10:13:43 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-05-09 10:13:43 +0800 |
commit | 6ec29d0566042c65956d46fd1a30c6182ce0e537 (patch) | |
tree | 0a8d156131a4bf1271ee8c4d66a7c627c15b9b5c | |
parent | fd8eaa72a611d050e1fe9c38c466c7812c7795dd (diff) | |
download | emacs-6ec29d0566042c65956d46fd1a30c6182ce0e537.tar.gz |
Allow disabling Motif drag protocol
* lisp/cus-start.el (standard): Add new variable.
* src/xterm.c (x_dnd_update_state, handle_one_xevent): Respect
new variable.
(syms_of_xterm): New variable `x-dnd-disable-motif-drag'.
-rw-r--r-- | lisp/cus-start.el | 3 | ||||
-rw-r--r-- | src/xterm.c | 31 |
2 files changed, 28 insertions, 6 deletions
diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 83ab61b28b5..d8c4b480359 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -832,6 +832,7 @@ since it could result in memory overflow and make Emacs crash." (scroll-bar-adjust-thumb-portion windows boolean "24.4") (x-scroll-event-delta-factor mouse float "29.1") (x-gtk-use-native-input keyboard boolean "29.1") + (x-dnd-disable-motif-drag dnd boolean "29.1") ;; xselect.c (x-select-enable-clipboard-manager killing boolean "24.1") ;; xsettings.c @@ -870,6 +871,8 @@ since it could result in memory overflow and make Emacs crash." ((or (equal "scroll-bar-adjust-thumb-portion" (symbol-name symbol)) (equal "x-scroll-event-delta-factor" + (symbol-name symbol)) + (equal "x-dnd-disable-motif-drag" (symbol-name symbol))) (featurep 'x)) ((string-match "\\`x-" (symbol-name symbol)) diff --git a/src/xterm.c b/src/xterm.c index 2bbc9f3d0c6..c9e26181912 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -14053,6 +14053,7 @@ x_dnd_update_state (struct x_display_info *dpyinfo, Time timestamp) x_dnd_send_leave (x_dnd_frame, x_dnd_last_seen_window); else if (x_dnd_last_seen_window != None && XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style) + && !x_dnd_disable_motif_drag && x_dnd_last_seen_window != FRAME_OUTER_WINDOW (x_dnd_frame)) { if (!x_dnd_motif_setup_p) @@ -14092,6 +14093,7 @@ x_dnd_update_state (struct x_display_info *dpyinfo, Time timestamp) x_dnd_send_leave (x_dnd_frame, x_dnd_last_seen_window); else if (x_dnd_last_seen_window != None && XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style) + && !x_dnd_disable_motif_drag && x_dnd_last_seen_window != FRAME_OUTER_WINDOW (x_dnd_frame)) { if (!x_dnd_motif_setup_p) @@ -14117,7 +14119,8 @@ x_dnd_update_state (struct x_display_info *dpyinfo, Time timestamp) if (target != None && x_dnd_last_protocol_version != -1) x_dnd_send_enter (x_dnd_frame, target, x_dnd_last_protocol_version); - else if (target != None && XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style)) + else if (target != None && XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style) + && !x_dnd_disable_motif_drag) { if (!x_dnd_motif_setup_p) xm_setup_drag_info (dpyinfo, x_dnd_frame); @@ -14148,7 +14151,8 @@ x_dnd_update_state (struct x_display_info *dpyinfo, Time timestamp) 0 #endif ); - else if (XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style) && target != None) + else if (XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style) && target != None + && !x_dnd_disable_motif_drag) { if (!x_dnd_motif_setup_p) xm_setup_drag_info (dpyinfo, x_dnd_frame); @@ -15875,6 +15879,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, x_dnd_send_leave (x_dnd_frame, x_dnd_last_seen_window); else if (x_dnd_last_seen_window != None && XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style) + && !x_dnd_disable_motif_drag && x_dnd_last_seen_window != FRAME_OUTER_WINDOW (x_dnd_frame)) { if (!x_dnd_motif_setup_p) @@ -15914,6 +15919,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, x_dnd_send_leave (x_dnd_frame, x_dnd_last_seen_window); else if (x_dnd_last_seen_window != None && XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style) + && x_dnd_disable_motif_drag && x_dnd_last_seen_window != FRAME_OUTER_WINDOW (x_dnd_frame)) { if (!x_dnd_motif_setup_p) @@ -15960,7 +15966,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (target != None && x_dnd_last_protocol_version != -1) x_dnd_send_enter (x_dnd_frame, target, x_dnd_last_protocol_version); - else if (target != None && XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style)) + else if (target != None && XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style) + && !x_dnd_disable_motif_drag) { if (!x_dnd_motif_setup_p) xm_setup_drag_info (dpyinfo, x_dnd_frame); @@ -15987,7 +15994,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, x_dnd_selection_timestamp, x_dnd_wanted_action, 0, event->xmotion.state); - else if (XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style) && target != None) + else if (XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style) && target != None + && !x_dnd_disable_motif_drag) { if (!x_dnd_motif_setup_p) xm_setup_drag_info (dpyinfo, x_dnd_frame); @@ -17454,6 +17462,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, x_dnd_send_leave (x_dnd_frame, x_dnd_last_seen_window); else if (x_dnd_last_seen_window != None && XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style) + && !x_dnd_disable_motif_drag && x_dnd_last_seen_window != FRAME_OUTER_WINDOW (x_dnd_frame)) { if (!x_dnd_motif_setup_p) @@ -17493,6 +17502,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, x_dnd_send_leave (x_dnd_frame, x_dnd_last_seen_window); else if (x_dnd_last_seen_window != None && XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style) + && !x_dnd_disable_motif_drag && x_dnd_last_seen_window != FRAME_OUTER_WINDOW (x_dnd_frame)) { if (!x_dnd_motif_setup_p) @@ -17541,7 +17551,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (target != None && x_dnd_last_protocol_version != -1) x_dnd_send_enter (x_dnd_frame, target, x_dnd_last_protocol_version); - else if (target != None && XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style)) + else if (target != None && XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style) + && !x_dnd_disable_motif_drag) { if (!x_dnd_motif_setup_p) xm_setup_drag_info (dpyinfo, x_dnd_frame); @@ -17581,7 +17592,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, x_dnd_wanted_action, 0, dnd_state); } - else if (XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style) && target != None) + else if (XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style) && target != None + && !x_dnd_disable_motif_drag) { if (!x_dnd_motif_setup_p) xm_setup_drag_info (dpyinfo, x_dnd_frame); @@ -24906,6 +24918,13 @@ during a drag-and-drop session, to work around broken implementations of Motif. */); x_dnd_fix_motif_leave = true; + DEFVAR_BOOL ("x-dnd-disable-motif-drag", x_dnd_disable_motif_drag, + doc: /* Disable the Motif drag protocol during DND. +This reduces network usage, but also means you can no longer scroll +around inside the Motif window underneath the cursor during +drag-and-drop. */); + x_dnd_disable_motif_drag = false; + DEFVAR_LISP ("x-dnd-movement-function", Vx_dnd_movement_function, doc: /* Function called upon mouse movement on a frame during drag-and-drop. It should either be nil, or accept two arguments FRAME and POSITION, |