From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Misha Gusarov" Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Make reading GNOME settings optional Date: Sun, 31 Jan 2021 23:23:58 +0100 Message-ID: <2BB10C11-590B-440F-A583-2326F86119F9@dottedmag.net> References: <20210131222247.43949-1-dottedmag@dottedmag.net> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34005"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Misha Gusarov To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jan 31 23:26:41 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 1l6LB3-0008lC-2G for ged-emacs-devel@m.gmane-mx.org; Sun, 31 Jan 2021 23:26:41 +0100 Original-Received: from localhost ([::1]:38510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6LB2-000628-2O for ged-emacs-devel@m.gmane-mx.org; Sun, 31 Jan 2021 17:26:40 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6L8i-00050y-CU for emacs-devel@gnu.org; Sun, 31 Jan 2021 17:24:16 -0500 Original-Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:44757) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6L8g-0001mV-NA for emacs-devel@gnu.org; Sun, 31 Jan 2021 17:24:16 -0500 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 0EF977A3; Sun, 31 Jan 2021 17:24:12 -0500 (EST) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sun, 31 Jan 2021 17:24:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dottedmag.net; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=fm1; bh=dR0pl6chTdeJX0w9MSc993ml8a T6LgFiBcwt6apbekA=; b=v6ami+Zdxl2ckYMFPvVefu+nBiq2ugR1OkPEjzoeRI vtva6VIlA0sSke9IwmM3lDrXJo/mXHlgsjRhxtZxRJSX3KUpxQe2t30PYA6Geu03 2xry10vLDuzdT5mxP5nHyFqN+uisKA8ySQNqeenR8lQIcdwo/XVXTczNxxqanLXF GlGBWHjky33fqzM4DJ6HsZa61DczXfyeFzrfTktBCsHDgxMn1lv4CBtlgXJ0yVy3 wkuqAleCILjEhQ+g7nvWTsFO5BYUROEBSuMrSiq6oCLsQLgMiFZ0N5KBZVfLOTxn C4TLh5/LxtJ/RqyL0JVU6YfgSky/NtuBH6Hy0AcTDfmg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=dR0pl6 chTdeJX0w9MSc993ml8aT6LgFiBcwt6apbekA=; b=IwqTzGbBpFXrLnJnxC8LO5 3uqniv1s+xY4NuuGCP0kZmXuA68Ho4Rw5JFQRwPxWHR5KLGzb4JAUkvGsKXhHBBj sE+n4IXoNCVyhAOXXZaOltoFjHNgS0nJkGpZXMEww0ESUaZozc904GGXMXi3X9AC GGLyKngZWQx7ZhM70F1AMsHwfamrFjct8jTc/KVxiG4naWAI0xVcKv/iWdb53IjC xsgFQ3wGcohnWdFLE1I2NFtUv4tKhuIyRToeIWK1KH9HUwEJR9zlR/1/1QbBPt9w H3kL4ERReVImTsnMIhBeKpimylDBN8Z20ZVdexDqTtCHQuyPAv2t4R8WpEK74jrw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeeigdduheejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffokfgjfhggtgesthdtmh dtredttdenucfhrhhomhepfdfoihhshhgrucfiuhhsrghrohhvfdcuoeguohhtthgvughm rghgseguohhtthgvughmrghgrdhnvghtqeenucggtffrrghtthgvrhhnpeffteefveeugf dvhfevkefhhedutefgtdelueegudeljeeifeefteegjeevleeufeenucfkphepudeguddr kedrleefrdduieefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepughothhtvggumhgrghesughothhtvggumhgrghdrnhgvth X-ME-Proxy: Original-Received: from [10.37.129.2] (c93-163.i12-24.melita.com [141.8.93.163]) by mail.messagingengine.com (Postfix) with ESMTPA id 35ACF108005C; Sun, 31 Jan 2021 17:24:12 -0500 (EST) X-Mailer: MailMate (1.13.2r5673) In-Reply-To: <20210131222247.43949-1-dottedmag@dottedmag.net> Received-SPF: pass client-ip=64.147.123.19; envelope-from=dottedmag@dottedmag.net; helo=wout3-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:263672 Archived-At: Hello. This patch is for feature/pgtk branch. Without it Emacs crashes on startup if gsettings-desktop-schemas are not installed. On 31 Jan 2021, at 23:22, Misha Gusarov wrote: > * 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 Best, Misha.