Skip to content

Commit

Permalink
Fixes: BlankOn#1053 - Operasi berkas -> manokwari sering galat
Browse files Browse the repository at this point in the history
Description: The icon used to draw is sometimes already invalidated, here we update the icon just before we need it
  • Loading branch information
mdamt committed May 3, 2012
1 parent 2897ae3 commit 7e0aa05
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/panel-window.vala
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public class PanelWindowPagerEntry : DrawingArea {
}

public class PanelWindowEntry : DrawingArea {
unowned Gdk.Pixbuf icon;
unowned Gdk.Pixbuf icon = null;
public unowned Wnck.Window window_info;
private Wnck.WindowState last_state;
private Gtk.StateFlags state;
Expand Down Expand Up @@ -170,7 +170,6 @@ public class PanelWindowEntry : DrawingArea {
| Gdk.EventMask.LEAVE_NOTIFY_MASK);

window_info = info;
icon = window_info.get_mini_icon ();
last_state = info.get_state ();
sync_window_states ();

Expand Down Expand Up @@ -233,7 +232,15 @@ public class PanelWindowEntry : DrawingArea {
});
}

void update_icon () {
icon = window_info.get_mini_icon ();
if (icon == null) {
icon = window_info.get_icon ();
}
}

public override void get_preferred_height (out int min, out int max) {
update_icon ();
// TODO
if (icon != null) {
min = max = icon.get_width () + Margin * 2;
Expand All @@ -252,6 +259,8 @@ public class PanelWindowEntry : DrawingArea {

Gtk.render_background (style, cr, 0, 0, get_allocated_width (), get_allocated_height ());

update_icon ();

if (icon != null) {
Gdk.cairo_set_source_pixbuf (cr, icon, Margin, Margin);
}
Expand Down

0 comments on commit 7e0aa05

Please sign in to comment.