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
1=== modified file 'debian/changelog'
2--- debian/changelog 2015-08-18 12:11:23 +0000
3+++ debian/changelog 2015-08-24 08:22:45 +0000
4@@ -1,3 +1,9 @@
5+unity-settings-daemon (15.04.1+15.10.20150818-0ubuntu2) UNRELEASED; urgency=medium
6+
7+ * Put a floor for window size to fix the issue in HiDPI.(LP: #1443767)
8+
9+ -- Bin Li <bin.li@canonical.com> Mon, 24 Aug 2015 16:10:54 +0800
10+
11 unity-settings-daemon (15.04.1+15.10.20150818-0ubuntu1) wily; urgency=medium
12
13 [ Carlos Garnacho ]
14
15=== modified file 'plugins/xsettings/gsd-xsettings-manager.c'
16--- plugins/xsettings/gsd-xsettings-manager.c 2015-06-07 19:13:44 +0000
17+++ plugins/xsettings/gsd-xsettings-manager.c 2015-08-24 08:22:45 +0000
18@@ -224,6 +224,9 @@
19
20 #define HIDPI_LIMIT (DPI_FALLBACK * 2)
21
22+#define WINDOW_WIDTH_LIMIT 1024
23+#define WINDOW_HEIGHT_LIMIT 768
24+
25 typedef struct _TranslationEntry TranslationEntry;
26 typedef void (* TranslationFunc) (GnomeXSettingsManager *manager,
27 TranslationEntry *trans,
28@@ -444,6 +447,7 @@
29 int width_mm, height_mm;
30 int monitor_scale;
31 double dpi_x, dpi_y;
32+ double scale_x, scale_y;
33
34 interface_settings = g_hash_table_lookup (manager->priv->settings, INTERFACE_SETTINGS_SCHEMA);
35 window_scale =
36@@ -479,11 +483,25 @@
37 if (width_mm > 0 && height_mm > 0) {
38 dpi_x = (double)rect.width * monitor_scale / (width_mm / 25.4);
39 dpi_y = (double)rect.height * monitor_scale / (height_mm / 25.4);
40+ scale_x = (double) rect.width / WINDOW_WIDTH_LIMIT;
41+ scale_y = (double) rect.height / WINDOW_HEIGHT_LIMIT;
42 /* We don't completely trust these values so both
43 must be high, and never pick higher ratio than
44 2 automatically */
45 if (dpi_x > HIDPI_LIMIT && dpi_y > HIDPI_LIMIT)
46 window_scale = 2;
47+ /* In some case, after change the window_scale to 2 will make
48+ window outside of screen.
49+ So we puts a floor on normal window size, which are
50+ WINDOW_WIDTH_LIMIT and WINDOW_HEIGHT_LIMIT, now is 1024x768.
51+ If the window_scale is bigger than scale_x or scale_y, we
52+ will reset the window_scale to 1.
53+ For example if window_scale is 2, and screen rect.width is 1920,
54+ we will not scale, cause WINDOW_WIDTH_LIMIT * 2 is 2048,
55+ the screen don't have enough space for the minimized window.
56+ */
57+ if (window_scale > scale_x || window_scale > scale_y)
58+ window_scale = 1;
59 }
60 }
61

Subscribers

People subscribed via source and target branches