Panel: do not change struts (available screen size) when shown in autohide mode (issue #619)

This commit is contained in:
o9000 2017-01-13 11:42:21 +01:00
parent 6f49df9612
commit 21326dca12
3 changed files with 19 additions and 11 deletions

View file

@ -2,6 +2,7 @@
- Fixes: - Fixes:
- tint2conf: executor tooltips are now correctly disabled when text config value is empty (contributed by Justin Jacobs) - tint2conf: executor tooltips are now correctly disabled when text config value is empty (contributed by Justin Jacobs)
- Battery: support Asus Chromebook Flip C100PA (issue #616) - Battery: support Asus Chromebook Flip C100PA (issue #616)
- Panel: do not change struts (available screen size) when shown in autohide mode (issue #619)
- Enhancements: - Enhancements:
- Desktop files (shortcuts) used in launcher are reloaded on click, in case the file has changed - Desktop files (shortcuts) used in launcher are reloaded on click, in case the file has changed
- New config option taskbar_hide_if_empty to hide an empty taskbar in multi_desktop mode (contributed by Benoit Averty) - New config option taskbar_hide_if_empty to hide an empty taskbar in multi_desktop mode (contributed by Benoit Averty)

View file

@ -548,7 +548,7 @@ void update_strut(Panel *p)
long struts[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; long struts[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
if (panel_horizontal) { if (panel_horizontal) {
int height = p->area.height + p->marginy; int height = p->area.height + p->marginy;
if (panel_strut_policy == STRUT_MINIMUM || (panel_strut_policy == STRUT_FOLLOW_SIZE && p->is_hidden)) if (panel_strut_policy == STRUT_MINIMUM || (panel_strut_policy == STRUT_FOLLOW_SIZE && panel_autohide))
height = p->hidden_height; height = p->hidden_height;
if (panel_position & TOP) { if (panel_position & TOP) {
struts[2] = height + monitor.y; struts[2] = height + monitor.y;
@ -563,7 +563,7 @@ void update_strut(Panel *p)
} }
} else { } else {
int width = p->area.width + p->marginx; int width = p->area.width + p->marginx;
if (panel_strut_policy == STRUT_MINIMUM || (panel_strut_policy == STRUT_FOLLOW_SIZE && p->is_hidden)) if (panel_strut_policy == STRUT_MINIMUM || (panel_strut_policy == STRUT_FOLLOW_SIZE && panel_autohide))
width = p->hidden_width; width = p->hidden_width;
if (panel_position & LEFT) { if (panel_position & LEFT) {
struts[0] = width + monitor.x; struts[0] = width + monitor.x;
@ -658,21 +658,24 @@ void place_panel_all_desktops(Panel *p)
PropModeReplace, PropModeReplace,
(unsigned char *)&val, (unsigned char *)&val,
1); 1);
}
void set_panel_layer(Panel *p, Layer layer)
{
Atom state[4]; Atom state[4];
state[0] = server.atom._NET_WM_STATE_SKIP_PAGER; state[0] = server.atom._NET_WM_STATE_SKIP_PAGER;
state[1] = server.atom._NET_WM_STATE_SKIP_TASKBAR; state[1] = server.atom._NET_WM_STATE_SKIP_TASKBAR;
state[2] = server.atom._NET_WM_STATE_STICKY; 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; state[3] = layer == BOTTOM_LAYER ? server.atom._NET_WM_STATE_BELOW : server.atom._NET_WM_STATE_ABOVE;
int num_atoms = panel_layer == NORMAL_LAYER ? 3 : 4; int num_atoms = layer == NORMAL_LAYER ? 3 : 4;
XChangeProperty(server.display, XChangeProperty(server.display,
p->main_win, p->main_win,
server.atom._NET_WM_STATE, server.atom._NET_WM_STATE,
XA_ATOM, XA_ATOM,
32, 32,
PropModeReplace, PropModeReplace,
(unsigned char *)state, (unsigned char *)state,
num_atoms); num_atoms);
} }
void replace_panel_all_desktops(Panel *p) void replace_panel_all_desktops(Panel *p)
@ -781,6 +784,7 @@ void set_panel_properties(Panel *p)
1); 1);
place_panel_all_desktops(p); place_panel_all_desktops(p);
set_panel_layer(p, panel_layer);
XWMHints wmhints; XWMHints wmhints;
memset(&wmhints, 0, sizeof(wmhints)); memset(&wmhints, 0, sizeof(wmhints));
@ -965,6 +969,7 @@ void autohide_show(void *p)
panel->is_hidden = 0; panel->is_hidden = 0;
XMapSubwindows(server.display, panel->main_win); // systray windows XMapSubwindows(server.display, panel->main_win); // systray windows
set_panel_window_geometry(panel); set_panel_window_geometry(panel);
set_panel_layer(panel, TOP_LAYER);
refresh_systray = TRUE; // ugly hack, because we actually only need to call XSetBackgroundPixmap refresh_systray = TRUE; // ugly hack, because we actually only need to call XSetBackgroundPixmap
panel_refresh = TRUE; panel_refresh = TRUE;
} }
@ -973,6 +978,7 @@ void autohide_hide(void *p)
{ {
Panel *panel = (Panel *)p; Panel *panel = (Panel *)p;
stop_autohide_timeout(panel); stop_autohide_timeout(panel);
set_panel_layer(panel, panel_layer);
panel->is_hidden = TRUE; panel->is_hidden = TRUE;
XUnmapSubwindows(server.display, panel->main_win); // systray windows XUnmapSubwindows(server.display, panel->main_win); // systray windows
set_panel_window_geometry(panel); set_panel_window_geometry(panel);

View file

@ -165,6 +165,7 @@ void place_panel_all_desktops(Panel *p);
void replace_panel_all_desktops(Panel *p); void replace_panel_all_desktops(Panel *p);
void set_panel_properties(Panel *p); void set_panel_properties(Panel *p);
void set_panel_window_geometry(Panel *panel); void set_panel_window_geometry(Panel *panel);
void set_panel_layer(Panel *p, Layer layer);
// draw background panel // draw background panel
void set_panel_background(Panel *p); void set_panel_background(Panel *p);