From: Misha Gusarov <dottedmag@dottedmag.net>
To: emacs-devel@gnu.org
Cc: Misha Gusarov <dottedmag@dottedmag.net>
Subject: [PATCH] Make reading GNOME settings optional
Date: Sun, 31 Jan 2021 23:22:47 +0100 [thread overview]
Message-ID: <20210131222247.43949-1-dottedmag@dottedmag.net> (raw)
* src/pgtkterm.c (pgtk_term_init):
Make reading GNOME settings optional.
---
src/pgtkterm.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 437249abeb..b1babad297 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -6798,6 +6798,26 @@ same_x_server (const char *name1, const char *name2)
&& (*name2 == '.' || *name2 == '\0'));
}
+#define GNOME_INTERFACE_SCHEMA "org.gnome.desktop.interface"
+
+static gdouble pkgt_text_scaling_factor(void)
+{
+ GSettingsSchemaSource *schema_source = g_settings_schema_source_get_default ();
+ if (schema_source != NULL)
+ {
+ GSettingsSchema *schema = g_settings_schema_source_lookup (schema_source,
+ GNOME_INTERFACE_SCHEMA, true);
+ if (schema != NULL)
+ {
+ g_settings_schema_unref (schema);
+ GSettings *set = g_settings_new (GNOME_INTERFACE_SCHEMA);
+ return g_settings_get_double (set, "text-scaling-factor");
+ }
+ }
+ return 1;
+}
+
+
/* Open a connection to X display DISPLAY_NAME, and return
the structure that describes the open display.
If we cannot contact the display, return null. */
@@ -6969,11 +6989,7 @@ pgtk_term_init (Lisp_Object display_name, char *resource_name)
{
GdkScreen *gscr = gdk_display_get_default_screen (dpyinfo->gdpy);
- GSettings *set = g_settings_new ("org.gnome.desktop.interface");
- gdouble x = g_settings_get_double (set, "text-scaling-factor");
- gdouble dpi = 0;
-
- dpi = 96.0 * x;
+ dpi = 96.0 * pgtk_text_scaling_factor();
gdk_screen_set_resolution (gscr, dpi);
dpyinfo->resx = dpi;
dpyinfo->resy = dpi;
--
2.28.0
next reply other threads:[~2021-01-31 22:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-31 22:22 Misha Gusarov [this message]
2021-01-31 22:23 ` [PATCH] Make reading GNOME settings optional Misha Gusarov
2021-01-31 22:28 ` Misha Gusarov
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=20210131222247.43949-1-dottedmag@dottedmag.net \
--to=dottedmag@dottedmag.net \
--cc=emacs-devel@gnu.org \
/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).