From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?SmluZMWZaWNoIE1ha292acSNa2E=?= Newsgroups: gmane.emacs.devel Subject: [PATCH] src/pgtkterm.c: Honor system DPI settings Date: Sat, 29 May 2021 10:32:10 +0200 Message-ID: <20210529103210.67bb58bf@holly> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/=cu6qIzgpDGdoDk.VGcaDHQ" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25665"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org, jewalsh@redhat.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat May 29 11:03:07 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lmus7-0006Yn-5J for ged-emacs-devel@m.gmane-mx.org; Sat, 29 May 2021 11:03:07 +0200 Original-Received: from localhost ([::1]:35422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lmus6-00078X-8c for ged-emacs-devel@m.gmane-mx.org; Sat, 29 May 2021 05:03:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57712) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmuOF-0001j5-Vs for emacs-devel@gnu.org; Sat, 29 May 2021 04:32:16 -0400 Original-Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:45626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lmuOE-0000eF-DH for emacs-devel@gnu.org; Sat, 29 May 2021 04:32:15 -0400 Original-Received: by mail-wr1-x42d.google.com with SMTP id z8so391691wrp.12 for ; Sat, 29 May 2021 01:32:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version; bh=wb1lCE/jo+zfiJwB29eY4aYu+kLC5BNz18wU+jWIZgo=; b=iEmhoyV9ms3DHlxAVjk6pVhOse5gSUyIgCJu5n2auZJlTb2uUBRHuCfcdh8hguNrpV 8RR/WO6iU1hglSi5gquxH4lXR6OuPL5IBPCDMdmrvbF1ua0IPQ7vJt3jsIEAnwuwBDel 888BacbT9K/+rLA1m7UCdGT3KkVgagbXIb6qIPi0EPlFx3zOqE6SeoJv9vKrbUap2OKn 4kfzwAa8qHgckSKHUWG/iBLFQ48MQlB/eZcdoHSMs928A7yJ9MKajAsX9OW6NqNcc417 EGyEKb3u6nrtTL4ASRDeT3xpyHo95xksEdXGgihEQ5VbOsguD+0uHpROXSxdj0k8/OgD +OBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version; bh=wb1lCE/jo+zfiJwB29eY4aYu+kLC5BNz18wU+jWIZgo=; b=Ouv5RvTXv8JlRDMqi2Le6r6WeaQAFlRxHb79YaDpkwEjFPEf19bi603Qh477o9Cpqq 8LiqE7d8iKkWhbiu367b8UaWofncoWEfKDkrj0EaNm3GO9RFu934t231UX4Lbwin0V6j O1BW9VQJQkD8mmGPvgt+4Usfj9POwDL/Ui40DM4R+7iJ4/3LTD0nxp53X7ReDVZ2NUky JC0+YybaXi2fGHATY9805n7DmUQGtTj42ocA5UWu2Fgobfy41hg54vOz82+abKALFE01 31m6TU4FtQYeY/wYkeKCiIHQWVhXlE6C0Vghef6ZdrDNpnWoFJfBcdjWvPpQy12Eu2Lb xCgQ== X-Gm-Message-State: AOAM531ac8DAMZEMvO58aZtuoCzZKSPHKFxUWCOgwYqAPDhNVuFP8SX9 EX9xDSTKnqtoWdvHF6yv1mJ1KFxg02AyTQ== X-Google-Smtp-Source: ABdhPJx3AwJTXKbvjjK/9R7qYohH9Kk2LNEz8xeWGMzy/fMVkbme+bkd/yKWx6fID0fMNgBdNnZT2w== X-Received: by 2002:a5d:6e0d:: with SMTP id h13mr12856133wrz.118.1622277132021; Sat, 29 May 2021 01:32:12 -0700 (PDT) Original-Received: from holly (ip-89-177-165-220.net.upcbroadband.cz. [89.177.165.220]) by smtp.gmail.com with ESMTPSA id w8sm8958324wre.70.2021.05.29.01.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 May 2021 01:32:11 -0700 (PDT) X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=makovick@gmail.com; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 29 May 2021 05:02:34 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:270038 Archived-At: --MP_/=cu6qIzgpDGdoDk.VGcaDHQ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, unlike most of other GTK3 applications, including the current X11 Emacs, PGTK build of Emacs seems to ignore the system DPI settings, always forcing the DPI of 96. This makes the fonts much smaller, which is especially annoying in the GTK menus - other fonts can be configured in the Faces customization. I tried to change Emacs to retrieve the display resolution instead of enforcing 96 DPI, as in the attached patch, and it seems to work on my display with system DPI set to 130 - the menu font size returns to normal, and font scaling is consistent with regular X11 Emacs with the same configuration. I also tried the Broadway display with this patch, and Emacs has the same font scaling as other GTK3 apps, which is what one would expect. Could the attached patch be included in the PGTK branch, or is there some fundamental reason PGTK Emacs uses its own DPI settings? Regards, -- Jindrich Makovicka --MP_/=cu6qIzgpDGdoDk.VGcaDHQ Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-src-pgtkterm.c-Honor-system-DPI-settings.patch >From f1c2ef5f5d59e259db9890d8528caf9ee3f007cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jind=C5=99ich=20Makovi=C4=8Dka?= Date: Sat, 29 May 2021 09:44:39 +0200 Subject: [PATCH] * src/pgtkterm.c: Honor system DPI settings --- src/pgtkterm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pgtkterm.c b/src/pgtkterm.c index f79329f7dd..6f70fb92ce 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -6974,8 +6974,11 @@ #define NUM_ARGV 10 { GdkScreen *gscr = gdk_display_get_default_screen (dpyinfo->gdpy); - gdouble dpi = 96.0 * pgtk_text_scaling_factor(); - gdk_screen_set_resolution (gscr, dpi); + gdouble dpi = gdk_screen_get_resolution (gscr); + if (dpi < 0) + dpi = 96.0; + + dpi *= pgtk_text_scaling_factor(); dpyinfo->resx = dpi; dpyinfo->resy = dpi; } -- 2.32.0.rc0 --MP_/=cu6qIzgpDGdoDk.VGcaDHQ--