Merge lp:~binli/unity-settings-daemon/dont-scale-out-of-screen into lp:unity-settings-daemon

Proposed by Bin Li
Status: Rejected
Rejected by: Didier Roche-Tolomelli
Proposed branch: lp:~binli/unity-settings-daemon/dont-scale-out-of-screen
Merge into: lp:unity-settings-daemon
Diff against target: 60 lines (+24/-0)
2 files modified
debian/changelog (+6/-0)
plugins/xsettings/gsd-xsettings-manager.c (+18/-0)
To merge this branch: bzr merge lp:~binli/unity-settings-daemon/dont-scale-out-of-screen
Reviewer Review Type Date Requested Status
Lars Karlitski (community) Disapprove
Sebastien Bacher Pending
PS Jenkins bot Pending
Unity Settings Daemon Development Team Pending
Review via email: mp+268881@code.launchpad.net

Description of the change

/* In some case, after change the window_scale to 2 will make
   window outside of screen.
   So we puts a floor on normal window size, which are
   WINDOW_WIDTH_LIMIT and WINDOW_HEIGHT_LIMIT, now is 1024x768.
   If the window_scale is bigger than scale_x or scale_y, we
   will reset the window_scale to 1.
   For example if window_scale is 2, and screen rect.width is 1920,
   we will not scale, cause WINDOW_WIDTH_LIMIT * 2 is 2048,
   the screen don't have enough space for the minimized window. */

To post a comment you must log in.
Revision history for this message
Lars Karlitski (larsu) wrote :

I don't think introducing another concept ("window_scale") to an already complex decision makes sense.

Instead, I propose that we specify a minimum logical resolution that Ubuntu needs and use that here instead. Ubiquity (and other applications) need to take care not to grow beyond that.

review: Disapprove
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Thanks for contribution to Ubuntu and help to make it better, as lars said, hardcoding values isn't the best strategy to be future-proof. The minimum logical size path would be better to deal that globally.

Do not hesitate if you are interested in giving a hand here if needed (larsu on #ubuntu-desktop on freenode) or through other MP!

Revision history for this message
Lars Karlitski (larsu) wrote :

Actually I changed my mind a bit: we shouldn;t hard-code a resolution, but a dpi. I've commented on the bug.

Unmerged revisions

4092. By Bin Li

 * Put a floor for window size to fix the issue in HiDPI.(LP: #1443767)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2015-08-18 12:11:23 +0000
+++ debian/changelog 2015-08-24 08:22:45 +0000
@@ -1,3 +1,9 @@
1unity-settings-daemon (15.04.1+15.10.20150818-0ubuntu2) UNRELEASED; urgency=medium
2
3 * Put a floor for window size to fix the issue in HiDPI.(LP: #1443767)
4
5 -- Bin Li <bin.li@canonical.com> Mon, 24 Aug 2015 16:10:54 +0800
6
1unity-settings-daemon (15.04.1+15.10.20150818-0ubuntu1) wily; urgency=medium7unity-settings-daemon (15.04.1+15.10.20150818-0ubuntu1) wily; urgency=medium
28
3 [ Carlos Garnacho ]9 [ Carlos Garnacho ]
410
=== modified file 'plugins/xsettings/gsd-xsettings-manager.c'
--- plugins/xsettings/gsd-xsettings-manager.c 2015-06-07 19:13:44 +0000
+++ plugins/xsettings/gsd-xsettings-manager.c 2015-08-24 08:22:45 +0000
@@ -224,6 +224,9 @@
224224
225#define HIDPI_LIMIT (DPI_FALLBACK * 2)225#define HIDPI_LIMIT (DPI_FALLBACK * 2)
226226
227#define WINDOW_WIDTH_LIMIT 1024
228#define WINDOW_HEIGHT_LIMIT 768
229
227typedef struct _TranslationEntry TranslationEntry;230typedef struct _TranslationEntry TranslationEntry;
228typedef void (* TranslationFunc) (GnomeXSettingsManager *manager,231typedef void (* TranslationFunc) (GnomeXSettingsManager *manager,
229 TranslationEntry *trans,232 TranslationEntry *trans,
@@ -444,6 +447,7 @@
444 int width_mm, height_mm;447 int width_mm, height_mm;
445 int monitor_scale;448 int monitor_scale;
446 double dpi_x, dpi_y;449 double dpi_x, dpi_y;
450 double scale_x, scale_y;
447451
448 interface_settings = g_hash_table_lookup (manager->priv->settings, INTERFACE_SETTINGS_SCHEMA);452 interface_settings = g_hash_table_lookup (manager->priv->settings, INTERFACE_SETTINGS_SCHEMA);
449 window_scale =453 window_scale =
@@ -479,11 +483,25 @@
479 if (width_mm > 0 && height_mm > 0) {483 if (width_mm > 0 && height_mm > 0) {
480 dpi_x = (double)rect.width * monitor_scale / (width_mm / 25.4);484 dpi_x = (double)rect.width * monitor_scale / (width_mm / 25.4);
481 dpi_y = (double)rect.height * monitor_scale / (height_mm / 25.4);485 dpi_y = (double)rect.height * monitor_scale / (height_mm / 25.4);
486 scale_x = (double) rect.width / WINDOW_WIDTH_LIMIT;
487 scale_y = (double) rect.height / WINDOW_HEIGHT_LIMIT;
482 /* We don't completely trust these values so both488 /* We don't completely trust these values so both
483 must be high, and never pick higher ratio than489 must be high, and never pick higher ratio than
484 2 automatically */490 2 automatically */
485 if (dpi_x > HIDPI_LIMIT && dpi_y > HIDPI_LIMIT)491 if (dpi_x > HIDPI_LIMIT && dpi_y > HIDPI_LIMIT)
486 window_scale = 2;492 window_scale = 2;
493 /* In some case, after change the window_scale to 2 will make
494 window outside of screen.
495 So we puts a floor on normal window size, which are
496 WINDOW_WIDTH_LIMIT and WINDOW_HEIGHT_LIMIT, now is 1024x768.
497 If the window_scale is bigger than scale_x or scale_y, we
498 will reset the window_scale to 1.
499 For example if window_scale is 2, and screen rect.width is 1920,
500 we will not scale, cause WINDOW_WIDTH_LIMIT * 2 is 2048,
501 the screen don't have enough space for the minimized window.
502 */
503 if (window_scale > scale_x || window_scale > scale_y)
504 window_scale = 1;
487 }505 }
488 }506 }
489507

Subscribers

People subscribed via source and target branches