wibox: all wiboxes go into one and only one array

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-05-10 14:55:13 +02:00
parent 7cc0b13eae
commit 3f6ab274c0
13 changed files with 68 additions and 75 deletions

View file

@ -401,8 +401,7 @@ client_real_stack(void)
config_win_vals[0]);
/* first stack not ontop wibox window */
foreach(s, globalconf.screens)
foreach(_sb, s->wiboxes)
foreach(_sb, globalconf.wiboxes)
{
wibox_t *sb = *_sb;
if(!sb->ontop)
@ -423,8 +422,7 @@ client_real_stack(void)
config_win_vals[0]);
/* then stack ontop wibox window */
foreach(s, globalconf.screens)
foreach(_sb, s->wiboxes)
foreach(_sb, globalconf.wiboxes)
{
wibox_t *sb = *_sb;
if(sb->ontop)

View file

@ -337,8 +337,7 @@ event_handle_destroynotify(void *data __attribute__ ((unused)),
if(globalconf.embedded.tab[i].win == ev->window)
{
xembed_window_array_take(&globalconf.embedded, i);
foreach(screen, globalconf.screens)
widget_invalidate_bytype(screen, widget_systray);
widget_invalidate_bytype(widget_systray);
}
return 0;
@ -670,8 +669,7 @@ event_handle_unmapnotify(void *data __attribute__ ((unused)),
if(globalconf.embedded.tab[i].win == ev->window)
{
xembed_window_array_take(&globalconf.embedded, i);
foreach(screen, globalconf.screens)
widget_invalidate_bytype(screen, widget_systray);
widget_invalidate_bytype(widget_systray);
}
return 0;

3
luaa.c
View file

@ -631,8 +631,7 @@ luaA_awesome_newindex(lua_State *L)
draw_font_delete(&globalconf.font);
globalconf.font = draw_font_new(newfont);
/* refresh all wiboxes */
foreach(screen, globalconf.screens)
foreach(wibox, screen->wiboxes)
foreach(wibox, globalconf.wiboxes)
(*wibox)->need_update = true;
foreach(c, globalconf.clients)
if((*c)->titlebar)

View file

@ -23,6 +23,8 @@
#include "screen.h"
#include "client.h"
#include "structs.h"
#include "wibox.h"
#include "common/tokenize.h"
#include "common/xutil.h"
/** Get the pointer position.

View file

@ -25,6 +25,7 @@
#include "property.h"
#include "client.h"
#include "ewmh.h"
#include "wibox.h"
#include "common/atoms.h"
#include "common/xutil.h"
@ -391,13 +392,13 @@ property_handle_xrootpmap_id(void *data __attribute__ ((unused)),
xcb_get_property_reply_t *reply)
{
if(globalconf.xinerama_is_active)
foreach(screen, globalconf.screens)
foreach(w, screen->wiboxes)
foreach(w, globalconf.wiboxes)
(*w)->need_update = true;
else
{
int screen = xutil_root2screen(connection, window);
foreach(w, globalconf.screens.tab[screen].wiboxes)
foreach(w, globalconf.wiboxes)
if(screen == screen_array_indexof(&globalconf.screens, (*w)->screen))
(*w)->need_update = true;
}

View file

@ -22,7 +22,7 @@
#ifndef AWESOME_SCREEN_H
#define AWESOME_SCREEN_H
#include "wibox.h"
#include "structs.h"
struct a_screen
{
@ -32,8 +32,6 @@ struct a_screen
bool need_arrange;
/** Tag list */
tag_array_t tags;
/** Wiboxes */
wibox_array_t wiboxes;
/** Window that contains the systray */
struct
{

View file

@ -48,6 +48,7 @@ ARRAY_TYPE(button_t *, button)
ARRAY_TYPE(tag_t *, tag)
ARRAY_TYPE(screen_t, screen)
ARRAY_TYPE(client_t *, client)
ARRAY_TYPE(wibox_t *, wibox)
/** Main configuration structure */
struct awesome_t
@ -140,6 +141,8 @@ struct awesome_t
screen_t *screen_focus;
/** Need to call client_stack_refresh() */
bool client_need_stack_refresh;
/** Wiboxes */
wibox_array_t wiboxes;
/** The startup notification display struct */
SnDisplay *sndisplay;
};

View file

@ -170,8 +170,7 @@ systray_request_handle(xcb_window_t embed_win, int phys_screen, xembed_info_t *i
xembed_window_array_append(&globalconf.embedded, em);
foreach(screen, globalconf.screens)
widget_invalidate_bytype(screen, widget_systray);
widget_invalidate_bytype(widget_systray);
return 0;
}

15
wibox.c
View file

@ -290,8 +290,7 @@ wibox_systray_refresh(wibox_t *wibox)
wibox_t *
wibox_getbywin(xcb_window_t win)
{
foreach(screen, globalconf.screens)
foreach(w, screen->wiboxes)
foreach(w, globalconf.wiboxes)
if((*w)->sw.window == win)
return *w;
@ -327,8 +326,7 @@ wibox_draw(wibox_t *wibox)
void
wibox_refresh(void)
{
foreach(screen, globalconf.screens)
foreach(w, screen->wiboxes)
foreach(w, globalconf.wiboxes)
if((*w)->need_update)
wibox_draw(*w);
@ -390,10 +388,10 @@ wibox_detach(wibox_t *wibox)
wibox->screen->need_arrange = true;
foreach(item, wibox->screen->wiboxes)
foreach(item, globalconf.wiboxes)
if(*item == wibox)
{
wibox_array_remove(&wibox->screen->wiboxes, item);
wibox_array_remove(&globalconf.wiboxes, item);
break;
}
@ -428,7 +426,7 @@ wibox_attach(screen_t *s)
if(cscreen != wibox->screen)
wibox_move(wibox, s->geometry.x, s->geometry.y);
wibox_array_append(&s->wiboxes, wibox);
wibox_array_append(&globalconf.wiboxes, wibox);
simplewindow_init(&wibox->sw, phys_screen,
wibox->sw.geometry,
@ -538,8 +536,7 @@ luaA_wibox_hasitem(lua_State *L, wibox_t *wibox, const void *item)
void
luaA_wibox_invalidate_byitem(lua_State *L, const void *item)
{
foreach(screen, globalconf.screens)
foreach(w, screen->wiboxes)
foreach(w, globalconf.wiboxes)
{
wibox_t *wibox = *w;
if(luaA_wibox_hasitem(L, wibox, item))

View file

@ -72,7 +72,7 @@ struct wibox_t
void wibox_unref_simplified(wibox_t **);
DO_ARRAY(wibox_t *, wibox, wibox_unref_simplified)
ARRAY_FUNCS(wibox_t *, wibox, wibox_unref_simplified)
void wibox_refresh(void);

View file

@ -299,13 +299,12 @@ widget_render(wibox_t *wibox)
}
/** Invalidate widgets which should be refresh depending on their types.
* \param screen Virtual screen.
* \param type Widget type to invalidate.
*/
void
widget_invalidate_bytype(screen_t *screen, widget_constructor_t *type)
widget_invalidate_bytype(widget_constructor_t *type)
{
foreach(wibox, screen->wiboxes)
foreach(wibox, globalconf.wiboxes)
foreach(wnode, (*wibox)->widgets)
if(wnode->widget->type == type)
{
@ -315,14 +314,12 @@ widget_invalidate_bytype(screen_t *screen, widget_constructor_t *type)
}
/** Set a wibox needs update because it has widget, or redraw a titlebar.
* \todo Probably needs more optimization.
* \param widget The widget to look for.
*/
void
widget_invalidate_bywidget(widget_t *widget)
{
foreach(screen, globalconf.screens)
foreach(wibox, screen->wiboxes)
foreach(wibox, globalconf.wiboxes)
if(!(*wibox)->need_update)
foreach(wnode, (*wibox)->widgets)
if(wnode->widget == widget)

View file

@ -77,7 +77,7 @@ void widget_render(wibox_t *);
void luaA_table2widgets(lua_State *, widget_node_array_t *);
void widget_invalidate_bywidget(widget_t *);
void widget_invalidate_bytype(screen_t *, widget_constructor_t *);
void widget_invalidate_bytype(widget_constructor_t *);
widget_constructor_t widget_textbox;
widget_constructor_t widget_progressbar;

View file

@ -24,6 +24,7 @@
#include "widget.h"
#include "screen.h"
#include "wibox.h"
#include "common/xembed.h"
#include "common/atoms.h"