GNOME Bugzilla – Bug 734480
Handle CLUTTER_SCALE envvar
Last modified: 2014-09-03 13:22:02 UTC
.
Created attachment 282901 [details] [review] x11: Handle GDK_SCALE envvar This makes it easier to test applications that use both clutter and GTK+ for Hi-DPI bugs.
Review of attachment 282901 [details] [review]: no, I'm not going to check for GDK-specific environment variables inside Clutter's X11 backend. the X11 backend is also already checking for the Gdk/WindowScalingFactor XSETTINGS key, so if that's set, it's already respected. there's a larger question about switching the default Clutter backend from X11 to GDK, now that Mutter can select the windowing system backend directly — in which case we'd depend on GDK's scaling factor, which can be set using GDK_SCALE.
(In reply to comment #2) > Review of attachment 282901 [details] [review]: > > no, I'm not going to check for GDK-specific environment variables inside > Clutter's X11 backend. > > the X11 backend is also already checking for the Gdk/WindowScalingFactor > XSETTINGS key, so if that's set, it's already respected. GDK_SCALE overrides whatever's in the XSettings, it makes debugging applications easier. This means I don't need to run my full session with hi-dpi, and everything that goes with it. > there's a larger question about switching the default Clutter backend from X11 > to GDK, now that Mutter can select the windowing system backend directly — in > which case we'd depend on GDK's scaling factor, which can be set using > GDK_SCALE. It doesn't seem to be mapped at all in the GDK backend. Except that the X11 backend is still the preferred one when running under X11... This should be enough to make it work: diff --git a/clutter/gdk/clutter-settings-gdk.h b/clutter/gdk/clutter-settings-gdk.h index c2b576e..9c0fd4f 100644 --- a/clutter/gdk/clutter-settings-gdk.h +++ b/clutter/gdk/clutter-settings-gdk.h @@ -7,6 +7,7 @@ static const struct { const char *settings_property; GType type; } _clutter_settings_map[] = { + { "gdk-window-scaling-factor", "window-scaling-factor", G_TYPE_INT }, { "gtk-double-click-time", "double-click-time", G_TYPE_INT }, { "gtk-double-click-distance", "double-click-distance", G_TYPE_INT }, { "gtk-dnd-drag-threshold", "dnd-drag-threshold", G_TYPE_INT },
(In reply to comment #3) > (In reply to comment #2) > > Review of attachment 282901 [details] [review] [details]: > > > > no, I'm not going to check for GDK-specific environment variables inside > > Clutter's X11 backend. > > > > the X11 backend is also already checking for the Gdk/WindowScalingFactor > > XSETTINGS key, so if that's set, it's already respected. > > GDK_SCALE overrides whatever's in the XSettings, it makes debugging > applications easier. This means I don't need to run my full session with > hi-dpi, and everything that goes with it. in the same place you set GDK_SCALE you can also set CLUTTER_SCALE. nevertheless... > > there's a larger question about switching the default Clutter backend from X11 > > to GDK, now that Mutter can select the windowing system backend directly — in > > which case we'd depend on GDK's scaling factor, which can be set using > > GDK_SCALE. > > It doesn't seem to be mapped at all in the GDK backend. Except that the X11 > backend is still the preferred one when running under X11... ... that's why I said that we may just decide to switch the default Clutter backend under X11 and Wayland to be the GDK backend. > This should be enough to make it work: > > diff --git a/clutter/gdk/clutter-settings-gdk.h > b/clutter/gdk/clutter-settings-gdk.h > index c2b576e..9c0fd4f 100644 > --- a/clutter/gdk/clutter-settings-gdk.h > +++ b/clutter/gdk/clutter-settings-gdk.h > @@ -7,6 +7,7 @@ static const struct { > const char *settings_property; > GType type; > } _clutter_settings_map[] = { > + { "gdk-window-scaling-factor", "window-scaling-factor", G_TYPE_INT }, > { "gtk-double-click-time", "double-click-time", G_TYPE_INT }, > { "gtk-double-click-distance", "double-click-distance", G_TYPE_INT }, > { "gtk-dnd-drag-threshold", "dnd-drag-threshold", G_TYPE_INT }, this looks good, feel free to push it.
Created attachment 282903 [details] [review] gdk: Add window-scaling-factor support So that we follow GDK's idea of a scaling factor for Clutter.
Created attachment 282904 [details] [review] x11: Handle CLUTTER_SCALE envvar This makes it easier to test applications that use both clutter and GTK+ for Hi-DPI bugs by passing both CLUTTER_SCALE and GDK_SCALE values as environment variables.
Created attachment 282905 [details] [review] wayland: Add support for CLUTTER_SCALE envvar
Created attachment 282906 [details] [review] doc: Document CLUTTER_SCALE envvar
see also bug 734587 — which is meant to move the GDK backend higher on the list of attempted backends.
Review of attachment 282903 [details] [review]: looks good.
I honestly don't understand the patches. Clutter already supports the CLUTTER_SCALE environment variable inside ClutterSettings. it overrides the ClutterSettings:window-scaling-factor value, so the XSETTINGS key is ignored if the environment variable is set.
(In reply to comment #11) > I honestly don't understand the patches. Clutter already supports the > CLUTTER_SCALE environment variable inside ClutterSettings. it overrides the > ClutterSettings:window-scaling-factor value, so the XSETTINGS key is ignored if > the environment variable is set. It does indeed, it's just not documented.
That leaves the GDK support, and the doc.
Review of attachment 282906 [details] [review]: LGTM.
Attachment 282903 [details] pushed as 908aedb - gdk: Add window-scaling-factor support Attachment 282906 [details] pushed as fe208bf - doc: Document CLUTTER_SCALE envvar