]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/mouse.el (context-menu-map): Select only unselected window (bug#53910)
authorJuri Linkov <juri@linkov.net>
Thu, 10 Feb 2022 18:57:42 +0000 (20:57 +0200)
committerJuri Linkov <juri@linkov.net>
Thu, 10 Feb 2022 18:57:42 +0000 (20:57 +0200)
lisp/mouse.el

index acaf6611af535690772fc3a52f2571eb3e63868f..1e205283de20d23cbea245961d48475a31381c22 100644 (file)
@@ -321,10 +321,12 @@ At the end, it's possible to modify the final menu by specifying
 the function `context-menu-filter-function'."
   (let* ((menu (make-sparse-keymap (propertize "Context Menu" 'hide t)))
          (click (or click last-input-event))
+         (window (posn-window (event-start click)))
          (fun (mouse-posn-property (event-start click)
                                    'context-menu-function)))
 
-    (select-window (posn-window (event-start click)))
+    (unless (eq (selected-window) window)
+      (select-window window))
 
     (if (functionp fun)
         (setq menu (funcall fun menu click))