elementary-dev-community team mailing list archive
-
elementary-dev-community team
-
Mailing list archive
-
Message #02711
[Merge] lp:~elementary-dev-community/wingpanel/bug-fix-1007630 into lp:wingpanel
Albert has proposed merging lp:~elementary-dev-community/wingpanel/bug-fix-1007630 into lp:wingpanel.
Requested reviews:
elementary Pantheon team (elementary-pantheon)
Related bugs:
Bug #1007630 in Wingpanel: "Wrong position of the arrow in some indicators"
https://bugs.launchpad.net/wingpanel/+bug/1007630
For more details, see:
https://code.launchpad.net/~elementary-dev-community/wingpanel/bug-fix-1007630/+merge/181999
Fixed the arrow not well positioned after changing the contents of the indicator, adding a repaint after "configure_event" signal.
This is how it looks on released version of elementary OS Luna:
https://www.dropbox.com/s/66jmohecrhwy5vs/luna_released_bug.mp4
This is how it looks with this fix:
https://www.dropbox.com/s/g63yurmg2izuxyq/luna_proposed_fix.mp4
--
https://code.launchpad.net/~elementary-dev-community/wingpanel/bug-fix-1007630/+merge/181999
Your team elementary Developer Community is subscribed to branch lp:~elementary-dev-community/wingpanel/bug-fix-1007630.
=== modified file 'src/Indicator/IndicatorObjectEntry.vala'
--- src/Indicator/IndicatorObjectEntry.vala 2013-08-19 19:12:24 +0000
+++ src/Indicator/IndicatorObjectEntry.vala 2013-08-25 14:36:27 +0000
@@ -27,8 +27,6 @@
// used for drawing
private Gtk.Window menu;
private Granite.Drawing.BufferSurface buffer;
- private int w = -1;
- private int h = -1;
private int arrow_height = 10;
private int arrow_width = 20;
private double x = 10.5;
@@ -72,9 +70,18 @@
set_submenu (entry.menu);
setup_drawing ();
-
- entry.menu.get_children ().foreach (setup_margin);
- entry.menu.insert.connect (setup_margin);
+<<<<<<< TREE
+
+ entry.menu.get_children ().foreach (setup_margin);
+ entry.menu.insert.connect (setup_margin);
+=======
+
+ entry.menu.get_children ().foreach (setup_margin);
+ entry.menu.insert.connect (setup_margin);
+
+ entry.menu.set_redraw_on_allocate (true);
+ entry.menu.configure_event.connect (entry_menu_configure_event_callback);
+>>>>>>> MERGE-SOURCE
}
public IndicatorIface get_indicator () {
@@ -113,39 +120,56 @@
menu_parent.app_paintable = true;
menu_parent.set_visual (Gdk.Screen.get_default ().get_rgba_visual ());
+<<<<<<< TREE
+=======
+ menu_parent.set_redraw_on_allocate (true);
+ menu_parent.configure_event.connect (entry_menu_parent_configure_event_callback);
+>>>>>>> MERGE-SOURCE
menu_parent.draw.connect (entry_menu_parent_draw_callback);
}
+<<<<<<< TREE
+=======
+ private bool entry_menu_configure_event_callback (Gdk.EventConfigure event) {
+ entry.menu.queue_draw ();
+ return false;
+ }
+
+ private bool entry_menu_parent_configure_event_callback (Gdk.EventConfigure event) {
+ var menu_parent = entry.menu.get_parent ();
+ menu_parent.queue_draw ();
+ return false;
+ }
+
+>>>>>>> MERGE-SOURCE
private bool entry_menu_parent_draw_callback (Cairo.Context ctx) {
- var new_w = entry.menu.get_parent ().get_allocated_width ();
- var new_h = entry.menu.get_parent ().get_allocated_height ();
-
- if (new_w != w || new_h != h) {
- w = new_w;
- h = new_h;
-
- buffer = new Granite.Drawing.BufferSurface (w, h);
- cairo_popover (w, h);
-
- var cr = buffer.context;
-
- // shadow
- cr.set_source_rgba (0, 0, 0, 0.5);
- cr.fill_preserve ();
- buffer.exponential_blur (6);
- cr.clip ();
-
- // background
- menu.get_style_context ().render_background (cr, 0, 0, w, h);
- cr.reset_clip ();
-
- // border
- cairo_popover (w, h);
- cr.set_operator (Cairo.Operator.SOURCE);
- cr.set_line_width (1);
- Gdk.cairo_set_source_rgba (cr, menu.get_style_context ().get_border_color (Gtk.StateFlags.NORMAL));
- cr.stroke ();
- }
+ var menu_parent = entry.menu.get_parent ();
+ int menu_width = menu_parent.get_allocated_width ();
+ int menu_height = menu_parent.get_allocated_height ();
+ int indicator_width = get_allocated_width ();
+ int indicator_height = get_allocated_height ();
+
+ buffer = new Granite.Drawing.BufferSurface (menu_width, menu_height);
+ cairo_popover (menu_width, menu_height, indicator_width, indicator_height);
+
+ var cr = buffer.context;
+
+ // shadow
+ cr.set_source_rgba (0, 0, 0, 0.5);
+ cr.fill_preserve ();
+ buffer.exponential_blur (6);
+ cr.clip ();
+
+ // background
+ menu.get_style_context ().render_background (cr, 0, 0, menu_width, menu_height);
+ cr.reset_clip ();
+
+ // border
+ cairo_popover (menu_width, menu_height, indicator_width, indicator_height);
+ cr.set_operator (Cairo.Operator.SOURCE);
+ cr.set_line_width (1);
+ Gdk.cairo_set_source_rgba (cr, menu.get_style_context ().get_border_color (Gtk.StateFlags.NORMAL));
+ cr.stroke ();
// clear surface to transparent
ctx.set_operator (Cairo.Operator.SOURCE);
@@ -159,35 +183,57 @@
return false;
}
- private void cairo_popover (int w, int h) {
- w = w - 20;
- h = h - 20;
-
+ private void cairo_popover (int menu_width, int menu_height, int indicator_width, int indicator_height) {
// Get some nice pos for the arrow
var offs = 30;
int p_x;
int w_x;
+ bool draw_tr_arc = true;
+ bool draw_tl_arc = true;
Gtk.Allocation alloc;
- this.get_window ().get_origin (out p_x, null);
- this.get_allocation (out alloc);
+ get_window ().get_origin (out p_x, null);
+ get_allocation (out alloc);
entry.menu.get_window ().get_origin (out w_x, null);
- offs = (p_x + alloc.x) - w_x + this.get_allocated_width () / 4;
- if (offs + 50 > (w + 20))
- offs = (w + 20) - 15 - arrow_width;
- if (offs < 17)
- offs = 17;
-
- buffer.context.arc (x + radius, y + arrow_height + radius, radius, Math.PI, Math.PI * 1.5);
+ offs = (p_x + alloc.x) - w_x + (indicator_width / 2) - (arrow_width / 2);
+
+ if (offs > menu_width - 10 - arrow_width) {
+ offs = menu_width - 10 - arrow_width;
+ draw_tr_arc = false;
+ }
+
+ if (offs < 10) {
+ offs = 10;
+ draw_tl_arc = false;
+ }
+
+ menu_width -= 20;
+ menu_height -= 20;
+
+ // Don't draw top left arc if arrow needs to be placed there
+ if (draw_tl_arc)
+ buffer.context.arc (x + radius, y + arrow_height + radius, radius, Math.PI, Math.PI * 1.5);
+
buffer.context.line_to (offs, y + arrow_height);
buffer.context.rel_line_to (arrow_width / 2.0, -arrow_height);
buffer.context.rel_line_to (arrow_width / 2.0, arrow_height);
+<<<<<<< TREE
buffer.context.arc (x + w - radius, y + arrow_height + radius, radius, Math.PI * 1.5, Math.PI * 2.0);
buffer.context.arc (x + w - radius, y + h - radius, radius, 0, Math.PI * 0.5);
buffer.context.arc (x + radius, y + h - radius, radius, Math.PI * 0.5, Math.PI);
+=======
+
+ // Don't draw top right arc if arrow needs to be placed there
+ if (draw_tr_arc)
+ buffer.context.arc (x + menu_width - radius, y + arrow_height + radius, radius, Math.PI * 1.5, Math.PI * 2.0);
+
+ buffer.context.arc (x + menu_width - radius, y + menu_height - radius, radius, 0, Math.PI * 0.5);
+ buffer.context.arc (x + radius, y + menu_height - radius, radius, Math.PI * 0.5, Math.PI);
+
+>>>>>>> MERGE-SOURCE
buffer.context.close_path ();
}
Follow ups
-
[Merge] lp:~elementary-dev-community/wingpanel/bug-fix-1007630 into lp:wingpanel
From: noreply, 2014-01-26
-
[Merge] lp:~elementary-dev-community/wingpanel/bug-fix-1007630 into lp:wingpanel
From: Daniel Fore, 2014-01-26
-
[Merge] lp:~elementary-dev-community/wingpanel/bug-fix-1007630 into lp:wingpanel
From: Daniel Fore, 2014-01-26
-
Re: [Merge] lp:~elementary-dev-community/wingpanel/bug-fix-1007630 into lp:wingpanel
From: Daniel Fore, 2014-01-26
-
Re: [Merge] lp:~elementary-dev-community/wingpanel/bug-fix-1007630 into lp:wingpanel
From: David Gomes, 2013-08-26
-
Re: [Merge] lp:~elementary-dev-community/wingpanel/bug-fix-1007630 into lp:wingpanel
From: David Gomes, 2013-08-26
-
Re: [Merge] lp:~elementary-dev-community/wingpanel/bug-fix-1007630 into lp:wingpanel
From: Albert, 2013-08-26
-
Re: [Merge] lp:~elementary-dev-community/wingpanel/bug-fix-1007630 into lp:wingpanel
From: Sergey "Shnatsel" Davidoff, 2013-08-26
-
Re: [Merge] lp:~elementary-dev-community/wingpanel/bug-fix-1007630 into lp:wingpanel
From: Sergey "Shnatsel" Davidoff, 2013-08-26
-
Re: [Merge] lp:~elementary-dev-community/wingpanel/bug-fix-1007630 into lp:wingpanel
From: Cameron Norman, 2013-08-26
-
Re: [Merge] lp:~elementary-dev-community/wingpanel/bug-fix-1007630 into lp:wingpanel
From: Erasmo Marín, 2013-08-26