Merge lp:~woodrow-shen/unity-greeter/fix-hidpi-support into lp:unity-greeter/14.04
- fix-hidpi-support
- Merge into 14.04
Status: | Needs review |
---|---|
Proposed branch: | lp:~woodrow-shen/unity-greeter/fix-hidpi-support |
Merge into: | lp:unity-greeter/14.04 |
Diff against target: |
552 lines (+148/-38) 10 files modified
src/cairo-utils.vala (+27/-0) src/dash-box.vala (+8/-4) src/dash-button.vala (+3/-1) src/dash-entry.vala (+8/-3) src/greeter-list.vala (+13/-8) src/list-stack.vala (+2/-1) src/main-window.vala (+4/-1) src/menubar.vala (+14/-2) src/prompt-box.vala (+26/-9) src/shutdown-dialog.vala (+43/-9) |
To merge this branch: | bzr merge lp:~woodrow-shen/unity-greeter/fix-hidpi-support |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robert Ancell | Needs Fixing | ||
Review via email: mp+242311@code.launchpad.net |
Commit message
Description of the change
The fix can scale menubar, prompt-box, and shutdown-dialog box according to gnome hidpi rules from https:/
Shih-Yuan Lee (fourdollars) wrote : | # |
Could you also consider to use the patch of https:/
- 1208. By Woodrow Shen
-
Fix the some code style.
- 1209. By Woodrow Shen
-
Fix the correct space number without tab.
Unmerged revisions
- 1209. By Woodrow Shen
-
Fix the correct space number without tab.
- 1208. By Woodrow Shen
-
Fix the some code style.
- 1207. By Woodrow Shen
-
Use get_hidpi_scale function to replace hard-code.
- 1206. By Woodrow Shen
-
This patch try to fix the problem that unity-greeter can't scale on a hidpi display.
Currenly the icons on menubar still don't work, and sometimes menuitem may unchanged
unexpectedly.
Preview Diff
1 | === modified file 'src/cairo-utils.vala' | |||
2 | --- src/cairo-utils.vala 2013-11-12 07:20:48 +0000 | |||
3 | +++ src/cairo-utils.vala 2014-11-21 06:18:51 +0000 | |||
4 | @@ -18,9 +18,36 @@ | |||
5 | 18 | * Mirco "MacSlow" Mueller <mirco.mueller@canonical.com> | 18 | * Mirco "MacSlow" Mueller <mirco.mueller@canonical.com> |
6 | 19 | */ | 19 | */ |
7 | 20 | 20 | ||
8 | 21 | public const int HIDPI_SCALE = 2; | ||
9 | 22 | |||
10 | 21 | namespace CairoUtils | 23 | namespace CairoUtils |
11 | 22 | { | 24 | { |
12 | 23 | 25 | ||
13 | 26 | public bool check_hidpi_display () | ||
14 | 27 | { | ||
15 | 28 | var screen = Gdk.Screen.get_default(); | ||
16 | 29 | var primary = screen.get_primary_monitor(); | ||
17 | 30 | |||
18 | 31 | Gdk.Rectangle area; | ||
19 | 32 | screen.get_monitor_geometry(primary, out area); | ||
20 | 33 | |||
21 | 34 | var diagonal = Math.sqrt (area.width * area.width + area.height * area.height); | ||
22 | 35 | |||
23 | 36 | var width_mm = screen.get_monitor_width_mm(primary); | ||
24 | 37 | var height_mm = screen.get_monitor_height_mm(primary); | ||
25 | 38 | |||
26 | 39 | var diagonal_mm = Math.sqrt (width_mm * width_mm + height_mm * height_mm); | ||
27 | 40 | |||
28 | 41 | var ppi = (int) (diagonal * 25.4 / diagonal_mm); | ||
29 | 42 | |||
30 | 43 | return (ppi >= 192) && (area.height >= 1200); | ||
31 | 44 | } | ||
32 | 45 | |||
33 | 46 | public int get_hidpi_scale () | ||
34 | 47 | { | ||
35 | 48 | return check_hidpi_display() ? HIDPI_SCALE : 1; | ||
36 | 49 | } | ||
37 | 50 | |||
38 | 24 | public void rounded_rectangle (Cairo.Context c, double x, double y, | 51 | public void rounded_rectangle (Cairo.Context c, double x, double y, |
39 | 25 | double width, double height, double radius) | 52 | double width, double height, double radius) |
40 | 26 | { | 53 | { |
41 | 27 | 54 | ||
42 | === modified file 'src/dash-box.vala' | |||
43 | --- src/dash-box.vala 2013-11-12 03:27:13 +0000 | |||
44 | +++ src/dash-box.vala 2014-11-21 06:18:51 +0000 | |||
45 | @@ -156,8 +156,11 @@ | |||
46 | 156 | } | 156 | } |
47 | 157 | else | 157 | else |
48 | 158 | { | 158 | { |
51 | 159 | min = grid_size * GreeterList.DEFAULT_BOX_HEIGHT - GreeterList.BORDER * 2; | 159 | var scale = CairoUtils.get_hidpi_scale(); |
52 | 160 | nat = grid_size * GreeterList.DEFAULT_BOX_HEIGHT - GreeterList.BORDER * 2; | 160 | min = grid_size * GreeterList.DEFAULT_BOX_HEIGHT * scale - GreeterList.BORDER * |
53 | 161 | scale * 2; | ||
54 | 162 | nat = grid_size * GreeterList.DEFAULT_BOX_HEIGHT * scale - GreeterList.BORDER * | ||
55 | 163 | scale * 2; | ||
56 | 161 | } | 164 | } |
57 | 162 | } | 165 | } |
58 | 163 | else | 166 | else |
59 | @@ -175,8 +178,9 @@ | |||
60 | 175 | 178 | ||
61 | 176 | public override void get_preferred_width (out int min, out int nat) | 179 | public override void get_preferred_width (out int min, out int nat) |
62 | 177 | { | 180 | { |
65 | 178 | min = grid_size * GreeterList.BOX_WIDTH - GreeterList.BORDER * 2; | 181 | var scale = CairoUtils.get_hidpi_scale(); |
66 | 179 | nat = grid_size * GreeterList.BOX_WIDTH - GreeterList.BORDER * 2; | 182 | min = grid_size * GreeterList.BOX_WIDTH * scale - GreeterList.BORDER * scale * 2; |
67 | 183 | nat = grid_size * GreeterList.BOX_WIDTH * scale - GreeterList.BORDER * scale * 2; | ||
68 | 180 | } | 184 | } |
69 | 181 | 185 | ||
70 | 182 | public override bool draw (Cairo.Context c) | 186 | public override bool draw (Cairo.Context c) |
71 | 183 | 187 | ||
72 | === modified file 'src/dash-button.vala' | |||
73 | --- src/dash-button.vala 2013-01-04 16:56:55 +0000 | |||
74 | +++ src/dash-button.vala 2014-11-21 06:18:51 +0000 | |||
75 | @@ -29,7 +29,9 @@ | |||
76 | 29 | set | 29 | set |
77 | 30 | { | 30 | { |
78 | 31 | _text = value; | 31 | _text = value; |
80 | 32 | text_label.set_markup ("<span font=\"Ubuntu 13\">%s</span>".printf (value)); | 32 | var font_size = 13 * CairoUtils.get_hidpi_scale(); |
81 | 33 | var font = "<span font=\"Ubuntu %d\">%s</span>".printf (font_size, value); | ||
82 | 34 | text_label.set_markup (font.printf (value)); | ||
83 | 33 | } | 35 | } |
84 | 34 | } | 36 | } |
85 | 35 | 37 | ||
86 | 36 | 38 | ||
87 | === modified file 'src/dash-entry.vala' | |||
88 | --- src/dash-entry.vala 2013-02-20 16:17:42 +0000 | |||
89 | +++ src/dash-entry.vala 2014-11-21 06:18:51 +0000 | |||
90 | @@ -23,7 +23,6 @@ | |||
91 | 23 | 23 | ||
92 | 24 | public class DashEntry : Gtk.Entry, Fadable | 24 | public class DashEntry : Gtk.Entry, Fadable |
93 | 25 | { | 25 | { |
94 | 26 | public static string font = "Ubuntu 14"; | ||
95 | 27 | public signal void respond (); | 26 | public signal void respond (); |
96 | 28 | 27 | ||
97 | 29 | public string constant_placeholder_text { get; set; } | 28 | public string constant_placeholder_text { get; set; } |
98 | @@ -73,7 +72,10 @@ | |||
99 | 73 | } | 72 | } |
100 | 74 | } | 73 | } |
101 | 75 | 74 | ||
103 | 76 | override_font (Pango.FontDescription.from_string (font)); | 75 | var font_size = 14 * CairoUtils.get_hidpi_scale(); |
104 | 76 | var set_font = "Ubuntu " + font_size.to_string(); | ||
105 | 77 | |||
106 | 78 | override_font (Pango.FontDescription.from_string (set_font)); | ||
107 | 77 | 79 | ||
108 | 78 | var style_ctx = get_style_context (); | 80 | var style_ctx = get_style_context (); |
109 | 79 | 81 | ||
110 | @@ -187,7 +189,10 @@ | |||
111 | 187 | 189 | ||
112 | 188 | /* Draw text */ | 190 | /* Draw text */ |
113 | 189 | var layout = create_pango_layout (constant_placeholder_text); | 191 | var layout = create_pango_layout (constant_placeholder_text); |
115 | 190 | layout.set_font_description (Pango.FontDescription.from_string ("Ubuntu 13")); | 192 | var font_size = 13 * CairoUtils.get_hidpi_scale(); |
116 | 193 | var set_font = "Ubuntu " + font_size.to_string(); | ||
117 | 194 | |||
118 | 195 | layout.set_font_description (Pango.FontDescription.from_string (set_font)); | ||
119 | 191 | Pango.cairo_show_layout (c, layout); | 196 | Pango.cairo_show_layout (c, layout); |
120 | 192 | 197 | ||
121 | 193 | c.restore (); | 198 | c.restore (); |
122 | 194 | 199 | ||
123 | === modified file 'src/greeter-list.vala' | |||
124 | --- src/greeter-list.vala 2014-04-30 03:05:18 +0000 | |||
125 | +++ src/greeter-list.vala 2014-11-21 06:18:51 +0000 | |||
126 | @@ -92,6 +92,7 @@ | |||
127 | 92 | private Gtk.Fixed fixed; | 92 | private Gtk.Fixed fixed; |
128 | 93 | public DashBox greeter_box; | 93 | public DashBox greeter_box; |
129 | 94 | private int cached_box_height = -1; | 94 | private int cached_box_height = -1; |
130 | 95 | private int scale; | ||
131 | 95 | 96 | ||
132 | 96 | protected enum Mode | 97 | protected enum Mode |
133 | 97 | { | 98 | { |
134 | @@ -118,7 +119,7 @@ | |||
135 | 118 | { | 119 | { |
136 | 119 | /* First, get grid row number as if menubar weren't there */ | 120 | /* First, get grid row number as if menubar weren't there */ |
137 | 120 | var row = (MainWindow.MENUBAR_HEIGHT + get_allocated_height ()) / grid_size; | 121 | var row = (MainWindow.MENUBAR_HEIGHT + get_allocated_height ()) / grid_size; |
139 | 121 | row = row - DEFAULT_BOX_HEIGHT; /* and no default dash box */ | 122 | row = row - (DEFAULT_BOX_HEIGHT * scale); /* and no default dash box */ |
140 | 122 | row = row / 2; /* and in the middle */ | 123 | row = row / 2; /* and in the middle */ |
141 | 123 | /* Now calculate y pixel spot keeping in mind menubar's allocation */ | 124 | /* Now calculate y pixel spot keeping in mind menubar's allocation */ |
142 | 124 | return row * grid_size - MainWindow.MENUBAR_HEIGHT; | 125 | return row * grid_size - MainWindow.MENUBAR_HEIGHT; |
143 | @@ -193,6 +194,8 @@ | |||
144 | 193 | { | 194 | { |
145 | 194 | debug ("Error getting session bus: %s", e.message); | 195 | debug ("Error getting session bus: %s", e.message); |
146 | 195 | } | 196 | } |
147 | 197 | |||
148 | 198 | scale = CairoUtils.get_hidpi_scale(); | ||
149 | 196 | } | 199 | } |
150 | 197 | 200 | ||
151 | 198 | private void on_bus_acquired (Object? obj, AsyncResult res) | 201 | private void on_bus_acquired (Object? obj, AsyncResult res) |
152 | @@ -219,8 +222,8 @@ | |||
153 | 219 | 222 | ||
154 | 220 | public override void get_preferred_width (out int min, out int nat) | 223 | public override void get_preferred_width (out int min, out int nat) |
155 | 221 | { | 224 | { |
158 | 222 | min = BOX_WIDTH * grid_size; | 225 | min = BOX_WIDTH * scale * grid_size; |
159 | 223 | nat = BOX_WIDTH * grid_size; | 226 | nat = BOX_WIDTH * scale * grid_size; |
160 | 224 | } | 227 | } |
161 | 225 | 228 | ||
162 | 226 | public override void get_preferred_height (out int min, out int nat) | 229 | public override void get_preferred_height (out int min, out int nat) |
163 | @@ -390,7 +393,8 @@ | |||
164 | 390 | protected void add_entry (PromptBox entry) | 393 | protected void add_entry (PromptBox entry) |
165 | 391 | { | 394 | { |
166 | 392 | entry.expand = true; | 395 | entry.expand = true; |
168 | 393 | entry.set_size_request (grid_size * BOX_WIDTH - BORDER * 2, -1); | 396 | |
169 | 397 | entry.set_size_request (grid_size * (BOX_WIDTH * scale) - (BORDER * scale) * 2, -1); | ||
170 | 394 | add_with_class (entry); | 398 | add_with_class (entry); |
171 | 395 | 399 | ||
172 | 396 | insert_entry (entry); | 400 | insert_entry (entry); |
173 | @@ -493,12 +497,12 @@ | |||
174 | 493 | 497 | ||
175 | 494 | protected int get_greeter_box_x () | 498 | protected int get_greeter_box_x () |
176 | 495 | { | 499 | { |
178 | 496 | return box_x + BORDER; | 500 | return box_x + (BORDER * scale); |
179 | 497 | } | 501 | } |
180 | 498 | 502 | ||
181 | 499 | protected int get_greeter_box_y () | 503 | protected int get_greeter_box_y () |
182 | 500 | { | 504 | { |
184 | 501 | return box_y + BORDER; | 505 | return box_y + (BORDER * scale); |
185 | 502 | } | 506 | } |
186 | 503 | 507 | ||
187 | 504 | protected virtual int get_position_y (double position) | 508 | protected virtual int get_position_y (double position) |
188 | @@ -534,7 +538,7 @@ | |||
189 | 534 | get_allocation (out allocation); | 538 | get_allocation (out allocation); |
190 | 535 | 539 | ||
191 | 536 | var child_allocation = Gtk.Allocation (); | 540 | var child_allocation = Gtk.Allocation (); |
193 | 537 | child_allocation.width = grid_size * BOX_WIDTH - BORDER * 2; | 541 | child_allocation.width = grid_size * (BOX_WIDTH * scale) - (BORDER * scale) * 2; |
194 | 538 | entry.get_preferred_height_for_width (child_allocation.width, null, out child_allocation.height); | 542 | entry.get_preferred_height_for_width (child_allocation.width, null, out child_allocation.height); |
195 | 539 | child_allocation.x = allocation.x + get_greeter_box_x (); | 543 | child_allocation.x = allocation.x + get_greeter_box_x (); |
196 | 540 | child_allocation.y = allocation.y + get_position_y (position); | 544 | child_allocation.y = allocation.y + get_position_y (position); |
197 | @@ -735,7 +739,8 @@ | |||
198 | 735 | c.save (); | 739 | c.save (); |
199 | 736 | c.push_group (); | 740 | c.push_group (); |
200 | 737 | 741 | ||
202 | 738 | c.rectangle (get_greeter_box_x (), get_greeter_box_y () - n_above * grid_size, grid_size * BOX_WIDTH - BORDER * 2, grid_size * (n_above + n_below + get_greeter_box_height_grids ())); | 742 | c.rectangle (get_greeter_box_x (), get_greeter_box_y () - n_above * grid_size, grid_size |
203 | 743 | * (BOX_WIDTH * scale)- (BORDER * scale) * 2, grid_size * (n_above + n_below + get_greeter_box_height_grids ())); | ||
204 | 739 | c.clip (); | 744 | c.clip (); |
205 | 740 | 745 | ||
206 | 741 | foreach (var child in fixed.get_children ()) | 746 | foreach (var child in fixed.get_children ()) |
207 | 742 | 747 | ||
208 | === modified file 'src/list-stack.vala' | |||
209 | --- src/list-stack.vala 2012-08-27 22:30:33 +0000 | |||
210 | +++ src/list-stack.vala 2014-11-21 06:18:51 +0000 | |||
211 | @@ -32,7 +32,8 @@ | |||
212 | 32 | 32 | ||
213 | 33 | construct | 33 | construct |
214 | 34 | { | 34 | { |
216 | 35 | width = grid_size * GreeterList.BOX_WIDTH; | 35 | var scale = CairoUtils.get_hidpi_scale(); |
217 | 36 | width = grid_size * GreeterList.BOX_WIDTH * scale; | ||
218 | 36 | } | 37 | } |
219 | 37 | 38 | ||
220 | 38 | public GreeterList? top () | 39 | public GreeterList? top () |
221 | 39 | 40 | ||
222 | === modified file 'src/main-window.vala' | |||
223 | --- src/main-window.vala 2014-03-26 21:25:01 +0000 | |||
224 | +++ src/main-window.vala 2014-11-21 06:18:51 +0000 | |||
225 | @@ -88,7 +88,10 @@ | |||
226 | 88 | { | 88 | { |
227 | 89 | debug ("Internal error loading menubox style: %s", e.message); | 89 | debug ("Internal error loading menubox style: %s", e.message); |
228 | 90 | } | 90 | } |
230 | 91 | menubox.set_size_request (-1, MENUBAR_HEIGHT); | 91 | |
231 | 92 | var scale = CairoUtils.get_hidpi_scale(); | ||
232 | 93 | |||
233 | 94 | menubox.set_size_request (-1, MENUBAR_HEIGHT * scale); | ||
234 | 92 | menubox.show (); | 95 | menubox.show (); |
235 | 93 | menualign.show (); | 96 | menualign.show (); |
236 | 94 | menubox.add (menualign); | 97 | menubox.add (menualign); |
237 | 95 | 98 | ||
238 | === modified file 'src/menubar.vala' | |||
239 | --- src/menubar.vala 2014-04-08 03:48:16 +0000 | |||
240 | +++ src/menubar.vala 2014-11-21 06:18:51 +0000 | |||
241 | @@ -115,6 +115,7 @@ | |||
242 | 115 | private Pid keyboard_pid = 0; | 115 | private Pid keyboard_pid = 0; |
243 | 116 | private Pid reader_pid = 0; | 116 | private Pid reader_pid = 0; |
244 | 117 | private Gtk.CheckMenuItem onscreen_keyboard_item; | 117 | private Gtk.CheckMenuItem onscreen_keyboard_item; |
245 | 118 | private int scale; | ||
246 | 118 | 119 | ||
247 | 119 | construct | 120 | construct |
248 | 120 | { | 121 | { |
249 | @@ -122,6 +123,8 @@ | |||
250 | 122 | 123 | ||
251 | 123 | pack_direction = Gtk.PackDirection.RTL; | 124 | pack_direction = Gtk.PackDirection.RTL; |
252 | 124 | 125 | ||
253 | 126 | scale = CairoUtils.get_hidpi_scale(); | ||
254 | 127 | |||
255 | 125 | if (UGSettings.get_boolean (UGSettings.KEY_SHOW_HOSTNAME)) | 128 | if (UGSettings.get_boolean (UGSettings.KEY_SHOW_HOSTNAME)) |
256 | 126 | { | 129 | { |
257 | 127 | var label = new Gtk.Label (Posix.utsname ().nodename); | 130 | var label = new Gtk.Label (Posix.utsname ().nodename); |
258 | @@ -137,6 +140,8 @@ | |||
259 | 137 | label.ensure_style (); | 140 | label.ensure_style (); |
260 | 138 | var fg = label.get_style_context ().get_color (Gtk.StateFlags.NORMAL); | 141 | var fg = label.get_style_context ().get_color (Gtk.StateFlags.NORMAL); |
261 | 139 | label.override_color (Gtk.StateFlags.INSENSITIVE, fg); | 142 | label.override_color (Gtk.StateFlags.INSENSITIVE, fg); |
262 | 143 | var font = 12 * scale; | ||
263 | 144 | label.override_font (Pango.FontDescription.from_string (font.to_string())); | ||
264 | 140 | } | 145 | } |
265 | 141 | 146 | ||
266 | 142 | /* Prevent dragging the window by the menubar */ | 147 | /* Prevent dragging the window by the menubar */ |
267 | @@ -175,8 +180,8 @@ | |||
268 | 175 | 180 | ||
269 | 176 | public override void get_preferred_height (out int min, out int nat) | 181 | public override void get_preferred_height (out int min, out int nat) |
270 | 177 | { | 182 | { |
273 | 178 | min = HEIGHT; | 183 | min = HEIGHT * scale; |
274 | 179 | nat = HEIGHT; | 184 | nat = HEIGHT * scale; |
275 | 180 | } | 185 | } |
276 | 181 | 186 | ||
277 | 182 | private void greeter_set_env (string key, string val) | 187 | private void greeter_set_env (string key, string val) |
278 | @@ -218,17 +223,21 @@ | |||
279 | 218 | a11y_item.show (); | 223 | a11y_item.show (); |
280 | 219 | a11y_item.set_submenu (new Gtk.Menu () as Gtk.Widget); | 224 | a11y_item.set_submenu (new Gtk.Menu () as Gtk.Widget); |
281 | 220 | onscreen_keyboard_item = new Gtk.CheckMenuItem.with_label (_("Onscreen keyboard")); | 225 | onscreen_keyboard_item = new Gtk.CheckMenuItem.with_label (_("Onscreen keyboard")); |
282 | 226 | var font = 12 * scale; | ||
283 | 227 | onscreen_keyboard_item.override_font (Pango.FontDescription.from_string (font.to_string())); | ||
284 | 221 | onscreen_keyboard_item.toggled.connect (keyboard_toggled_cb); | 228 | onscreen_keyboard_item.toggled.connect (keyboard_toggled_cb); |
285 | 222 | onscreen_keyboard_item.show (); | 229 | onscreen_keyboard_item.show (); |
286 | 223 | unowned Gtk.Menu submenu = a11y_item.submenu; | 230 | unowned Gtk.Menu submenu = a11y_item.submenu; |
287 | 224 | submenu.append (onscreen_keyboard_item); | 231 | submenu.append (onscreen_keyboard_item); |
288 | 225 | high_contrast_item = new Gtk.CheckMenuItem.with_label (_("High Contrast")); | 232 | high_contrast_item = new Gtk.CheckMenuItem.with_label (_("High Contrast")); |
289 | 233 | high_contrast_item.override_font (Pango.FontDescription.from_string (font.to_string())); | ||
290 | 226 | high_contrast_item.toggled.connect (high_contrast_toggled_cb); | 234 | high_contrast_item.toggled.connect (high_contrast_toggled_cb); |
291 | 227 | high_contrast_item.add_accelerator ("activate", accel_group, Gdk.Key.h, Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE); | 235 | high_contrast_item.add_accelerator ("activate", accel_group, Gdk.Key.h, Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE); |
292 | 228 | high_contrast_item.show (); | 236 | high_contrast_item.show (); |
293 | 229 | submenu.append (high_contrast_item); | 237 | submenu.append (high_contrast_item); |
294 | 230 | high_contrast_item.set_active (UGSettings.get_boolean (UGSettings.KEY_HIGH_CONTRAST)); | 238 | high_contrast_item.set_active (UGSettings.get_boolean (UGSettings.KEY_HIGH_CONTRAST)); |
295 | 231 | var item = new Gtk.CheckMenuItem.with_label (_("Screen Reader")); | 239 | var item = new Gtk.CheckMenuItem.with_label (_("Screen Reader")); |
296 | 240 | item.override_font (Pango.FontDescription.from_string (font.to_string())); | ||
297 | 232 | item.toggled.connect (screen_reader_toggled_cb); | 241 | item.toggled.connect (screen_reader_toggled_cb); |
298 | 233 | item.add_accelerator ("activate", accel_group, Gdk.Key.s, Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE); | 242 | item.add_accelerator ("activate", accel_group, Gdk.Key.s, Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE); |
299 | 234 | item.show (); | 243 | item.show (); |
300 | @@ -527,6 +536,9 @@ | |||
301 | 527 | break; | 536 | break; |
302 | 528 | 537 | ||
303 | 529 | var menuitem = (IndicatorMenuItem) child; | 538 | var menuitem = (IndicatorMenuItem) child; |
304 | 539 | var font = 12 * scale; | ||
305 | 540 | menuitem.override_font (Pango.FontDescription.from_string (font.to_string())); | ||
306 | 541 | menuitem.entry.label.override_font (Pango.FontDescription.from_string (font.to_string())); | ||
307 | 530 | var child_object = get_indicator_object_from_entry (menuitem.entry); | 542 | var child_object = get_indicator_object_from_entry (menuitem.entry); |
308 | 531 | var child_index = get_indicator_index (child_object); | 543 | var child_index = get_indicator_index (child_object); |
309 | 532 | if (child_index > index) | 544 | if (child_index > index) |
310 | 533 | 545 | ||
311 | === modified file 'src/prompt-box.vala' | |||
312 | --- src/prompt-box.vala 2013-01-01 20:26:59 +0000 | |||
313 | +++ src/prompt-box.vala 2014-11-21 06:18:51 +0000 | |||
314 | @@ -71,6 +71,9 @@ | |||
315 | 71 | protected static const int COL_ENTRIES_END = 1; | 71 | protected static const int COL_ENTRIES_END = 1; |
316 | 72 | protected static const int COL_ENTRIES_WIDTH = 1; | 72 | protected static const int COL_ENTRIES_WIDTH = 1; |
317 | 73 | 73 | ||
318 | 74 | protected static const int MSG_FONT_SIZE = 10; | ||
319 | 75 | protected static const int LAB_FONT_SIZE = 13; | ||
320 | 76 | |||
321 | 74 | protected int start_row; | 77 | protected int start_row; |
322 | 75 | protected int last_row; | 78 | protected int last_row; |
323 | 76 | 79 | ||
324 | @@ -87,12 +90,16 @@ | |||
325 | 87 | Object (id: id); | 90 | Object (id: id); |
326 | 88 | } | 91 | } |
327 | 89 | 92 | ||
328 | 93 | private int scale; | ||
329 | 94 | |||
330 | 90 | construct | 95 | construct |
331 | 91 | { | 96 | { |
332 | 92 | set_start_row (); | 97 | set_start_row (); |
333 | 93 | reset_last_row (); | 98 | reset_last_row (); |
334 | 94 | expand = true; | 99 | expand = true; |
335 | 95 | 100 | ||
336 | 101 | scale = CairoUtils.get_hidpi_scale(); | ||
337 | 102 | |||
338 | 96 | fixed = new Gtk.Fixed (); | 103 | fixed = new Gtk.Fixed (); |
339 | 97 | fixed.show (); | 104 | fixed.show (); |
340 | 98 | add (fixed); | 105 | add (fixed); |
341 | @@ -100,7 +107,7 @@ | |||
342 | 100 | box_grid = new Gtk.Grid (); | 107 | box_grid = new Gtk.Grid (); |
343 | 101 | box_grid.column_spacing = 4; | 108 | box_grid.column_spacing = 4; |
344 | 102 | box_grid.row_spacing = 3; | 109 | box_grid.row_spacing = 3; |
346 | 103 | box_grid.margin_top = GreeterList.BORDER; | 110 | box_grid.margin_top = GreeterList.BORDER * scale; |
347 | 104 | box_grid.margin_bottom = 6; | 111 | box_grid.margin_bottom = 6; |
348 | 105 | box_grid.expand = true; | 112 | box_grid.expand = true; |
349 | 106 | 113 | ||
350 | @@ -171,8 +178,11 @@ | |||
351 | 171 | name_grid.column_spacing = 4; | 178 | name_grid.column_spacing = 4; |
352 | 172 | name_grid.hexpand = true; | 179 | name_grid.hexpand = true; |
353 | 173 | 180 | ||
354 | 181 | int font_size = LAB_FONT_SIZE * scale; | ||
355 | 182 | string font = "Ubuntu " + font_size.to_string(); | ||
356 | 183 | |||
357 | 174 | name_label = new FadingLabel (""); | 184 | name_label = new FadingLabel (""); |
359 | 175 | name_label.override_font (Pango.FontDescription.from_string ("Ubuntu 13")); | 185 | name_label.override_font (Pango.FontDescription.from_string (font)); |
360 | 176 | name_label.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 1.0f }); | 186 | name_label.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 1.0f }); |
361 | 177 | name_label.valign = Gtk.Align.START; | 187 | name_label.valign = Gtk.Align.START; |
362 | 178 | name_label.vexpand = true; | 188 | name_label.vexpand = true; |
363 | @@ -235,8 +245,11 @@ | |||
364 | 235 | var small_name_grid = new Gtk.Grid (); | 245 | var small_name_grid = new Gtk.Grid (); |
365 | 236 | small_name_grid.column_spacing = 4; | 246 | small_name_grid.column_spacing = 4; |
366 | 237 | 247 | ||
367 | 248 | var font_size = LAB_FONT_SIZE * scale; | ||
368 | 249 | var font = "Ubuntu " + font_size.to_string(); | ||
369 | 250 | |||
370 | 238 | small_name_label = new FadingLabel (""); | 251 | small_name_label = new FadingLabel (""); |
372 | 239 | small_name_label.override_font (Pango.FontDescription.from_string ("Ubuntu 13")); | 252 | small_name_label.override_font (Pango.FontDescription.from_string (font)); |
373 | 240 | small_name_label.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 1.0f }); | 253 | small_name_label.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 1.0f }); |
374 | 241 | small_name_label.yalign = 0.5f; | 254 | small_name_label.yalign = 0.5f; |
375 | 242 | small_name_label.xalign = 0.0f; | 255 | small_name_label.xalign = 0.0f; |
376 | @@ -281,8 +294,8 @@ | |||
377 | 281 | public override void get_preferred_height (out int min, out int nat) | 294 | public override void get_preferred_height (out int min, out int nat) |
378 | 282 | { | 295 | { |
379 | 283 | base.get_preferred_height (out min, out nat); | 296 | base.get_preferred_height (out min, out nat); |
382 | 284 | min = round_to_grid (min + GreeterList.BORDER * 2) - GreeterList.BORDER * 2; | 297 | min = round_to_grid (min + GreeterList.BORDER * scale * 2) - GreeterList.BORDER * scale * 2; |
383 | 285 | nat = round_to_grid (nat + GreeterList.BORDER * 2) - GreeterList.BORDER * 2; | 298 | nat = round_to_grid (nat + GreeterList.BORDER * scale * 2) - GreeterList.BORDER * scale * 2; |
384 | 286 | } | 299 | } |
385 | 287 | 300 | ||
386 | 288 | public void set_zone (Gtk.Widget zone) | 301 | public void set_zone (Gtk.Widget zone) |
387 | @@ -435,8 +448,10 @@ | |||
388 | 435 | public void add_message (string text, bool is_error) | 448 | public void add_message (string text, bool is_error) |
389 | 436 | { | 449 | { |
390 | 437 | var label = new FadingLabel (text); | 450 | var label = new FadingLabel (text); |
391 | 451 | var font_size = MSG_FONT_SIZE * scale; | ||
392 | 452 | var font = "Ubuntu " + font_size.to_string(); | ||
393 | 438 | 453 | ||
395 | 439 | label.override_font (Pango.FontDescription.from_string ("Ubuntu 10")); | 454 | label.override_font (Pango.FontDescription.from_string (font)); |
396 | 440 | 455 | ||
397 | 441 | Gdk.RGBA color = { 1.0f, 1.0f, 1.0f, 1.0f }; | 456 | Gdk.RGBA color = { 1.0f, 1.0f, 1.0f, 1.0f }; |
398 | 442 | if (is_error) | 457 | if (is_error) |
399 | @@ -514,7 +529,9 @@ | |||
400 | 514 | 529 | ||
401 | 515 | combo.get_style_context ().add_class ("lightdm-combo"); | 530 | combo.get_style_context ().add_class ("lightdm-combo"); |
402 | 516 | combo.get_child ().get_style_context ().add_class ("lightdm-combo"); | 531 | combo.get_child ().get_style_context ().add_class ("lightdm-combo"); |
404 | 517 | combo.get_child ().override_font (Pango.FontDescription.from_string (DashEntry.font)); | 532 | var font_size = 14 * CairoUtils.get_hidpi_scale(); |
405 | 533 | var font = "Ubuntu " + font_size.to_string(); | ||
406 | 534 | combo.get_child ().override_font (Pango.FontDescription.from_string (font)); | ||
407 | 518 | 535 | ||
408 | 519 | attach_item (combo, false); | 536 | attach_item (combo, false); |
409 | 520 | 537 | ||
410 | @@ -644,13 +661,13 @@ | |||
411 | 644 | 661 | ||
412 | 645 | public override void get_preferred_width (out int min, out int nat) | 662 | public override void get_preferred_width (out int min, out int nat) |
413 | 646 | { | 663 | { |
415 | 647 | min = WIDTH; | 664 | min = WIDTH * CairoUtils.get_hidpi_scale(); |
416 | 648 | nat = min; | 665 | nat = min; |
417 | 649 | } | 666 | } |
418 | 650 | 667 | ||
419 | 651 | public override void get_preferred_height (out int min, out int nat) | 668 | public override void get_preferred_height (out int min, out int nat) |
420 | 652 | { | 669 | { |
422 | 653 | min = HEIGHT; | 670 | min = HEIGHT * CairoUtils.get_hidpi_scale(); |
423 | 654 | nat = min; | 671 | nat = min; |
424 | 655 | } | 672 | } |
425 | 656 | 673 | ||
426 | 657 | 674 | ||
427 | === modified file 'src/shutdown-dialog.vala' | |||
428 | --- src/shutdown-dialog.vala 2014-03-26 20:46:06 +0000 | |||
429 | +++ src/shutdown-dialog.vala 2014-11-21 06:18:51 +0000 | |||
430 | @@ -56,6 +56,7 @@ | |||
431 | 56 | 56 | ||
432 | 57 | private AnimateTimer animation; | 57 | private AnimateTimer animation; |
433 | 58 | private bool closing = false; | 58 | private bool closing = false; |
434 | 59 | private int scale; | ||
435 | 59 | 60 | ||
436 | 60 | 61 | ||
437 | 61 | public ShutdownDialog (ShutdownDialogType type, Background bg) | 62 | public ShutdownDialog (ShutdownDialogType type, Background bg) |
438 | @@ -76,14 +77,16 @@ | |||
439 | 76 | }); | 77 | }); |
440 | 77 | add (monitor_events); | 78 | add (monitor_events); |
441 | 78 | 79 | ||
443 | 79 | vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 10); | 80 | scale = CairoUtils.get_hidpi_scale(); |
444 | 81 | |||
445 | 82 | vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 10 * scale); | ||
446 | 80 | vbox.visible = true; | 83 | vbox.visible = true; |
447 | 81 | 84 | ||
448 | 82 | vbox.margin = BORDER_INTERNAL_SIZE; | 85 | vbox.margin = BORDER_INTERNAL_SIZE; |
453 | 83 | vbox.margin_top += 9; | 86 | vbox.margin_top += 9 * scale ; |
454 | 84 | vbox.margin_left += 20; | 87 | vbox.margin_left += 20 * scale; |
455 | 85 | vbox.margin_right += 20; | 88 | vbox.margin_right += 20 * scale; |
456 | 86 | vbox.margin_bottom += 2; | 89 | vbox.margin_bottom += 2 * scale; |
457 | 87 | 90 | ||
458 | 88 | // This event box consumes the click events inside the vbox | 91 | // This event box consumes the click events inside the vbox |
459 | 89 | vbox_events = new Gtk.EventBox(); | 92 | vbox_events = new Gtk.EventBox(); |
460 | @@ -104,7 +107,9 @@ | |||
461 | 104 | { | 107 | { |
462 | 105 | var title_label = new Gtk.Label (_("Shut Down")); | 108 | var title_label = new Gtk.Label (_("Shut Down")); |
463 | 106 | title_label.visible = true; | 109 | title_label.visible = true; |
465 | 107 | title_label.override_font (Pango.FontDescription.from_string ("Ubuntu Light 15")); | 110 | var font_size = 15 * scale; |
466 | 111 | var font = "Ubuntu Light " + font_size.to_string(); | ||
467 | 112 | title_label.override_font (Pango.FontDescription.from_string (font)); | ||
468 | 108 | title_label.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 1.0f }); | 113 | title_label.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 1.0f }); |
469 | 109 | title_label.set_alignment (0.0f, 0.5f); | 114 | title_label.set_alignment (0.0f, 0.5f); |
470 | 110 | vbox.pack_start (title_label, false, false, 0); | 115 | vbox.pack_start (title_label, false, false, 0); |
471 | @@ -138,13 +143,15 @@ | |||
472 | 138 | 143 | ||
473 | 139 | var label = new Gtk.Label (text); | 144 | var label = new Gtk.Label (text); |
474 | 140 | label.set_line_wrap (true); | 145 | label.set_line_wrap (true); |
476 | 141 | label.override_font (Pango.FontDescription.from_string ("Ubuntu Light 12")); | 146 | var font_size = 12 * scale; |
477 | 147 | var font = "Ubuntu Light " + font_size.to_string(); | ||
478 | 148 | label.override_font (Pango.FontDescription.from_string (font)); | ||
479 | 142 | label.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 1.0f }); | 149 | label.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 1.0f }); |
480 | 143 | label.set_alignment (0.0f, 0.5f); | 150 | label.set_alignment (0.0f, 0.5f); |
481 | 144 | label.visible = true; | 151 | label.visible = true; |
482 | 145 | vbox.pack_start (label, false, false, 0); | 152 | vbox.pack_start (label, false, false, 0); |
483 | 146 | 153 | ||
485 | 147 | button_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 20); | 154 | button_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 20 * 2); |
486 | 148 | button_box.visible = true; | 155 | button_box.visible = true; |
487 | 149 | vbox.pack_start (button_box, false, false, 0); | 156 | vbox.pack_start (button_box, false, false, 0); |
488 | 150 | 157 | ||
489 | @@ -541,6 +548,7 @@ | |||
490 | 541 | private string? active_filename; | 548 | private string? active_filename; |
491 | 542 | private Gtk.Image i; | 549 | private Gtk.Image i; |
492 | 543 | private Gtk.Label? l; | 550 | private Gtk.Label? l; |
493 | 551 | private int scale; | ||
494 | 544 | 552 | ||
495 | 545 | public DialogButton (string inactive_filename, string focused_filename, string? active_filename, Gtk.Label? label = null) | 553 | public DialogButton (string inactive_filename, string focused_filename, string? active_filename, Gtk.Label? label = null) |
496 | 546 | { | 554 | { |
497 | @@ -550,6 +558,11 @@ | |||
498 | 550 | relief = Gtk.ReliefStyle.NONE; | 558 | relief = Gtk.ReliefStyle.NONE; |
499 | 551 | focus_on_click = false; | 559 | focus_on_click = false; |
500 | 552 | i = new Gtk.Image.from_file (inactive_filename); | 560 | i = new Gtk.Image.from_file (inactive_filename); |
501 | 561 | scale = CairoUtils.get_hidpi_scale(); | ||
502 | 562 | int h = i.pixbuf.height; | ||
503 | 563 | int w = i.pixbuf.width; | ||
504 | 564 | var pixbuf = i.pixbuf.scale_simple(h * scale, w * scale, Gdk.InterpType.BILINEAR); | ||
505 | 565 | i.set_from_pixbuf(pixbuf); | ||
506 | 553 | i.visible = true; | 566 | i.visible = true; |
507 | 554 | add (i); | 567 | add (i); |
508 | 555 | 568 | ||
509 | @@ -558,7 +571,9 @@ | |||
510 | 558 | if (l != null) | 571 | if (l != null) |
511 | 559 | { | 572 | { |
512 | 560 | l.visible = true; | 573 | l.visible = true; |
514 | 561 | l.override_font (Pango.FontDescription.from_string ("Ubuntu Light 12")); | 574 | var font_size = 12 * scale; |
515 | 575 | var font = "Ubuntu Light " + font_size.to_string(); | ||
516 | 576 | l.override_font (Pango.FontDescription.from_string (font)); | ||
517 | 562 | l.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 0.0f }); | 577 | l.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 0.0f }); |
518 | 563 | l.override_color (Gtk.StateFlags.FOCUSED, { 1.0f, 1.0f, 1.0f, 1.0f }); | 578 | l.override_color (Gtk.StateFlags.FOCUSED, { 1.0f, 1.0f, 1.0f, 1.0f }); |
519 | 564 | l.override_color (Gtk.StateFlags.ACTIVE, { 1.0f, 1.0f, 1.0f, 1.0f }); | 579 | l.override_color (Gtk.StateFlags.ACTIVE, { 1.0f, 1.0f, 1.0f, 1.0f }); |
520 | @@ -605,13 +620,32 @@ | |||
521 | 605 | (new_flags & Gtk.StateFlags.FOCUSED) != 0) | 620 | (new_flags & Gtk.StateFlags.FOCUSED) != 0) |
522 | 606 | { | 621 | { |
523 | 607 | if ((new_flags & Gtk.StateFlags.ACTIVE) != 0 && active_filename != null) | 622 | if ((new_flags & Gtk.StateFlags.ACTIVE) != 0 && active_filename != null) |
524 | 623 | { | ||
525 | 608 | i.set_from_file (active_filename); | 624 | i.set_from_file (active_filename); |
526 | 625 | |||
527 | 626 | int h = i.pixbuf.height; | ||
528 | 627 | int w = i.pixbuf.width; | ||
529 | 628 | var pixbuf = i.pixbuf.scale_simple(h * scale, w * scale, Gdk.InterpType.BILINEAR); | ||
530 | 629 | i.set_from_pixbuf(pixbuf); | ||
531 | 630 | } | ||
532 | 609 | else | 631 | else |
533 | 632 | { | ||
534 | 610 | i.set_from_file (focused_filename); | 633 | i.set_from_file (focused_filename); |
535 | 634 | |||
536 | 635 | int h = i.pixbuf.height; | ||
537 | 636 | int w = i.pixbuf.width; | ||
538 | 637 | var pixbuf = i.pixbuf.scale_simple(h * scale, w * scale, Gdk.InterpType.BILINEAR); | ||
539 | 638 | i.set_from_pixbuf(pixbuf); | ||
540 | 639 | } | ||
541 | 611 | } | 640 | } |
542 | 612 | else | 641 | else |
543 | 613 | { | 642 | { |
544 | 614 | i.set_from_file (inactive_filename); | 643 | i.set_from_file (inactive_filename); |
545 | 644 | |||
546 | 645 | int h = i.pixbuf.height; | ||
547 | 646 | int w = i.pixbuf.width; | ||
548 | 647 | var pixbuf = i.pixbuf.scale_simple(h * scale, w * scale, Gdk.InterpType.BILINEAR); | ||
549 | 648 | i.set_from_pixbuf(pixbuf); | ||
550 | 615 | } | 649 | } |
551 | 616 | 650 | ||
552 | 617 | if (l != null) | 651 | if (l != null) |
The use of DashEntry.font is a bug and there are a number of style changes to fix.