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 734480 - Handle CLUTTER_SCALE envvar
Handle CLUTTER_SCALE envvar
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2014-08-08 11:24 UTC by Bastien Nocera
Modified: 2014-09-03 13:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
x11: Handle GDK_SCALE envvar (1.85 KB, patch)
2014-08-08 11:24 UTC, Bastien Nocera
rejected Details | Review
gdk: Add window-scaling-factor support (1020 bytes, patch)
2014-08-08 12:51 UTC, Bastien Nocera
committed Details | Review
x11: Handle CLUTTER_SCALE envvar (1.98 KB, patch)
2014-08-08 12:51 UTC, Bastien Nocera
none Details | Review
wayland: Add support for CLUTTER_SCALE envvar (1.17 KB, patch)
2014-08-08 12:51 UTC, Bastien Nocera
none Details | Review
doc: Document CLUTTER_SCALE envvar (1.03 KB, patch)
2014-08-08 12:51 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2014-08-08 11:24:14 UTC
.
Comment 1 Bastien Nocera 2014-08-08 11:24:18 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.
Comment 2 Emmanuele Bassi (:ebassi) 2014-08-08 12:01:35 UTC
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.
Comment 3 Bastien Nocera 2014-08-08 12:35:59 UTC
(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 },
Comment 4 Emmanuele Bassi (:ebassi) 2014-08-08 12:42:48 UTC
(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.
Comment 5 Bastien Nocera 2014-08-08 12:51:34 UTC
Created attachment 282903 [details] [review]
gdk: Add window-scaling-factor support

So that we follow GDK's idea of a scaling factor for Clutter.
Comment 6 Bastien Nocera 2014-08-08 12:51:39 UTC
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.
Comment 7 Bastien Nocera 2014-08-08 12:51:45 UTC
Created attachment 282905 [details] [review]
wayland: Add support for CLUTTER_SCALE envvar
Comment 8 Bastien Nocera 2014-08-08 12:51:50 UTC
Created attachment 282906 [details] [review]
doc: Document CLUTTER_SCALE envvar
Comment 9 Emmanuele Bassi (:ebassi) 2014-08-12 18:53:38 UTC
see also bug 734587 — which is meant to move the GDK backend higher on the list of attempted backends.
Comment 10 Emmanuele Bassi (:ebassi) 2014-08-12 18:55:48 UTC
Review of attachment 282903 [details] [review]:

looks good.
Comment 11 Emmanuele Bassi (:ebassi) 2014-08-12 18:59:48 UTC
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.
Comment 12 Bastien Nocera 2014-08-15 14:07:49 UTC
(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.
Comment 13 Bastien Nocera 2014-08-15 14:09:10 UTC
That leaves the GDK support, and the doc.
Comment 14 Emmanuele Bassi (:ebassi) 2014-09-03 13:20:04 UTC
Review of attachment 282906 [details] [review]:

LGTM.
Comment 15 Emmanuele Bassi (:ebassi) 2014-09-03 13:21:43 UTC
Attachment 282903 [details] pushed as 908aedb - gdk: Add window-scaling-factor support
Attachment 282906 [details] pushed as fe208bf - doc: Document CLUTTER_SCALE envvar