X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/6b8bc570715801cb194dc4273370eab87628e8bf..62f1ca498cf11a3fa9b707c115673ea7b298e957:/lisp/xt-mouse.el diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index 66542578d7..eca5f813ca 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el @@ -50,7 +50,7 @@ M-down-mouse-1 M-down-mouse-2 M-down-mouse-3)) (put event-type 'event-kind 'mouse-click)) -(defun xterm-mouse-translate (event) +(defun xterm-mouse-translate (_event) "Read a click and release event from XTerm." (save-excursion (save-window-excursion @@ -120,10 +120,17 @@ ;; read xterm sequences above ascii 127 (#x7f) (defun xterm-mouse-event-read () + ;; We get the characters decoded by the keyboard coding system. Try + ;; to recover the raw character. (let ((c (read-char))) - (if (> c #x3FFF80) - (+ 128 (- c #x3FFF80)) - c))) + (cond ;; If meta-flag is t we get a meta character + ((>= c ?\M-\^@) + (- c (- ?\M-\^@ 128))) + ;; Reencode the character in the keyboard coding system, if + ;; this is a non-ASCII character. + ((>= c #x80) + (aref (encode-coding-string (string c) (keyboard-coding-system)) 0)) + (t c)))) (defun xterm-mouse-truncate-wrap (f) "Truncate with wrap-around." @@ -228,7 +235,7 @@ down the SHIFT key while pressing the mouse button." (dolist (terminal (terminal-list)) (turn-on-xterm-mouse-tracking-on-terminal terminal))) -(defun turn-off-xterm-mouse-tracking (&optional force) +(defun turn-off-xterm-mouse-tracking (&optional _force) "Disable Emacs mouse tracking in xterm." (dolist (terminal (terminal-list)) (turn-off-xterm-mouse-tracking-on-terminal terminal)))