unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#55463: [PATCH] Fix font options compilation with gsettings disabled
@ 2022-05-16 20:22 Pieter van Prooijen
  2022-05-17  1:05 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 4+ messages in thread
From: Pieter van Prooijen @ 2022-05-16 20:22 UTC (permalink / raw)
  To: 55463; +Cc: wilde

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

Hello All,

This is a small patch to make the recent gsettings font rendering
changes compile when pgtk is configured but gsettings is not.

Kind Regards,

Pieter van Prooijen




[-- Attachment #2: 0001-Fix-font-options-compilation-with-gsettings-disabled.patch --]
[-- Type: text/x-patch, Size: 2208 bytes --]

From 3c970748371f288d4068042e8cc6e7e7089040bd Mon Sep 17 00:00:00 2001
From: Pieter van Prooijen <pieter.van.prooijen@teloden.nl>
Date: Mon, 16 May 2022 15:20:27 +0200
Subject: [PATCH] Fix font options compilation with gsettings disabled

* src/xsettings.c (xsettings_get_font_options): Return a font_options
even if gsettings is not enabled.
---
 src/xsettings.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/xsettings.c b/src/xsettings.c
index 2e33ef958a..53d8a25e16 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -206,6 +206,11 @@ #define XSETTINGS_TOOL_BAR_STYLE  "Gtk/ToolbarStyle"
   unsigned seen;
 };
 
+#ifdef HAVE_PGTK
+/* The cairo font_options as obtained using gsettings.  */
+static cairo_font_options_t *font_options;
+#endif
+
 #ifdef HAVE_GSETTINGS
 #define GSETTINGS_SCHEMA         "org.gnome.desktop.interface"
 #define GSETTINGS_TOOL_BAR_STYLE "toolbar-style"
@@ -225,11 +230,6 @@ #define GSETTINGS_FONT_HINTING       "font-hinting"
 
 static GSettings *gsettings_client;
 
-#ifdef HAVE_PGTK
-
-/* The cairo font_options as obtained using gsettings.  */
-static cairo_font_options_t *font_options;
-
 static bool
 xg_settings_key_valid_p (GSettings *settings, const char *key)
 {
@@ -253,6 +253,7 @@ xg_settings_key_valid_p (GSettings *settings, const char *key)
 #endif
 }
 
+#ifdef HAVE_PGTK
 /* Store an event for re-rendering of the fonts.  */
 static void
 store_font_options_changed (void)
@@ -1200,13 +1201,17 @@ xsettings_get_system_normal_font (void)
 #endif
 
 #ifdef HAVE_PGTK
-/* Return the cairo font options, updated from the gsettings font
-   config entries.  The caller should call cairo_font_options_destroy
-   on the result.  */
+/* Return the cairo font options, optionally updated from the gsettings
+   font config entries.  The caller should call
+   cairo_font_options_destroy on the result.  */
 cairo_font_options_t *
 xsettings_get_font_options (void)
 {
-  return cairo_font_options_copy (font_options);
+  if (font_options != NULL)
+    return cairo_font_options_copy (font_options);
+  else
+    /* GSettings is not configured.  */
+    return cairo_font_options_create ();
 }
 #endif
 
-- 
2.34.1


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

* bug#55463: [PATCH] Fix font options compilation with gsettings disabled
  2022-05-16 20:22 bug#55463: [PATCH] Fix font options compilation with gsettings disabled Pieter van Prooijen
@ 2022-05-17  1:05 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-05-17  8:28   ` Pieter van Prooijen
  0 siblings, 1 reply; 4+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-05-17  1:05 UTC (permalink / raw)
  To: Pieter van Prooijen; +Cc: wilde, 55463

Pieter van Prooijen <pieter.van.prooijen@teloden.nl> writes:

> Hello All,
>
> This is a small patch to make the recent gsettings font rendering
> changes compile when pgtk is configured but gsettings is not.

Thanks.

> -/* Return the cairo font options, updated from the gsettings font
> -   config entries.  The caller should call cairo_font_options_destroy
> -   on the result.  */
> +/* Return the cairo font options, optionally updated from the gsettings
> +   font config entries.  The caller should call
> +   cairo_font_options_destroy on the result.  */

I think this change is extraneous.  That comment doesn't have to be so
detailed, since building Emacs without GSettings support is a rather
oddball configuration, and it obviously cannot be used without support
being built-in.

Otherwise, LGTM.





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

* bug#55463: [PATCH] Fix font options compilation with gsettings disabled
  2022-05-17  1:05 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-05-17  8:28   ` Pieter van Prooijen
  2022-05-17 10:15     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 4+ messages in thread
