Merge lp:~woodrow-shen/unity-greeter/fix-hidpi-support into lp:unity-greeter

Proposed by Woodrow Shen
Status: Rejected
Rejected by: Robert Ancell
Proposed branch: lp:~woodrow-shen/unity-greeter/fix-hidpi-support
Merge into: lp:unity-greeter
Diff against target: 617 lines (+171/-38) (has conflicts)
13 files modified
NEWS (+8/-0)
configure.ac (+4/-0)
debian/changelog (+11/-0)
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)
Text conflict in NEWS
Text conflict in configure.ac
Text conflict in debian/changelog
To merge this branch: bzr merge lp:~woodrow-shen/unity-greeter/fix-hidpi-support
Reviewer Review Type Date Requested Status
Robert Ancell Pending
Review via email: mp+242046@code.launchpad.net

Commit message

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.

Description of the change

The fix can scale menubar, prompt-box, and shutdown-dialog box according to gnome hidpi rules from https://wiki.gnome.org/HowDoI/HiDpi. so I just added hidpi checking into cairo-utils for temporary. But icons on menubar seem that it's hard to scale even if I used to re-scale by gtk.image. Besides, the scale factor is fixed to 2 for hidpi condition.

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) wrote :

This branch shows merge conflicts - should this have been proposed to lp:unity-greeter/14.04?

Revision history for this message
Robert Ancell (robert-ancell) wrote :

In check_hidpi_display you iterate across all the monitors but only check the primary one. Why not just:

screen.get_monitor_geometry(primary, out area)

Revision history for this message
Robert Ancell (robert-ancell) wrote :

You have a number of cases where you've used an explicit variable type, e.g. "int num_monitor" where you could just use "var num_monitor" instead.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

You have a lot of hardcoded scaling like:

var hidpi = CairoUtils.check_hidpi_display();
scale = (hidpi) ? 2 : 1;

Why not:
scale = CairoUtils.get_hidpi_scale ()

and just define the 2 once in that function?

Revision history for this message
Robert Ancell (robert-ancell) wrote :

It otherwise looks pretty good. Thanks Woodrow!

Revision history for this message
Woodrow Shen (woodrow-shen) wrote :

ok, I will re-modify it and re-send proposal to lp:unity-greeter/14.04. You just reject this merge proposal ?

Revision history for this message
Robert Ancell (robert-ancell) wrote :

You should update this proposal to apply to trunk and also make one that applies to 14.04 - otherwise users in 15.04 will not have hidpi support. We should also consider making an MP that applies to 14.10. This is easy to do once this is applied to trunk:

$ bzr branch lp:unity-greeter/14.04
$ cd 14.04
$ bzr merge -c <commit> lp:unity-greeter
$ bzr commit
(make merge request)

1207. By Woodrow Shen

Use get_hidpi_scale function to replace hard-code.

1208. By Woodrow Shen

Fix the some code style.

1209. By Woodrow Shen

Fix the correct space number without tab.

Revision history for this message
Robert Ancell (robert-ancell) wrote :
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Rejecting this MP because it's out of sync and according to https://code.launchpad.net/~fourdollars/unity-greeter/add-hidpi-support/+merge/244266 it should be obsolete.

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.

1205. By Robert Ancell

Releasing 14.04.10

1204. By Robert Ancell

