From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Tobias Bading Newsgroups: gmane.emacs.bugs Subject: bug#38402: [PATCH] Fix empty/incorrect GTK menus on HiDPI monitors with window scaling factor > 1 Date: Wed, 27 Nov 2019 16:59:39 +0100 Message-ID: <500cbb5f-b7e4-f809-d8fe-567e39e981fc@web.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------B29E641BEAC7050CB65CCF73" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="40311"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 To: 38402@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 27 17:02:40 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iZzm3-000ANM-Tw for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Nov 2019 17:02:40 +0100 Original-Received: from localhost ([::1]:39926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZzm2-0001hA-8C for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Nov 2019 11:02:38 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55349) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZzjY-00014J-Da for bug-gnu-emacs@gnu.org; Wed, 27 Nov 2019 11:00:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZzjW-0000PC-UJ for bug-gnu-emacs@gnu.org; Wed, 27 Nov 2019 11:00:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50129) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iZzjW-0000Ox-QN for bug-gnu-emacs@gnu.org; Wed, 27 Nov 2019 11:00:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iZzjW-0005pb-OK for bug-gnu-emacs@gnu.org; Wed, 27 Nov 2019 11:00:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tobias Bading Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Nov 2019 16:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 38402 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.157487039222371 (code B ref -1); Wed, 27 Nov 2019 16:00:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Nov 2019 15:59:52 +0000 Original-Received: from localhost ([127.0.0.1]:56102 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iZzjL-0005ok-Ns for submit@debbugs.gnu.org; Wed, 27 Nov 2019 10:59:52 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:45399) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iZzjK-0005od-I5 for submit@debbugs.gnu.org; Wed, 27 Nov 2019 10:59:50 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55310) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZzjI-0000jX-Q2 for bug-gnu-emacs@gnu.org; Wed, 27 Nov 2019 10:59:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZzjG-0000F6-Ox for bug-gnu-emacs@gnu.org; Wed, 27 Nov 2019 10:59:48 -0500 Original-Received: from mout.web.de ([212.227.17.11]:47179) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iZzjC-0000As-Sw for bug-gnu-emacs@gnu.org; Wed, 27 Nov 2019 10:59:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1574870379; bh=E/PbpuiPLZ+fupudQKXqXGG8Y068Qk47TQ+s1yP7amc=; h=X-UI-Sender-Class:To:From:Subject:Date; b=gs0ttUiWI44vvB4tR1WxFzLaeokzxvEhq0Bdk3XXOpy3JqmeXbHI2elrtBuWqCx3/ kKneP9rHe2HPu8/AWgIYGnxe3qOGPNOlICtif5F7L41HO9bnWVCplE39ADlpuw3xeO wTl0d1ps7TsM5TgFpC1pvwVYc8rSIDskIZF29sy0= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Original-Received: from [192.168.2.103] ([84.143.156.184]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MgO8g-1iCOZZ2iRi-00NeoI for ; Wed, 27 Nov 2019 16:59:39 +0100 Content-Language: en-US X-Provags-ID: V03:K1:mwnisxF4DQpw4TcoV+cdYa2mKIUBbVlM/Xs8Z8AleQFlX2/Htkv 4FsSOX8DBZwcvEHtfI99ZutHJy27J67qvOekaG2Hv9IhnbsEVRVGLP38Otbo3z4Thm6VMRO 1/mSQgv3j8zJ5Vq6sliTJuYKMtpYaUyvK3giXGPNTDe6K20RvlkuXUrvcKQ5gliq89QeI/h Y2bJz7++COvLzb5KLKJ+g== X-UI-Out-Filterresults: notjunk:1;V03:K0:IC+V6Y1jHN0=:xOLSgaTf03G8GCUAmTdMSi hCGEssBZ80BCHdieZezQUl32BsO37y8504jO+fLu4DBS8q6HCuMVGnWkUKpF8zdXWKQNAtkws vzCdJftcIezhfCsjhG9sdbQ0VEz/o4ahmfESoWS0Fr5f++lQOiszCeH3esM5yww7VRJic6M1M 4KndLBBfCZEV2js7a8yr5nZoBG+EGr0MNZHJRpa+AaaA4HIlmaGsGj85+FFynzkQgp5Jmrh6F UtTW01uh/c8/0sYW/GWZrCKQJ+W4ItxqKdiIs5kWC2zm3f1B7WJLsemBULqA3XSXk+uP96d29 ekh3QAuQQ94XCthJWEbo6M0bR3HgyCXzO35pAKFKq6L54m5eUTVal64Bv89OM3m+WuSAyQsze Ld3xFZ9nKIBJ/Y+C0jmUAERTram9ARHHXU6MkWOhCb6KifFVKGZ/ZUJOujUzMsF972Wuabpja XGPETph6qFRV8P0f9vYkOFWBfbfgIlkiEdm9a7BGexTWMszQY9vy6CKrAA3DYqUDeIJ/v+npW 26aYneZwui8t7dW/i46OED7OmgaHBzHmrV/X9zAR7IsT+rnsbtOFkh2rsHRIGzQaT/fDnfs9D jxvHpWh5Fg+jcHv8gKblrURwYUsSaHrPGI9tgyNmoDJzUesoXRsfAMRSmiRopR4h4S6RU7NpM 2h2xp6mZ9kIK9bqtJ16XHdY8igTks/9Y9tqSA5R90Ucu+i9f+tij8V47QuTUXo5vDSeKtJ2Xo RKnwi3KbBybi8r+iO2i6ANT6/S1NP+T7BEfOcpkhNbjDjtaPXPl6q83aXBIxIfOJAm79+ARd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:172544 Archived-At: This is a multi-part message in MIME format. --------------B29E641BEAC7050CB65CCF73 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable This should fix Bug#31223, Bug#28106, Bug#23672 as well as Ubuntu bug https://bugs.launchpad.net/ubuntu/+source/emacs25/+bug/1695228 Also fixes the formerly unscaled Y value returned by frame-monitor-workarea (and display-monitor-attributes-list). For details on why some GTK menus were empty please see thread https://lists.gnu.org/archive/html/emacs-devel/2019-11/msg01061.html * src/gtkutil.c =C2=A0 (menubar_map_cb): properly scale req.height so that the menu bar's =C2=A0 height is in device pixels as expected =C2=A0 (xg_update_frame_menubar): dito =C2=A0 (xg_event_is_for_menubar): properly scale rec.x and rec.y so that =C2=A0 gtk_widget_intersect() works as intended * src/xfns.c =C2=A0 (Fx_display_monitor_attributes_list): properly scale work.x and wo= rk.y --------------B29E641BEAC7050CB65CCF73 Content-Type: text/x-patch; charset=UTF-8; name="0001-Fix-empty-incorrect-GTK-menus-on-HiDPI-monitors.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="0001-Fix-empty-incorrect-GTK-menus-on-HiDPI-monitors.patch" =46rom ee5855067f50f6e208a960994eec7184d44d324e Mon Sep 17 00:00:00 2001 From: Tobias Bading Date: Wed, 27 Nov 2019 16:51:26 +0100 Subject: [PATCH] Fix empty/incorrect GTK menus on HiDPI monitors with wind= ow scaling factor > 1 This should fix Bug#31223, Bug#28106, Bug#23672 as well as Ubuntu bug https://bugs.launchpad.net/ubuntu/+source/emacs25/+bug/1695228 Also fixes the formerly unscaled Y value returned by frame-monitor-workarea (and display-monitor-attributes-list). For details on why some GTK menus were empty please see thread https://lists.gnu.org/archive/html/emacs-devel/2019-11/msg01061.html * src/gtkutil.c (menubar_map_cb): properly scale req.height so that the menu bar's height is in device pixels as expected (xg_update_frame_menubar): dito (xg_event_is_for_menubar): properly scale rec.x and rec.y so that gtk_widget_intersect() works as intended * src/xfns.c (Fx_display_monitor_attributes_list): properly scale work.x and work.y =2D-- src/gtkutil.c | 8 +++++--- src/xfns.c | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gtkutil.c b/src/gtkutil.c index cf5c31aa20..7e6db57c9d 100644 =2D-- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -3471,6 +3471,7 @@ menubar_map_cb (GtkWidget *w, gpointer user_data) GtkRequisition req; struct frame *f =3D user_data; gtk_widget_get_preferred_size (w, NULL, &req); + req.height *=3D xg_get_scale (f); if (FRAME_MENUBAR_HEIGHT (f) !=3D req.height) { FRAME_MENUBAR_HEIGHT (f) =3D req.height; @@ -3502,7 +3503,7 @@ xg_update_frame_menubar (struct frame *f) g_signal_connect (x->menubar_widget, "map", G_CALLBACK (menubar_map_cb)= , f); gtk_widget_show_all (x->menubar_widget); gtk_widget_get_preferred_size (x->menubar_widget, NULL, &req); - + req.height *=3D xg_get_scale (f); if (FRAME_MENUBAR_HEIGHT (f) !=3D req.height) { FRAME_MENUBAR_HEIGHT (f) =3D req.height; @@ -3568,8 +3569,9 @@ xg_event_is_for_menubar (struct frame *f, const XEve= nt *event) list =3D gtk_container_get_children (GTK_CONTAINER (x->menubar_widget))= ; if (! list) return 0; - rec.x =3D event->xbutton.x; - rec.y =3D event->xbutton.y; + int scale =3D xg_get_scale (f); + rec.x =3D event->xbutton.x / scale; + rec.y =3D event->xbutton.y / scale; rec.width =3D 1; rec.height =3D 1; diff --git a/src/xfns.c b/src/xfns.c index b1b40702c2..47aa19607f 100644 =2D-- a/src/xfns.c +++ b/src/xfns.c @@ -5093,6 +5093,8 @@ DEFUN ("x-display-monitor-attributes-list", Fx_displ= ay_monitor_attributes_list, #endif rec.width *=3D scale; rec.height *=3D scale; + work.x *=3D scale; + work.y *=3D scale; work.width *=3D scale; work.height *=3D scale; =2D- 2.20.1 --------------B29E641BEAC7050CB65CCF73--