screen: store statusbars as array

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-09-20 16:45:43 +02:00
parent b11c068b96
commit 44ef511aed
15 changed files with 124 additions and 91 deletions

View File

@ -319,7 +319,6 @@ client_stack(void)
uint32_t config_win_vals[2]; uint32_t config_win_vals[2];
client_node_t *node; client_node_t *node;
layer_t layer; layer_t layer;
statusbar_t *sb;
int screen; int screen;
config_win_vals[0] = XCB_NONE; config_win_vals[0] = XCB_NONE;
@ -333,7 +332,9 @@ client_stack(void)
/* then stack statusbar window */ /* then stack statusbar window */
for(screen = 0; screen < globalconf.nscreen; screen++) for(screen = 0; screen < globalconf.nscreen; screen++)
for(sb = globalconf.screens[screen].statusbar; sb; sb = sb->next) for(int i = 0; i < globalconf.screens[screen].statusbars.len; i++)
{
statusbar_t *sb = globalconf.screens[screen].statusbars.tab[i];
if(sb->sw) if(sb->sw)
{ {
xcb_configure_window(globalconf.connection, xcb_configure_window(globalconf.connection,
@ -342,6 +343,7 @@ client_stack(void)
config_win_vals); config_win_vals);
config_win_vals[0] = sb->sw->window; config_win_vals[0] = sb->sw->window;
} }
}
/* finally stack everything else */ /* finally stack everything else */
for(layer = LAYER_FULLSCREEN - 1; layer >= LAYER_DESKTOP; layer--) for(layer = LAYER_FULLSCREEN - 1; layer >= LAYER_DESKTOP; layer--)
@ -833,8 +835,11 @@ client_unmanage(client_t *c)
if(client_hasstrut(c)) if(client_hasstrut(c))
/* All the statusbars (may) need to be repositioned */ /* All the statusbars (may) need to be repositioned */
for(int screen = 0; screen < globalconf.nscreen; screen++) for(int screen = 0; screen < globalconf.nscreen; screen++)
for(statusbar_t *s = globalconf.screens[screen].statusbar; s; s = s->next) for(int i = 0; i < globalconf.screens[screen].statusbars.len; i++)
{
statusbar_t *s = globalconf.screens[screen].statusbars.tab[i];
statusbar_position_update(s); statusbar_position_update(s);
}
/* set client as invalid */ /* set client as invalid */
c->invalid = true; c->invalid = true;

23
event.c
View File

