Refresh sticky panel status on desktop change (workaround for issue #555)

This commit is contained in:
o9000 2016-03-22 22:48:02 +01:00
parent d1b959818e
commit 5f82ef4d3b
3 changed files with 32 additions and 24 deletions

View file

@ -570,6 +570,34 @@ void set_panel_items_order(Panel *p)
initialize_positions(&p->area, 0);
}
void place_panel_all_desktops(Panel *p)
{
long val = ALL_DESKTOPS;
XChangeProperty(server.display,
p->main_win,
server.atom._NET_WM_DESKTOP,
XA_CARDINAL,
32,
PropModeReplace,
(unsigned char *)&val,
1);
Atom state[4];
state[0] = server.atom._NET_WM_STATE_SKIP_PAGER;
state[1] = server.atom._NET_WM_STATE_SKIP_TASKBAR;
state[2] = server.atom._NET_WM_STATE_STICKY;
state[3] = panel_layer == BOTTOM_LAYER ? server.atom._NET_WM_STATE_BELOW : server.atom._NET_WM_STATE_ABOVE;
int num_atoms = panel_layer == NORMAL_LAYER ? 3 : 4;
XChangeProperty(server.display,
p->main_win,
server.atom._NET_WM_STATE,
XA_ATOM,
32,
PropModeReplace,
(unsigned char *)state,
num_atoms);
}
void set_panel_properties(Panel *p)
{
XStoreName(server.display, p->main_win, panel_window_name);
@ -608,30 +636,7 @@ void set_panel_properties(Panel *p)
(unsigned char *)&val,
1);
val = ALL_DESKTOPS;
XChangeProperty(server.display,
p->main_win,
server.atom._NET_WM_DESKTOP,
XA_CARDINAL,
32,
PropModeReplace,
(unsigned char *)&val,
1);
Atom state[4];
state[0] = server.atom._NET_WM_STATE_SKIP_PAGER;
state[1] = server.atom._NET_WM_STATE_SKIP_TASKBAR;
state[2] = server.atom._NET_WM_STATE_STICKY;
state[3] = panel_layer == BOTTOM_LAYER ? server.atom._NET_WM_STATE_BELOW : server.atom._NET_WM_STATE_ABOVE;
int num_atoms = panel_layer == NORMAL_LAYER ? 3 : 4;
XChangeProperty(server.display,
p->main_win,
server.atom._NET_WM_STATE,
XA_ATOM,
32,
PropModeReplace,
(unsigned char *)state,
num_atoms);
place_panel_all_desktops(p);
XWMHints wmhints;
memset(&wmhints, 0, sizeof(wmhints));

View file

@ -154,6 +154,7 @@ gboolean resize_panel(void *obj);
void render_panel(Panel *panel);
void set_panel_items_order(Panel *p);
void place_panel_all_desktops(Panel *p);
void set_panel_properties(Panel *p);
// draw background panel

View file

@ -953,6 +953,7 @@ void event_property_notify(XEvent *e)
init_taskbar();
for (int i = 0; i < num_panels; i++) {
init_taskbar_panel(&panels[i]);
place_panel_all_desktops(&panels[i]);
set_panel_items_order(&panels[i]);
update_taskbar_visibility(&panels[i]);
panels[i].area.resize_needed = 1;
@ -963,6 +964,7 @@ void event_property_notify(XEvent *e)
} else if (old_desktop != server.desktop) {
for (int i = 0; i < num_panels; i++) {
Panel *panel = &panels[i];
place_panel_all_desktops(panel);
set_taskbar_state(&panel->taskbar[old_desktop], TASKBAR_NORMAL);
set_taskbar_state(&panel->taskbar[server.desktop], TASKBAR_ACTIVE);
// check ALL_DESKTOPS task => resize taskbar