all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] src/pgtkterm.c: Honor system DPI settings
@ 2021-05-29  8:32 Jindřich Makovička
  2021-05-30 11:09 ` Yuuki Harano
  0 siblings, 1 reply; 2+ messages in thread
From: Jindřich Makovička @ 2021-05-29  8:32 UTC (permalink / raw)
  To: emacs-devel, jewalsh

[-- 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-30 11:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-29  8:32 [PATCH] src/pgtkterm.c: Honor system DPI settings Jindřich Makovička
2021-05-30 11:09 ` Yuuki Harano

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.