Merge lp:~seb128/unity-settings-daemon/non-unity-sessions-need-scaling into lp:unity-settings-daemon

Proposed by Sebastien Bacher
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 4069
Merged at revision: 4074
Proposed branch: lp:~seb128/unity-settings-daemon/non-unity-sessions-need-scaling
Merge into: lp:unity-settings-daemon
Diff against target: 56 lines (+32/-2)
1 file modified
plugins/xsettings/gsd-xsettings-manager.c (+32/-2)
To merge this branch: bzr merge lp:~seb128/unity-settings-daemon/non-unity-sessions-need-scaling
Reviewer Review Type Date Requested Status
Lars Karlitski (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Unity Settings Daemon Development Team Pending
Review via email: mp+250153@code.launchpad.net

Commit message

Restore code that set the scaling factor according the screen dpi, but only
when not under and Unity session. That was desactived in r4020 because Unity
is handling those values, but this is not the case under ubiquity or
unity-greeter.

Description of the change

Restore code that set the scaling factor according the screen dpi, but only
when not under and Unity session. That was desactived in r4020 because Unity
is handling those values, but this is not the case under ubiquity or
unity-greeter.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Lars Karlitski (larsu) wrote :

I can't believe the mm values are sometimes 16/9. We should look into fixing this in the proper module.

Look ok to me otherwise. Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/xsettings/gsd-xsettings-manager.c'
2--- plugins/xsettings/gsd-xsettings-manager.c 2014-11-27 10:52:57 +0000
3+++ plugins/xsettings/gsd-xsettings-manager.c 2015-02-18 15:17:24 +0000
4@@ -436,7 +436,7 @@
5 static int
6 get_window_scale (GnomeXSettingsManager *manager)
7 {
8- GSettings *interface_settings;
9+ GSettings *interface_settings;
10 int window_scale;
11 GdkRectangle rect;
12 GdkDisplay *display;
13@@ -445,13 +445,43 @@
14 int monitor_scale;
15 double dpi_x, dpi_y;
16
17- interface_settings = g_hash_table_lookup (manager->priv->settings, INTERFACE_SETTINGS_SCHEMA);
18+ interface_settings = g_hash_table_lookup (manager->priv->settings, INTERFACE_SETTINGS_SCHEMA);
19 window_scale =
20 g_settings_get_uint (interface_settings, SCALING_FACTOR_KEY);
21 if (window_scale == 0) {
22 window_scale = 1;
23+
24+ /* Under Unity let the shell handle the scaling */
25+ if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0)
26+ goto out;
27+
28+ display = gdk_display_get_default ();
29+ screen = gdk_display_get_default_screen (display);
30+ gdk_screen_get_monitor_geometry (screen, 0, &rect);
31+ width_mm = gdk_screen_get_monitor_width_mm (screen, 0);
32+ height_mm = gdk_screen_get_monitor_height_mm (screen, 0);
33+ monitor_scale = gdk_screen_get_monitor_scale_factor (screen, 0);
34+
35+ /* Somebody encoded the aspect ratio (16/9 or 16/10)
36+ * instead of the physical size */
37+ if ((width_mm == 160 && height_mm == 90) ||
38+ (width_mm == 160 && height_mm == 100) ||
39+ (width_mm == 16 && height_mm == 9) ||
40+ (width_mm == 16 && height_mm == 10))
41+ goto out;
42+
43+ if (width_mm > 0 && height_mm > 0) {
44+ dpi_x = (double)rect.width * monitor_scale / (width_mm / 25.4);
45+ dpi_y = (double)rect.height * monitor_scale / (height_mm / 25.4);
46+ /* We don't completely trust these values so both
47+ must be high, and never pick higher ratio than
48+ 2 automatically */
49+ if (dpi_x > HIDPI_LIMIT && dpi_y > HIDPI_LIMIT)
50+ window_scale = 2;
51+ }
52 }
53
54+out:
55 return window_scale;
56 }
57

Subscribers

People subscribed via source and target branches