Update icon on demand

This commit is contained in:
Sanel Zukan 2010-03-09 23:38:57 +00:00
parent bd5dbb7ed9
commit eebda8a375
2 changed files with 23 additions and 0 deletions

View File

@ -26,6 +26,7 @@ EDELIB_NS_USING(NETWM_CHANGED_ACTIVE_WINDOW)
EDELIB_NS_USING(NETWM_CHANGED_CURRENT_WORKSPACE)
EDELIB_NS_USING(NETWM_CHANGED_WINDOW_LIST)
EDELIB_NS_USING(NETWM_CHANGED_WINDOW_NAME)
EDELIB_NS_USING(NETWM_CHANGED_WINDOW_ICON)
EDELIB_NS_USING(WM_WINDOW_STATE_ICONIC)
static void button_cb(TaskButton *b, void *t) {
@ -58,6 +59,12 @@ static void net_event_cb(int action, Window xid, void *data) {
tt->update_active_button();
return;
}
if(action == NETWM_CHANGED_WINDOW_ICON) {
Taskbar *tt = (Taskbar*)data;
tt->update_child_icon(xid);
return;
}
}
Taskbar::Taskbar() : Fl_Group(0, 0, 40, 25), curr_active(NULL), prev_active(NULL), panel(NULL) {
@ -243,6 +250,21 @@ void Taskbar::update_child_title(Window xid) {
}
}
void Taskbar::update_child_icon(Window xid) {
E_RETURN_IF_FAIL(xid >= 0);
TaskButton *o;
for(int i = 0; i < children(); i++) {
o = (TaskButton*)child(i);
if(o->get_window_xid() == xid) {
o->update_image_from_xid();
o->redraw();
break;
}
}
}
void Taskbar::panel_redraw(void) {
E_RETURN_IF_FAIL(panel != NULL);
panel->redraw();

View File

@ -23,6 +23,7 @@ public:
void update_active_button(int xid = -1);
void activate_window(TaskButton *b);
void update_child_title(Window xid);
void update_child_icon(Window xid);
void panel_redraw(void);
};