diff options
author | Po Lu <luangruo@yahoo.com> | 2022-03-17 15:12:23 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-03-17 15:12:23 +0800 |
commit | 13762d24b88a370f349d308c48b28b94bcbbad18 (patch) | |
tree | 9c3d8bda3b915604e5991bf0fb6dbc40d9dbfdd5 /lisp/mouse.el | |
parent | af90a4547167e9997ed2bd4a86b055c503c31462 (diff) | |
download | emacs-13762d24b88a370f349d308c48b28b94bcbbad18.tar.gz emacs-13762d24b88a370f349d308c48b28b94bcbbad18.tar.bz2 emacs-13762d24b88a370f349d308c48b28b94bcbbad18.zip |
Display drag-and-drop messages in echo area on non-graphics displays
* lisp/mouse.el (mouse-drag-and-drop-region-display-tooltip)
(mouse-drag-and-drop-region-hide-tooltip): New functions.
(mouse-drag-and-drop-region): Use them instead of calling
`x-hide-tip' and `x-show-tip' directly.
Diffstat (limited to 'lisp/mouse.el')
-rw-r--r-- | lisp/mouse.el | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index 3e7ae246975..93c89de91c2 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -2991,6 +2991,21 @@ highlight the original region when (declare-function rectangle-intersect-p "rect" (pos1 size1 pos2 size2)) (declare-function x-begin-drag "xfns.c") +(defun mouse-drag-and-drop-region-display-tooltip (tooltip) + "Display TOOLTIP, a tooltip string, using `x-show-tip'. +Call `tooltip-show-help-non-mode' instead on non-graphical displays." + (if (display-graphic-p) + (x-show-tip tooltip) + (tooltip-show-help-non-mode tooltip))) + +(defun mouse-drag-and-drop-region-hide-tooltip () + "Hide any tooltip currently displayed. +Call `tooltip-show-help-non-mode' to clear the echo area message +instead on non-graphical displays." + (if (display-graphic-p) + (x-hide-tip) + (tooltip-show-help-non-mode nil))) + (defun mouse-drag-and-drop-region (event) "Move text in the region to point where mouse is dragged to. The transportation of text is also referred as `drag and drop'. @@ -3087,6 +3102,7 @@ is copied instead of being cut." (throw 'loop t))))))) (when (and mouse-drag-and-drop-region-cross-program + (display-graphic-p) (fboundp 'x-begin-drag) (framep (posn-window (event-end event))) (let ((location (posn-x-y (event-end event))) @@ -3097,7 +3113,7 @@ is copied instead of being cut." (frame-pixel-width frame)) (> (cdr location) (frame-pixel-height frame))))) - (x-hide-tip) + (mouse-drag-and-drop-region-hide-tooltip) (gui-set-selection 'XdndSelection value-selection) (let ((drag-action-or-frame (x-begin-drag '("UTF8_STRING" "text/plain" @@ -3183,8 +3199,8 @@ is copied instead of being cut." ;; which change the text properties, and ;; `text-tooltip' can potentially be the text which ;; will be pasted. - (x-show-tip text-tooltip) - (x-hide-tip)) + (mouse-drag-and-drop-region-display-tooltip text-tooltip) + (mouse-drag-and-drop-region-hide-tooltip)) ;; Show cursor and highlight the original region. (when mouse-drag-and-drop-region-show-cursor |