widget: remove old cache system

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-11-12 13:45:08 +01:00
parent 4fcf48e247
commit 0716ecb4fd
6 changed files with 10 additions and 19 deletions

10
event.c
View File

@ -324,15 +324,14 @@ event_handle_destroynotify(void *data __attribute__ ((unused)),
{ {
client_t *c; client_t *c;
xembed_window_t *emwin; xembed_window_t *emwin;
int i;
if((c = client_getbywin(ev->window))) if((c = client_getbywin(ev->window)))
client_unmanage(c); client_unmanage(c);
else if((emwin = xembed_getbywin(globalconf.embedded, ev->event))) else if((emwin = xembed_getbywin(globalconf.embedded, ev->event)))
{ {
xembed_window_list_detach(&globalconf.embedded, emwin); xembed_window_list_detach(&globalconf.embedded, emwin);
for(i = 0; i < globalconf.nscreen; i++) for(int i = 0; i < globalconf.nscreen; i++)
widget_invalidate_cache(i, WIDGET_CACHE_EMBEDDED); widget_invalidate_bytype(i, systray_new);
} }
return 0; return 0;
@ -625,7 +624,6 @@ event_handle_unmapnotify(void *data __attribute__ ((unused)),
{ {
client_t *c; client_t *c;
xembed_window_t *em; xembed_window_t *em;
int i;
if((c = client_getbywin(ev->window))) if((c = client_getbywin(ev->window)))
{ {
@ -637,8 +635,8 @@ event_handle_unmapnotify(void *data __attribute__ ((unused)),
else if((em = xembed_getbywin(globalconf.embedded, ev->window))) else if((em = xembed_getbywin(globalconf.embedded, ev->window)))
{ {
xembed_window_list_detach(&globalconf.embedded, em); xembed_window_list_detach(&globalconf.embedded, em);
for(i = 0; i < globalconf.nscreen; i++) for(int i = 0; i < globalconf.nscreen; i++)
widget_invalidate_cache(i, WIDGET_CACHE_EMBEDDED); widget_invalidate_bytype(i, systray_new);
} }
return 0; return 0;

View File

@ -129,8 +129,6 @@ struct widget_t
void *data; void *data;
/** Button bindings */ /** Button bindings */
button_array_t buttons; button_array_t buttons;
/** Cache flags */
int cache_flags;
/** True if the widget is visible */ /** True if the widget is visible */
bool isvisible; bool isvisible;
}; };

View File

@ -173,7 +173,7 @@ systray_request_handle(xcb_window_t embed_win, int phys_screen, xembed_info_t *i
MIN(XEMBED_VERSION, em->info.version)); MIN(XEMBED_VERSION, em->info.version));
for(i = 0; i < globalconf.nscreen; i++) for(i = 0; i < globalconf.nscreen; i++)
widget_invalidate_cache(i, WIDGET_CACHE_EMBEDDED); widget_invalidate_bytype(i, systray_new);
return 0; return 0;
} }

View File

@ -308,21 +308,19 @@ widget_common_new(widget_t *widget)
widget->align_supported = AlignLeft | AlignRight; widget->align_supported = AlignLeft | AlignRight;
} }
/** Invalidate widgets which should be refresh upon /** Invalidate widgets which should be refresh depending on their types.
* external modifications. widget_t who watch flags will
* be set to be refreshed.
* \param screen Virtual screen number. * \param screen Virtual screen number.
* \param flags Cache flags to invalidate. * \param type Widget type to invalidate.
*/ */
void void
widget_invalidate_cache(int screen, int flags) widget_invalidate_bytype(int screen, widget_constructor_t *type)
{ {
for(int i = 0; i < globalconf.screens[screen].wiboxes.len; i++) for(int i = 0; i < globalconf.screens[screen].wiboxes.len; i++)
{ {
wibox_t *wibox = globalconf.screens[screen].wiboxes.tab[i]; wibox_t *wibox = globalconf.screens[screen].wiboxes.tab[i];
for(int j = 0; j < wibox->widgets.len; j++) for(int j = 0; j < wibox->widgets.len; j++)
if(wibox->widgets.tab[j].widget->cache_flags & flags) if(wibox->widgets.tab[j].widget->type == type)
{ {
wibox->need_update = true; wibox->need_update = true;
break; break;

View File

@ -24,8 +24,6 @@
#include "mouse.h" #include "mouse.h"
#define WIDGET_CACHE_EMBEDDED (1<<3)
struct widget_node_t struct widget_node_t
{ {
/** The widget */ /** The widget */
@ -38,7 +36,6 @@ void widget_delete(widget_t **);
DO_RCNT(widget_t, widget, widget_delete) DO_RCNT(widget_t, widget, widget_delete)
void widget_invalidate_cache(int, int);
int widget_calculate_offset(int, int, int, int); int widget_calculate_offset(int, int, int, int);
void widget_common_new(widget_t *); void widget_common_new(widget_t *);
void widget_render(widget_node_array_t *, draw_context_t *, xcb_gcontext_t, xcb_drawable_t, int, orientation_t, int, int, wibox_t *); void widget_render(widget_node_array_t *, draw_context_t *, xcb_gcontext_t, xcb_drawable_t, int, orientation_t, int, int, wibox_t *);
@ -47,6 +44,7 @@ int luaA_widget_userdata_new(lua_State *, widget_t *);
void luaA_table2widgets(lua_State *, widget_node_array_t *); void luaA_table2widgets(lua_State *, widget_node_array_t *);
void widget_invalidate_bywidget(widget_t *); void widget_invalidate_bywidget(widget_t *);
void widget_invalidate_bytype(int, widget_constructor_t *);
widget_constructor_t textbox_new; widget_constructor_t textbox_new;
widget_constructor_t progressbar_new; widget_constructor_t progressbar_new;

View File

@ -84,7 +84,6 @@ systray_new(alignment_t align)
w->align = align; w->align = align;
w->draw = systray_draw; w->draw = systray_draw;
w->geometry = systray_geometry; w->geometry = systray_geometry;
w->cache_flags = WIDGET_CACHE_EMBEDDED;
return w; return w;
} }