XIconifyWindow (server.dsp, tsk->win, server.screen);
break;
case TOGGLE_ICONIFY:
- if (tsk == task_active) XIconifyWindow (server.dsp, tsk->win, server.screen);
- else set_active (tsk->win);
+ if (task_active && tsk->win == task_active->win)
+ XIconifyWindow (server.dsp, tsk->win, server.screen);
+ else
+ set_active (tsk->win);
break;
case SHADE:
window_toggle_shade (tsk->win);
else {
tsk = task_get_task (win);
if (!tsk) {
- if ( at != server.atom._NET_WM_STATE)
- return;
- else if ( !(tsk = add_task(win)) )
+ if (at != server.atom._NET_WM_STATE)
return;
+ else {
+ // xfce4 sends _NET_WM_STATE after minimized to tray, so we need to check if window is mapped
+ // if it is mapped and not set as skip_taskbar, we must add it to our task list
+ XWindowAttributes wa;
+ XGetWindowAttributes(server.dsp, win, &wa);
+ if (wa.map_state == IsViewable && !window_is_skip_taskbar(win)) {
+ if ( (tsk = add_task(win)) )
+ panel_refresh = 1;
+ else
+ return;
+ }
+ }
}
//printf("atom root_win = %s, %s\n", XGetAtomName(server.dsp, at), tsk->title);