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 705410 - hi-dpi support: scale UI
hi-dpi support: scale UI
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2013-08-03 14:36 UTC by Matthias Clasen
Modified: 2014-02-18 22:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
st: Add high dpi support (5.08 KB, patch)
2014-02-12 16:44 UTC, drago01
reviewed Details | Review
layout: Set high dpi scaling factor (1.73 KB, patch)
2014-02-12 16:45 UTC, drago01
none Details | Review
st: Add high dpi support (4.91 KB, patch)
2014-02-12 17:25 UTC, drago01
committed Details | Review
shell-global: Set high dpi scaling factor (1.71 KB, patch)
2014-02-12 18:20 UTC, drago01
committed Details | Review
altTab: Scale icons by the scale_factor (1.25 KB, patch)
2014-02-15 15:19 UTC, drago01
none Details | Review
iconGrid: Scale icons by the scale factor (1.01 KB, patch)
2014-02-15 15:19 UTC, drago01
none Details | Review
panel: Apply scale factor to faded icon (1016 bytes, patch)
2014-02-15 15:19 UTC, drago01
none Details | Review
dash: Scale icons by the scale_factor (1.37 KB, patch)
2014-02-15 15:19 UTC, drago01
none Details | Review
Here's an a bit different approach that uses GTK's scaled loaders from GtkIconTheme in order to get an icon of the proper size. (9.52 KB, patch)
2014-02-16 06:19 UTC, Cosimo Cecchi
committed Details | Review
shell-app: finish support for loading with scale (4.42 KB, patch)
2014-02-16 06:19 UTC, Cosimo Cecchi
committed Details | Review
altTab: don't override icon size request (3.07 KB, patch)
2014-02-16 06:19 UTC, Cosimo Cecchi
committed Details | Review
altTab: account for scale factor when computing icon size (1.70 KB, patch)
2014-02-16 06:19 UTC, Cosimo Cecchi
committed Details | Review
iconGrid: don't force icon size to the BaseIcon (997 bytes, patch)
2014-02-16 06:19 UTC, Cosimo Cecchi
committed Details | Review
st-icon: remove custom size request/allocate (4.69 KB, patch)
2014-02-16 06:19 UTC, Cosimo Cecchi
committed Details | Review
dash: account for scale factor to determine icon size (2.03 KB, patch)
2014-02-16 06:19 UTC, Cosimo Cecchi
committed Details | Review
appDisplay: don't force size on folder icon actor (1.49 KB, patch)
2014-02-16 06:20 UTC, Cosimo Cecchi
committed Details | Review
altTab: Scale thumbnails by the scale factor (2.01 KB, patch)
2014-02-16 09:14 UTC, drago01
committed Details | Review
hdpi: Revert hacks (3.51 KB, patch)
2014-02-18 22:32 UTC, drago01
committed Details | Review
shell_global: Use g_signal_connect_swapped for update_scale_factor (1.12 KB, patch)
2014-02-18 22:32 UTC, drago01
none Details | Review
shell_global: Use correct agruments for in update_scale_factor (1.04 KB, patch)
2014-02-18 22:37 UTC, drago01
committed Details | Review

Description Matthias Clasen 2013-08-03 14:36:34 UTC
The UI that is drawn by gnome-shell (top bar, menus, dialogs, etc) needs to be scaled by the scale factor when on a hi-dpi display.
Comment 1 drago01 2013-08-04 08:56:26 UTC
Where is the "scale factor" ? Env var? root window property? Something else?
Comment 2 Jasper St. Pierre (not reading bugmail) 2013-08-04 09:17:52 UTC
Right now, it's the GDK_SCALE environment variable, but we've been talking about moving it to an xsetting or root window property.
Comment 3 Ray Strode [halfline] 2013-09-30 19:19:21 UTC
so clutter now doubles the stage scale factor when CLUTTER_SCALE is set.  It will eventually attach to the same XSetting value that we use for gtk+.

unfortunately, setting CLUTTER_SCALE=2 doesn't magically make things work for the shell.  Pixels get double-sized like they're supposed to, but I believe the shell still makes layout decisions based on xrandr information, so the output only shows the upper left quadrant of the screen.
Comment 4 drago01 2014-02-12 16:44:42 UTC
Created attachment 268927 [details] [review]
st: Add high dpi support

