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
=== modified file 'plugins/xsettings/gsd-xsettings-manager.c'
--- plugins/xsettings/gsd-xsettings-manager.c 2014-11-27 10:52:57 +0000
+++ plugins/xsettings/gsd-xsettings-manager.c 2015-02-18 15:17:24 +0000
@@ -436,7 +436,7 @@
436static int436static int
437get_window_scale (GnomeXSettingsManager *manager)437get_window_scale (GnomeXSettingsManager *manager)
438{438{
439 GSettings *interface_settings;439 GSettings *interface_settings;
440 int window_scale;440 int window_scale;
441 GdkRectangle rect;441 GdkRectangle rect;
442 GdkDisplay *display;442 GdkDisplay *display;
@@ -445,13 +445,43 @@
445 int monitor_scale;445 int monitor_scale;
446 double dpi_x, dpi_y;446 double dpi_x, dpi_y;
447447
448 interface_settings = g_hash_table_lookup (manager->priv->settings, INTERFACE_SETTINGS_SCHEMA);448 interface_settings = g_hash_table_lookup (manager->priv->settings, INTERFACE_SETTINGS_SCHEMA);
449 window_scale =449 window_scale =
450 g_settings_get_uint (interface_settings, SCALING_FACTOR_KEY);450 g_settings_get_uint (interface_settings, SCALING_FACTOR_KEY);
451 if (window_scale == 0) {451 if (window_scale == 0) {
452 window_scale = 1;452 window_scale = 1;
453
454 /* Under Unity let the shell handle the scaling */
455 if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0)
456 goto out;
457
458 display = gdk_display_get_default ();
459 screen = gdk_display_get_default_screen (display);
460 gdk_screen_get_monitor_geometry (screen, 0, &rect);
461 width_mm = gdk_screen_get_monitor_width_mm (screen, 0);
462 height_mm = gdk_screen_get_monitor_height_mm (screen, 0);
463 monitor_scale = gdk_screen_get_monitor_scale_factor (screen, 0);
464
465 /* Somebody encoded the aspect ratio (16/9 or 16/10)
466 * instead of the physical size */
467 if ((width_mm == 160 && height_mm == 90) ||
468 (width_mm == 160 && height_mm == 100) ||
469 (width_mm == 16 && height_mm == 9) ||
470 (width_mm == 16 && height_mm == 10))
471 goto out;
472
473 if (width_mm > 0 && height_mm > 0) {
474 dpi_x = (double)rect.width * monitor_scale / (width_mm / 25.4);
475 dpi_y = (double)rect.height * monitor_scale / (height_mm / 25.4);
476 /* We don't completely trust these values so both
477 must be high, and never pick higher ratio than
478 2 automatically */
479 if (dpi_x > HIDPI_LIMIT && dpi_y > HIDPI_LIMIT)
480 window_scale = 2;
481 }
453 }482 }
454483
484out:
455 return window_scale;485 return window_scale;
456}486}
457487

Subscribers

People subscribed via source and target branches