Merge lp:~elementary-dev-community/wingpanel/bug-fix-1007630 into lp:~elementary-pantheon/wingpanel/old-trunk

Proposed by Albert
Status: Merged
Approved by: Danielle Foré
Approved revision: 151
Merged at revision: 155
Proposed branch: lp:~elementary-dev-community/wingpanel/bug-fix-1007630
Merge into: lp:~elementary-pantheon/wingpanel/old-trunk
Diff against target: 168 lines (+74/-48)
1 file modified
src/Indicator/IndicatorObjectEntry.vala (+74/-48)
To merge this branch: bzr merge lp:~elementary-dev-community/wingpanel/bug-fix-1007630
Reviewer Review Type Date Requested Status
Danielle Foré Approve
David Gomes (community) Approve
Review via email: mp+181999@code.launchpad.net

Commit message

Fixed the arrow not well positioned after changing the contents of the indicator, adding a repaint after "configure_event" signal.

Description of the change

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

To post a comment you must log in.
151. By Albert

Fixed conflicts

Revision history for this message
Erasmo Marín (erasmo-marin) wrote :

It segfaults to me (stable luna)

wingpanel
[_LOG_LEVEL_INFO 20:57:38.238671] Application.vala:77: Wingpanel version: 0.2.4
[_LOG_LEVEL_INFO 20:57:38.238845] Application.vala:79: Kernel version: 3.8.0-27-generic
[_LOG_LEVEL_WARN 20:57:38.424913] IndicatorFileModel.vala:60: SKIP LOADING: libappmenu.so
[_LOG_LEVEL_FATAL 20:57:38.428324] [GLib-GObject] g_object_set: assertion `G_IS_OBJECT (object)' failed
[_LOG_LEVEL_FATAL 20:57:38.428367] Wingpanel will not function properly.
[_LOG_LEVEL_FATAL 20:57:38.439736] IndicatorFileModel.vala:91: Unable to load /usr/lib/indicators3/7/libindicator-terminal.so
[_LOG_LEVEL_FATAL 20:57:38.439786] Wingpanel will not function properly.
[_LOG_LEVEL_WARN 20:57:38.439863] [GLib-GObject] invalid unclassed pointer in cast to `GObject'
[_LOG_LEVEL_FATAL 20:57:38.439930] [GLib-GObject] g_object_steal_data: assertion `G_IS_OBJECT (object)' failed
[_LOG_LEVEL_FATAL 20:57:38.439962] Wingpanel will not function properly.
[_LOG_LEVEL_WARN 20:57:38.439997] [GLib-GObject] invalid unclassed pointer in cast to `GObject'
[_LOG_LEVEL_FATAL 20:57:38.440030] [GLib-GObject] g_object_steal_data: assertion `G_IS_OBJECT (object)' failed
[_LOG_LEVEL_FATAL 20:57:38.440062] Wingpanel will not function properly.
[_LOG_LEVEL_FATAL 20:57:38.440623] IndicatorFileModel.vala:91: Unable to load /usr/lib/indicators3/7/libapplication.so
[_LOG_LEVEL_FATAL 20:57:38.440662] Wingpanel will not function properly.
[_LOG_LEVEL_FATAL 20:57:38.443748] IndicatorFileModel.vala:91: Unable to load /usr/lib/indicators3/7/libdatetime.so
[_LOG_LEVEL_FATAL 20:57:38.443820] Wingpanel will not function properly.
[_LOG_LEVEL_WARN 20:57:38.444045] [Gtk] A floating object was finalized. This means that someonecalled g_object_unref() on an object that had only a floatingreference; the initial floating reference is not owned by anyoneand must be removed with g_object_ref_sink().
[_LOG_LEVEL_WARN 20:57:38.454013] [libindicator] IndicatorObject class does not create a menu. We need one of those.
Violación de segmento

Revision history for this message
Cody Garver (codygarver) wrote :

Compile with valac-0.16 only

Sent from my iPhone

On Aug 25, 2013, at 8:01 PM, "Erasmo Marín" <email address hidden> wrote:

> It segfaults to me (stable luna)
>
> wingpanel
> [_LOG_LEVEL_INFO 20:57:38.238671] Application.vala:77: Wingpanel version: 0.2.4
> [_LOG_LEVEL_INFO 20:57:38.238845] Application.vala:79: Kernel version: 3.8.0-27-generic
> [_LOG_LEVEL_WARN 20:57:38.424913] IndicatorFileModel.vala:60: SKIP LOADING: libappmenu.so
> [_LOG_LEVEL_FATAL 20:57:38.428324] [GLib-GObject] g_object_set: assertion `G_IS_OBJECT (object)' failed
> [_LOG_LEVEL_FATAL 20:57:38.428367] Wingpanel will not function properly.
> [_LOG_LEVEL_FATAL 20:57:38.439736] IndicatorFileModel.vala:91: Unable to load /usr/lib/indicators3/7/libindicator-terminal.so
> [_LOG_LEVEL_FATAL 20:57:38.439786] Wingpanel will not function properly.
> [_LOG_LEVEL_WARN 20:57:38.439863] [GLib-GObject] invalid unclassed pointer in cast to `GObject'
> [_LOG_LEVEL_FATAL 20:57:38.439930] [GLib-GObject] g_object_steal_data: assertion `G_IS_OBJECT (object)' failed
> [_LOG_LEVEL_FATAL 20:57:38.439962] Wingpanel will not function properly.
> [_LOG_LEVEL_WARN 20:57:38.439997] [GLib-GObject] invalid unclassed pointer in cast to `GObject'
> [_LOG_LEVEL_FATAL 20:57:38.440030] [GLib-GObject] g_object_steal_data: assertion `G_IS_OBJECT (object)' failed
> [_LOG_LEVEL_FATAL 20:57:38.440062] Wingpanel will not function properly.
> [_LOG_LEVEL_FATAL 20:57:38.440623] IndicatorFileModel.vala:91: Unable to load /usr/lib/indicators3/7/libapplication.so
> [_LOG_LEVEL_FATAL 20:57:38.440662] Wingpanel will not function properly.
> [_LOG_LEVEL_FATAL 20:57:38.443748] IndicatorFileModel.vala:91: Unable to load /usr/lib/indicators3/7/libdatetime.so
> [_LOG_LEVEL_FATAL 20:57:38.443820] Wingpanel will not function properly.
> [_LOG_LEVEL_WARN 20:57:38.444045] [Gtk] A floating object was finalized. This means that someonecalled g_object_unref() on an object that had only a floatingreference; the initial floating reference is not owned by anyoneand must be removed with g_object_ref_sink().
> [_LOG_LEVEL_WARN 20:57:38.454013] [libindicator] IndicatorObject class does not create a menu. We need one of those.
> Violación de segmento
>
> --
> https://code.launchpad.net/~elementary-dev-community/wingpanel/bug-fix-1007630/+merge/181999
> Your team elementary Pantheon team is requested to review the proposed merge of lp:~elementary-dev-community/wingpanel/bug-fix-1007630 into lp:wingpanel.