Add a scale_factor property to StThemeContext that can
be used to enable (integer) scaling of pixel values.

--

Talked about this with Owen on IRC. Doing the handling in St's css code
and adjusting the icon sizes should be enough to get high dpi working.

This patches implement the former and it seems to work pretty well in
my testing.
Comment 5 drago01 2014-02-12 16:45:17 UTC
Created attachment 268929 [details] [review]
layout: Set high dpi scaling factor

Set the scaling factor when the dpi is above the hidpi threshold.
Comment 6 Florian Müllner 2014-02-12 17:09:17 UTC
Review of attachment 268927 [details] [review]:

::: src/st/st-theme-context.c
@@ +168,3 @@
+            context->scale_factor = scale_factor;
+            g_object_notify (G_OBJECT (context), "scale-factor");
+            g_object_thaw_notify (G_OBJECT (context));

freeze/thaw isn't useful for a single property
Comment 7 Jasper St. Pierre (not reading bugmail) 2014-02-12 17:14:47 UTC
Review of attachment 268927 [details] [review]:

::: src/st/st-theme-context.c
@@ +168,3 @@
+            context->scale_factor = scale_factor;
+            g_object_notify (G_OBJECT (context), "scale-factor");
+            g_object_thaw_notify (G_OBJECT (context));

You also don't need g_object_notify in a set_property handler. If somebody goes through g_object_set_property, it will notify automatically.
Comment 8 drago01 2014-02-12 17:25:34 UTC
Created attachment 268942 [details] [review]
st: Add high dpi support

Add a scale_factor property to StThemeContext that can
be used to enable (integer) scaling of pixel values.
Comment 9 drago01 2014-02-12 18:20:25 UTC
Created attachment 268948 [details] [review]
shell-global: Set high dpi scaling factor

Set the scaling factor based on the xsetting.


---

OK as discussed on IRC with Jasper instead of duplicating gsd code,
read out the xsetting in shell-global.
Comment 10 Jasper St. Pierre (not reading bugmail) 2014-02-12 18:38:34 UTC
Review of attachment 268948 [details] [review]:

::: src/shell-global.c
@@ +749,3 @@
+
+static gboolean
+monitors_changed (gpointer data)

This should probably be called update_scale_factor rather than monitors_changed.

@@ +760,3 @@
+  g_object_set (context, "scale-factor", g_value_get_int (&value), NULL);
+
+  return TRUE;

monitors-changed doesn't need a boolean return value.

@@ +941,3 @@
                     G_CALLBACK (focus_window_changed), global);
 
