Merge lp:~unity-team/unity/unity.quicklist-visual-tweaks into lp:unity

Proposed by Mirco Müller
Status: Merged
Merged at revision: 310
Proposed branch: lp:~unity-team/unity/unity.quicklist-visual-tweaks
Merge into: lp:unity
Diff against target: 140 lines (+39/-11)
3 files modified
unity-private/launcher/quicklist-controller.vala (+1/-1)
unity-private/launcher/quicklist-view.vala (+6/-6)
unity/quicklist-rendering.vala (+32/-4)
To merge this branch: bzr merge lp:~unity-team/unity/unity.quicklist-visual-tweaks
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Review via email: mp+26806@code.launchpad.net

Description of the change

modified:
  unity-private/launcher/quicklist-controller.vala
  unity-private/launcher/quicklist-view.vala
  unity/quicklist-rendering.vala

This pulls some of the visual tweaks from a session I had with Michael Forrest during pre-UDS for pixel-perfecting tooltips and quicklists. I hope this will never change again :)

To post a comment you must log in.
Revision history for this message
Neil J. Patel (njpatel) wrote :

Approved, looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'unity-private/launcher/quicklist-controller.vala'
2--- unity-private/launcher/quicklist-controller.vala 2010-05-28 11:09:24 +0000
3+++ unity-private/launcher/quicklist-controller.vala 2010-06-04 13:46:26 +0000
4@@ -84,7 +84,7 @@
5 float x;
6 float y;
7 this.menu.get_position (out x, out y);
8- this.menu.set_position (x - (float) 20.0f, y - 4.0f);
9+ this.menu.set_position (x - (float) 22.0f, y - 1.0f);
10 this.is_in_label = true;
11 }
12
13
14=== modified file 'unity-private/launcher/quicklist-view.vala'
15--- unity-private/launcher/quicklist-view.vala 2010-04-27 15:41:47 +0000
16+++ unity-private/launcher/quicklist-view.vala 2010-06-04 13:46:26 +0000
17@@ -29,15 +29,15 @@
18 const float MARGIN = 0.5f;
19 const float BORDER = 0.25f;
20 const float CORNER_RADIUS = 0.3f;
21- const float CORNER_RADIUS_ABS = 8.0f;
22+ const float CORNER_RADIUS_ABS = 5.0f;
23 const float SHADOW_SIZE = 1.25f;
24 const float ITEM_HEIGHT = 2.0f;
25 const float ITEM_CORNER_RADIUS = 0.3f;
26- const float ITEM_CORNER_RADIUS_ABS = 6.0f;
27+ const float ITEM_CORNER_RADIUS_ABS = 4.0f;
28 const float ANCHOR_HEIGHT = 1.5f;
29- const float ANCHOR_HEIGHT_ABS = 14.0f;
30+ const float ANCHOR_HEIGHT_ABS = 18.0f;
31 const float ANCHOR_WIDTH = 0.75f;
32- const float ANCHOR_WIDTH_ABS = 8.0f;
33+ const float ANCHOR_WIDTH_ABS = 10.0f;
34
35 // we subclass Ctk.MenuSeperator here because we need to adapt it's appearance
36 public class QuicklistMenuSeperator : Ctk.MenuSeperator
37@@ -459,9 +459,9 @@
38 {
39 Ctk.Padding padding = Ctk.Padding () {
40 left = (int) (Ctk.em_to_pixel (BORDER + SHADOW_SIZE) + ANCHOR_WIDTH_ABS),
41- right = (int) Ctk.em_to_pixel (BORDER + SHADOW_SIZE),
42+ right = (int) Ctk.em_to_pixel (BORDER + SHADOW_SIZE) - 1,
43 top = (int) Ctk.em_to_pixel (BORDER + SHADOW_SIZE),
44- bottom = (int) Ctk.em_to_pixel (BORDER + SHADOW_SIZE)
45+ bottom = (int) Ctk.em_to_pixel (SHADOW_SIZE) + 1
46 };
47 this.set_padding (padding);
48 //this.spacing = (int) Ctk.em_to_pixel (GAP);
49
50=== modified file 'unity/quicklist-rendering.vala'
51--- unity/quicklist-rendering.vala 2010-04-26 14:04:37 +0000
52+++ unity/quicklist-rendering.vala 2010-06-04 13:46:26 +0000
53@@ -30,15 +30,15 @@
54 const float MARGIN = 0.5f;
55 const float BORDER = 0.25f;
56 const float CORNER_RADIUS = 0.3f;
57- const float CORNER_RADIUS_ABS = 8.0f;
58+ const float CORNER_RADIUS_ABS = 5.0f;
59 const float SHADOW_SIZE = 1.25f;
60 const float ITEM_HEIGHT = 2.0f;
61 const float ITEM_CORNER_RADIUS = 0.3f;
62- const float ITEM_CORNER_RADIUS_ABS = 6.0f;
63+ const float ITEM_CORNER_RADIUS_ABS = 4.0f;
64 const float ANCHOR_HEIGHT = 1.5f;
65- const float ANCHOR_HEIGHT_ABS = 14.0f;
66+ const float ANCHOR_HEIGHT_ABS = 18.0f;
67 const float ANCHOR_WIDTH = 0.75f;
68- const float ANCHOR_WIDTH_ABS = 8.0f;
69+ const float ANCHOR_WIDTH_ABS = 10.0f;
70
71 public class Seperator : GLib.Object
72 {
73@@ -150,12 +150,21 @@
74 Cairo.Surface surface = new Cairo.ImageSurface (Cairo.Format.A1, 1, 1);
75 Cairo.Context cr = new Cairo.Context (surface);
76 Pango.Layout layout = Pango.cairo_create_layout (cr);
77+ Gtk.Settings settings = Gtk.Settings.get_default ();
78 Pango.FontDescription desc = Pango.FontDescription.from_string (font);
79 desc.set_weight (Pango.Weight.NORMAL);
80 layout.set_font_description (desc);
81 layout.set_wrap (Pango.WrapMode.WORD_CHAR);
82 layout.set_ellipsize (Pango.EllipsizeMode.END);
83 layout.set_text (text, -1);
84+ Pango.Context pango_context = layout.get_context ();
85+ Gdk.Screen screen = Gdk.Screen.get_default ();
86+ Pango.cairo_context_set_font_options (pango_context,
87+ screen.get_font_options ());
88+ Pango.cairo_context_set_resolution (pango_context,
89+ (float) settings.gtk_xft_dpi /
90+ (float) Pango.SCALE);
91+ layout.context_changed ();
92 Pango.Rectangle log_rect;
93 layout.get_extents (null, out log_rect);
94 width = log_rect.width / Pango.SCALE;
95@@ -179,12 +188,21 @@
96 cr.set_source_rgba (1.0f, 1.0f, 1.0f, 1.0f);
97
98 Pango.Layout layout = Pango.cairo_create_layout (cr);
99+ Gtk.Settings settings = Gtk.Settings.get_default ();
100 Pango.FontDescription desc = Pango.FontDescription.from_string (font);
101 desc.set_weight (Pango.Weight.NORMAL);
102 layout.set_font_description (desc);
103 layout.set_wrap (Pango.WrapMode.WORD_CHAR);
104 layout.set_ellipsize (Pango.EllipsizeMode.END);
105 layout.set_text (text, -1);
106+ Pango.Context pango_context = layout.get_context ();
107+ Gdk.Screen screen = Gdk.Screen.get_default ();
108+ Pango.cairo_context_set_font_options (pango_context,
109+ screen.get_font_options ());
110+ Pango.cairo_context_set_resolution (pango_context,
111+ (float) settings.gtk_xft_dpi /
112+ (float) Pango.SCALE);
113+ layout.context_changed ();
114
115 int text_width;
116 int text_height;
117@@ -223,6 +241,7 @@
118
119 // draw text
120 Pango.Layout layout = Pango.cairo_create_layout (cr);
121+ Gtk.Settings settings = Gtk.Settings.get_default ();
122 Pango.FontDescription desc = Pango.FontDescription.from_string (font);
123 desc.set_weight (Pango.Weight.NORMAL);
124 layout.set_font_description (desc);
125@@ -230,6 +249,15 @@
126 layout.set_ellipsize (Pango.EllipsizeMode.END);
127 layout.set_text (text, -1);
128
129+ Pango.Context pango_context = layout.get_context ();
130+ Gdk.Screen screen = Gdk.Screen.get_default ();
131+ Pango.cairo_context_set_font_options (pango_context,
132+ screen.get_font_options ());
133+ Pango.cairo_context_set_resolution (pango_context,
134+ (float) settings.gtk_xft_dpi /
135+ (float) Pango.SCALE);
136+ layout.context_changed ();
137+
138 int text_width;
139 int text_height;
140 get_text_extents (font, text, out text_width, out text_height);