From 0716ecb4fd6d75df0a41b43f45f596f023f81836 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 12 Nov 2008 13:45:08 +0100 Subject: [PATCH] widget: remove old cache system Signed-off-by: Julien Danjou --- event.c | 10 ++++------ structs.h | 2 -- systray.c | 2 +- widget.c | 10 ++++------ widget.h | 4 +--- widgets/systray.c | 1 - 6 files changed, 10 insertions(+), 19 deletions(-) diff --git a/event.c b/event.c index 96b88d525..9ea89290f 100644 --- a/event.c +++ b/event.c @@ -324,15 +324,14 @@ event_handle_destroynotify(void *data __attribute__ ((unused)), { client_t *c; xembed_window_t *emwin; - int i; if((c = client_getbywin(ev->window))) client_unmanage(c); else if((emwin = xembed_getbywin(globalconf.embedded, ev->event))) { xembed_window_list_detach(&globalconf.embedded, emwin); - for(i = 0; i < globalconf.nscreen; i++) - widget_invalidate_cache(i, WIDGET_CACHE_EMBEDDED); + for(int i = 0; i < globalconf.nscreen; i++) + widget_invalidate_bytype(i, systray_new); } return 0; @@ -625,7 +624,6 @@ event_handle_unmapnotify(void *data __attribute__ ((unused)), { client_t *c; xembed_window_t *em; - int i; 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))) { xembed_window_list_detach(&globalconf.embedded, em); - for(i = 0; i < globalconf.nscreen; i++) - widget_invalidate_cache(i, WIDGET_CACHE_EMBEDDED); + for(int i = 0; i < globalconf.nscreen; i++) + widget_invalidate_bytype(i, systray_new); } return 0; diff --git a/structs.h b/structs.h index d4a9cc047..50483e784 100644 --- a/structs.h +++ b/structs.h @@ -129,8 +129,6 @@ struct widget_t void *data; /** Button bindings */ button_array_t buttons; - /** Cache flags */ - int cache_flags; /** True if the widget is visible */ bool isvisible; }; diff --git a/systray.c b/systray.c index a9aac04e0..fb05f1332 100644 --- a/systray.c +++ b/systray.c @@ -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)); for(i = 0; i < globalconf.nscreen; i++) - widget_invalidate_cache(i, WIDGET_CACHE_EMBEDDED); + widget_invalidate_bytype(i, systray_new); return 0; } diff --git a/widget.c b/widget.c index e4c8da6b6..aefbb994c 100644 --- a/widget.c +++ b/widget.c @@ -308,21 +308,19 @@ widget_common_new(widget_t *widget) widget->align_supported = AlignLeft | AlignRight; } -/** Invalidate widgets which should be refresh upon - * external modifications. widget_t who watch flags will - * be set to be refreshed. +/** Invalidate widgets which should be refresh depending on their types. * \param screen Virtual screen number. - * \param flags Cache flags to invalidate. + * \param type Widget type to invalidate. */ 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++) { wibox_t *wibox = globalconf.screens[screen].wiboxes.tab[i]; 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; break; diff --git a/widget.h b/widget.h index ef834a07d..34cfda4dd 100644 --- a/widget.h +++ b/widget.h @@ -24,8 +24,6 @@ #include "mouse.h" -#define WIDGET_CACHE_EMBEDDED (1<<3) - struct widget_node_t { /** The widget */ @@ -38,7 +36,6 @@ void widget_delete(widget_t **); DO_RCNT(widget_t, widget, widget_delete) -void widget_invalidate_cache(int, int); int widget_calculate_offset(int, int, int, int); 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 *); @@ -47,6 +44,7 @@ int luaA_widget_userdata_new(lua_State *, widget_t *); void luaA_table2widgets(lua_State *, widget_node_array_t *); void widget_invalidate_bywidget(widget_t *); +void widget_invalidate_bytype(int, widget_constructor_t *); widget_constructor_t textbox_new; widget_constructor_t progressbar_new; diff --git a/widgets/systray.c b/widgets/systray.c index 324eef5dd..ef12ff71e 100644 --- a/widgets/systray.c +++ b/widgets/systray.c @@ -84,7 +84,6 @@ systray_new(alignment_t align) w->align = align; w->draw = systray_draw; w->geometry = systray_geometry; - w->cache_flags = WIDGET_CACHE_EMBEDDED; return w; }