wibox: all wiboxes go into one and only one array
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
7cc0b13eae
commit
3f6ab274c0
42
client.c
42
client.c
|
@ -401,19 +401,18 @@ 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)
|
||||
{
|
||||
wibox_t *sb = *_sb;
|
||||
if(!sb->ontop)
|
||||
{
|
||||
xcb_configure_window(globalconf.connection,
|
||||
sb->sw.window,
|
||||
XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE,
|
||||
config_win_vals);
|
||||
config_win_vals[0] = sb->sw.window;
|
||||
}
|
||||
xcb_configure_window(globalconf.connection,
|
||||
sb->sw.window,
|
||||
XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE,
|
||||
config_win_vals);
|
||||
config_win_vals[0] = sb->sw.window;
|
||||
}
|
||||
}
|
||||
|
||||
/* then stack clients */
|
||||
for(layer = LAYER_BELOW; layer < LAYER_COUNT; layer++)
|
||||
|
@ -423,19 +422,18 @@ 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)
|
||||
{
|
||||
wibox_t *sb = *_sb;
|
||||
if(sb->ontop)
|
||||
{
|
||||
xcb_configure_window(globalconf.connection,
|
||||
sb->sw.window,
|
||||
XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE,
|
||||
config_win_vals);
|
||||
config_win_vals[0] = sb->sw.window;
|
||||
}
|
||||
xcb_configure_window(globalconf.connection,
|
||||
sb->sw.window,
|
||||
XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE,
|
||||
config_win_vals);
|
||||
config_win_vals[0] = sb->sw.window;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
6
event.c
6
event.c
|
@ -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;
|
||||
|
|
5
luaa.c
5
luaa.c
|
@ -631,9 +631,8 @@ 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)
|
||||
(*wibox)->need_update = true;
|
||||
foreach(wibox, globalconf.wiboxes)
|
||||
(*wibox)->need_update = true;
|
||||
foreach(c, globalconf.clients)
|
||||
if((*c)->titlebar)
|
||||
(*c)->titlebar->need_update = true;
|
||||
|
|
2
mouse.c
2
mouse.c
|
@ -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.
|
||||
|
|
11
property.c
11
property.c
|
@ -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,14 +392,14 @@ 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)
|
||||
(*w)->need_update = true;
|
||||
foreach(w, globalconf.wiboxes)
|
||||
(*w)->need_update = true;
|
||||
else
|
||||
{
|
||||
int screen = xutil_root2screen(connection, window);
|
||||
foreach(w, globalconf.screens.tab[screen].wiboxes)
|
||||
(*w)->need_update = true;
|
||||
foreach(w, globalconf.wiboxes)
|
||||
if(screen == screen_array_indexof(&globalconf.screens, (*w)->screen))
|
||||
(*w)->need_update = true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
4
screen.h
4
screen.h
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
39
wibox.c
39
wibox.c
|
@ -290,10 +290,9 @@ wibox_systray_refresh(wibox_t *wibox)
|
|||
wibox_t *
|
||||
wibox_getbywin(xcb_window_t win)
|
||||
{
|
||||
foreach(screen, globalconf.screens)
|
||||
foreach(w, screen->wiboxes)
|
||||
if((*w)->sw.window == win)
|
||||
return *w;
|
||||
foreach(w, globalconf.wiboxes)
|
||||
if((*w)->sw.window == win)
|
||||
return *w;
|
||||
|
||||
foreach(_c, globalconf.clients)
|
||||
{
|
||||
|
@ -327,10 +326,9 @@ wibox_draw(wibox_t *wibox)
|
|||
void
|
||||
wibox_refresh(void)
|
||||
{
|
||||
foreach(screen, globalconf.screens)
|
||||
foreach(w, screen->wiboxes)
|
||||
if((*w)->need_update)
|
||||
wibox_draw(*w);
|
||||
foreach(w, globalconf.wiboxes)
|
||||
if((*w)->need_update)
|
||||
wibox_draw(*w);
|
||||
|
||||
foreach(_c, globalconf.clients)
|
||||
{
|
||||
|
@ -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,19 +536,18 @@ 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))
|
||||
{
|
||||
wibox_t *wibox = *w;
|
||||
if(luaA_wibox_hasitem(L, wibox, item))
|
||||
{
|
||||
/* recompute widget node list */
|
||||
wibox_widgets_table_build(L, wibox);
|
||||
lua_pop(L, 1); /* remove widgets table */
|
||||
}
|
||||
|
||||
/* recompute widget node list */
|
||||
wibox_widgets_table_build(L, wibox);
|
||||
lua_pop(L, 1); /* remove widgets table */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach(_c, globalconf.clients)
|
||||
{
|
||||
client_t *c = *_c;
|
||||
|
|
2
wibox.h
2
wibox.h
|
@ -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);
|
||||
|
||||
|
|
23
widget.c
23
widget.c
|
@ -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,21 +314,19 @@ 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)
|
||||
if(!(*wibox)->need_update)
|
||||
foreach(wnode, (*wibox)->widgets)
|
||||
if(wnode->widget == widget)
|
||||
{
|
||||
(*wibox)->need_update = true;
|
||||
break;
|
||||
}
|
||||
foreach(wibox, globalconf.wiboxes)
|
||||
if(!(*wibox)->need_update)
|
||||
foreach(wnode, (*wibox)->widgets)
|
||||
if(wnode->widget == widget)
|
||||
{
|
||||
(*wibox)->need_update = true;
|
||||
break;
|
||||
}
|
||||
|
||||
foreach(_c, globalconf.clients)
|
||||
{
|
||||
|
|
2
widget.h
2
widget.h
|
@ -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;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "widget.h"
|
||||
#include "screen.h"
|
||||
#include "wibox.h"
|
||||
#include "common/xembed.h"
|
||||
#include "common/atoms.h"
|
||||
|
||||
|
|
Loading…
Reference in New Issue