After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 786694 - wayland: fix fontconfig monitoring
wayland: fix fontconfig monitoring
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: xsettings
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
Depends on: 786693
Blocks:
 
 
Reported: 2017-08-23 18:35 UTC by Matthias Clasen
Modified: 2018-02-27 15:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Introduce org.gnome.SettingsDaemon.FontConfig (9.29 KB, patch)
2017-12-26 21:07 UTC, Martin Blanchard
none Details | Review
Introduce org.gnome.SettingsDaemon.FontConfig (timestamp as int64) (9.70 KB, patch)
2018-02-09 15:53 UTC, Martin Blanchard
none Details | Review
Introduce org.gnome.SettingsDaemon.FontConfig (timestamp as int64) (9.72 KB, patch)
2018-02-09 12:13 UTC, Martin Blanchard
none Details | Review
Introduce org.gnome.SettingsDaemon.FontConfig (timestamp as int64) (9.68 KB, patch)
2018-02-21 22:59 UTC, Martin Blanchard
needs-work Details | Review
xsettings: Expose monitored settings through D-Bus (9.99 KB, patch)
2018-02-22 16:17 UTC, Bastien Nocera
none Details | Review
xsettings: Expose monitored settings through D-Bus (9.99 KB, patch)
2018-02-23 16:29 UTC, Bastien Nocera
committed Details | Review
xsettings: Use temporary variable for GTK+ modules dir (2.67 KB, patch)
2018-02-23 16:29 UTC, Bastien Nocera
committed Details | Review
xsettings: Make it possible to override GTK+ modules path (981 bytes, patch)
2018-02-23 16:29 UTC, Bastien Nocera
committed Details | Review
xsettings: Add tests for D-Bus interface (9.18 KB, patch)
2018-02-23 16:29 UTC, Bastien Nocera
none Details | Review
xsettings: Add tests for D-Bus interface (9.25 KB, patch)
2018-02-26 12:10 UTC, Bastien Nocera
none Details | Review
xsettings: Make it possible to ignore llvmpipe (1.04 KB, patch)
2018-02-26 13:52 UTC, Bastien Nocera
committed Details | Review
xsettings: Add tests for D-Bus interface (11.90 KB, patch)
2018-02-26 13:52 UTC, Bastien Nocera
none Details | Review
tests: Rename work directory (896 bytes, patch)
2018-02-26 13:53 UTC, Bastien Nocera
committed Details | Review
xsettings: Add tests for D-Bus interface (11.90 KB, patch)
2018-02-27 12:53 UTC, Bastien Nocera
committed Details | Review
tests: Fix concurrent launches of Xorg-reliant test cases (3.61 KB, patch)
2018-02-27 12:53 UTC, Bastien Nocera
committed Details | Review

Description Matthias Clasen 2017-08-23 18:35:30 UTC
+++ This bug was initially created as a clone of Bug #786693 +++

Under X11, we are using and X setting that contains a 'fontconfig timestamp', and that gets updated by gnome-settings-daemon. This doesn't work under Wayland, since we only monitor those xsettings that are backed by a gsetting.

After some discussion on #gtk+, we suggest to use a dbus signal instead. It can be emitted by the same gsd plugin that maintains the xsettings.
Comment 1 Martin Blanchard 2017-12-26 21:07:14 UTC
Created attachment 365988 [details] [review]
Introduce org.gnome.SettingsDaemon.FontConfig

Timestamp is exposed as the 'ConfigTimestamp' property of a (new) 
org.gnome.SettingsDaemon.FontConfig dbus interface. 'PropertiesChanged', from org.freedesktop.DBus.Properties, is emitted on update.

It feels wrong to implement this in the xsettings plugin. Think it deserves a dedicated plugin; xsettings could rely on this new one. But needs more work...

Comments and feedbacks welcome.
Comment 2 Matthias Clasen 2017-12-28 13:52:26 UTC
Thanks for working on this!
Comment 3 Matthias Clasen 2017-12-28 13:59:57 UTC
Review of attachment 365988 [details] [review]:

::: plugins/xsettings/gsd-xsettings-manager.c
@@ +81,3 @@
+"<node name='/org/gnome/SettingsDaemon/FontConfig'>"
+"  <interface name='org.gnome.SettingsDaemon.FontConfig'>"
+"    <property name='ConfigTimestamp' type='i' access='read'/>"

Should maybe be 'u' instead of 'i' ?
Comment 4 Matthias Clasen 2017-12-28 14:00:20 UTC
Review of attachment 365988 [details] [review]:

