emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#36165: closed (27.0.50; `select-frame-set-input-fo


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#36165: closed (27.0.50; `select-frame-set-input-focus' moves mouse pointer outside of frame)
Date: Wed, 12 Jun 2019 14:41:04 +0000

Your message dated Wed, 12 Jun 2019 14:39:23 +0000
with message-id <CAOqdjBe=address@hidden>
and subject line Re: bug#36165: 27.0.50; `select-frame-set-input-focus' moves 
mouse pointer outside of frame
has caused the debbugs.gnu.org bug report #36165,
regarding 27.0.50; `select-frame-set-input-focus' moves mouse pointer outside 
of frame
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden.)


-- 
36165: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=36165
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 27.0.50; `select-frame-set-input-focus' moves mouse pointer outside of frame Date: Tue, 11 Jun 2019 07:22:41 +0000
In emacs -Q, disable scroll-bar-mode and evaluate:

(let ((mouse-autoselect-window t))
  (select-frame-set-input-focus (window-frame)))

The mouse pointer will now be to the right of the window frame; with
normal window managers, this doesn't matter much, except that a "resize
this window" cursor might be shown rather than the usual one, but with
tiling window managers, the cursor position may correspond to another
window, which is then raised and wrongly receives keyboard focus. This
actually happened to me.

The attached patch fixes things, by moving the mouse pointer to the last
valid x position.

diff --git a/lisp/frame.el b/lisp/frame.el
index a8c230cb7b..7b61003c9a 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -979,10 +979,11 @@ select-frame-set-input-focus
   ;; Move mouse cursor if necessary.
   (cond
    (mouse-autoselect-window
-    (let ((edges (window-inside-edges (frame-selected-window frame))))
+    (let ((edges (window-edges (frame-selected-window frame)
+                               t nil t)))
       ;; Move mouse cursor into FRAME's selected window to avoid that
       ;; Emacs mouse-autoselects another window.
-      (set-mouse-position frame (nth 2 edges) (nth 1 edges))))
+      (set-mouse-pixel-position frame (1- (nth 2 edges)) (nth 1 edges))))
    (focus-follows-mouse
     ;; Move mouse cursor into FRAME to avoid that another frame gets
     ;; selected by the window manager.

Attachment: emacs-patch-2.diff
Description: Text Data


--- End Message ---
--- Begin Message --- Subject: Re: bug#36165: 27.0.50; `select-frame-set-input-focus' moves mouse pointer outside of frame Date: Wed, 12 Jun 2019 14:39:23 +0000
Thanks, it appears to work here.

On Tue, Jun 11, 2019 at 8:17 AM martin rudalics <address@hidden> wrote:
>
>  > In emacs -Q, disable scroll-bar-mode and evaluate:
>  >
>  > (let ((mouse-autoselect-window t))
>  >    (select-frame-set-input-focus (window-frame)))
>  >
>  > The mouse pointer will now be to the right of the window frame; with
>  > normal window managers, this doesn't matter much, except that a "resize
>  > this window" cursor might be shown rather than the usual one, but with
>  > tiling window managers, the cursor position may correspond to another
>  > window, which is then raised and wrongly receives keyboard focus. This
>  > actually happened to me.
>  >
>  > The attached patch fixes things, by moving the mouse pointer to the last
>  > valid x position.
>
> Pushed to master.  Please have a look and close the bug in case I did
> things right.
>
> Thank your very much, martin


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]