From: Pieter van Prooijen @ 2022-05-17  8:28 UTC (permalink / raw)
  To: Po Lu; +Cc: wilde, 55463

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

Hi, 

I've reverted the change in the comment, here's the patch without that
change.

Kind Regards,

Pieter

On Tue, 2022-05-17 at 09:05 +0800, Po Lu wrote:
> Pieter van Prooijen <pieter.van.prooijen@teloden.nl> writes:
> 
> > Hello All,
> > 
> > This is a small patch to make the recent gsettings font rendering
> > changes compile when pgtk is configured but gsettings is not.
> 
> Thanks.
> 
> > -/* Return the cairo font options, updated from the gsettings font
> > -   config entries.  The caller should call
> > cairo_font_options_destroy
> > -   on the result.  */
> > +/* Return the cairo font options, optionally updated from the
> > gsettings
> > +   font config entries.  The caller should call
> > +   cairo_font_options_destroy on the result.  */
> 
> I think this change is extraneous.  That comment doesn't have to be
> so
> detailed, since building Emacs without GSettings support is a rather
> oddball configuration, and it obviously cannot be used without
> support
> being built-in.
> 
> Otherwise, LGTM.


[-- Attachment #2: 0001-Fix-font-options-compilation-with-gsettings-disabled.patch --]
[-- Type: text/x-patch, Size: 1840 bytes --]

From 3548e6dbc5e820a48f0ed4885a912ead39f9bf94 Mon Sep 17 00:00:00 2001
From: Pieter van Prooijen <pieter.van.prooijen@teloden.nl>
Date: Mon, 16 May 2022 15:20:27 +0200
Subject: [PATCH] Fix font options compilation with gsettings disabled

* src/xsettings.c (xsettings_get_font_options): Return a font_options
even if gsettings is not enabled.
---
 src/xsettings.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/xsettings.c b/src/xsettings.c
index 2e33ef958a..45341d8ebd 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -206,6 +206,11 @@ #define XSETTINGS_TOOL_BAR_STYLE  "Gtk/ToolbarStyle"
   unsigned seen;
 };
 
+#ifdef HAVE_PGTK
+/* The cairo font_options as obtained using gsettings.  */
+static cairo_font_options_t *font_options;
+#endif
+
 #ifdef HAVE_GSETTINGS
 #define GSETTINGS_SCHEMA         "org.gnome.desktop.interface"
 #define GSETTINGS_TOOL_BAR_STYLE "toolbar-style"
@@ -225,11 +230,6 @@ #define GSETTINGS_FONT_HINTING       "font-hinting"
 
 static GSettings *gsettings_client;
 
-#ifdef HAVE_PGTK
-
-/* The cairo font_options as obtained using gsettings.  */
-static cairo_font_options_t *font_options;
-
 static bool
 xg_settings_key_valid_p (GSettings *settings, const char *key)
 {
@@ -253,6 +253,7 @@ xg_settings_key_valid_p (GSettings *settings, const char *key)
 #endif
 }
 
+#ifdef HAVE_PGTK
 /* Store an event for re-rendering of the fonts.  */
 static void
 store_font_options_changed (void)
@@ -1206,7 +1207,11 @@ xsettings_get_system_normal_font (void)
 cairo_font_options_t *
 xsettings_get_font_options (void)
 {
-  return cairo_font_options_copy (font_options);
+  if (font_options != NULL)
+    return cairo_font_options_copy (font_options);
+  else
+    /* GSettings is not configured.  */
+    return cairo_font_options_create ();
 }
 #endif
 
-- 
2.34.1


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

* bug#55463: [PATCH] Fix font options compilation with gsettings disabled
  2022-05-17  8:28   ` Pieter van Prooijen
@ 2022-05-17 10:15     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 4+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-05-17 10:15 UTC (permalink / raw)
  To: Pieter van Prooijen; +Cc: wilde, 55463-done

Pieter van Prooijen <pieter.van.prooijen@teloden.nl> writes:

> Hi, 
>
> I've reverted the change in the comment, here's the patch without that
> change.

Now installed, so I'm closing this bug.  Thanks.





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

end of thread, other threads:[~2022-05-17 10:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16 20:22 bug#55463: [PATCH] Fix font options compilation with gsettings disabled Pieter van Prooijen
2022-05-17  1:05 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-17  8:28   ` Pieter van Prooijen
2022-05-17 10:15     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors

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).