Require user to acknowledge messages after last prompt

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2014-08-21 21:50:24 +0000
+++ NEWS 2014-11-21 06:18:52 +0000
@@ -1,3 +1,4 @@
1<<<<<<< TREE
1Overview of changes in unity-greeter 14.10.22Overview of changes in unity-greeter 14.10.2
23
3 - Switch the screen reader keyboard shortcut to be the same as the default4 - Switch the screen reader keyboard shortcut to be the same as the default
@@ -12,6 +13,13 @@
12 - Require user to acknowledge messages received after authentication is13 - Require user to acknowledge messages received after authentication is
13 complete, for example if their password is about to expire.14 complete, for example if their password is about to expire.
1415
16=======
17Overview of changes in unity-greeter 14.04.10
18
19 - Require user to acknowledge messages received after authentication is
20 complete, for example if their password is about to expire.
21
22>>>>>>> MERGE-SOURCE
15Overview of changes in unity-greeter 14.04.923Overview of changes in unity-greeter 14.04.9
1624
17 - Correctly handle SIGTERM and quit cleanly. We were previously not stopping25 - Correctly handle SIGTERM and quit cleanly. We were previously not stopping
1826
=== modified file 'configure.ac'
--- configure.ac 2014-11-04 02:49:30 +0000
+++ configure.ac 2014-11-21 06:18:52 +0000
@@ -2,7 +2,11 @@
22
3dnl Process this file with autoconf to produce a configure script.3dnl Process this file with autoconf to produce a configure script.
44
5<<<<<<< TREE
5AC_INIT(unity-greeter, 14.10.2)6AC_INIT(unity-greeter, 14.10.2)
7=======
8AC_INIT(unity-greeter, 14.04.10)
9>>>>>>> MERGE-SOURCE
6AC_CONFIG_MACRO_DIR(m4)10AC_CONFIG_MACRO_DIR(m4)
7AM_INIT_AUTOMAKE11AM_INIT_AUTOMAKE
8AM_PROG_CC_C_O12AM_PROG_CC_C_O
913
=== modified file 'debian/changelog'
--- debian/changelog 2014-08-21 21:50:24 +0000
+++ debian/changelog 2014-11-21 06:18:52 +0000
@@ -1,3 +1,4 @@
1<<<<<<< TREE
1unity-greeter (14.10.2-0ubuntu1) utopic; urgency=medium2unity-greeter (14.10.2-0ubuntu1) utopic; urgency=medium
23
3 * New upstream release:4 * New upstream release:
@@ -27,6 +28,16 @@
2728
28 -- Dimitri John Ledkov <xnox@ubuntu.com> Thu, 24 Apr 2014 00:23:42 +010029 -- Dimitri John Ledkov <xnox@ubuntu.com> Thu, 24 Apr 2014 00:23:42 +0100
2930
31=======
32unity-greeter (14.04.10-0ubuntu1) trusty; urgency=medium
33
34 * New upstream release:
35 - Require user to acknowledge messages received after authentication is
36 complete, for example if their password is about to expire. (LP: #1304866)
37
38 -- Robert Ancell <robert.ancell@canonical.com> Wed, 30 Apr 2014 15:33:19 +1200
39
40>>>>>>> MERGE-SOURCE
30unity-greeter (14.04.9-0ubuntu1) trusty; urgency=medium41unity-greeter (14.04.9-0ubuntu1) trusty; urgency=medium
3142
32 * New upstream release:43 * New upstream release:
3344
=== modified file 'src/cairo-utils.vala'
--- src/cairo-utils.vala 2014-04-30 00:13:06 +0000
+++ src/cairo-utils.vala 2014-11-21 06:18:52 +0000
@@ -18,9 +18,36 @@
18 * Mirco "MacSlow" Mueller <mirco.mueller@canonical.com>18 * Mirco "MacSlow" Mueller <mirco.mueller@canonical.com>
19 */19 */
2020
21public const int HIDPI_SCALE = 2;
22
21namespace CairoUtils23namespace CairoUtils
22{24{
2325
26public bool check_hidpi_display ()
27{
28 var screen = Gdk.Screen.get_default();
29 var primary = screen.get_primary_monitor();
30
31 Gdk.Rectangle area;
32 screen.get_monitor_geometry(primary, out area);
33
34 var diagonal = Math.sqrt (area.width * area.width + area.height * area.height);
35
36 var width_mm = screen.get_monitor_width_mm(primary);
37 var height_mm = screen.get_monitor_height_mm(primary);
38
39 var diagonal_mm = Math.sqrt (width_mm * width_mm + height_mm * height_mm);
40
41 var ppi = (int) (diagonal * 25.4 / diagonal_mm);
42
43 return (ppi >= 192) && (area.height >= 1200);
44}
45
46public int get_hidpi_scale ()
47{
48 return check_hidpi_display() ? HIDPI_SCALE : 1;
49}
50
24public void rounded_rectangle (Cairo.Context c, double x, double y,51public void rounded_rectangle (Cairo.Context c, double x, double y,
25 double width, double height, double radius)52 double width, double height, double radius)
26{53{
2754
=== modified file 'src/dash-box.vala'
--- src/dash-box.vala 2013-11-12 03:27:13 +0000
+++ src/dash-box.vala 2014-11-21 06:18:52 +0000
@@ -156,8 +156,11 @@
156 }156 }
157 else157 else
158 {158 {
159 min = grid_size * GreeterList.DEFAULT_BOX_HEIGHT - GreeterList.BORDER * 2;159 var scale = CairoUtils.get_hidpi_scale();
160 nat = grid_size * GreeterList.DEFAULT_BOX_HEIGHT - GreeterList.BORDER * 2;160 min = grid_size * GreeterList.DEFAULT_BOX_HEIGHT * scale - GreeterList.BORDER *
161 scale * 2;
162 nat = grid_size * GreeterList.DEFAULT_BOX_HEIGHT * scale - GreeterList.BORDER *
163 scale * 2;
161 }164 }
162 }165 }
163 else166 else
@@ -175,8 +178,9 @@
175178
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)
177 {180 {
178 min = grid_size * GreeterList.BOX_WIDTH - GreeterList.BORDER * 2;181 var scale = CairoUtils.get_hidpi_scale();
179 nat = grid_size * GreeterList.BOX_WIDTH - GreeterList.BORDER * 2;182 min = grid_size * GreeterList.BOX_WIDTH * scale - GreeterList.BORDER * scale * 2;
183 nat = grid_size * GreeterList.BOX_WIDTH * scale - GreeterList.BORDER * scale * 2;
180 }184 }
181185
182 public override bool draw (Cairo.Context c)186 public override bool draw (Cairo.Context c)
183187
=== modified file 'src/dash-button.vala'
--- src/dash-button.vala 2013-01-04 16:56:55 +0000
+++ src/dash-button.vala 2014-11-21 06:18:52 +0000
@@ -29,7 +29,9 @@
29 set29 set
30 {30 {
31 _text = value;31 _text = value;
32 text_label.set_markup ("<span font=\"Ubuntu 13\">%s</span>".printf (value));32 var font_size = 13 * CairoUtils.get_hidpi_scale();
33 var font = "<span font=\"Ubuntu %d\">%s</span>".printf (font_size, value);
34 text_label.set_markup (font.printf (value));
33 }35 }
34 }36 }
3537
3638
=== modified file 'src/dash-entry.vala'
--- src/dash-entry.vala 2013-02-20 16:17:42 +0000
+++ src/dash-entry.vala 2014-11-21 06:18:52 +0000
@@ -23,7 +23,6 @@
2323
24public class DashEntry : Gtk.Entry, Fadable24public class DashEntry : Gtk.Entry, Fadable
25{25{
26 public static string font = "Ubuntu 14";
27 public signal void respond ();26 public signal void respond ();
2827
29 public string constant_placeholder_text { get; set; }28 public string constant_placeholder_text { get; set; }
@@ -73,7 +72,10 @@
73 }72 }
74 }73 }
7574
76 override_font (Pango.FontDescription.from_string (font));75 var font_size = 14 * CairoUtils.get_hidpi_scale();
76 var set_font = "Ubuntu " + font_size.to_string();
77
78 override_font (Pango.FontDescription.from_string (set_font));
7779
78 var style_ctx = get_style_context ();80 var style_ctx = get_style_context ();
7981
@@ -187,7 +189,10 @@
187189
188 /* Draw text */190 /* Draw text */
189 var layout = create_pango_layout (constant_placeholder_text);191 var layout = create_pango_layout (constant_placeholder_text);
190 layout.set_font_description (Pango.FontDescription.from_string ("Ubuntu 13"));192 var font_size = 13 * CairoUtils.get_hidpi_scale();
193 var set_font = "Ubuntu " + font_size.to_string();
194
195 layout.set_font_description (Pango.FontDescription.from_string (set_font));
191 Pango.cairo_show_layout (c, layout);196 Pango.cairo_show_layout (c, layout);
192197
193 c.restore ();198 c.restore ();
194199
=== modified file 'src/greeter-list.vala'
--- src/greeter-list.vala 2014-04-30 00:11:07 +0000
+++ src/greeter-list.vala 2014-11-21 06:18:52 +0000
@@ -92,6 +92,7 @@
92 private Gtk.Fixed fixed;92 private Gtk.Fixed fixed;
93 public DashBox greeter_box;93 public DashBox greeter_box;
94 private int cached_box_height = -1;94 private int cached_box_height = -1;
95 private int scale;
9596
96 protected enum Mode97 protected enum Mode
97 {98 {
@@ -118,7 +119,7 @@
118 {119 {
119 /* First, get grid row number as if menubar weren't there */120 /* First, get grid row number as if menubar weren't there */
120 var row = (MainWindow.MENUBAR_HEIGHT + get_allocated_height ()) / grid_size;121 var row = (MainWindow.MENUBAR_HEIGHT + get_allocated_height ()) / grid_size;
121 row = row - DEFAULT_BOX_HEIGHT; /* and no default dash box */122 row = row - (DEFAULT_BOX_HEIGHT * scale); /* and no default dash box */
122 row = row / 2; /* and in the middle */123 row = row / 2; /* and in the middle */
123 /* Now calculate y pixel spot keeping in mind menubar's allocation */124 /* Now calculate y pixel spot keeping in mind menubar's allocation */
124 return row * grid_size - MainWindow.MENUBAR_HEIGHT;125 return row * grid_size - MainWindow.MENUBAR_HEIGHT;
@@ -193,6 +194,8 @@
193 {194 {
194 debug ("Error getting session bus: %s", e.message);195 debug ("Error getting session bus: %s", e.message);
195 }196 }
197
198 scale = CairoUtils.get_hidpi_scale();
196 }199 }
197200
198 private void on_bus_acquired (Object? obj, AsyncResult res)201 private void on_bus_acquired (Object? obj, AsyncResult res)
@@ -219,8 +222,8 @@
219222
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)
221 {224 {
222 min = BOX_WIDTH * grid_size;225 min = BOX_WIDTH * scale * grid_size;
223 nat = BOX_WIDTH * grid_size;226 nat = BOX_WIDTH * scale * grid_size;
224 }227 }
225228
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)
@@ -390,7 +393,8 @@
390 protected void add_entry (PromptBox entry)393 protected void add_entry (PromptBox entry)
391 {394 {
392 entry.expand = true;395 entry.expand = true;
393 entry.set_size_request (grid_size * BOX_WIDTH - BORDER * 2, -1);396
397 entry.set_size_request (grid_size * (BOX_WIDTH * scale) - (BORDER * scale) * 2, -1);
394 add_with_class (entry);398 add_with_class (entry);
395399
396 insert_entry (entry);400 insert_entry (entry);
@@ -493,12 +497,12 @@
493497
494 protected int get_greeter_box_x ()498 protected int get_greeter_box_x ()
495 {499 {
496 return box_x + BORDER;500 return box_x + (BORDER * scale);
497 }501 }
498502
499 protected int get_greeter_box_y ()503 protected int get_greeter_box_y ()
500 {504 {
501 return box_y + BORDER;505 return box_y + (BORDER * scale);
502 }506 }
503507
504 protected virtual int get_position_y (double position)508 protected virtual int get_position_y (double position)
@@ -534,7 +538,7 @@
534 get_allocation (out allocation);538 get_allocation (out allocation);
535539
536 var child_allocation = Gtk.Allocation ();540 var child_allocation = Gtk.Allocation ();
537 child_allocation.width = grid_size * BOX_WIDTH - BORDER * 2;541 child_allocation.width = grid_size * (BOX_WIDTH * scale) - (BORDER * scale) * 2;
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);
539 child_allocation.x = allocation.x + get_greeter_box_x ();543 child_allocation.x = allocation.x + get_greeter_box_x ();
540 child_allocation.y = allocation.y + get_position_y (position);544 child_allocation.y = allocation.y + get_position_y (position);
@@ -735,7 +739,8 @@
735 c.save ();739 c.save ();
736 c.push_group ();740 c.push_group ();
737741
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
743 * (BOX_WIDTH * scale)- (BORDER * scale) * 2, grid_size * (n_above + n_below + get_greeter_box_height_grids ()));
739 c.clip ();744 c.clip ();
740745
741 foreach (var child in fixed.get_children ())746 foreach (var child in fixed.get_children ())
742747
=== modified file 'src/list-stack.vala'
--- src/list-stack.vala 2012-08-27 22:30:33 +0000
+++ src/list-stack.vala 2014-11-21 06:18:52 +0000
@@ -32,7 +32,8 @@
3232
33 construct33 construct
34 {34 {
35 width = grid_size * GreeterList.BOX_WIDTH;35 var scale = CairoUtils.get_hidpi_scale();
36 width = grid_size * GreeterList.BOX_WIDTH * scale;
36 }37 }
3738
38 public GreeterList? top ()39 public GreeterList? top ()
3940
=== modified file 'src/main-window.vala'
--- src/main-window.vala 2014-03-26 21:25:01 +0000
+++ src/main-window.vala 2014-11-21 06:18:52 +0000
@@ -88,7 +88,10 @@
88 {88 {
89 debug ("Internal error loading menubox style: %s", e.message);89 debug ("Internal error loading menubox style: %s", e.message);
90 }90 }
91 menubox.set_size_request (-1, MENUBAR_HEIGHT);91
92 var scale = CairoUtils.get_hidpi_scale();
93
94 menubox.set_size_request (-1, MENUBAR_HEIGHT * scale);
92 menubox.show ();95 menubox.show ();
93 menualign.show ();96 menualign.show ();
94 menubox.add (menualign);97 menubox.add (menualign);
9598
=== modified file 'src/menubar.vala'
--- src/menubar.vala 2014-08-21 04:39:56 +0000
+++ src/menubar.vala 2014-11-21 06:18:52 +0000
@@ -115,6 +115,7 @@
115 private Pid keyboard_pid = 0;115 private Pid keyboard_pid = 0;
116 private Pid reader_pid = 0;116 private Pid reader_pid = 0;
117 private Gtk.CheckMenuItem onscreen_keyboard_item;117 private Gtk.CheckMenuItem onscreen_keyboard_item;
118 private int scale;
118119
119 construct120 construct
120 {121 {
@@ -122,6 +123,8 @@
122123
123 pack_direction = Gtk.PackDirection.RTL;124 pack_direction = Gtk.PackDirection.RTL;
124125
126 scale = CairoUtils.get_hidpi_scale();
127
125 if (UGSettings.get_boolean (UGSettings.KEY_SHOW_HOSTNAME))128 if (UGSettings.get_boolean (UGSettings.KEY_SHOW_HOSTNAME))
126 {129 {
127 var label = new Gtk.Label (Posix.utsname ().nodename);130 var label = new Gtk.Label (Posix.utsname ().nodename);
@@ -137,6 +140,8 @@
137 label.ensure_style ();140 label.ensure_style ();
138 var fg = label.get_style_context ().get_color (Gtk.StateFlags.NORMAL);141 var fg = label.get_style_context ().get_color (Gtk.StateFlags.NORMAL);
139 label.override_color (Gtk.StateFlags.INSENSITIVE, fg);142 label.override_color (Gtk.StateFlags.INSENSITIVE, fg);
143 var font = 12 * scale;
144 label.override_font (Pango.FontDescription.from_string (font.to_string()));
140 }145 }
141146
142 /* Prevent dragging the window by the menubar */147 /* Prevent dragging the window by the menubar */
@@ -175,8 +180,8 @@
175180
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)
177 {182 {
178 min = HEIGHT;183 min = HEIGHT * scale;
179 nat = HEIGHT;184 nat = HEIGHT * scale;
180 }185 }
181186
182 private void greeter_set_env (string key, string val)187 private void greeter_set_env (string key, string val)
@@ -218,17 +223,21 @@
218 a11y_item.show ();223 a11y_item.show ();
219 a11y_item.set_submenu (new Gtk.Menu () as Gtk.Widget);224 a11y_item.set_submenu (new Gtk.Menu () as Gtk.Widget);
220 onscreen_keyboard_item = new Gtk.CheckMenuItem.with_label (_("Onscreen keyboard"));225 onscreen_keyboard_item = new Gtk.CheckMenuItem.with_label (_("Onscreen keyboard"));
226 var font = 12 * scale;
227 onscreen_keyboard_item.override_font (Pango.FontDescription.from_string (font.to_string()));
221 onscreen_keyboard_item.toggled.connect (keyboard_toggled_cb);228 onscreen_keyboard_item.toggled.connect (keyboard_toggled_cb);
222 onscreen_keyboard_item.show ();229 onscreen_keyboard_item.show ();
223 unowned Gtk.Menu submenu = a11y_item.submenu;230 unowned Gtk.Menu submenu = a11y_item.submenu;
224 submenu.append (onscreen_keyboard_item);231 submenu.append (onscreen_keyboard_item);
225 high_contrast_item = new Gtk.CheckMenuItem.with_label (_("High Contrast"));232 high_contrast_item = new Gtk.CheckMenuItem.with_label (_("High Contrast"));
233 high_contrast_item.override_font (Pango.FontDescription.from_string (font.to_string()));
226 high_contrast_item.toggled.connect (high_contrast_toggled_cb);234 high_contrast_item.toggled.connect (high_contrast_toggled_cb);
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);
228 high_contrast_item.show ();236 high_contrast_item.show ();
229 submenu.append (high_contrast_item);237 submenu.append (high_contrast_item);
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));
231 var item = new Gtk.CheckMenuItem.with_label (_("Screen Reader"));239 var item = new Gtk.CheckMenuItem.with_label (_("Screen Reader"));
240 item.override_font (Pango.FontDescription.from_string (font.to_string()));
232 item.toggled.connect (screen_reader_toggled_cb);241 item.toggled.connect (screen_reader_toggled_cb);
233 item.add_accelerator ("activate", accel_group, Gdk.Key.s, Gdk.ModifierType.SUPER_MASK | Gdk.ModifierType.MOD1_MASK, Gtk.AccelFlags.VISIBLE);242 item.add_accelerator ("activate", accel_group, Gdk.Key.s, Gdk.ModifierType.SUPER_MASK | Gdk.ModifierType.MOD1_MASK, Gtk.AccelFlags.VISIBLE);
234 item.show ();243 item.show ();
@@ -527,6 +536,9 @@
527 break;536 break;
528537
529 var menuitem = (IndicatorMenuItem) child;538 var menuitem = (IndicatorMenuItem) child;
539 var font = 12 * scale;
540 menuitem.override_font (Pango.FontDescription.from_string (font.to_string()));
541 menuitem.entry.label.override_font (Pango.FontDescription.from_string (font.to_string()));
530 var child_object = get_indicator_object_from_entry (menuitem.entry);542 var child_object = get_indicator_object_from_entry (menuitem.entry);
531 var child_index = get_indicator_index (child_object);543 var child_index = get_indicator_index (child_object);
532 if (child_index > index)544 if (child_index > index)
533545
=== modified file 'src/prompt-box.vala'
--- src/prompt-box.vala 2013-01-01 20:26:59 +0000
+++ src/prompt-box.vala 2014-11-21 06:18:52 +0000
@@ -71,6 +71,9 @@
71 protected static const int COL_ENTRIES_END = 1;71 protected static const int COL_ENTRIES_END = 1;
72 protected static const int COL_ENTRIES_WIDTH = 1;72 protected static const int COL_ENTRIES_WIDTH = 1;
7373
74 protected static const int MSG_FONT_SIZE = 10;
75 protected static const int LAB_FONT_SIZE = 13;
76
74 protected int start_row;77 protected int start_row;
75 protected int last_row;78 protected int last_row;
7679
@@ -87,12 +90,16 @@
87 Object (id: id);90 Object (id: id);
88 }91 }
8992
93 private int scale;
94
90 construct95 construct
91 {96 {
92 set_start_row ();97 set_start_row ();
93 reset_last_row ();98 reset_last_row ();
94 expand = true;99 expand = true;
95100
101 scale = CairoUtils.get_hidpi_scale();
102
96 fixed = new Gtk.Fixed ();103 fixed = new Gtk.Fixed ();
97 fixed.show ();104 fixed.show ();
98 add (fixed);105 add (fixed);
@@ -100,7 +107,7 @@
100 box_grid = new Gtk.Grid ();107 box_grid = new Gtk.Grid ();
101 box_grid.column_spacing = 4;108 box_grid.column_spacing = 4;
102 box_grid.row_spacing = 3;109 box_grid.row_spacing = 3;
103 box_grid.margin_top = GreeterList.BORDER;110 box_grid.margin_top = GreeterList.BORDER * scale;
104 box_grid.margin_bottom = 6;111 box_grid.margin_bottom = 6;
105 box_grid.expand = true;112 box_grid.expand = true;
106113
@@ -171,8 +178,11 @@
171 name_grid.column_spacing = 4;178 name_grid.column_spacing = 4;
172 name_grid.hexpand = true;179 name_grid.hexpand = true;
173180
181 int font_size = LAB_FONT_SIZE * scale;
182 string font = "Ubuntu " + font_size.to_string();
183
174 name_label = new FadingLabel ("");184 name_label = new FadingLabel ("");
175 name_label.override_font (Pango.FontDescription.from_string ("Ubuntu 13"));185 name_label.override_font (Pango.FontDescription.from_string (font));
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 });
177 name_label.valign = Gtk.Align.START;187 name_label.valign = Gtk.Align.START;
178 name_label.vexpand = true;188 name_label.vexpand = true;
@@ -235,8 +245,11 @@
235 var small_name_grid = new Gtk.Grid ();245 var small_name_grid = new Gtk.Grid ();
236 small_name_grid.column_spacing = 4;246 small_name_grid.column_spacing = 4;
237247
248 var font_size = LAB_FONT_SIZE * scale;
249 var font = "Ubuntu " + font_size.to_string();
250
238 small_name_label = new FadingLabel ("");251 small_name_label = new FadingLabel ("");
239 small_name_label.override_font (Pango.FontDescription.from_string ("Ubuntu 13"));252 small_name_label.override_font (Pango.FontDescription.from_string (font));
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 });
241 small_name_label.yalign = 0.5f;254 small_name_label.yalign = 0.5f;
242 small_name_label.xalign = 0.0f;255 small_name_label.xalign = 0.0f;
@@ -281,8 +294,8 @@
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)
282 {295 {
283 base.get_preferred_height (out min, out nat);296 base.get_preferred_height (out min, out nat);
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;
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;
286 }299 }
287300
288 public void set_zone (Gtk.Widget zone)301 public void set_zone (Gtk.Widget zone)
@@ -435,8 +448,10 @@
435 public void add_message (string text, bool is_error)448 public void add_message (string text, bool is_error)
436 {449 {
437 var label = new FadingLabel (text);450 var label = new FadingLabel (text);
451 var font_size = MSG_FONT_SIZE * scale;
452 var font = "Ubuntu " + font_size.to_string();
438453
439 label.override_font (Pango.FontDescription.from_string ("Ubuntu 10"));454 label.override_font (Pango.FontDescription.from_string (font));
440455
441 Gdk.RGBA color = { 1.0f, 1.0f, 1.0f, 1.0f };456 Gdk.RGBA color = { 1.0f, 1.0f, 1.0f, 1.0f };
442 if (is_error)457 if (is_error)
@@ -514,7 +529,9 @@
514529
515 combo.get_style_context ().add_class ("lightdm-combo");530 combo.get_style_context ().add_class ("lightdm-combo");
516 combo.get_child ().get_style_context ().add_class ("lightdm-combo");531 combo.get_child ().get_style_context ().add_class ("lightdm-combo");
517 combo.get_child ().override_font (Pango.FontDescription.from_string (DashEntry.font));532 var font_size = 14 * CairoUtils.get_hidpi_scale();
533 var font = "Ubuntu " + font_size.to_string();
534 combo.get_child ().override_font (Pango.FontDescription.from_string (font));
518535
519 attach_item (combo, false);536 attach_item (combo, false);
520537
@@ -644,13 +661,13 @@
644661
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)
646 {663 {
647 min = WIDTH;664 min = WIDTH * CairoUtils.get_hidpi_scale();
648 nat = min;665 nat = min;
649 }666 }
650667
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)
652 {669 {
653 min = HEIGHT;670 min = HEIGHT * CairoUtils.get_hidpi_scale();
654 nat = min;671 nat = min;
655 }672 }
656673
657674
=== modified file 'src/shutdown-dialog.vala'
--- src/shutdown-dialog.vala 2014-03-26 20:46:06 +0000
+++ src/shutdown-dialog.vala 2014-11-21 06:18:52 +0000
@@ -56,6 +56,7 @@
5656
57 private AnimateTimer animation;57 private AnimateTimer animation;
58 private bool closing = false;58 private bool closing = false;
59 private int scale;
5960
6061
61 public ShutdownDialog (ShutdownDialogType type, Background bg)62 public ShutdownDialog (ShutdownDialogType type, Background bg)
@@ -76,14 +77,16 @@
76 });77 });
77 add (monitor_events);78 add (monitor_events);
7879
79 vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 10);80 scale = CairoUtils.get_hidpi_scale();
81
82 vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 10 * scale);
80 vbox.visible = true;83 vbox.visible = true;
8184
82 vbox.margin = BORDER_INTERNAL_SIZE;85 vbox.margin = BORDER_INTERNAL_SIZE;
83 vbox.margin_top += 9;86 vbox.margin_top += 9 * scale ;
84 vbox.margin_left += 20;87 vbox.margin_left += 20 * scale;
85 vbox.margin_right += 20;88 vbox.margin_right += 20 * scale;
86 vbox.margin_bottom += 2;89 vbox.margin_bottom += 2 * scale;
8790
88 // This event box consumes the click events inside the vbox91 // This event box consumes the click events inside the vbox
89 vbox_events = new Gtk.EventBox();92 vbox_events = new Gtk.EventBox();
@@ -104,7 +107,9 @@
104 {107 {
105 var title_label = new Gtk.Label (_("Shut Down"));108 var title_label = new Gtk.Label (_("Shut Down"));
106 title_label.visible = true;109 title_label.visible = true;
107 title_label.override_font (Pango.FontDescription.from_string ("Ubuntu Light 15"));110 var font_size = 15 * scale;
111 var font = "Ubuntu Light " + font_size.to_string();
112 title_label.override_font (Pango.FontDescription.from_string (font));
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 });
109 title_label.set_alignment (0.0f, 0.5f);114 title_label.set_alignment (0.0f, 0.5f);
110 vbox.pack_start (title_label, false, false, 0);115 vbox.pack_start (title_label, false, false, 0);
@@ -138,13 +143,15 @@
138143
139 var label = new Gtk.Label (text);144 var label = new Gtk.Label (text);
140 label.set_line_wrap (true);145 label.set_line_wrap (true);
141 label.override_font (Pango.FontDescription.from_string ("Ubuntu Light 12"));146 var font_size = 12 * scale;
147 var font = "Ubuntu Light " + font_size.to_string();
148 label.override_font (Pango.FontDescription.from_string (font));
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 });
143 label.set_alignment (0.0f, 0.5f);150 label.set_alignment (0.0f, 0.5f);
144 label.visible = true;151 label.visible = true;
145 vbox.pack_start (label, false, false, 0);152 vbox.pack_start (label, false, false, 0);
146153
147 button_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 20);154 button_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 20 * 2);
148 button_box.visible = true;155 button_box.visible = true;
149 vbox.pack_start (button_box, false, false, 0);156 vbox.pack_start (button_box, false, false, 0);
150157
@@ -541,6 +548,7 @@
541 private string? active_filename;548 private string? active_filename;
542 private Gtk.Image i;549 private Gtk.Image i;
543 private Gtk.Label? l;550 private Gtk.Label? l;
551 private int scale;
544552
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)
546 {554 {
@@ -550,6 +558,11 @@
550 relief = Gtk.ReliefStyle.NONE;558 relief = Gtk.ReliefStyle.NONE;
551 focus_on_click = false;559 focus_on_click = false;
552 i = new Gtk.Image.from_file (inactive_filename);560 i = new Gtk.Image.from_file (inactive_filename);
561 scale = CairoUtils.get_hidpi_scale();
562 int h = i.pixbuf.height;
563 int w = i.pixbuf.width;
564 var pixbuf = i.pixbuf.scale_simple(h * scale, w * scale, Gdk.InterpType.BILINEAR);
565 i.set_from_pixbuf(pixbuf);
553 i.visible = true;566 i.visible = true;
554 add (i);567 add (i);
555568
@@ -558,7 +571,9 @@
558 if (l != null)571 if (l != null)
559 {572 {
560 l.visible = true;573 l.visible = true;
561 l.override_font (Pango.FontDescription.from_string ("Ubuntu Light 12"));574 var font_size = 12 * scale;
575 var font = "Ubuntu Light " + font_size.to_string();
576 l.override_font (Pango.FontDescription.from_string (font));
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 });
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 });
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 });
@@ -605,13 +620,32 @@
605 (new_flags & Gtk.StateFlags.FOCUSED) != 0)620 (new_flags & Gtk.StateFlags.FOCUSED) != 0)
606 {621 {
607 if ((new_flags & Gtk.StateFlags.ACTIVE) != 0 && active_filename != null)622 if ((new_flags & Gtk.StateFlags.ACTIVE) != 0 && active_filename != null)
623 {
608 i.set_from_file (active_filename);624 i.set_from_file (active_filename);
625
626 int h = i.pixbuf.height;
627 int w = i.pixbuf.width;
628 var pixbuf = i.pixbuf.scale_simple(h * scale, w * scale, Gdk.InterpType.BILINEAR);
629 i.set_from_pixbuf(pixbuf);
630 }
609 else631 else
632 {
610 i.set_from_file (focused_filename);633 i.set_from_file (focused_filename);
634
635 int h = i.pixbuf.height;
636 int w = i.pixbuf.width;
637 var pixbuf = i.pixbuf.scale_simple(h * scale, w * scale, Gdk.InterpType.BILINEAR);
638 i.set_from_pixbuf(pixbuf);
639 }
611 }640 }
612 else641 else
613 {642 {
614 i.set_from_file (inactive_filename);643 i.set_from_file (inactive_filename);
644
645 int h = i.pixbuf.height;
646 int w = i.pixbuf.width;
647 var pixbuf = i.pixbuf.scale_simple(h * scale, w * scale, Gdk.InterpType.BILINEAR);
648 i.set_from_pixbuf(pixbuf);
615 }649 }
616650
617 if (l != null)651 if (l != null)

Subscribers

People subscribed via source and target branches