+  g_signal_connect (global->gdk_screen, "monitors-changed",

I'd like to have a comment about why we're connecting to the gdk_screen rather than mutter here.
Comment 11 drago01 2014-02-12 18:47:08 UTC
Pushed with suggested changes, leaving bug open for the icon scaling issue.

Attachment 268942 [details] pushed as d868e6b - st: Add high dpi support
Attachment 268948 [details] pushed as ba459f4 - shell-global: Set high dpi scaling factor
Comment 12 drago01 2014-02-12 21:37:07 UTC
(In reply to comment #9)
> Created an attachment (id=268948) [details] [review]
> shell-global: Set high dpi scaling factor
> 
> Set the scaling factor based on the xsetting.
> 
> 
> ---
> 
> OK as discussed on IRC with Jasper instead of duplicating gsd code,
> read out the xsetting in shell-global.

OK, this seem to hang gdm (shell at gdm to be exact) at login time but not when run inside the session with --mode=gdm ... the layout.js patch works in both. I have no idea why this happens yet. Maybe we are calling it to early? But comenting out the gdk_screen_get_setting does not fix the hang either.
Comment 13 drago01 2014-02-13 08:54:36 UTC
(In reply to comment #12)
> (In reply to comment #9)
> > Created an attachment (id=268948) [details] [review] [details] [review]
> > shell-global: Set high dpi scaling factor
> > 
> > Set the scaling factor based on the xsetting.
> > 
> > 
> > ---
> > 
> > OK as discussed on IRC with Jasper instead of duplicating gsd code,
> > read out the xsetting in shell-global.
> 
> OK, this seem to hang gdm (shell at gdm to be exact) at login time but not when
> run inside the session with --mode=gdm ... the layout.js patch works in both. I
> have no idea why this happens yet. Maybe we are calling it to early? But
> comenting out the gdk_screen_get_setting does not fix the hang either.

I went back to the other one to get gdm working again.
Comment 14 drago01 2014-02-15 15:19:05 UTC
Created attachment 269201 [details] [review]
altTab: Scale icons by the scale_factor

This makes them look correct on high dpi screens.
Comment 15 drago01 2014-02-15 15:19:14 UTC
Created attachment 269202 [details] [review]
iconGrid: Scale icons by the scale factor

This makes them look correct on high dpi screens.
Comment 16 drago01 2014-02-15 15:19:23 UTC
Created attachment 269203 [details] [review]
panel: Apply scale factor to faded icon

This makes it look correct on high dpi screens.
Comment 17 drago01 2014-02-15 15:19:34 UTC
Created attachment 269204 [details] [review]
dash: Scale icons by the scale_factor

This makes them look correct on high dpi screens.
Comment 18 Cosimo Cecchi 2014-02-16 06:19:20 UTC
Created attachment 269269 [details] [review]
Here's an a bit different approach that uses GTK's scaled loaders from GtkIconTheme in order to get an icon of the proper size.

---

texture-cache: require icon scale to load gicon

To support HiDpi.
Comment 19 Cosimo Cecchi 2014-02-16 06:19:28 UTC
Created attachment 269270 [details] [review]
shell-app: finish support for loading with scale
Comment 20 Cosimo Cecchi 2014-02-16 06:19:33 UTC
Created attachment 269271 [details] [review]
altTab: don't override icon size request

Instead of overriding the actor's request with the icon size, just set
the new icon size on the actors, and let the default handler take the
preferred size of children.
Comment 21 Cosimo Cecchi 2014-02-16 06:19:38 UTC
Created attachment 269272 [details] [review]
altTab: account for scale factor when computing icon size
Comment 22 Cosimo Cecchi 2014-02-16 06:19:42 UTC
Created attachment 269273 [details] [review]
iconGrid: don't force icon size to the BaseIcon

Since we might get a scaled up version for HiDpi.
Comment 23 Cosimo Cecchi 2014-02-16 06:19:48 UTC
Created attachment 269274 [details] [review]
st-icon: remove custom size request/allocate

Use a layout manager instead. This has the effect of not enforcing a
priv->icon_size size request, since that value is unscaled.
Comment 24 Cosimo Cecchi 2014-02-16 06:19:55 UTC
Created attachment 269275 [details] [review]
dash: account for scale factor to determine icon size
Comment 25 Cosimo Cecchi 2014-02-16 06:20:00 UTC
Created attachment 269276 [details] [review]
appDisplay: don't force size on folder icon actor

Use a table layout instead.
Comment 26 drago01 2014-02-16 09:01:59 UTC
(In reply to comment #18)
> Created an attachment (id=269269) [details] [review]
> Here's an a bit different approach that uses GTK's scaled loaders from
> GtkIconTheme in order to get an icon of the proper size.
> 
> ---
> 
> texture-cache: require icon scale to load gicon
> 
> To support HiDpi.

OK, just tested your patches seems to work better (also fixes stuff like icons in lg).
Comment 27 drago01 2014-02-16 09:05:10 UTC
Review of attachment 269269 [details] [review]:

Looks good.
Comment 28 drago01 2014-02-16 09:09:16 UTC
Review of attachment 269270 [details] [review]:

LG.
Comment 29 drago01 2014-02-16 09:14:56 UTC
Created attachment 269279 [details] [review]
altTab: Scale thumbnails by the scale factor

Fixes their size on high dpi.

--

Just noticed that the window thumbnails in alt tab are small, this patch fixes them.
Comment 30 drago01 2014-02-16 09:15:52 UTC
Review of attachment 269271 [details] [review]:

LG.
Comment 31 drago01 2014-02-16 09:16:52 UTC
Review of attachment 269272 [details] [review]:

LG.
Comment 32 drago01 2014-02-16 09:17:28 UTC
Review of attachment 269273 [details] [review]:

OK.
Comment 33 drago01 2014-02-16 09:18:10 UTC
Review of attachment 269274 [details] [review]:

OK.
Comment 34 drago01 2014-02-16 09:19:45 UTC
Review of attachment 269275 [details] [review]:

OK.
Comment 35 drago01 2014-02-16 09:20:38 UTC
Review of attachment 269276 [details] [review]:

LG.
Comment 36 Cosimo Cecchi 2014-02-16 15:50:42 UTC
Attachment 269270 [details] pushed as 407dc74 - shell-app: finish support for loading with scale
Attachment 269271 [details] pushed as ad97fc6 - altTab: don't override icon size request
Attachment 269272 [details] pushed as fc719c1 - altTab: account for scale factor when computing icon size
Attachment 269273 [details] pushed as 9cc1017 - iconGrid: don't force icon size to the BaseIcon
Attachment 269274 [details] pushed as f543161 - st-icon: remove custom size request/allocate
Attachment 269275 [details] pushed as e92d204 - dash: account for scale factor to determine icon size
Attachment 269276 [details] pushed as f959caf - appDisplay: don't force size on folder icon actor

Pushed all these, thanks for the review.
Comment 37 Cosimo Cecchi 2014-02-16 15:54:13 UTC
Review of attachment 269279 [details] [review]:

Looks good other than a little coding style nit

::: js/ui/altTab.js
@@ +657,3 @@
         let spacing = this._items[0].child.get_theme_node().get_length('spacing');
+        let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
+        let thumbnail_size = THUMBNAIL_DEFAULT_SIZE * scaleFactor;

Should be thumbnailSize for consistency with the rest of the file.
Comment 38 drago01 2014-02-16 15:56:32 UTC
Pushed with coding style fix.

Attachment 269279 [details] pushed as 3b7593e - altTab: Scale thumbnails by the scale factor
Comment 39 drago01 2014-02-18 20:05:23 UTC
(In reply to comment #12)
> (In reply to comment #9)
> > Created an attachment (id=268948) [details] [review] [details] [review]
> > shell-global: Set high dpi scaling factor
> > 
> > Set the scaling factor based on the xsetting.
> > 
> > 
> > ---
> > 
> > OK as discussed on IRC with Jasper instead of duplicating gsd code,
> > read out the xsetting in shell-global.
> 
> OK, this seem to hang gdm (shell at gdm to be exact) at login time but not when
> run inside the session with --mode=gdm ... the layout.js patch works in both. I
> have no idea why this happens yet. Maybe we are calling it to early? But
> comenting out the gdk_screen_get_setting does not fix the hang either.

Reopening because we should figure out why this hangs gdm and stop duplicating code.
Comment 40 drago01 2014-02-18 22:32:03 UTC
Created attachment 269629 [details] [review]
hdpi: Revert hacks

Revert the hacks that where added in response to a bug caused by
commit ba459f4d202
Comment 41 drago01 2014-02-18 22:32:15 UTC
Created attachment 269630 [details] [review]
shell_global: Use g_signal_connect_swapped for update_scale_factor

Using g_signal_connect is wrong because we get the wrong argument passed
to to the callback.
Comment 42 drago01 2014-02-18 22:37:28 UTC
Created attachment 269633 [details] [review]
shell_global: Use correct agruments for in update_scale_factor

Otherwise we crash ...
Comment 43 Jasper St. Pierre (not reading bugmail) 2014-02-18 22:38:06 UTC
Review of attachment 269633 [details] [review]:

Looks good.
Comment 44 Jasper St. Pierre (not reading bugmail) 2014-02-18 22:38:25 UTC
Review of attachment 269629 [details] [review]:

OK.
Comment 45 drago01 2014-02-18 22:39:54 UTC
Attachment 269629 [details] pushed as 9e05e87 - hdpi: Revert hacks
Attachment 269633 [details] pushed as cd40011 - shell_global: Use correct agruments for in update_scale_factor