From unknown Sun Jun 22 17:16:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36165: 27.0.50; `select-frame-set-input-focus' moves mouse pointer outside of frame Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 11 Jun 2019 07:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 36165 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 36165@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.156023780830759 (code B ref -1); Tue, 11 Jun 2019 07:24:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 Jun 2019 07:23:28 +0000 Received: from localhost ([127.0.0.1]:57935 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hab7w-000803-AT for submit@debbugs.gnu.org; Tue, 11 Jun 2019 03:23:28 -0400 Received: from lists.gnu.org ([209.51.188.17]:49332) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hab7u-0007zu-O8 for submit@debbugs.gnu.org; Tue, 11 Jun 2019 03:23:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35318) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hab7t-0007yx-7t for bug-gnu-emacs@gnu.org; Tue, 11 Jun 2019 03:23:26 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hab7s-0003G2-34 for bug-gnu-emacs@gnu.org; Tue, 11 Jun 2019 03:23:25 -0400 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]:32840) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hab7r-0003BN-St for bug-gnu-emacs@gnu.org; Tue, 11 Jun 2019 03:23:24 -0400 Received: by mail-ot1-x335.google.com with SMTP id p4so7678657oti.0 for ; Tue, 11 Jun 2019 00:23:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=CCU9Fv6/Ke+zYP1os1CYMEhJEHfFbDY0KbMcd9iu/Iw=; b=OBmQe6YMV3L7YRN7sXfrY+sSHgkX9s7mlLLTzPQwLIwTlx6FR3IfyNuwOmoPtLGJRW 4t5Kv51OsCEM1K43js0vkBCr8agUL8Kmv2D5zOIAgdrVcVl37rvMqNzanJpWc/65+jQ7 h/EipS++YPNrGMx/ZySIpp45NEXmhdWVmzPhUjtoFHlyFxprVAAwg3j9KPRz+bIhMXcy bUA+l03jV1l5CoSwcLzRt/RwE1XUlRSntJJDMJFqvHN8BYB1J5BhFtU3NlJ1sDRNQAZo 0VLUL7eKRDmH5p1RKJtb5J0yvcsz41UQiuDpd1oYjMqbqCbGSvdQrXILfZbCyZwm+tKn K3FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=CCU9Fv6/Ke+zYP1os1CYMEhJEHfFbDY0KbMcd9iu/Iw=; b=A3rhqYJJ69bBd0pL1B/fHJONc42mAWUUOVvksgV2IKxFrDbEQF2WbzB5MLHPbScMIZ flo8lkY/Dqxvk4Kr4Qc5aXu7ZvO5xSlMQg3EWmY131QD0ktZSxrWP3O1J8i7z1E2Qx+F IXOgW0IsJPBlhFnwwHVfI8bcEidmD8FsjETiNg97pi7vkAD2MDQKiVSAqo+mHIHxEDN1 dvS26U4b3xKqrJ/zO8os7FhhbEAnqqb/CIKXGsJo+y4bodCerYBbSbMmUrEzRONY+MZP ha6RdQ8OUy3pYR/roD7qyT8qj6XgjAYGF8+yFkqUKCdoFS1jn86lXcJ1xEuGL7rrY2Y0 q+rg== X-Gm-Message-State: APjAAAWwsB8a1cS7s5DbttWzhyaNHX64OECnL/uWbWCuFjm2ox2KyNDy XS6X9UDGsenIbKqHhTAVvrPaY9WM70ep6jjNcSmjI1OGJLY= X-Google-Smtp-Source: APXvYqx+JN4I3/IalkrGZ0FuvEaYJYKYtsyiOVNntdvp7BfshG1Ndq1b/I9+tOoOQYawzHXEiIo5h7dc5UCsyAz5EeY= X-Received: by 2002:a9d:7284:: with SMTP id t4mr23698444otj.154.1560237799684; Tue, 11 Jun 2019 00:23:19 -0700 (PDT) MIME-Version: 1.0 From: Pip Cet Date: Tue, 11 Jun 2019 07:22:41 +0000 Message-ID: Content-Type: multipart/mixed; boundary="000000000000d0fc1e058b072b0c" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::335 X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --000000000000d0fc1e058b072b0c Content-Type: text/plain; charset="UTF-8" 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. --000000000000d0fc1e058b072b0c Content-Type: text/x-patch; charset="US-ASCII"; name="emacs-patch-2.diff" Content-Disposition: attachment; filename="emacs-patch-2.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jwrh968c0 ZGlmZiAtLWdpdCBhL2xpc3AvZnJhbWUuZWwgYi9saXNwL2ZyYW1lLmVsCmluZGV4IGE4YzIzMGNi N2IuLjdiNjEwMDNjOWEgMTAwNjQ0Ci0tLSBhL2xpc3AvZnJhbWUuZWwKKysrIGIvbGlzcC9mcmFt ZS5lbApAQCAtOTc5LDEwICs5NzksMTEgQEAgc2VsZWN0LWZyYW1lLXNldC1pbnB1dC1mb2N1cwog ICA7OyBNb3ZlIG1vdXNlIGN1cnNvciBpZiBuZWNlc3NhcnkuCiAgIChjb25kCiAgICAobW91c2Ut YXV0b3NlbGVjdC13aW5kb3cKLSAgICAobGV0ICgoZWRnZXMgKHdpbmRvdy1pbnNpZGUtZWRnZXMg KGZyYW1lLXNlbGVjdGVkLXdpbmRvdyBmcmFtZSkpKSkKKyAgICAobGV0ICgoZWRnZXMgKHdpbmRv dy1lZGdlcyAoZnJhbWUtc2VsZWN0ZWQtd2luZG93IGZyYW1lKQorICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIHQgbmlsIHQpKSkKICAgICAgIDs7IE1vdmUgbW91c2UgY3Vyc29yIGludG8g RlJBTUUncyBzZWxlY3RlZCB3aW5kb3cgdG8gYXZvaWQgdGhhdAogICAgICAgOzsgRW1hY3MgbW91 c2UtYXV0b3NlbGVjdHMgYW5vdGhlciB3aW5kb3cuCi0gICAgICAoc2V0LW1vdXNlLXBvc2l0aW9u IGZyYW1lIChudGggMiBlZGdlcykgKG50aCAxIGVkZ2VzKSkpKQorICAgICAgKHNldC1tb3VzZS1w aXhlbC1wb3NpdGlvbiBmcmFtZSAoMS0gKG50aCAyIGVkZ2VzKSkgKG50aCAxIGVkZ2VzKSkpKQog ICAgKGZvY3VzLWZvbGxvd3MtbW91c2UKICAgICA7OyBNb3ZlIG1vdXNlIGN1cnNvciBpbnRvIEZS QU1FIHRvIGF2b2lkIHRoYXQgYW5vdGhlciBmcmFtZSBnZXRzCiAgICAgOzsgc2VsZWN0ZWQgYnkg dGhlIHdpbmRvdyBtYW5hZ2VyLgo= --000000000000d0fc1e058b072b0c-- From unknown Sun Jun 22 17:16:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36165: 27.0.50; `select-frame-set-input-focus' moves mouse pointer outside of frame Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 11 Jun 2019 08:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36165 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pip Cet , 36165@debbugs.gnu.org Received: via spool by 36165-submit@debbugs.gnu.org id=B36165.15602410763504 (code B ref 36165); Tue, 11 Jun 2019 08:18:02 +0000 Received: (at 36165) by debbugs.gnu.org; 11 Jun 2019 08:17:56 +0000 Received: from localhost ([127.0.0.1]:57986 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1habye-0000uQ-Gp for submit@debbugs.gnu.org; Tue, 11 Jun 2019 04:17:56 -0400 Received: from mout.gmx.net ([212.227.17.21]:43755) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1habyc-0000uD-QQ for 36165@debbugs.gnu.org; Tue, 11 Jun 2019 04:17:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1560241065; bh=npoXcV9QOWB39eq0+j/T8tBUFDbYgohvNqHaPTM3alU=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=kIIfeUyNYsGjKZ0XCesgi1CpId774UJlMdlDHe01nWeiDkuxRgwXqzzfM03gLYVi+ sBgr68mZVRCg8WjWGEavLjounfm3KotWJgs5z9szSCwkvkmSwo2uiwFaBRr2+bF9LI TTNnZXllC1nZwu3lloMm28buifhT7WfRskXEUwhg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.1.101] ([213.162.73.248]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MNf1y-1hTUAd2WB0-007FrE; Tue, 11 Jun 2019 10:17:45 +0200 References: From: martin rudalics Message-ID: Date: Tue, 11 Jun 2019 10:17:50 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-DE Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:N+Qefz8qcT6Yp5wPKpmKGK0Rj6YZTURCtxBq2WsR70Vw0dzxaEJ 4qtbESWGKN8jeF7rlJKle07JdviriDb46Zs8L7MppQ3hH0hp6V5NmESvDeOfpQaDOtrGn/m LyssWSCRAoyR+9e1VQYFDT5I7Dh7fQBjDcVw8DAYBkcsq72VNoVP+K8maSbRi2oLw7bRGjZ IrxUTXEXiXuVQ8nX1rZQg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:8U9gYEk3ydk=:Nolk41gMt6uFhpnHEUnKti 7RXIJMbzTLddxRZCA4WDm3yHUTdMUfIaHIOLNPwS9QRAXyVkM0ro6c+skWOjLPzeDXfIC9PwJ GOK1awXzGKC6qPcjHPw3jKyLsxZBeqzZiKOOtetSdjKYG3BAomSBouyIYIYKjzrdvb9EPgTHQ BlIibdNdVD+uV4Xtsy7IyKGH6Ils6BWimwNQ6OpUNomYarScjq3JLrATfrF0DdQ0BNwctgdQ5 J3lE3IgD1ZCJkDR4EwaR6B+Np5eGiOv4eStdOUqG0kvF+swAI2IOD7F3pYnAuFOMbsvRpqp/s G3GtVqdhSsqpSyXpMcNKwURTs15cbONQ3Pxi9qsLhpJ9uw+QUMuawg5WAs+fGg4DSgsXbTewd ojvls5KNbWeB4bbrQTlydFHIzrEcmMd0+0JyY4UII3oDE7PtEvMJefuYexx38Y5iVi3Kp5mFq 7S1y2h+cosAz/1yJLH7c3HHtWRmqgB+VuChU8wfOJw92IAbKFMcDtcXa9F146pAN7qCp2KIc5 5LVwA3tZYoUQo3+CH+ZNH0utQRyRSsejP2lsoBdJu6PKfXalln1lYuZAS6V2bmqN4Q8TmI6s/ 5p0zOH+jDztswJOs2wwXstHYZjep2yQBpCLRtem4i6lYzGP6h7WNF3Wwsno2t8qar2ZAWBLSl C8KivUpngE3YvNYTdByjxbma1Iav5pdp/GwemHB6KpIpKlJ/skRRQbpzLVNV8SbeXMYYpM04D 9rgUtp1eqVIdrKfug0J97p5YEWLLEyr+n5wNCSRBAq1o8xZd9oNmSIUsVqN6oUEGhj/OB+KWL 11eVDV6tjOGK3IAnVGBDaLZI/wBEHux2tpcgzEy6IWQtzryHKVwhrW5FYDdGDmfvm2323hV+S sp8pQnGYGcq2Z6ZGCOWaeczhniVm5isZgCK06R8uv9jL02X/mjQtzb6EvU6/R2ee2CYz5KRK5 lirXfYlpV+i8B+sI/vlHn929GQZ7z5wtqwkf4jWo+5RMokg6tPkah X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > 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 From unknown Sun Jun 22 17:16:10 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Pip Cet Subject: bug#36165: closed (Re: bug#36165: 27.0.50; `select-frame-set-input-focus' moves mouse pointer outside of frame) Message-ID: References: X-Gnu-PR-Message: they-closed 36165 X-Gnu-PR-Package: emacs Reply-To: 36165@debbugs.gnu.org Date: Wed, 12 Jun 2019 14:41:04 +0000 Content-Type: multipart/mixed; boundary="----------=_1560350464-12858-1" This is a multi-part message in MIME format... ------------=_1560350464-12858-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #36165: 27.0.50; `select-frame-set-input-focus' moves mouse pointer outside= of frame which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 36165@debbugs.gnu.org. --=20 36165: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D36165 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1560350464-12858-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 36165-done) by debbugs.gnu.org; 12 Jun 2019 14:40:08 +0000 Received: from localhost ([127.0.0.1]:33794 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hb4Q3-0003Jc-U1 for submit@debbugs.gnu.org; Wed, 12 Jun 2019 10:40:08 -0400 Received: from mail-oi1-f172.google.com ([209.85.167.172]:35444) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hb4Q1-0003J0-EP for 36165-done@debbugs.gnu.org; Wed, 12 Jun 2019 10:40:06 -0400 Received: by mail-oi1-f172.google.com with SMTP id y6so11874753oix.2 for <36165-done@debbugs.gnu.org>; Wed, 12 Jun 2019 07:40:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=z1KCigh836nX8Nlsk/lSQEzxvUF3lbErZ5L+ixT5HaU=; b=ZveicFy35n8PbiSGzKjeGONICMNF+vh2Forq1ep79ehD4X4IkWOPseuCzrEYvyi6fh h65Xb0m7LJPO9lLMvAASPscTYL3kK84nmSX9R7Jtm5dNHSL3QtOcYDwzubf5QujhKgEb L9A7K7PMHAQML2+t+Dt5yqXNK3YlpI3zrKBf+8ZeCGdwV0SVJ10fqtmHyAE63Ti0Q7Ei mWWnqdP8w/2obIsOXF0dDV43SaJSQ8YWHrKwW/BgYeegu1Aj8NmxP+4EndlQ2BKk90oY jGFWF/zNNjgAxl/usLCnWpGrAu6Q0aimq2ia2j0g3MC2vU9Z58C+Kx7DFK3TSVsQ1Xx+ HN6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=z1KCigh836nX8Nlsk/lSQEzxvUF3lbErZ5L+ixT5HaU=; b=DTILL03xJqFOxGJvO/8TDIbi0UCXchpJBrg36zGt/p0OCPUmlaUj3xN5M0iwDjnRaq 8t1hs20N9Qo1cZAIlsKR2pWdBnuOwbyBb894uq5xZDOEjODoj9xgY3yxNEWO7FqTjJws ipzOPnbmHaxf3++vA5A4KPMwvo+AThPjwZrg5R+yIVOb2sOuewm5ewi7NVZ/o4Lq7qIG b1VYZOkKAuNw2cFpoZh5ZYtale1mGOsCqJ3RNeQ7efzSx57IwSwllUHYqn729eooB7Dt tJwFW57bkd2PB7rDQiami9Tpy1FSAJOzz4hsFaduMvgjovakSFG9l76jbF02QcjyATxD jL9A== X-Gm-Message-State: APjAAAXZYi1doNK6AqpCEoDnZhWxWWVX2XuTMLKnbCQnl9YA9Cu0ADc+ CLtIDL2mxO9ho938BaLEs/tk7Fk/iJbV7f8UQo0= X-Google-Smtp-Source: APXvYqzhfY+kotDZFxkIAEUkr0bQ0hTNeDrk++pIq5dTgs6z9nPaIcS5/tjJh4kBjzUE796kU9xcpJdvkbtJhDdTGXM= X-Received: by 2002:aca:58c4:: with SMTP id m187mr18684498oib.112.1560350399800; Wed, 12 Jun 2019 07:39:59 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Pip Cet Date: Wed, 12 Jun 2019 14:39:23 +0000 Message-ID: Subject: Re: bug#36165: 27.0.50; `select-frame-set-input-focus' moves mouse pointer outside of frame To: martin rudalics Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 36165-done Cc: 36165-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Thanks, it appears to work here. On Tue, Jun 11, 2019 at 8:17 AM martin rudalics 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 ------------=_1560350464-12858-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 11 Jun 2019 07:23:28 +0000 Received: from localhost ([127.0.0.1]:57935 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hab7w-000803-AT for submit@debbugs.gnu.org; Tue, 11 Jun 2019 03:23:28 -0400 Received: from lists.gnu.org ([209.51.188.17]:49332) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hab7u-0007zu-O8 for submit@debbugs.gnu.org; Tue, 11 Jun 2019 03:23:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35318) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hab7t-0007yx-7t for bug-gnu-emacs@gnu.org; Tue, 11 Jun 2019 03:23:26 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hab7s-0003G2-34 for bug-gnu-emacs@gnu.org; Tue, 11 Jun 2019 03:23:25 -0400 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]:32840) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hab7r-0003BN-St for bug-gnu-emacs@gnu.org; Tue, 11 Jun 2019 03:23:24 -0400 Received: by mail-ot1-x335.google.com with SMTP id p4so7678657oti.0 for ; Tue, 11 Jun 2019 00:23:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=CCU9Fv6/Ke+zYP1os1CYMEhJEHfFbDY0KbMcd9iu/Iw=; b=OBmQe6YMV3L7YRN7sXfrY+sSHgkX9s7mlLLTzPQwLIwTlx6FR3IfyNuwOmoPtLGJRW 4t5Kv51OsCEM1K43js0vkBCr8agUL8Kmv2D5zOIAgdrVcVl37rvMqNzanJpWc/65+jQ7 h/EipS++YPNrGMx/ZySIpp45NEXmhdWVmzPhUjtoFHlyFxprVAAwg3j9KPRz+bIhMXcy bUA+l03jV1l5CoSwcLzRt/RwE1XUlRSntJJDMJFqvHN8BYB1J5BhFtU3NlJ1sDRNQAZo 0VLUL7eKRDmH5p1RKJtb5J0yvcsz41UQiuDpd1oYjMqbqCbGSvdQrXILfZbCyZwm+tKn K3FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=CCU9Fv6/Ke+zYP1os1CYMEhJEHfFbDY0KbMcd9iu/Iw=; b=A3rhqYJJ69bBd0pL1B/fHJONc42mAWUUOVvksgV2IKxFrDbEQF2WbzB5MLHPbScMIZ flo8lkY/Dqxvk4Kr4Qc5aXu7ZvO5xSlMQg3EWmY131QD0ktZSxrWP3O1J8i7z1E2Qx+F IXOgW0IsJPBlhFnwwHVfI8bcEidmD8FsjETiNg97pi7vkAD2MDQKiVSAqo+mHIHxEDN1 dvS26U4b3xKqrJ/zO8os7FhhbEAnqqb/CIKXGsJo+y4bodCerYBbSbMmUrEzRONY+MZP ha6RdQ8OUy3pYR/roD7qyT8qj6XgjAYGF8+yFkqUKCdoFS1jn86lXcJ1xEuGL7rrY2Y0 q+rg== X-Gm-Message-State: APjAAAWwsB8a1cS7s5DbttWzhyaNHX64OECnL/uWbWCuFjm2ox2KyNDy XS6X9UDGsenIbKqHhTAVvrPaY9WM70ep6jjNcSmjI1OGJLY= X-Google-Smtp-Source: APXvYqx+JN4I3/IalkrGZ0FuvEaYJYKYtsyiOVNntdvp7BfshG1Ndq1b/I9+tOoOQYawzHXEiIo5h7dc5UCsyAz5EeY= X-Received: by 2002:a9d:7284:: with SMTP id t4mr23698444otj.154.1560237799684; Tue, 11 Jun 2019 00:23:19 -0700 (PDT) MIME-Version: 1.0 From: Pip Cet Date: Tue, 11 Jun 2019 07:22:41 +0000 Message-ID: Subject: 27.0.50; `select-frame-set-input-focus' moves mouse pointer outside of frame To: bug-gnu-emacs@gnu.org Content-Type: multipart/mixed; boundary="000000000000d0fc1e058b072b0c" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::335 X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --000000000000d0fc1e058b072b0c Content-Type: text/plain; charset="UTF-8" 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. --000000000000d0fc1e058b072b0c Content-Type: text/x-patch; charset="US-ASCII"; name="emacs-patch-2.diff" Content-Disposition: attachment; filename="emacs-patch-2.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jwrh968c0 ZGlmZiAtLWdpdCBhL2xpc3AvZnJhbWUuZWwgYi9saXNwL2ZyYW1lLmVsCmluZGV4IGE4YzIzMGNi N2IuLjdiNjEwMDNjOWEgMTAwNjQ0Ci0tLSBhL2xpc3AvZnJhbWUuZWwKKysrIGIvbGlzcC9mcmFt ZS5lbApAQCAtOTc5LDEwICs5NzksMTEgQEAgc2VsZWN0LWZyYW1lLXNldC1pbnB1dC1mb2N1cwog ICA7OyBNb3ZlIG1vdXNlIGN1cnNvciBpZiBuZWNlc3NhcnkuCiAgIChjb25kCiAgICAobW91c2Ut YXV0b3NlbGVjdC13aW5kb3cKLSAgICAobGV0ICgoZWRnZXMgKHdpbmRvdy1pbnNpZGUtZWRnZXMg KGZyYW1lLXNlbGVjdGVkLXdpbmRvdyBmcmFtZSkpKSkKKyAgICAobGV0ICgoZWRnZXMgKHdpbmRv dy1lZGdlcyAoZnJhbWUtc2VsZWN0ZWQtd2luZG93IGZyYW1lKQorICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIHQgbmlsIHQpKSkKICAgICAgIDs7IE1vdmUgbW91c2UgY3Vyc29yIGludG8g RlJBTUUncyBzZWxlY3RlZCB3aW5kb3cgdG8gYXZvaWQgdGhhdAogICAgICAgOzsgRW1hY3MgbW91 c2UtYXV0b3NlbGVjdHMgYW5vdGhlciB3aW5kb3cuCi0gICAgICAoc2V0LW1vdXNlLXBvc2l0aW9u IGZyYW1lIChudGggMiBlZGdlcykgKG50aCAxIGVkZ2VzKSkpKQorICAgICAgKHNldC1tb3VzZS1w aXhlbC1wb3NpdGlvbiBmcmFtZSAoMS0gKG50aCAyIGVkZ2VzKSkgKG50aCAxIGVkZ2VzKSkpKQog ICAgKGZvY3VzLWZvbGxvd3MtbW91c2UKICAgICA7OyBNb3ZlIG1vdXNlIGN1cnNvciBpbnRvIEZS QU1FIHRvIGF2b2lkIHRoYXQgYW5vdGhlciBmcmFtZSBnZXRzCiAgICAgOzsgc2VsZWN0ZWQgYnkg dGhlIHdpbmRvdyBtYW5hZ2VyLgo= --000000000000d0fc1e058b072b0c-- ------------=_1560350464-12858-1--