@ -130,7 +130,6 @@ event_handle_button(void *data, xcb_connection_t *connection, xcb_button_press_e
const int nb_screen = xcb_setup_roots_length(xcb_get_setup(connection)); const int nb_screen = xcb_setup_roots_length(xcb_get_setup(connection));
client_t *c; client_t *c;
widget_node_t *w; widget_node_t *w;
statusbar_t *statusbar;
/* ev->state is /* ev->state is
* button status (8 bits) + modifiers status (8 bits) * button status (8 bits) + modifiers status (8 bits)
@ -139,7 +138,9 @@ event_handle_button(void *data, xcb_connection_t *connection, xcb_button_press_e
ev->state &= 0x00ff; ev->state &= 0x00ff;
for(screen = 0; screen < globalconf.nscreen; screen++) for(screen = 0; screen < globalconf.nscreen; screen++)
for(statusbar = globalconf.screens[screen].statusbar; statusbar; statusbar = statusbar->next) for(int i = 0; i < globalconf.screens[screen].statusbars.len; i++)
{
statusbar_t *statusbar = globalconf.screens[screen].statusbars.tab[i];
if(statusbar->sw if(statusbar->sw
&& (statusbar->sw->window == ev->event || statusbar->sw->window == ev->child)) && (statusbar->sw->window == ev->event || statusbar->sw->window == ev->child))
{ {
@ -157,6 +158,7 @@ event_handle_button(void *data, xcb_connection_t *connection, xcb_button_press_e
/* return even if no widget match */ /* return even if no widget match */
return 0; return 0;
} }
}
if((c = client_getbytitlebarwin(ev->event))) if((c = client_getbytitlebarwin(ev->event)))
{ {
@ -221,8 +223,11 @@ event_handle_configurerequest(void *data __attribute__ ((unused)),
if(client_hasstrut(c)) if(client_hasstrut(c))
/* All the statusbars (may) need to be repositioned */ /* All the statusbars (may) need to be repositioned */
for(int screen = 0; screen < globalconf.nscreen; screen++) for(int screen = 0; screen < globalconf.nscreen; screen++)
for(statusbar_t *s = globalconf.screens[screen].statusbar; s; s = s->next) for(int i = 0; i < globalconf.screens[screen].statusbars.len; i++)
{
statusbar_t *s = globalconf.screens[screen].statusbars.tab[i];
statusbar_position_update(s); statusbar_position_update(s);
}
} }
else else
{ {
@ -488,20 +493,22 @@ event_handle_expose(void *data __attribute__ ((unused)),
xcb_connection_t *connection __attribute__ ((unused)), xcb_connection_t *connection __attribute__ ((unused)),
xcb_expose_event_t *ev) xcb_expose_event_t *ev)
{ {
int screen;
statusbar_t *statusbar;
client_t *c;
if(!ev->count) if(!ev->count)
{ {
int screen;
client_t *c;
for(screen = 0; screen < globalconf.nscreen; screen++) for(screen = 0; screen < globalconf.nscreen; screen++)
for(statusbar = globalconf.screens[screen].statusbar; statusbar; statusbar = statusbar->next) for(int i = 0; i < globalconf.screens[screen].statusbars.len; i++)
{
statusbar_t *statusbar = globalconf.screens[screen].statusbars.tab[i];
if(statusbar->sw if(statusbar->sw
&& statusbar->sw->window == ev->window) && statusbar->sw->window == ev->window)
{ {
simplewindow_refresh_pixmap(statusbar->sw); simplewindow_refresh_pixmap(statusbar->sw);
return 0; return 0;
} }
}
if((c = client_getbytitlebarwin(ev->window))) if((c = client_getbytitlebarwin(ev->window)))
simplewindow_refresh_pixmap(c->titlebar->sw); simplewindow_refresh_pixmap(c->titlebar->sw);

7
ewmh.c
View File

@ -212,7 +212,7 @@ ewmh_update_workarea(int phys_screen)
tag_array_t *tags = &globalconf.screens[phys_screen].tags; tag_array_t *tags = &globalconf.screens[phys_screen].tags;
uint32_t *area = p_alloca(uint32_t, tags->len * 4); uint32_t *area = p_alloca(uint32_t, tags->len * 4);
area_t geom = screen_area_get(phys_screen, area_t geom = screen_area_get(phys_screen,
globalconf.screens[phys_screen].statusbar, &globalconf.screens[phys_screen].statusbars,
&globalconf.screens[phys_screen].padding, &globalconf.screens[phys_screen].padding,
true); true);
@ -534,8 +534,11 @@ ewmh_client_strut_update(client_t *c, xcb_get_property_reply_t *strut_r)
client_need_arrange(c); client_need_arrange(c);
/* All the statusbars (may) need to be repositioned */ /* All the statusbars (may) need to be repositioned */
for(int screen = 0; screen < globalconf.nscreen; screen++) for(int screen = 0; screen < globalconf.nscreen; screen++)
for(statusbar_t *s = globalconf.screens[screen].statusbar; s; s = s->next) for(int i = 0; i < globalconf.screens[screen].statusbars.len; i++)
{
statusbar_t *s = globalconf.screens[screen].statusbars.tab[i];
statusbar_position_update(s); statusbar_position_update(s);
}
} }
} }

View File

@ -42,7 +42,7 @@ layout_fair(int screen, const orientation_t orientation)
area_t geometry, area; area_t geometry, area;
area = screen_area_get(screen, area = screen_area_get(screen,
globalconf.screens[screen].statusbar, &globalconf.screens[screen].statusbars,
&globalconf.screens[screen].padding, &globalconf.screens[screen].padding,
true); true);

View File

@ -33,7 +33,7 @@ layout_fibonacci(int screen, int shape)
client_t *c; client_t *c;
area_t geometry, area; area_t geometry, area;
geometry = area = screen_area_get(screen, geometry = area = screen_area_get(screen,
globalconf.screens[screen].statusbar, &globalconf.screens[screen].statusbars,
&globalconf.screens[screen].padding, &globalconf.screens[screen].padding,
true); true);

View File

@ -35,7 +35,7 @@ layout_magnifier(int screen)
client_t *c, *focus; client_t *c, *focus;
tag_t **curtags = tags_get_current(screen); tag_t **curtags = tags_get_current(screen);
area_t geometry, area = screen_area_get(screen, area_t geometry, area = screen_area_get(screen,
globalconf.screens[screen].statusbar, &globalconf.screens[screen].statusbars,
&globalconf.screens[screen].padding, &globalconf.screens[screen].padding,
true); true);

View File

@ -31,7 +31,7 @@ layout_max(int screen)
{ {
client_t *c; client_t *c;
area_t area = screen_area_get(screen, area_t area = screen_area_get(screen,
globalconf.screens[screen].statusbar, &globalconf.screens[screen].statusbars,
&globalconf.screens[screen].padding, &globalconf.screens[screen].padding,
true); true);

View File

@ -43,7 +43,7 @@ _tile(int screen, const position_t position)
tag_t **curtags = tags_get_current(screen); tag_t **curtags = tags_get_current(screen);
area = screen_area_get(screen, area = screen_area_get(screen,
globalconf.screens[screen].statusbar, &globalconf.screens[screen].statusbars,
&globalconf.screens[screen].padding, &globalconf.screens[screen].padding,
true); true);

View File

@ -132,7 +132,7 @@ mouse_snapclient(client_t *c, area_t geometry, int snap)
area_t snapper_geometry; area_t snapper_geometry;
area_t screen_geometry = area_t screen_geometry =
screen_area_get(c->screen, screen_area_get(c->screen,
globalconf.screens[c->screen].statusbar, &globalconf.screens[c->screen].statusbars,
&globalconf.screens[c->screen].padding, &globalconf.screens[c->screen].padding,
false); false);
@ -750,7 +750,7 @@ mouse_client_resize_tiled(client_t *c)
layout = tag->layout; layout = tag->layout;
area = screen_area_get(tag->screen, area = screen_area_get(tag->screen,
globalconf.screens[tag->screen].statusbar, &globalconf.screens[tag->screen].statusbars,
&globalconf.screens[tag->screen].padding, &globalconf.screens[tag->screen].padding,
true); true);
@ -854,7 +854,7 @@ mouse_client_resize_magnified(client_t *c, bool infobox)
root = xutil_screen_get(globalconf.connection, c->phys_screen)->root; root = xutil_screen_get(globalconf.connection, c->phys_screen)->root;
area = screen_area_get(tag->screen, area = screen_area_get(tag->screen,
globalconf.screens[tag->screen].statusbar, &globalconf.screens[tag->screen].statusbars,
&globalconf.screens[tag->screen].padding, &globalconf.screens[tag->screen].padding,
true); true);

View File

@ -156,17 +156,16 @@ screen_getbycoord(int screen, int x, int y)
/** Get screens info. /** Get screens info.
* \param screen Screen number. * \param screen Screen number.
* \param statusbar Statusbar list to remove. * \param statusbars Statusbar list to remove.
* \param padding Padding. * \param padding Padding.
* \param strut Honor windows strut. * \param strut Honor windows strut.
* \return The screen area. * \return The screen area.
*/ */
area_t area_t
screen_area_get(int screen, statusbar_t *statusbar, screen_area_get(int screen, statusbar_array_t *statusbars,
padding_t *padding, bool strut) padding_t *padding, bool strut)
{ {
area_t area = globalconf.screens[screen].geometry; area_t area = globalconf.screens[screen].geometry;
statusbar_t *sb;
uint16_t top = 0, bottom = 0, left = 0, right = 0; uint16_t top = 0, bottom = 0, left = 0, right = 0;
/* make padding corrections */ /* make padding corrections */
@ -216,23 +215,27 @@ screen_area_get(int screen, statusbar_t *statusbar,
} }
for(sb = statusbar; sb; sb = sb->next) if(statusbars)
switch(sb->position) for(int i = 0; i < statusbars->len; i++)
{ {
case Top: statusbar_t *sb = statusbars->tab[i];
top = MAX(top, (uint16_t) (sb->sw->geometry.y - area.y) + sb->sw->geometry.height); switch(sb->position)
break; {
case Bottom: case Top:
bottom = MAX(bottom, (uint16_t) (area.y + area.height) - sb->sw->geometry.y); top = MAX(top, (uint16_t) (sb->sw->geometry.y - area.y) + sb->sw->geometry.height);
break; break;
case Left: case Bottom:
left = MAX(left, (uint16_t) (sb->sw->geometry.x - area.x) + sb->sw->geometry.width); bottom = MAX(bottom, (uint16_t) (area.y + area.height) - sb->sw->geometry.y);
break; break;
case Right: case Left:
right = MAX(right, (uint16_t) (area.x + area.width) - sb->sw->geometry.x); left = MAX(left, (uint16_t) (sb->sw->geometry.x - area.x) + sb->sw->geometry.width);
break; break;
default: case Right:
break; right = MAX(right, (uint16_t) (area.x + area.width) - sb->sw->geometry.x);
break;
default:
break;
}
} }
area.x += left; area.x += left;
@ -245,25 +248,26 @@ screen_area_get(int screen, statusbar_t *statusbar,
/** Get display info. /** Get display info.
* \param phys_screen Physical screen number. * \param phys_screen Physical screen number.
* \param statusbar The statusbars. * \param statusbars The statusbars.
* \param padding Padding. * \param padding Padding.
* \return The display area. * \return The display area.
*/ */
area_t area_t
display_area_get(int phys_screen, statusbar_t *statusbar, padding_t *padding) display_area_get(int phys_screen, statusbar_array_t *statusbars, padding_t *padding)
{ {
area_t area = { 0, 0, 0, 0 };
statusbar_t *sb;
xcb_screen_t *s = xutil_screen_get(globalconf.connection, phys_screen); xcb_screen_t *s = xutil_screen_get(globalconf.connection, phys_screen);
area_t area = { .x = 0,
.y = 0,
.width = s->width_in_pixels,
.height = s->height_in_pixels };
area.width = s->width_in_pixels; if(statusbars)
area.height = s->height_in_pixels; for(int i = 0; i < statusbars->len; i++)
{
for(sb = statusbar; sb; sb = sb->next) statusbar_t *sb = statusbars->tab[i];
{ area.y += sb->position == Top ? sb->height : 0;
area.y += sb->position == Top ? sb->height : 0; area.height -= (sb->position == Top || sb->position == Bottom) ? sb->height : 0;
area.height -= (sb->position == Top || sb->position == Bottom) ? sb->height : 0; }
}
/* make padding corrections */ /* make padding corrections */
if(padding) if(padding)
@ -508,7 +512,7 @@ luaA_screen_index(lua_State *L)
lua_setfield(L, -2, "height"); lua_setfield(L, -2, "height");
break; break;
case A_TK_WORKAREA: case A_TK_WORKAREA:
g = screen_area_get(s->index, s->statusbar, &s->padding, true); g = screen_area_get(s->index, &s->statusbars, &s->padding, true);
lua_newtable(L); lua_newtable(L);
lua_pushnumber(L, g.x); lua_pushnumber(L, g.x);
lua_setfield(L, -2, "x"); lua_setfield(L, -2, "x");
@ -544,8 +548,6 @@ luaA_screen_padding(lua_State *L)
if(lua_gettop(L) == 2) if(lua_gettop(L) == 2)
{ {
statusbar_t *sb;
luaA_checktable(L, 2); luaA_checktable(L, 2);
s->padding.right = luaA_getopt_number(L, 2, "right", 0); s->padding.right = luaA_getopt_number(L, 2, "right", 0);
@ -556,8 +558,8 @@ luaA_screen_padding(lua_State *L)
s->need_arrange = true; s->need_arrange = true;
/* All the statusbar repositioned */ /* All the statusbar repositioned */
for(sb = s->statusbar; sb; sb = sb->next) for(int i = 0; i < s->statusbars.len; i++)
statusbar_position_update(sb); statusbar_position_update(s->statusbars.tab[i]);
ewmh_update_workarea(screen_virttophys(s->index)); ewmh_update_workarea(screen_virttophys(s->index));
} }

View File

@ -28,8 +28,8 @@
void screen_scan(void); void screen_scan(void);
int screen_getbycoord(int, int, int); int screen_getbycoord(int, int, int);
area_t screen_area_get(int, statusbar_t *, padding_t *, bool); area_t screen_area_get(int, statusbar_array_t *, padding_t *, bool);
area_t display_area_get(int, statusbar_t *, padding_t *); area_t display_area_get(int, statusbar_array_t *, padding_t *);
int screen_virttophys(int); int screen_virttophys(int);
void screen_client_moveto(client_t *, int, bool, bool); void screen_client_moveto(client_t *, int, bool, bool);

View File

@ -236,11 +236,13 @@ statusbar_draw(statusbar_t *statusbar)
statusbar_t * statusbar_t *
statusbar_getbywin(xcb_window_t w) statusbar_getbywin(xcb_window_t w)
{ {
statusbar_t *s; for(int screen = 0; screen < globalconf.nscreen; screen++)
for(int i = 0; i < globalconf.nscreen; i++) for(int i = 0; i < globalconf.screens[screen].statusbars.len; i++)
for(s = globalconf.screens[i].statusbar; s; s = s->next) {
statusbar_t *s = globalconf.screens[screen].statusbars.tab[i];
if(s->sw->window == w) if(s->sw->window == w)
return s; return s;
}
return NULL; return NULL;
} }
@ -249,13 +251,13 @@ statusbar_getbywin(xcb_window_t w)
void void
statusbar_refresh(void) statusbar_refresh(void)
{ {
int screen; for(int screen = 0; screen < globalconf.nscreen; screen++)
statusbar_t *statusbar; for(int i = 0; i < globalconf.screens[screen].statusbars.len; i++)
{
for(screen = 0; screen < globalconf.nscreen; screen++) statusbar_t *s = globalconf.screens[screen].statusbars.tab[i];
for(statusbar = globalconf.screens[screen].statusbar; statusbar; statusbar = statusbar->next) if(s->need_update)
if(statusbar->need_update) statusbar_draw(s);
statusbar_draw(statusbar); }
} }
static void static void
@ -278,7 +280,6 @@ statusbar_clean(statusbar_t *statusbar)
void void
statusbar_position_update(statusbar_t *statusbar) statusbar_position_update(statusbar_t *statusbar)
{ {
statusbar_t *sb;
area_t area, wingeometry; area_t area, wingeometry;
xcb_pixmap_t dw; xcb_pixmap_t dw;
xcb_screen_t *s = NULL; xcb_screen_t *s = NULL;
@ -291,8 +292,9 @@ statusbar_position_update(statusbar_t *statusbar)
&globalconf.screens[statusbar->screen].padding, true); &globalconf.screens[statusbar->screen].padding, true);
/* Top and Bottom statusbar_t have prio */ /* Top and Bottom statusbar_t have prio */
for(sb = globalconf.screens[statusbar->screen].statusbar; sb; sb = sb->next) for(int i = 0; i < globalconf.screens[statusbar->screen].statusbars.len; i++)
{ {
statusbar_t *sb = globalconf.screens[statusbar->screen].statusbars.tab[i];
/* Ignore every statusbar after me that is in the same position */ /* Ignore every statusbar after me that is in the same position */
if(statusbar == sb) if(statusbar == sb)
{ {
@ -656,7 +658,12 @@ statusbar_remove(statusbar_t *statusbar)
/* restore position */ /* restore position */
statusbar->position = p; statusbar->position = p;
statusbar_list_detach(&globalconf.screens[statusbar->screen].statusbar, statusbar); for(int i = 0; i < globalconf.screens[statusbar->screen].statusbars.len; i++)
if(globalconf.screens[statusbar->screen].statusbars.tab[i] == statusbar)
{
statusbar_array_take(&globalconf.screens[statusbar->screen].statusbars, i);
break;
}
globalconf.screens[statusbar->screen].need_arrange = true; globalconf.screens[statusbar->screen].need_arrange = true;
statusbar->screen = SCREEN_UNDEF; statusbar->screen = SCREEN_UNDEF;
statusbar_unref(&statusbar); statusbar_unref(&statusbar);
@ -671,7 +678,7 @@ static int
luaA_statusbar_newindex(lua_State *L) luaA_statusbar_newindex(lua_State *L)
{ {
size_t len; size_t len;
statusbar_t *s, **statusbar = luaA_checkudata(L, 1, "statusbar"); statusbar_t **statusbar = luaA_checkudata(L, 1, "statusbar");
const char *buf, *attr = luaL_checklstring(L, 2, &len); const char *buf, *attr = luaL_checklstring(L, 2, &len);
position_t p; position_t p;
int screen; int screen;
@ -692,21 +699,27 @@ luaA_statusbar_newindex(lua_State *L)
(*statusbar)->screen + 1); (*statusbar)->screen + 1);
/* Check for uniq name and id. */ /* Check for uniq name and id. */
for(s = globalconf.screens[screen].statusbar; s; s = s->next) for(int i = 0; i < globalconf.screens[screen].statusbars.len; i++)
{
statusbar_t *s = globalconf.screens[screen].statusbars.tab[i];
if(!a_strcmp(s->name, (*statusbar)->name)) if(!a_strcmp(s->name, (*statusbar)->name))
luaL_error(L, "a statusbar with that name is already on screen %d\n", luaL_error(L, "a statusbar with that name is already on screen %d\n",
screen + 1); screen + 1);
}
statusbar_remove(*statusbar); statusbar_remove(*statusbar);
(*statusbar)->screen = screen; (*statusbar)->screen = screen;
statusbar_list_append(&globalconf.screens[screen].statusbar, *statusbar); statusbar_array_append(&globalconf.screens[screen].statusbars, *statusbar);
statusbar_ref(statusbar); statusbar_ref(statusbar);
/* All the other statusbar and ourselves need to be repositioned */ /* All the other statusbar and ourselves need to be repositioned */
for(s = globalconf.screens[screen].statusbar; s; s = s->next) for(int i = 0; i < globalconf.screens[screen].statusbars.len; i++)
{
statusbar_t *s = globalconf.screens[screen].statusbars.tab[i];
statusbar_position_update(s); statusbar_position_update(s);
}
ewmh_update_workarea(screen_virttophys(screen)); ewmh_update_workarea(screen_virttophys(screen));
} }
@ -743,8 +756,11 @@ luaA_statusbar_newindex(lua_State *L)
(*statusbar)->position = p; (*statusbar)->position = p;
if((*statusbar)->screen != SCREEN_UNDEF) if((*statusbar)->screen != SCREEN_UNDEF)
{ {
for(s = globalconf.screens[(*statusbar)->screen].statusbar; s; s = s->next) for(int i = 0; i < globalconf.screens[(*statusbar)->screen].statusbars.len; i++)
{
statusbar_t *s = globalconf.screens[(*statusbar)->screen].statusbars.tab[i];
statusbar_position_update(s); statusbar_position_update(s);
}
ewmh_update_workarea(screen_virttophys((*statusbar)->screen)); ewmh_update_workarea(screen_virttophys((*statusbar)->screen));
} }
} }

View File

@ -42,7 +42,7 @@ void statusbar_position_update(statusbar_t *);
int luaA_statusbar_userdata_new(lua_State *, statusbar_t *); int luaA_statusbar_userdata_new(lua_State *, statusbar_t *);
DO_RCNT(statusbar_t, statusbar, statusbar_delete) DO_RCNT(statusbar_t, statusbar, statusbar_delete)
DO_SLIST(statusbar_t, statusbar, statusbar_delete) ARRAY_FUNCS(statusbar_t *, statusbar, statusbar_unref)
#endif #endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -245,9 +245,8 @@ struct statusbar_t
} colors; } colors;
/** Widget the mouse is over */ /** Widget the mouse is over */
widget_node_t *mouse_over; widget_node_t *mouse_over;
/** Next and previous statusbars */
statusbar_t *prev, *next;
}; };
ARRAY_TYPE(statusbar_t *, statusbar)
/* Strut */ /* Strut */
typedef struct typedef struct
@ -401,8 +400,8 @@ typedef struct
bool need_arrange; bool need_arrange;
/** Tag list */ /** Tag list */
tag_array_t tags; tag_array_t tags;
/** Status bar */ /** Statusbars */
statusbar_t *statusbar; statusbar_array_t statusbars;
/** Padding */ /** Padding */
padding_t padding; padding_t padding;
/** Window that contains the systray */ /** Window that contains the systray */

View File

@ -210,18 +210,18 @@ widget_common_new(widget_t *widget)
void void
widget_invalidate_cache(int screen, int flags) widget_invalidate_cache(int screen, int flags)
{ {
statusbar_t *statusbar; for(int i = 0; i < globalconf.screens[screen].statusbars.len; i++)
widget_node_t *widget; {
statusbar_t *statusbar = globalconf.screens[screen].statusbars.tab[i];
widget_node_t *widget;
for(statusbar = globalconf.screens[screen].statusbar;
statusbar;
statusbar = statusbar->next)
for(widget = statusbar->widgets; widget; widget = widget->next) for(widget = statusbar->widgets; widget; widget = widget->next)
if(widget->widget->cache_flags & flags) if(widget->widget->cache_flags & flags)
{ {
statusbar->need_update = true; statusbar->need_update = true;
break; break;
} }
}
} }
/** Set a statusbar needs update because it has widget, or redraw a titlebar. /** Set a statusbar needs update because it has widget, or redraw a titlebar.
@ -232,14 +232,14 @@ void
widget_invalidate_bywidget(widget_t *widget) widget_invalidate_bywidget(widget_t *widget)
{ {
int screen; int screen;
statusbar_t *statusbar;
widget_node_t *witer; widget_node_t *witer;
client_t *c; client_t *c;
for(screen = 0; screen < globalconf.nscreen; screen++) for(screen = 0; screen < globalconf.nscreen; screen++)
for(statusbar = globalconf.screens[screen].statusbar; for(int i = 0; i < globalconf.screens[screen].statusbars.len; i++)
statusbar; {
statusbar = statusbar->next) statusbar_t *statusbar = globalconf.screens[screen].statusbars.tab[i];
if(!statusbar->need_update) if(!statusbar->need_update)
for(witer = statusbar->widgets; witer; witer = witer->next) for(witer = statusbar->widgets; witer; witer = witer->next)
if(witer->widget == widget) if(witer->widget == widget)
@ -247,6 +247,7 @@ widget_invalidate_bywidget(widget_t *widget)
statusbar->need_update = true; statusbar->need_update = true;
break; break;
} }
}
for(c = globalconf.clients; c; c = c->next) for(c = globalconf.clients; c; c = c->next)
if(c->titlebar && !c->titlebar->need_update) if(c->titlebar && !c->titlebar->need_update)