From unknown Sun Jun 22 17:10:52 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#18429 <18429@debbugs.gnu.org> To: bug#18429 <18429@debbugs.gnu.org> Subject: Status: 24.3; Emacs window doubles in size upon second focus on high-DPI display Reply-To: bug#18429 <18429@debbugs.gnu.org> Date: Mon, 23 Jun 2025 00:10:52 +0000 retitle 18429 24.3; Emacs window doubles in size upon second focus on high-= DPI display reassign 18429 emacs submitter 18429 Anders Kaseorg severity 18429 normal tag 18429 fixed thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 08 14:37:30 2014 Received: (at submit) by debbugs.gnu.org; 8 Sep 2014 18:37:30 +0000 Received: from localhost ([127.0.0.1]:34075 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XR3of-00056C-55 for submit@debbugs.gnu.org; Mon, 08 Sep 2014 14:37:29 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45852) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XR3oc-00055t-UQ for submit@debbugs.gnu.org; Mon, 08 Sep 2014 14:37:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XR3oQ-00056h-JL for submit@debbugs.gnu.org; Mon, 08 Sep 2014 14:37:21 -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 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:41121) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XR3oQ-00056d-Gj for submit@debbugs.gnu.org; Mon, 08 Sep 2014 14:37:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XR3oJ-0001Db-Tq for bug-gnu-emacs@gnu.org; Mon, 08 Sep 2014 14:37:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XR3oA-0004yT-QE for bug-gnu-emacs@gnu.org; Mon, 08 Sep 2014 14:37:07 -0400 Received: from dmz-mailsec-scanner-2.mit.edu ([18.9.25.13]:58637) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XR3oA-0004xz-Fv for bug-gnu-emacs@gnu.org; Mon, 08 Sep 2014 14:36:58 -0400 X-AuditID: 1209190d-f79c06d000006f95-78-540df74991d8 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) (using TLS with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP id D0.74.28565.947FD045; Mon, 8 Sep 2014 14:36:57 -0400 (EDT) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id s88Iavvw004069 for ; Mon, 8 Sep 2014 14:36:57 -0400 Received: from localhost (buzzword-bingo.mit.edu [18.9.64.24]) (authenticated bits=0) (User authenticated as andersk@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s88IatNE026329 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Mon, 8 Sep 2014 14:36:56 -0400 Date: Mon, 8 Sep 2014 14:36:55 -0400 (EDT) From: Anders Kaseorg To: bug-gnu-emacs@gnu.org Subject: 24.3; Emacs window doubles in size upon second focus on high-DPI display Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNIsWRmVeSWpSXmKPExsUixCmqrOv5nTfE4N0SPYvvB6ocGD3appkF MEZx2aSk5mSWpRbp2yVwZayc+4CtoF+h4vK9/ywNjNOluxg5OSQETCTm/D3DCmGLSVy4t56t i5GLQ0hgNpPEuQm7GCGcM4wSDfv+MEE415gkurYsZQNpYRHQkmg9P4sFxGYTUJP4cPQr2CgR AUmJr3dawWxhgWCJW5tXMoPYvAIeEh/+zQGrFxXQlTj07w8bRFxQ4uTMJ2BxZgF1iQOfLjJC 2NoS92+2sU1g5JuFpGwWkrJZSMoWMDKvYpRNya3SzU3MzClOTdYtTk7My0st0jXSy80s0UtN Kd3ECA4xSd4djO8OKh1iFOBgVOLhTbjKEyLEmlhWXJl7iFGSg0lJlHfbR94QIb6k/JTKjMTi jPii0pzU4kOMEhzMSiK8Ty8D5XhTEiurUovyYVLSHCxK4rxvra2ChQTSE0tSs1NTC1KLYLIy HBxKEryF34AaBYtS01Mr0jJzShDSTBycIMN5gIYHgNTwFhck5hZnpkPkTzEacyxY8aGXiWNd 57d+JiGWvPy8VClxXnWQUgGQ0ozSPLhpsDTxilEc6Dlh3kCQKh5gioGb9wpoFRPQqknBYKtK EhFSUg2MAb/N37f/kKnt0uTfV2p/j+GZ6bvH4u+C9Iy8z0zy+FuzbMl923+/SjReBq54Y+Zp bPOtRTwubvVjoUWVt3yfXggMOPbpobpUeugU4wcdH+92NnyLMZ3taR2q8ClO+MO+nJSGiJ66 ZfW/my4s7GN3LpGaqV/OVLU/2ZLXxNh4e1FVliiX/BMlluKMREMt5qLiRACUBbwx7gIAAA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -4.0 (----) This bug report will be sent to the Bug-GNU-Emacs mailing list and the GNU bug tracker at debbugs.gnu.org. Please check that the From: line contains a valid email address. After a delay of up to one day, you should receive an acknowledgment at that address. Please write in English if possible, as the Emacs maintainers usually do not have translators for other languages. Please describe exactly what actions triggered the bug, and the precise symptoms of the bug. If you can, give a recipe starting from `emacs -Q': 1. Start emacs -Q on a high-DPI display. (Mine is a 15.6=E2=80=B3 display running at 3840=C3=972160, and GNOME automatically selects a scaling factor of 2.) 2. Unfocus the Emacs window. 3. Refocus the Emacs window. The window doubles in size! (As far as I can tell, this only happens the second time Emacs is focused.) If Emacs crashed, and you have the Emacs process in the gdb debugger, please include the output from the following gdb commands: `bt full' and `xbacktrace'. For information about debugging Emacs, please read the file /usr/share/emacs/24.3/etc/DEBUG. In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.12.2) of 2014-09-08 on lgw01-01, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.11501000 System Description:=09Ubuntu Utopic Unicorn (development branch) Configured using: `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu' '--prefix=3D/usr' '--sharedstatedir=3D/var/lib' '--libexecdir=3D/usr/lib' '--localstatedir=3D/var/lib' '--infodir=3D/usr/share/info' '--mandir=3D/usr/share/man' '--with-pop=3Dyes' '--enable-locallisppath=3D/etc/emacs24:/etc/emacs:/usr/local/share/emacs/2= 4.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-l= isp:/usr/share/emacs/site-lisp' '--with-crt-dir=3D/usr/lib/x86_64-linux-gnu' '--with-x=3Dyes' '--with-x-toolkit=3Dgtk3' '--with-toolkit-scroll-bars' 'build_alias=3Dx86_64-linux-gnu' 'CFLAGS=3D-g -O2 -fstack-protector-strong -Wformat -Werror=3Dformat-security -Wall' 'LDFLAGS=3D-Wl,-Bsymbolic-functions -Wl,-z,relro' 'CPPFLAGS=3D-D_FORTIFY_SOURCE=3D2'' Important settings: value of $LC_MONETARY: en_US.UTF-8 value of $LC_NUMERIC: en_US.UTF-8 value of $LC_TIME: en_US.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=3Duim locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: (only . t) Recent input: M-x r e p o r t - b u=20 g Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 21 01:28:41 2014 Received: (at 18429) by debbugs.gnu.org; 21 Oct 2014 05:28:41 +0000 Received: from localhost ([127.0.0.1]:57667 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XgRzs-0004KP-T8 for submit@debbugs.gnu.org; Tue, 21 Oct 2014 01:28:41 -0400 Received: from dmz-mailsec-scanner-8.mit.edu ([18.7.68.37]:64903) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XgRzq-0004K6-0B for 18429@debbugs.gnu.org; Tue, 21 Oct 2014 01:28:38 -0400 X-AuditID: 12074425-f79e46d000002583-b8-5445ef004bab Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) (using TLS with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP id 79.13.09603.00FE5445; Tue, 21 Oct 2014 01:28:32 -0400 (EDT) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id s9L5SVkl024308 for <18429@debbugs.gnu.org>; Tue, 21 Oct 2014 01:28:32 -0400 Received: from localhost (buzzword-bingo.mit.edu [18.9.64.24]) (authenticated bits=0) (User authenticated as andersk@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s9L5SUBG029090 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for <18429@debbugs.gnu.org>; Tue, 21 Oct 2014 01:28:31 -0400 Date: Tue, 21 Oct 2014 01:28:30 -0400 (EDT) From: Anders Kaseorg To: 18429@debbugs.gnu.org Subject: Re: 24.3; Emacs window doubles in size upon second focus on high-DPI display Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGIsWRmVeSWpSXmKPExsUixG6nosvw3jXEYPEbVYt5Py8zOjB6XJy0 jzmAMYrLJiU1J7MstUjfLoEr48VBxYKnjBW7O7+yNDDuYOxi5OSQEDCRWHv2DzOELSZx4d56 ti5GLg4hgdlMEjvXnGeCcM4ySjS8mQvlXGeS2HN6ERNIC4uAtsT23cvZQGw2ATWJD0e/soLY IgKSEk0r17CA2MIC4RIdt9aD2bwCHhIvvm9hB7FFBXQlDv37wwYRF5Q4OfMJWA2zgLrEgU8X GSFsbYn7N9vYJjDyzUJSNgtJ2SwkZQsYmVcxyqbkVunmJmbmFKcm6xYnJ+blpRbpWujlZpbo paaUbmIEB5mL6g7GCYeUDjEKcDAq8fBuWOYaIsSaWFZcmXuIUZKDSUmUN/slUIgvKT+lMiOx OCO+qDQntfgQowQHs5II798YoBxvSmJlVWpRPkxKmoNFSZx30w++ECGB9MSS1OzU1ILUIpis DAeHkgTv/LdAjYJFqempFWmZOSUIaSYOTpDhPEDDn4LU8BYXJOYWZ6ZD5E8x6nK0NL3tZRJi ycvPS5US510CUiQAUpRRmgc3B5YcXjGKA70lzNsNUsUDTCxwk14BLWECWvJ5gwvIkpJEhJRU A2P7N2Pfuw67ph11cLDcHrDr59Mfl+bq7fxczHVD4sKkbBWZYoPyQy1qCj/flMkyByw/yqf6 vcLHU7iq6Fyu/qu4ZSnqP+9+k3qlf19OweTDKsMJu9i3WDw1WVhbkKwzKcErfHe568QwBfMH 8if11lWy3Zp6UuRxqPS5Az2/TVOW/OpImP+x/JkSS3FGoqEWc1FxIgBYAD8M6QIAAA== X-Spam-Score: -3.7 (---) X-Debbugs-Envelope-To: 18429 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -3.7 (---) Things seems to be somewhat better in 24.4. The initial window size is=20 still double what it should be (about 160 chars wide instead of 80), but=20 at least it doesn=E2=80=99t double in size again when refocused. Anders From debbugs-submit-bounces@debbugs.gnu.org Thu May 14 11:31:33 2015 Received: (at 18429) by debbugs.gnu.org; 14 May 2015 15:31:33 +0000 Received: from localhost ([127.0.0.1]:45220 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ysv6i-0000FT-1q for submit@debbugs.gnu.org; Thu, 14 May 2015 11:31:32 -0400 Received: from mailfe09.swip.net ([212.247.155.1]:46375 helo=swip.net) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ysv6e-0000BZ-Rp for 18429@debbugs.gnu.org; Thu, 14 May 2015 11:31:29 -0400 X-T2-Spam-Status: No, hits=0.8 required=5.0 tests=BAYES_50 Received: from hosdjarv.se (account mj138573@tele2.se [46.59.42.57] verified) by mailfe09.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 423495051; Thu, 14 May 2015 17:31:20 +0200 Message-ID: <5554BFC8.9060901@swipnet.se> Date: Thu, 14 May 2015 17:31:20 +0200 From: =?UTF-8?B?SmFuIERqw6Rydg==?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Anders Kaseorg , 18429@debbugs.gnu.org Subject: Re: bug#18429: 24.3; Emacs window doubles in size upon second focus on high-DPI display References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 18429 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -0.0 (/) Den 2014-10-21 07:28, Anders Kaseorg skrev: > Things seems to be somewhat better in 24.4. The initial window size is > still double what it should be (about 160 chars wide instead of 80), but > at least it doesn’t double in size again when refocused. > Its the gnome scaling factor of 2 that does it. Emacs is only partly a Gtk+ application. The Gtk+ parts scale, but the Emacs text parts does not. Jan D. From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 12 17:10:58 2015 Received: (at 18429) by debbugs.gnu.org; 12 Oct 2015 21:10:58 +0000 Received: from localhost ([127.0.0.1]:37556 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZlkMz-00073i-Fp for submit@debbugs.gnu.org; Mon, 12 Oct 2015 17:10:57 -0400 Received: from mail-io0-f170.google.com ([209.85.223.170]:34007) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZlkMx-00073R-84; Mon, 12 Oct 2015 17:10:55 -0400 Received: by iow1 with SMTP id 1so1394851iow.1; Mon, 12 Oct 2015 14:10:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type; bh=/aPe9rmSDBXVRJR/74k5aFwqTd2UEqSAG0Y3Db3mmH8=; b=fhoGXgpjmmbD77BLLd7WiMBj1qmu4JuxJL4MDmK3a9nY/5Pa+mpG3NxMUIsywT3x17 HEfn5X52k3VL68YLqbP/H5BVUjYLpUbHmgC/j/Jt1Voa7b1gN6BkTD0d34LjE2D6l+Zv Z4u/AwufRhr/Nc9rSQ++DjXQh0BGrD4MyLKGVKoKGc9iox+LXpsy8IBO99QWpnJKrzgR c+CvGUTdH6+L2E9GocePR5ZX704xw/iyBxumNKJrj9PznkM32ZORE1iJrNJgEpXtIYk8 CTUAeOHEiAh2wys5GY+lQY9PGqA7pNx4CwKcrSSXbyHRhfQ4+JmZpmWKbYa8hy6W+aQ8 K5ww== X-Received: by 10.107.148.72 with SMTP id w69mr35411639iod.82.1444684254816; Mon, 12 Oct 2015 14:10:54 -0700 (PDT) Received: from ryan-XPS-13-9343 ([137.28.231.82]) by smtp.gmail.com with ESMTPSA id t7sm107640igz.10.2015.10.12.14.10.53 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 12 Oct 2015 14:10:53 -0700 (PDT) From: Ryan Prior To: 21348@debbugs.gnu.org Subject: Re: bug#21348: 25.0.50; Screen scaling factor >=2 causes menus, tooltips to display in the wrong place In-Reply-To: (Ryan Prior's message of "Tue, 25 Aug 2015 17:51:28 -0500") References: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Date: Mon, 12 Oct 2015 16:10:52 -0500 Message-ID: <86twpvhjxf.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 18429 Cc: 20619@debbugs.gnu.org, 18429@debbugs.gnu.org, 21469@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -0.7 (/) --=-=-= Content-Type: text/plain I wrote a patch to fix the issues from bugs #20619 and #21348 for GTK users. When the functions to display a tooltip or menu are called, Emacs scales coordinates using a factor from GTK. In my testing, non-GTK tooltips and menus weren't broken, so the problem is specific to GTK and the patch has no effect on non-GTK builds. Michael Droettboom, will you apply this patch and verify that the menus are now placed correctly on your system? There's something else entirely going on with the scroll bars in bug #21469, this patch doesn't address that at all. I had never noticed that hidpi bug because I dont use scroll bars, but I can confirm that turning on scroll bars causes strange behavior. It might be possible that a similar scaling strategy for scroll bar placement could provide a fix, so I CC'd that bug. I will investigate that more as time allows. The final hidpi bug I looked at, #18429, I am unable to reproduce. Perhaps it is not applicable to my platform - I'm on Ubuntu Trusty, while the reporter is on Utopic. Anders Kaseorg, can you still reproduce the bug? Finally, there's the open question of why the coordinates these functions are getting are doubled in the first place. Given my limited familiarity with Emacs internals, I have not made any progress on that question. Perhaps there are few enough places where these sometimes-inflated coordinates are passed into GTK that we can just scale them everywhere and call it good enough. Or perhaps there's a more robust solution somewhere else - if anybody can help explain this to me, I would be appreciative. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Adjust-overlay-position-on-hidpi-screens.patch Content-Description: patch to fix bugs #21348, #20619 >From 3addec3d592b9fc81e2a1503a37ccb078f03118c Mon Sep 17 00:00:00 2001 From: Ryan Prior Date: Fri, 2 Oct 2015 19:22:28 -0500 Subject: [PATCH] Adjust overlay position on hidpi screens Scale the display positions of tooltips and menus according to the window scaling factor provided by GTK3, if it is available (Bug#21348). * src/gtkutil.h (xg_scale_x_y_with_widget): * src/gtkutil.c (xg_scale_x_y_with_widget): Fuction finds scaling factor and performs scaling. (xg_show_tooltip): Divide position of tooltip by scaling factor. * src/xmenu.c (create_and_show_popup_menu) [HAVE_GTK3]: Divide position of native GTK3 menus by scaling factor. --- src/gtkutil.c | 14 ++++++++++++++ src/gtkutil.h | 4 ++++ src/xmenu.c | 6 ++++++ 3 files changed, 24 insertions(+) diff --git a/src/gtkutil.c b/src/gtkutil.c index 34e81b5..db80b2e 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -748,6 +748,7 @@ xg_show_tooltip (struct frame *f, int root_x, int root_y) if (x->ttip_window) { block_input (); + xg_scale_x_y_with_widget(GTK_WIDGET(x->ttip_window), &root_x, &root_y); gtk_window_move (x->ttip_window, root_x, root_y); gtk_widget_show_all (GTK_WIDGET (x->ttip_window)); unblock_input (); @@ -3223,6 +3224,19 @@ xg_update_submenu (GtkWidget *submenu, return newsub; } +/* Scale X and Y. + WIDGET the gtk widget from which to get the scaling factor */ +void +xg_scale_x_y_with_widget (GtkWidget *widget, + int *x, + int *y) +{ + gint scale_factor = gtk_widget_get_scale_factor(widget); + if(x) *x /= scale_factor; + if(y) *y /= scale_factor; +} + + /* Update the MENUBAR. F is the frame the menu bar belongs to. VAL describes the contents of the menu bar. diff --git a/src/gtkutil.h b/src/gtkutil.h index 34338db..8db063a 100644 --- a/src/gtkutil.h +++ b/src/gtkutil.h @@ -96,6 +96,10 @@ extern GtkWidget *xg_create_widget (const char *type, GCallback deactivate_cb, GCallback highlight_cb); +extern void xg_scale_x_y_with_widget (GtkWidget *widget, + int *x, + int *y); + extern void xg_modify_menubar_widgets (GtkWidget *menubar, struct frame *f, struct _widget_value *val, diff --git a/src/xmenu.c b/src/xmenu.c index 192ed89..1b7bbb5 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -1229,6 +1229,12 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv, /* Child of win. */ &dummy_window); +#ifdef HAVE_GTK3 + /* Use window scaling factor to adjust position for hidpi screens. */ + xg_scale_x_y_with_widget(GTK_WIDGET(f->output_data.x->ttip_window), + &x, + &y); +#endif unblock_input (); popup_x_y.x = x; popup_x_y.y = y; -- 2.6.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 13 11:51:50 2015 Received: (at 18429) by debbugs.gnu.org; 13 Oct 2015 15:51:50 +0000 Received: from localhost ([127.0.0.1]:38924 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zm1rh-0001QA-RF for submit@debbugs.gnu.org; Tue, 13 Oct 2015 11:51:50 -0400 Received: from mout.gmx.net ([212.227.17.20]:60951) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zm1rf-0001Pq-MN; Tue, 13 Oct 2015 11:51:48 -0400 Received: from [188.22.238.113] ([188.22.238.113]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0LgI0W-1aOePO1GlQ-00neDu; Tue, 13 Oct 2015 17:51:46 +0200 Message-ID: <561D288E.7070803@gmx.at> Date: Tue, 13 Oct 2015 17:51:42 +0200 From: martin rudalics MIME-Version: 1.0 To: Ryan Prior , 21348@debbugs.gnu.org Subject: Re: bug#21469: bug#21348: 25.0.50; Screen scaling factor >=2 causes menus, tooltips to display in the wrong place References: <86twpvhjxf.fsf@gmail.com> In-Reply-To: <86twpvhjxf.fsf@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K0:8j+pBGyt3wE2IIIUEUy160DB8nnWh1Lo0JYNZ0vp1PZbJX+51cj 0D9YCh5xN43XuXrzPcEXV0icSu1mLF1knjFg0Z9SYTT9yjhS+h7wbIhFjWLpAX5LKfAXyAU Yi8aRnwGDCr17yVvyXNDihEERH5HUB0cKH3iiwKnBt7YiazvYjQr+2de29ykbDdtjZeYMfH DEeIftd//23U3BUMJPgaw== X-UI-Out-Filterresults: notjunk:1;V01:K0:opKyW66IunQ=:rUMwifr2d0GCbKulKPz5WB WF80fIGQLHj9xf0/R1tqufJmcKbYbzdaB+b66X8SwTWxKFf+2sQKcAMAs1pxQKuQMGeIScWlC qFCDcXw95bEGzVTMpPBAqw5FIRlPxPYIwwv7VqntAu/VNhp9DCyr9CUGuBSgUgCp+VPfx50xE Q9ODeHCGJmL/oxf7r3N5Am3mXYr+3KwCFwyltWzS3iDk1RF4Zrkg0pjhpKe0fUfBFUv/A5SaS fKvMO0NmcJXhMIIStkvisIL6DT32UPNMHzeXV/walmwcMNOwOwVyKpdYBo0+fTW9xjK+kMsuI kR5/eRJ8xhB19HiZGdiST1UmG1/qQwQ2ZrpbwbzKF+cwxx4Yg4+IbqGaf3JKyFVvMCBqT27s6 hmfE1ctno2s2OnOoXdoAQM04sGJUo1T4srAJq5pA3kCodAeuWT8U/fIaDDNpdd+BKVM6gD1St zVf4MX7OeYBU63mYxSqYMye9cbtjQdoU3QfSwAMGG3w4EEXdovXkwsp+fmh4LzCxtfvYqbQlP KroB5bP4opjNWbN2Jitpdxfuym5oVnzogogZ/M4znQN0bWaPRS6io7TFbQJm2QZJMfjBupiGV bileDw/dLtQKguouZd5eBIvsnqZyrk68K2NNWcaIi7/wWQuK3c/Q90iluLseXZCLjM2Uau1/o VPMCLpgPiNO0i5neRwrGkOfhRWi1VIurPAKsHXiLBcbZShhcS15Ar6P94Yaju6R3tqLKDrkvg TWFdGr9qLOTdtStHyxLSmIuQZKwtQre9vrvPZdDTOZmpZoPpUPTwD1yka2HgxuFCIOd7dk1dP M6el7rH X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 18429 Cc: 20619@debbugs.gnu.org, 18429@debbugs.gnu.org, 21469@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -0.7 (/) > I wrote a patch to fix the issues from bugs #20619 and #21348 for GTK > users. When the functions to display a tooltip or menu are called, Ema= cs > scales coordinates using a factor from GTK. In my testing, non-GTK > tooltips and menus weren't broken, so the problem is specific to GTK a= nd > the patch has no effect on non-GTK builds. Thank you very much Ryan. Your help is very appreciated. > Michael Droettboom, will you > apply this patch and verify that the menus are now placed correctly on= > your system? Michael, pretty please, do that. If you have any problems applying the patch or building Emacs, please tell us. It would be great to fix and test this before the release. > There's something else entirely going on with the scroll bars in bug > #21469, this patch doesn't address that at all. I had never noticed th= at > hidpi bug because I dont use scroll bars, but I can confirm that turni= ng > on scroll bars causes strange behavior. Is the behavior you see "consistent"? Robert's screenhots seem to tell that the x-position of each scrollbar is always twice of what it should be. > It might be possible that a > similar scaling strategy for scroll bar placement could provide a fix,= > so I CC'd that bug. I will investigate that more as time allows. That would be great. > The final hidpi bug I looked at, #18429, I am unable to > reproduce. Perhaps it is not applicable to my platform - I'm on Ubuntu= > Trusty, while the reporter is on Utopic. Anders Kaseorg, can you still= > reproduce the bug? Let's hope that Anders is listening. > Finally, there's the open question of why the coordinates these > functions are getting are doubled in the first place. Given my limited= > familiarity with Emacs internals, I have not made any progress on that= > question. Perhaps there are few enough places where these > sometimes-inflated coordinates are passed into GTK that we can just > scale them everywhere and call it good enough. I don't see any problems with such a solution. > Or perhaps there's a more > robust solution somewhere else - if anybody can help explain this to m= e, > I would be appreciative. Are the frame parameters =E2=80=98top=E2=80=99 and =E2=80=98left=E2=80=99= affected? Suppose you do say (set-frame-parameter nil 'left 500) with scaling in effect. Does the frame appear 500 pixels left of the left screen edge? If not, then mouse warping (=E2=80=98set-mouse-absolute-pixel-position=E2=80=99) is pr= obably affected too and we really have to look into a more generic solution. martin From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 13 12:35:21 2015 Received: (at 18429) by debbugs.gnu.org; 13 Oct 2015 16:35:21 +0000 Received: from localhost ([127.0.0.1]:38956 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zm2Xl-0002Xz-S4 for submit@debbugs.gnu.org; Tue, 13 Oct 2015 12:35:20 -0400 Received: from mail-yk0-f170.google.com ([209.85.160.170]:34180) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zm2Xi-0002Xe-UZ; Tue, 13 Oct 2015 12:35:15 -0400 Received: by ykdg206 with SMTP id g206so22204493ykd.1; Tue, 13 Oct 2015 09:35:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=Aw6lc+XRdcLkjToCPFhWG+oZoVjiAjgUYXnYCMxXzgg=; b=m2c+7ytCb8aAu4INey9WI8+j2LTMROzwdcn7mTB6wi5uFHLwJA9/+isSG9hyBb6Ycz gYQw24U1XTTOgHxWxWTDwVhYCQHr/1bblS5gSI29XiLaF54AIGdmao8i3eb/AdRGxw2Z LIQDDQ70ojKs2+qsYGRC6NcuHpsgMFZlYah6Aq02Xx9/+1oaMqjulhSlwE8SM3+2uUji FDUIArx2rxIAhqsrX2OVeeGOAxKP9rYvd5wSe/9nXgZi1ZBqa5Ert1JnZEYEzDKsTpfn mWUTTyJRzBRBtYJc8yGYpVqzXZJkQ8+eiWG2OBGy/wdJPYy3VFEIgVZfUeGOb/ad9tti 4vpA== X-Received: by 10.13.217.80 with SMTP id b77mr28126999ywe.339.1444754114341; Tue, 13 Oct 2015 09:35:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.87.193 with HTTP; Tue, 13 Oct 2015 09:34:34 -0700 (PDT) In-Reply-To: <561D288E.7070803@gmx.at> References: <86twpvhjxf.fsf@gmail.com> <561D288E.7070803@gmx.at> From: Ryan Prior Date: Tue, 13 Oct 2015 11:34:34 -0500 Message-ID: Subject: Re: bug#21469: bug#21348: 25.0.50; Screen scaling factor >=2 causes menus, tooltips to display in the wrong place To: martin rudalics Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 18429 Cc: 20619@debbugs.gnu.org, 18429@debbugs.gnu.org, 21348@debbugs.gnu.org, 21469@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -0.7 (/) On Tue, Oct 13, 2015 at 10:51 AM, martin rudalics wrote: > Are the frame parameters =E2=80=98top=E2=80=99 and =E2=80=98left=E2=80=99= affected? Suppose you do say > (set-frame-parameter nil 'left 500) with scaling in effect. Does the > frame appear 500 pixels left of the left screen edge? If not, then > mouse warping (=E2=80=98set-mouse-absolute-pixel-position=E2=80=99) is pr= obably affected > too and we really have to look into a more generic solution. I spent some time playing with frame positions. TABLE: `(set-frame-parameter nil 'left ,x) _____________________________________________ x | actual frame distance from left screen edge (px) 0 | 20 500 | 520 1600 | 1620 1800 | 1772 2000 | 1772 A few observations: 1) offset of 20 pixels I've never noticed this issue because it doesn't affect maximized frames. Maybe that number 20 is significant somehow, or perhaps this is a separate bug. The first time after I start `emacs -Q` and set the left frame edge to 0, the frame flashes momentarily into place flush with the left screen edge, for perhaps a single video frame, and then jumps 20 pixels to the right. Subsequent calls to set the left frame edge to 0 do not trigger this flashing behavior. 2) numbers are proportional, modulo the unexplained offset We do not see doubling behavior here. I have added no scaling code pertaining to frame positioning. 3) frame "sticks" to the right screen edge Given the width of the frame I was testing with, when the left frame edge is 1772 pixels from the left screen edge, the right frame edge is flush with the right screen edge. Setting the left frame edge to a greater value does not result in a further movement of the frame. l appreciate any help with corroboration and analysis of these results. Yours, Ryan From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 13 13:21:52 2015 Received: (at 18429) by debbugs.gnu.org; 13 Oct 2015 17:21:52 +0000 Received: from localhost ([127.0.0.1]:38992 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zm3Gp-0003e0-Bo for submit@debbugs.gnu.org; Tue, 13 Oct 2015 13:21:51 -0400 Received: from mout.gmx.net ([212.227.17.22]:59895) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zm3Gl-0003dR-3i; Tue, 13 Oct 2015 13:21:47 -0400 Received: from [188.22.238.113] ([188.22.238.113]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0Lkiqm-1aKHYj42dg-00aSNp; Tue, 13 Oct 2015 19:21:46 +0200 Message-ID: <561D3DA5.9000801@gmx.at> Date: Tue, 13 Oct 2015 19:21:41 +0200 From: martin rudalics MIME-Version: 1.0 To: Ryan Prior Subject: Re: bug#21469: bug#21348: 25.0.50; Screen scaling factor >=2 causes menus, tooltips to display in the wrong place References: <86twpvhjxf.fsf@gmail.com> <561D288E.7070803@gmx.at> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K0:55H+aAeVjtvLuHXy8ztASJu8BAqKGuypfFlEeEaJovFSpATIPJh lej5hcbZwBhuXW6nAOTYcuuj/JQwhdGfuG0azlhGbRp6e+Go35EaR61hzwsASGDawzI4U3v d+fPlGo9p3P8MMYK6I7gsb1yFvTpfhTKEy6qPfadPnJGvMubpCqdmTyyWoy+pq+EaC2Jbfm oSebKsVgO7P+QprKn//Rw== X-UI-Out-Filterresults: notjunk:1;V01:K0:KnKuE9vOKBs=:Y6VDbJTqwowo4MH2W4zvoy 428/0lN7grKqvxeczOLwuwJCu1SAf4k7Rz5yWmODAzRHnyqwKo0TisvjNTLem5HU0KgOjpiXR QP5PxfEj/1/7Sk/dg1cuAfya3Emyx7RUeDPlasOdi3+lO5Y5o2yOcQnSUazrUY31RBmTr/Bue kOaCAYvLh9Dq7skcUUy2LjDFiwnhBoeKfXvki24x/dOMZsl5ejgY/HDwdesfTRirIUSt0mUP7 lfVasBGkK4ml86At1Erq0A8CzLwu1s8HSVq6NnnhoVFMlUmGcGi5/cANf/dWDDXHkOehXavGj 1gnbp3fOxIUIQqZnnkumQUE2PjgQAAr/jMErkJ3th6DTNRD4kSuXvctasMPcOUaSHBH9sOsEZ aGzzEpSJrz7rnW7FBPehLn11nGG8iGou6DuBtKBYoRAqn6HXCU9idBSaIAvUsHcB+pLpL+5NO UJ6ZImJzbcGU/vP40sIQDHIjltJwSFe1Pevc7bnN5jhXoJvnkkLwuwtZvtSJwK+sy30Vm1BN2 ob/wBtzp8m1Zp5moEY8GvfZr06X/hGorCFZDvDgRug4nIKjrql/jA98S7DpWMBS2PyLBMV5H6 NfU2VsucadN6e5bSRPm3/W6SbxnQV8oo+ogUiDjAWRMGvAPvXS9Et3PO06QZdQ7C0QvDQr1JQ JiAc0YIOb9K6L6EmaUZhGKQWXDKyO5LHBjdoLxvHx8fgGLddMMemxeckbr+SZt03H4jM4jsy4 rdnwaHe3Prze3IkuskkkgPbFGRXDBs9NUx0ixxfzlMnGpo4ETB/u1YUHLAzTd1+9GmZW93w+Z 09+kuvs X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 18429 Cc: 20619@debbugs.gnu.org, 18429@debbugs.gnu.org, 21348@debbugs.gnu.org, 21469@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -0.7 (/) > TABLE: `(set-frame-parameter nil 'left ,x) > _____________________________________________ > x | actual frame distance from left screen edge (px) > 0 | 20 > 500 | 520 > 1600 | 1620 > 1800 | 1772 > 2000 | 1772 > > A few observations: > 1) offset of 20 pixels > I've never noticed this issue because it doesn't affect maximized > frames. Maybe that number 20 is significant somehow, or perhaps this > is a separate bug. The first time after I start `emacs -Q` and set the= > left frame edge to 0, the frame flashes momentarily into place flush > with the left screen edge, for perhaps a single video frame, and then > jumps 20 pixels to the right. This might be window manager related. Can you try again with the =E2=80=98user-position=E2=80=99 frame parameter non-nil? Like (modify-frame-parameters nil '((left . 0) (user-position . t))) > Subsequent calls to set the left frame > edge to 0 do not trigger this flashing behavior. You mean on a subsequent attempt the frame is flushed left or still at position 20. What happens when you try something similar with the =E2=80= =98top=E2=80=99 parameter? > 2) numbers are proportional, modulo the unexplained offset > We do not see doubling behavior here. I have added no scaling code > pertaining to frame positioning. Does that mean the offset of 20 pixels appears with scaling turned off and on? > 3) frame "sticks" to the right screen edge > Given the width of the frame I was testing with, when the left frame > edge is 1772 pixels from the left screen edge, the right frame edge is= > flush with the right screen edge. Setting the left frame edge to a > greater value does not result in a further movement of the frame. So the window manager probably constrains frame positioning. What happens with a frame larger than the screen size? And does =E2=80=98set-mouse-absolute-pixel-position=E2=80=99 work normall= y? martin From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 17 11:01:18 2017 Received: (at control) by debbugs.gnu.org; 17 Jul 2017 15:01:18 +0000 Received: from localhost ([127.0.0.1]:44611 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dX7WQ-0008UQ-0S for submit@debbugs.gnu.org; Mon, 17 Jul 2017 11:01:18 -0400 Received: from hermes.netfonds.no ([80.91.224.195]:46050) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dX7WN-0008UH-Gy for control@debbugs.gnu.org; Mon, 17 Jul 2017 11:01:15 -0400 Received: from cm-84.209.243.26.getinternet.no ([84.209.243.26] helo=stories) by hermes.netfonds.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1dX7W6-0007X4-GX for control@debbugs.gnu.org; Mon, 17 Jul 2017 17:01:14 +0200 Date: Mon, 17 Jul 2017 17:00:57 +0200 Message-Id: To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #18429 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control 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: 0.0 (/) tags 18429 fixed close 18429 From unknown Sun Jun 22 17:10:52 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 15 Aug 2017 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator