From da9de6938d909ee18febe9f6e79c2f3645ed54f8 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 25 Aug 2008 13:32:26 +0200 Subject: [PATCH] statusbar: add statusbar_getbywin() Signed-off-by: Julien Danjou --- statusbar.c | 15 +++++++++++++++ statusbar.h | 1 + 2 files changed, 16 insertions(+) diff --git a/statusbar.c b/statusbar.c index 8218ba0b..407722ac 100644 --- a/statusbar.c +++ b/statusbar.c @@ -228,6 +228,21 @@ statusbar_draw(statusbar_t *statusbar) statusbar_systray_refresh(statusbar); } +/** Get a statusbar by its window. + * \param w The window id. + * \return A statusbar if found, NULL otherwise. + */ +statusbar_t * +statusbar_getbywin(xcb_window_t w) +{ + statusbar_t *s; + for(int i = 0; i < globalconf.screens_info->nscreen; i++) + for(s = globalconf.screens[i].statusbar; s; s = s->next) + if(s->sw->window == w) + return s; + return NULL; +} + /** Statusbar refresh function. */ void diff --git a/statusbar.h b/statusbar.h index a8e3223b..1565b760 100644 --- a/statusbar.h +++ b/statusbar.h @@ -35,6 +35,7 @@ statusbar_delete(statusbar_t **statusbar) p_delete(statusbar); } +statusbar_t * statusbar_getbywin(xcb_window_t); void statusbar_refresh(void); void statusbar_position_update(statusbar_t *);