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
=== modified file 'unity-private/launcher/quicklist-controller.vala'
--- unity-private/launcher/quicklist-controller.vala 2010-05-28 11:09:24 +0000
+++ unity-private/launcher/quicklist-controller.vala 2010-06-04 13:46:26 +0000
@@ -84,7 +84,7 @@
84 float x;84 float x;
85 float y;85 float y;
86 this.menu.get_position (out x, out y);86 this.menu.get_position (out x, out y);
87 this.menu.set_position (x - (float) 20.0f, y - 4.0f);87 this.menu.set_position (x - (float) 22.0f, y - 1.0f);
88 this.is_in_label = true;88 this.is_in_label = true;
89 }89 }
9090
9191
=== modified file 'unity-private/launcher/quicklist-view.vala'
--- unity-private/launcher/quicklist-view.vala 2010-04-27 15:41:47 +0000
+++ unity-private/launcher/quicklist-view.vala 2010-06-04 13:46:26 +0000
@@ -29,15 +29,15 @@
29 const float MARGIN = 0.5f;29 const float MARGIN = 0.5f;
30 const float BORDER = 0.25f;30 const float BORDER = 0.25f;
31 const float CORNER_RADIUS = 0.3f;31 const float CORNER_RADIUS = 0.3f;
32 const float CORNER_RADIUS_ABS = 8.0f;32 const float CORNER_RADIUS_ABS = 5.0f;
33 const float SHADOW_SIZE = 1.25f;33 const float SHADOW_SIZE = 1.25f;
34 const float ITEM_HEIGHT = 2.0f;34 const float ITEM_HEIGHT = 2.0f;
35 const float ITEM_CORNER_RADIUS = 0.3f;35 const float ITEM_CORNER_RADIUS = 0.3f;
36 const float ITEM_CORNER_RADIUS_ABS = 6.0f;36 const float ITEM_CORNER_RADIUS_ABS = 4.0f;
37 const float ANCHOR_HEIGHT = 1.5f;37 const float ANCHOR_HEIGHT = 1.5f;
38 const float ANCHOR_HEIGHT_ABS = 14.0f;38 const float ANCHOR_HEIGHT_ABS = 18.0f;
39 const float ANCHOR_WIDTH = 0.75f;39 const float ANCHOR_WIDTH = 0.75f;
40 const float ANCHOR_WIDTH_ABS = 8.0f;40 const float ANCHOR_WIDTH_ABS = 10.0f;
4141
42 // we subclass Ctk.MenuSeperator here because we need to adapt it's appearance42 // we subclass Ctk.MenuSeperator here because we need to adapt it's appearance
43 public class QuicklistMenuSeperator : Ctk.MenuSeperator43 public class QuicklistMenuSeperator : Ctk.MenuSeperator
@@ -459,9 +459,9 @@
459 {459 {
460 Ctk.Padding padding = Ctk.Padding () {460 Ctk.Padding padding = Ctk.Padding () {
461 left = (int) (Ctk.em_to_pixel (BORDER + SHADOW_SIZE) + ANCHOR_WIDTH_ABS),461 left = (int) (Ctk.em_to_pixel (BORDER + SHADOW_SIZE) + ANCHOR_WIDTH_ABS),
462 right = (int) Ctk.em_to_pixel (BORDER + SHADOW_SIZE),462 right = (int) Ctk.em_to_pixel (BORDER + SHADOW_SIZE) - 1,
463 top = (int) Ctk.em_to_pixel (BORDER + SHADOW_SIZE),463 top = (int) Ctk.em_to_pixel (BORDER + SHADOW_SIZE),
464 bottom = (int) Ctk.em_to_pixel (BORDER + SHADOW_SIZE)464 bottom = (int) Ctk.em_to_pixel (SHADOW_SIZE) + 1
465 };465 };
466 this.set_padding (padding);466 this.set_padding (padding);
467 //this.spacing = (int) Ctk.em_to_pixel (GAP);467 //this.spacing = (int) Ctk.em_to_pixel (GAP);
468468
=== modified file 'unity/quicklist-rendering.vala'
--- unity/quicklist-rendering.vala 2010-04-26 14:04:37 +0000
+++ unity/quicklist-rendering.vala 2010-06-04 13:46:26 +0000
@@ -30,15 +30,15 @@
30 const float MARGIN = 0.5f;30 const float MARGIN = 0.5f;
31 const float BORDER = 0.25f;31 const float BORDER = 0.25f;
32 const float CORNER_RADIUS = 0.3f;32 const float CORNER_RADIUS = 0.3f;
33 const float CORNER_RADIUS_ABS = 8.0f;33 const float CORNER_RADIUS_ABS = 5.0f;
34 const float SHADOW_SIZE = 1.25f;34 const float SHADOW_SIZE = 1.25f;
35 const float ITEM_HEIGHT = 2.0f;35 const float ITEM_HEIGHT = 2.0f;
36 const float ITEM_CORNER_RADIUS = 0.3f;36 const float ITEM_CORNER_RADIUS = 0.3f;
37 const float ITEM_CORNER_RADIUS_ABS = 6.0f;37 const float ITEM_CORNER_RADIUS_ABS = 4.0f;
38 const float ANCHOR_HEIGHT = 1.5f;38 const float ANCHOR_HEIGHT = 1.5f;
39 const float ANCHOR_HEIGHT_ABS = 14.0f;39 const float ANCHOR_HEIGHT_ABS = 18.0f;
40 const float ANCHOR_WIDTH = 0.75f;40 const float ANCHOR_WIDTH = 0.75f;
41 const float ANCHOR_WIDTH_ABS = 8.0f;41 const float ANCHOR_WIDTH_ABS = 10.0f;
4242
43 public class Seperator : GLib.Object43 public class Seperator : GLib.Object
44 {44 {
@@ -150,12 +150,21 @@
150 Cairo.Surface surface = new Cairo.ImageSurface (Cairo.Format.A1, 1, 1);150 Cairo.Surface surface = new Cairo.ImageSurface (Cairo.Format.A1, 1, 1);
151 Cairo.Context cr = new Cairo.Context (surface);151 Cairo.Context cr = new Cairo.Context (surface);
152 Pango.Layout layout = Pango.cairo_create_layout (cr);152 Pango.Layout layout = Pango.cairo_create_layout (cr);
153 Gtk.Settings settings = Gtk.Settings.get_default ();
153 Pango.FontDescription desc = Pango.FontDescription.from_string (font);154 Pango.FontDescription desc = Pango.FontDescription.from_string (font);
154 desc.set_weight (Pango.Weight.NORMAL);155 desc.set_weight (Pango.Weight.NORMAL);
155 layout.set_font_description (desc);156 layout.set_font_description (desc);
156 layout.set_wrap (Pango.WrapMode.WORD_CHAR);157 layout.set_wrap (Pango.WrapMode.WORD_CHAR);
157 layout.set_ellipsize (Pango.EllipsizeMode.END);158 layout.set_ellipsize (Pango.EllipsizeMode.END);
158 layout.set_text (text, -1);159 layout.set_text (text, -1);
160 Pango.Context pango_context = layout.get_context ();
161 Gdk.Screen screen = Gdk.Screen.get_default ();
162 Pango.cairo_context_set_font_options (pango_context,
163 screen.get_font_options ());
164 Pango.cairo_context_set_resolution (pango_context,
165 (float) settings.gtk_xft_dpi /
166 (float) Pango.SCALE);
167 layout.context_changed ();
159 Pango.Rectangle log_rect;168 Pango.Rectangle log_rect;
160 layout.get_extents (null, out log_rect);169 layout.get_extents (null, out log_rect);
161 width = log_rect.width / Pango.SCALE;170 width = log_rect.width / Pango.SCALE;
@@ -179,12 +188,21 @@
179 cr.set_source_rgba (1.0f, 1.0f, 1.0f, 1.0f);188 cr.set_source_rgba (1.0f, 1.0f, 1.0f, 1.0f);
180189
181 Pango.Layout layout = Pango.cairo_create_layout (cr);190 Pango.Layout layout = Pango.cairo_create_layout (cr);
191 Gtk.Settings settings = Gtk.Settings.get_default ();
182 Pango.FontDescription desc = Pango.FontDescription.from_string (font);192 Pango.FontDescription desc = Pango.FontDescription.from_string (font);
183 desc.set_weight (Pango.Weight.NORMAL);193 desc.set_weight (Pango.Weight.NORMAL);
184 layout.set_font_description (desc);194 layout.set_font_description (desc);
185 layout.set_wrap (Pango.WrapMode.WORD_CHAR);195 layout.set_wrap (Pango.WrapMode.WORD_CHAR);
186 layout.set_ellipsize (Pango.EllipsizeMode.END);196 layout.set_ellipsize (Pango.EllipsizeMode.END);
187 layout.set_text (text, -1);197 layout.set_text (text, -1);
198 Pango.Context pango_context = layout.get_context ();
199 Gdk.Screen screen = Gdk.Screen.get_default ();
200 Pango.cairo_context_set_font_options (pango_context,
201 screen.get_font_options ());
202 Pango.cairo_context_set_resolution (pango_context,
203 (float) settings.gtk_xft_dpi /
204 (float) Pango.SCALE);
205 layout.context_changed ();
188206
189 int text_width;207 int text_width;
190 int text_height;208 int text_height;
@@ -223,6 +241,7 @@
223241
224 // draw text242 // draw text
225 Pango.Layout layout = Pango.cairo_create_layout (cr);243 Pango.Layout layout = Pango.cairo_create_layout (cr);
244 Gtk.Settings settings = Gtk.Settings.get_default ();
226 Pango.FontDescription desc = Pango.FontDescription.from_string (font);245 Pango.FontDescription desc = Pango.FontDescription.from_string (font);
227 desc.set_weight (Pango.Weight.NORMAL);246 desc.set_weight (Pango.Weight.NORMAL);
228 layout.set_font_description (desc);247 layout.set_font_description (desc);
@@ -230,6 +249,15 @@
230 layout.set_ellipsize (Pango.EllipsizeMode.END);249 layout.set_ellipsize (Pango.EllipsizeMode.END);
231 layout.set_text (text, -1);250 layout.set_text (text, -1);
232251
252 Pango.Context pango_context = layout.get_context ();
253 Gdk.Screen screen = Gdk.Screen.get_default ();
254 Pango.cairo_context_set_font_options (pango_context,
255 screen.get_font_options ());
256 Pango.cairo_context_set_resolution (pango_context,
257 (float) settings.gtk_xft_dpi /
258 (float) Pango.SCALE);
259 layout.context_changed ();
260
233 int text_width;261 int text_width;
234 int text_height;262 int text_height;
235 get_text_extents (font, text, out text_width, out text_height);263 get_text_extents (font, text, out text_width, out text_height);