Revision history for this message
Cameron Norman (cameronnemo) wrote :

Same as above for me.

Revision history for this message
Sergey "Shnatsel" Davidoff (shnatsel) wrote :

How, o how many times shall I tell you to use elementary-test-merge for reproducible builds and testing, instead of doing everything manually? Are you not bored to do the download-compile-run cycles manually yet?

sudo apt-get install elementary-testing-scripts
elementary-test-merge https://code.launchpad.net/~elementary-dev-community/wingpanel/bug-fix-1007630/+merge/181999

And it compiles and installs. Please don't bother doing all this manually.

Revision history for this message
Sergey "Shnatsel" Davidoff (shnatsel) wrote :

It does fix the bug for me.

Revision history for this message
Albert (optimisme) wrote :

I don't even know what "elementary-testing-scripts" are, can you document it properly at the developers website?

Revision history for this message
David Gomes (davidgomes) wrote :

So, tigrang's branch was Needs Fixing because designers don't want the arrows on the edge of the indicators. Therefore, this branch needs ~elementary-design input too. Personally, I think it's better to have them there than to have a buggy indicators experience. Still, it's up to them, since I approve the code (had already approved tigrang's).

review: Approve
Revision history for this message
David Gomes (davidgomes) wrote :

bazaar.launchpad.net/~elementary-dev-community/wingpanel/bug-fix-1007630/revision/150

I mean, I approved what tigrang did and now I also approve that.

Revision history for this message
Danielle Foré (danrabbit) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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:51:25 +0000
@@ -27,8 +27,6 @@
27 // used for drawing27 // used for drawing
28 private Gtk.Window menu;28 private Gtk.Window menu;
29 private Granite.Drawing.BufferSurface buffer;29 private Granite.Drawing.BufferSurface buffer;
30 private int w = -1;
31 private int h = -1;
32 private int arrow_height = 10;30 private int arrow_height = 10;
33 private int arrow_width = 20;31 private int arrow_width = 20;
34 private double x = 10.5;32 private double x = 10.5;
@@ -75,6 +73,9 @@
7573
76 entry.menu.get_children ().foreach (setup_margin);74 entry.menu.get_children ().foreach (setup_margin);
77 entry.menu.insert.connect (setup_margin);75 entry.menu.insert.connect (setup_margin);
76
77 entry.menu.set_redraw_on_allocate (true);
78 entry.menu.configure_event.connect (entry_menu_configure_event_callback);
78 }79 }
7980
80 public IndicatorIface get_indicator () {81 public IndicatorIface get_indicator () {
@@ -113,39 +114,50 @@
113 menu_parent.app_paintable = true;114 menu_parent.app_paintable = true;
114 menu_parent.set_visual (Gdk.Screen.get_default ().get_rgba_visual ());115 menu_parent.set_visual (Gdk.Screen.get_default ().get_rgba_visual ());
115116
117 menu_parent.set_redraw_on_allocate (true);
118 menu_parent.configure_event.connect (entry_menu_parent_configure_event_callback);
116 menu_parent.draw.connect (entry_menu_parent_draw_callback);119 menu_parent.draw.connect (entry_menu_parent_draw_callback);
117 }120 }
118121
122 private bool entry_menu_configure_event_callback (Gdk.EventConfigure event) {
123 entry.menu.queue_draw ();
124 return false;
125 }
126
127 private bool entry_menu_parent_configure_event_callback (Gdk.EventConfigure event) {
128 var menu_parent = entry.menu.get_parent ();
129 menu_parent.queue_draw ();
130 return false;
131 }
132
119 private bool entry_menu_parent_draw_callback (Cairo.Context ctx) {133 private bool entry_menu_parent_draw_callback (Cairo.Context ctx) {
120 var new_w = entry.menu.get_parent ().get_allocated_width ();134 var menu_parent = entry.menu.get_parent ();
121 var new_h = entry.menu.get_parent ().get_allocated_height ();135 int menu_width = menu_parent.get_allocated_width ();
122136 int menu_height = menu_parent.get_allocated_height ();
123 if (new_w != w || new_h != h) {137 int indicator_width = get_allocated_width ();
124 w = new_w;138 int indicator_height = get_allocated_height ();
125 h = new_h;139
126140 buffer = new Granite.Drawing.BufferSurface (menu_width, menu_height);
127 buffer = new Granite.Drawing.BufferSurface (w, h);141 cairo_popover (menu_width, menu_height, indicator_width, indicator_height);
128 cairo_popover (w, h);142
129143 var cr = buffer.context;
130 var cr = buffer.context;144
131145 // shadow
132 // shadow146 cr.set_source_rgba (0, 0, 0, 0.5);
133 cr.set_source_rgba (0, 0, 0, 0.5);147 cr.fill_preserve ();
134 cr.fill_preserve ();148 buffer.exponential_blur (6);
135 buffer.exponential_blur (6);149 cr.clip ();
136 cr.clip ();150
137151 // background
138 // background152 menu.get_style_context ().render_background (cr, 0, 0, menu_width, menu_height);
139 menu.get_style_context ().render_background (cr, 0, 0, w, h);153 cr.reset_clip ();
140 cr.reset_clip ();154
141155 // border
142 // border156 cairo_popover (menu_width, menu_height, indicator_width, indicator_height);
143 cairo_popover (w, h);157 cr.set_operator (Cairo.Operator.SOURCE);
144 cr.set_operator (Cairo.Operator.SOURCE);158 cr.set_line_width (1);
145 cr.set_line_width (1);159 Gdk.cairo_set_source_rgba (cr, menu.get_style_context ().get_border_color (Gtk.StateFlags.NORMAL));
146 Gdk.cairo_set_source_rgba (cr, menu.get_style_context ().get_border_color (Gtk.StateFlags.NORMAL));160 cr.stroke ();
147 cr.stroke ();
148 }
149161
150 // clear surface to transparent162 // clear surface to transparent
151 ctx.set_operator (Cairo.Operator.SOURCE);163 ctx.set_operator (Cairo.Operator.SOURCE);
@@ -159,34 +171,48 @@
159 return false;171 return false;
160 }172 }
161173
162 private void cairo_popover (int w, int h) {174 private void cairo_popover (int menu_width, int menu_height, int indicator_width, int indicator_height) {
163 w = w - 20;
164 h = h - 20;
165
166 // Get some nice pos for the arrow175 // Get some nice pos for the arrow
167 var offs = 30;176 var offs = 30;
168 int p_x;177 int p_x;
169 int w_x;178 int w_x;
179 bool draw_tr_arc = true;
180 bool draw_tl_arc = true;
170 Gtk.Allocation alloc;181 Gtk.Allocation alloc;
171 this.get_window ().get_origin (out p_x, null);
172 this.get_allocation (out alloc);
173182
183 get_window ().get_origin (out p_x, null);
184 get_allocation (out alloc);
174 entry.menu.get_window ().get_origin (out w_x, null);185 entry.menu.get_window ().get_origin (out w_x, null);
175186
176 offs = (p_x + alloc.x) - w_x + this.get_allocated_width () / 4;187 offs = (p_x + alloc.x) - w_x + (indicator_width / 2) - (arrow_width / 2);
177 if (offs + 50 > (w + 20))188
178 offs = (w + 20) - 15 - arrow_width;189 if (offs > menu_width - 10 - arrow_width) {
179 if (offs < 17)190 offs = menu_width - 10 - arrow_width;
180 offs = 17;191 draw_tr_arc = false;
181192 }
182 buffer.context.arc (x + radius, y + arrow_height + radius, radius, Math.PI, Math.PI * 1.5);193
194 if (offs < 10) {
195 offs = 10;
196 draw_tl_arc = false;
197 }
198
199 menu_width -= 20;
200 menu_height -= 20;
201
202 // Don't draw top left arc if arrow needs to be placed there
203 if (draw_tl_arc)
204 buffer.context.arc (x + radius, y + arrow_height + radius, radius, Math.PI, Math.PI * 1.5);
205
183 buffer.context.line_to (offs, y + arrow_height);206 buffer.context.line_to (offs, y + arrow_height);
184 buffer.context.rel_line_to (arrow_width / 2.0, -arrow_height);207 buffer.context.rel_line_to (arrow_width / 2.0, -arrow_height);
185 buffer.context.rel_line_to (arrow_width / 2.0, arrow_height);208 buffer.context.rel_line_to (arrow_width / 2.0, arrow_height);
186 buffer.context.arc (x + w - radius, y + arrow_height + radius, radius, Math.PI * 1.5, Math.PI * 2.0);209
187210 // Don't draw top right arc if arrow needs to be placed there
188 buffer.context.arc (x + w - radius, y + h - radius, radius, 0, Math.PI * 0.5);211 if (draw_tr_arc)
189 buffer.context.arc (x + radius, y + h - radius, radius, Math.PI * 0.5, Math.PI);212 buffer.context.arc (x + menu_width - radius, y + arrow_height + radius, radius, Math.PI * 1.5, Math.PI * 2.0);
213
214 buffer.context.arc (x + menu_width - radius, y + menu_height - radius, radius, 0, Math.PI * 0.5);
215 buffer.context.arc (x + radius, y + menu_height - radius, radius, Math.PI * 0.5, Math.PI);
190216
191 buffer.context.close_path ();217 buffer.context.close_path ();
192 }218 }

Subscribers

People subscribed via source and target branches