Merge lp:~eyelash/granite/fix-931249 into lp:~elementary-pantheon/granite/granite

Proposed by eyelash
Status: Merged
Merged at revision: 264
Proposed branch: lp:~eyelash/granite/fix-931249
Merge into: lp:~elementary-pantheon/granite/granite
Diff against target: 71 lines (+14/-12)
1 file modified
lib/Widgets/PopOver.vala (+14/-12)
To merge this branch: bzr merge lp:~eyelash/granite/fix-931249
Reviewer Review Type Date Requested Status
Cody Garver (community) Approve
Review via email: mp+109581@code.launchpad.net

Description of the change

I wanted to make sure different border-widths and border-radii were actually supported so I propose to merge the last few commits as well.

To post a comment you must log in.
Revision history for this message
Cody Garver (codygarver) wrote :

Hey man, great work. Send me your email address so I can give you proper credit when I commit this. https://launchpad.net/~codygarver/+contactuser

Revision history for this message
Cody Garver (codygarver) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/Widgets/PopOver.vala'
--- lib/Widgets/PopOver.vala 2012-05-28 13:36:39 +0000
+++ lib/Widgets/PopOver.vala 2012-06-11 08:55:26 +0000
@@ -358,30 +358,32 @@
358 move(x, y);358 move(x, y);
359 }359 }
360360
361 protected void cairo_popover (Cairo.Context cr, double x, double y, double width, double height) {361 protected void cairo_popover (Cairo.Context cr, double x, double y, double width, double height, double border_radius) {
362
363 if (border_radius < 0.0) border_radius = 0.0;
362364
363 // The top half365 // The top half
364 if (arrow_up) {366 if (arrow_up) {
365 cr.arc (x + BORDER_RADIUS, y + ARROW_HEIGHT + BORDER_RADIUS, BORDER_RADIUS, Math.PI, Math.PI * 1.5);367 cr.arc (x + border_radius, y + ARROW_HEIGHT + border_radius, border_radius, Math.PI, Math.PI * 1.5);
366 cr.line_to (arrow_offset, y + ARROW_HEIGHT);368 cr.line_to (arrow_offset, y + ARROW_HEIGHT);
367 cr.rel_line_to (ARROW_WIDTH / 2.0, -ARROW_HEIGHT);369 cr.rel_line_to (ARROW_WIDTH / 2.0, -ARROW_HEIGHT);
368 cr.rel_line_to (ARROW_WIDTH / 2.0, ARROW_HEIGHT);370 cr.rel_line_to (ARROW_WIDTH / 2.0, ARROW_HEIGHT);
369 cr.arc (x + width - BORDER_RADIUS, y + ARROW_HEIGHT + BORDER_RADIUS, BORDER_RADIUS, Math.PI * 1.5, Math.PI * 2.0);371 cr.arc (x + width - border_radius, y + ARROW_HEIGHT + border_radius, border_radius, Math.PI * 1.5, Math.PI * 2.0);
370 } else {372 } else {
371 cr.arc (x + BORDER_RADIUS, y + BORDER_RADIUS, BORDER_RADIUS, Math.PI, Math.PI * 1.5);373 cr.arc (x + border_radius, y + border_radius, border_radius, Math.PI, Math.PI * 1.5);
372 cr.arc (x + width - BORDER_RADIUS, y + BORDER_RADIUS, BORDER_RADIUS, Math.PI * 1.5, Math.PI * 2.0);374 cr.arc (x + width - border_radius, y + border_radius, border_radius, Math.PI * 1.5, Math.PI * 2.0);
373 }375 }
374376
375 // The bottom half377 // The bottom half
376 if (arrow_up) {378 if (arrow_up) {
377 cr.arc (x + width - BORDER_RADIUS, y + height - BORDER_RADIUS, BORDER_RADIUS, 0, Math.PI * 0.5);379 cr.arc (x + width - border_radius, y + height - border_radius, border_radius, 0, Math.PI * 0.5);
378 cr.arc (x + BORDER_RADIUS, y + height - BORDER_RADIUS, BORDER_RADIUS, Math.PI * 0.5, Math.PI);380 cr.arc (x + border_radius, y + height - border_radius, border_radius, Math.PI * 0.5, Math.PI);
379 } else {381 } else {
380 cr.arc (x + width - BORDER_RADIUS, y + height - ARROW_HEIGHT - BORDER_RADIUS, BORDER_RADIUS, 0, Math.PI * 0.5);382 cr.arc (x + width - border_radius, y + height - ARROW_HEIGHT - border_radius, border_radius, 0, Math.PI * 0.5);
381 cr.line_to (arrow_offset + ARROW_WIDTH, y + height - ARROW_HEIGHT);383 cr.line_to (arrow_offset + ARROW_WIDTH, y + height - ARROW_HEIGHT);
382 cr.rel_line_to (-ARROW_WIDTH / 2.0, ARROW_HEIGHT);384 cr.rel_line_to (-ARROW_WIDTH / 2.0, ARROW_HEIGHT);
383 cr.rel_line_to (-ARROW_WIDTH / 2.0, -ARROW_HEIGHT);385 cr.rel_line_to (-ARROW_WIDTH / 2.0, -ARROW_HEIGHT);
384 cr.arc (x + BORDER_RADIUS, y + height - ARROW_HEIGHT - BORDER_RADIUS, BORDER_RADIUS, Math.PI * 0.5, Math.PI);386 cr.arc (x + border_radius, y + height - ARROW_HEIGHT - border_radius, border_radius, Math.PI * 0.5, Math.PI);
385 }387 }
386 cr.close_path ();388 cr.close_path ();
387 }389 }
@@ -397,14 +399,14 @@
397399
398 // Shadow first400 // Shadow first
399 cairo_popover (main_buffer.context, SHADOW_SIZE, SHADOW_SIZE,401 cairo_popover (main_buffer.context, SHADOW_SIZE, SHADOW_SIZE,
400 w - SHADOW_SIZE * 2, h - SHADOW_SIZE * 2);402 w - SHADOW_SIZE * 2, h - SHADOW_SIZE * 2, BORDER_RADIUS);
401 main_buffer.context.set_source_rgba (0.0, 0.0, 0.0, 0.4);403 main_buffer.context.set_source_rgba (0.0, 0.0, 0.0, 0.4);
402 main_buffer.context.fill_preserve ();404 main_buffer.context.fill_preserve ();
403 main_buffer.exponential_blur (SHADOW_SIZE / 2 - 1); // rough approximation405 main_buffer.exponential_blur (SHADOW_SIZE / 2 - 1); // rough approximation
404406
405 // Background407 // Background
406 main_buffer.context.clip ();408 main_buffer.context.clip ();
407 Gtk.render_background (menu.get_style_context (), main_buffer.context, SHADOW_SIZE, SHADOW_SIZE, w - 2 * SHADOW_SIZE, h - 2 * SHADOW_SIZE);409 Gtk.render_background (menu.get_style_context (), main_buffer.context, 0, 0, w, h);
408 if(is_composited) {410 if(is_composited) {
409 if(get_window () != null)411 if(get_window () != null)
410 get_window ().input_shape_combine_region (new Cairo.Region.rectangle({0, 0, w - 2*(PADDINGS.right + SHADOW_SIZE), h - 2*(PADDINGS.top + SHADOW_SIZE) - ARROW_HEIGHT}),412 get_window ().input_shape_combine_region (new Cairo.Region.rectangle({0, 0, w - 2*(PADDINGS.right + SHADOW_SIZE), h - 2*(PADDINGS.top + SHADOW_SIZE) - ARROW_HEIGHT}),
@@ -415,7 +417,7 @@
415 // Outer border417 // Outer border
416 main_buffer.context.reset_clip ();418 main_buffer.context.reset_clip ();
417 cairo_popover (main_buffer.context, SHADOW_SIZE + BORDER_WIDTH / 2.0, SHADOW_SIZE + BORDER_WIDTH / 2.0,419 cairo_popover (main_buffer.context, SHADOW_SIZE + BORDER_WIDTH / 2.0, SHADOW_SIZE + BORDER_WIDTH / 2.0,
418 w - SHADOW_SIZE * 2 - BORDER_WIDTH, h - SHADOW_SIZE * 2 - BORDER_WIDTH);420 w - SHADOW_SIZE * 2 - BORDER_WIDTH, h - SHADOW_SIZE * 2 - BORDER_WIDTH, BORDER_RADIUS - BORDER_WIDTH / 2.0);
419 main_buffer.context.set_line_width (BORDER_WIDTH);421 main_buffer.context.set_line_width (BORDER_WIDTH);
420 Gdk.cairo_set_source_rgba (main_buffer.context, get_style_context ().get_border_color (Gtk.StateFlags.NORMAL));422 Gdk.cairo_set_source_rgba (main_buffer.context, get_style_context ().get_border_color (Gtk.StateFlags.NORMAL));
421 main_buffer.context.stroke ();423 main_buffer.context.stroke ();

Subscribers

People subscribed via source and target branches