unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jindřich Makovička" <makovick@gmail.com>
To: emacs-devel@gnu.org, jewalsh@redhat.com
Subject: [PATCH] src/pgtkterm.c: Honor system DPI settings
Date: Sat, 29 May 2021 10:32:10 +0200	[thread overview]
Message-ID: <20210529103210.67bb58bf@holly> (raw)

[-- Attachment #1: Type: text/plain, Size: 914 bytes --]

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

[-- Attachment #2: 0001-src-pgtkterm.c-Honor-system-DPI-settings.patch --]
[-- Type: text/x-patch, Size: 865 bytes --]

From f1c2ef5f5d59e259db9890d8528caf9ee3f007cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jind=C5=99ich=20Makovi=C4=8Dka?= <makovick@gmail.com>
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


             reply	other threads:[~2021-05-29  8:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-29  8:32 Jindřich Makovička [this message]
2021-05-30 11:09 ` [PATCH] src/pgtkterm.c: Honor system DPI settings Yuuki Harano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210529103210.67bb58bf@holly \
    --to=makovick@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=jewalsh@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).