.
Comment 5 Martin Blanchard 2017-12-28 14:54:56 UTC
(In reply to Matthias Clasen from comment #3)
> Should maybe be 'u' instead of 'i' ?

Not sure about what to do here: xsettings plugin is using an int value retrieved from time(), gtk+'s setting in uint, and GLib's time seems to be represented by int64...

In my opinion, exposing an int64 from g_get_real_time() would be the best option, but wouldn't help on gtk+ side. The int type has only been kept for some sort of compatibility with the original xsetting. So should we simplify and opt for gtk+'s uint?
Comment 6 Martin Blanchard 2018-02-09 12:13:39 UTC
Created attachment 368196 [details] [review]
Introduce org.gnome.SettingsDaemon.FontConfig (timestamp as int64)

Third version: fix stupid bug in previous version...
Comment 7 Martin Blanchard 2018-02-09 15:53:12 UTC
Created attachment 368188 [details] [review]
Introduce org.gnome.SettingsDaemon.FontConfig (timestamp as int64)

Second version: time is represented as int64 and valued using g_get_real_time().

Comments and feedbacks welcome.
Comment 8 Bastien Nocera 2018-02-12 15:53:13 UTC
It's too late to land this for GNOME 3.28. The gnome-shell patch will need reviewing before this can land, assuming the code is correct.

At a glance, you'll want to go through the patch and remove the unnecessary whitespace changes.
Comment 9 Martin Blanchard 2018-02-21 22:59:03 UTC
Created attachment 368734 [details] [review]
Introduce org.gnome.SettingsDaemon.FontConfig (timestamp as int64)

Fourth version: removed a couple of extra whitespaces.
Comment 10 Martin Blanchard 2018-02-21 23:00:29 UTC
(In reply to Bastien Nocera from comment #8)
> It's too late to land this for GNOME 3.28. The gnome-shell patch will need
> reviewing before this can land, assuming the code is correct.

May have missed something here, sorry: what is this gnome-shell patch you are talking about?
Comment 11 Bastien Nocera 2018-02-22 00:30:03 UTC
(In reply to Martin Blanchard from comment #10)
> (In reply to Bastien Nocera from comment #8)
> > It's too late to land this for GNOME 3.28. The gnome-shell patch will need
> > reviewing before this can land, assuming the code is correct.
> 
> May have missed something here, sorry: what is this gnome-shell patch you
> are talking about?

Never mind, the gtk+ patch rather. I'll review it later.
Comment 12 Bastien Nocera 2018-02-22 11:52:20 UTC
Review of attachment 368734 [details] [review]:

1) Get rid of the array
2) Every time a timestamp change has happened, queue sending the new value for half-a-second (or a second?), reschedule if a new timestamp arrives in that time
3) Don't use g_get_real_time()

::: plugins/xsettings/gsd-xsettings-manager.c
@@ +80,3 @@
+static const gchar introspection_xml[] =
+"<node name='/org/gnome/SettingsDaemon/FontConfig'>"
+"  <interface name='org.gnome.SettingsDaemon.FontConfig'>"

Is this really the name of the interface we want to use? What about GTK+ apps under other Wayland desktops?

@@ +284,3 @@
         GSettings         *plugin_settings;
         FcMonitor         *fontconfig_monitor;
+        GArray            *fontconfig_timestamps;

I've stared at the code for a long while, and can't figure out why you need to send a "changed" signal for each and every fontconfig timestamp change. Why do that?

You could just keep the last one, and send it out when it changes, or aggregate/coalesce the changes into one event if the changes are too close together. You need to remember that this would wake up every single GTK+ program, so less notifications is better.

@@ +1189,3 @@
         GList       *list, *l;
         const char  *session;
+        gint64       timestamp = g_get_real_time ();

You shouldn't user g_get_real_time(), this will break if the time on the machine is changed. Any reason why g_get_monotonic_time() can't be used?

@@ +1453,3 @@
+        manager = GNOME_XSETTINGS_MANAGER (user_data);
+
+        if (manager->priv->dbus_connection == NULL)

This isn't necessary, you get a connection in the arguments of the function above, and you don't use this variable anyway.
Comment 13 Bastien Nocera 2018-02-22 14:25:59 UTC
The XSettings in the xsettings plugin are either:
- in GSettings, and GTK+ will read those directly under Wayland
- hardcoded in gnome-settings-daemon, for older versions of GTK+, and hardcoded in newer versions of GTK+ 3.x
- "computed" in the xsettings plugin

Those last ones are what we're interested in here. They are:
- fontconfig timestamps (Fontconfig/Timestamp)
- whether to enable animations (used for remote displays, Gtk/EnableAnimations)
- GTK+ modules list (Gtk/Modules)
- whether gnome-shell (and its builtin menu) is running (Gtk/ShellShowsAppMenu)
- a number of font and DPI settings (see xft_settings_set_xsettings())

That last two are handled directly in GTK+ in Wayland talking to the compositor and checking its capabilities, or in gdk/wayland/gdkscreen-wayland.c.

Which leaves us with those first 3 settings (for now).

So, on top of the fontconfig specific changes above, it would be nice if:
- the D-Bus name showed that the settings are GTK+ specific, say "org.gtk.Settings"
- also export Gtk/EnableAnimations and the modules list through D-Bus
Comment 14 Bastien Nocera 2018-02-22 16:17:16 UTC
Created attachment 368775 [details] [review]
xsettings: Expose monitored settings through D-Bus

A number of things that gnome-settings-daemon monitors for all the GTK+
applications aren't currently available for GTK+ Wayland clients, only
through XSettings.

As we already monitor fontconfig configurations, enabled GTK+ modules
and whether applications should use animations, export those through a
D-Bus interface.

See https://bugzilla.gnome.org/show_bug.cgi?id=786693

Based on patch by Martin Blanchard <tchaik@gmx.com>
Comment 15 Bastien Nocera 2018-02-22 16:18:12 UTC
The patch above is completely untested, and the GTK+ patch needs rewriting.

You might need to also apply the patch from bug 793721 for this one to apply.
Comment 16 Bastien Nocera 2018-02-23 16:29:11 UTC
Created attachment 368833 [details] [review]
xsettings: Expose monitored settings through D-Bus

A number of things that gnome-settings-daemon monitors for all the GTK+
applications aren't currently available for GTK+ Wayland clients, only
through XSettings.

As we already monitor fontconfig configurations, enabled GTK+ modules
and whether applications should use animations, export those through a
D-Bus interface.

See https://bugzilla.gnome.org/show_bug.cgi?id=786693

Based on patch by Martin Blanchard <tchaik@gmx.com>
Comment 17 Bastien Nocera 2018-02-23 16:29:17 UTC
Created attachment 368834 [details] [review]
xsettings: Use temporary variable for GTK+ modules dir

So that we can override it later.
Comment 18 Bastien Nocera 2018-02-23 16:29:24 UTC
Created attachment 368835 [details] [review]
xsettings: Make it possible to override GTK+ modules path
Comment 19 Bastien Nocera 2018-02-23 16:29:30 UTC
Created attachment 368836 [details] [review]
xsettings: Add tests for D-Bus interface

FIXME, EnableAnimations doesn't work because the test can't create a
"boolean" property, and I don't know why.
Comment 20 Bastien Nocera 2018-02-26 12:10:40 UTC
Created attachment 368931 [details] [review]
xsettings: Add tests for D-Bus interface
Comment 21 Bastien Nocera 2018-02-26 13:52:51 UTC
Created attachment 368943 [details] [review]
xsettings: Make it possible to ignore llvmpipe

So that we can test out vino support.
Comment 22 Bastien Nocera 2018-02-26 13:52:58 UTC
Created attachment 368944 [details] [review]
xsettings: Add tests for D-Bus interface
Comment 23 Bastien Nocera 2018-02-26 13:53:04 UTC
Created attachment 368945 [details] [review]
tests: Rename work directory

There's more than just a power test now.
Comment 24 Bastien Nocera 2018-02-27 12:53:06 UTC
Created attachment 369014 [details] [review]
xsettings: Add tests for D-Bus interface
Comment 25 Bastien Nocera 2018-02-27 12:53:19 UTC
Created attachment 369015 [details] [review]
tests: Fix concurrent launches of Xorg-reliant test cases
Comment 26 Bastien Nocera 2018-02-27 15:36:27 UTC
Attachment 368833 [details] pushed as 522640a - xsettings: Expose monitored settings through D-Bus
Attachment 368834 [details] pushed as 85e162f - xsettings: Use temporary variable for GTK+ modules dir
Attachment 368835 [details] pushed as 2b79fb8 - xsettings: Make it possible to override GTK+ modules path
Attachment 368943 [details] pushed as e514810 - xsettings: Make it possible to ignore llvmpipe
Attachment 368945 [details] pushed as 26e1e1e - tests: Rename work directory
Attachment 369014 [details] pushed as 8ec7856 - xsettings: Add tests for D-Bus interface
Attachment 369015 [details] pushed as 9dbb9e8 - tests: Fix concurrent launches of Xorg-reliant test cases