From 8f9be2289a1162c3c72f850b1b995e1dd81978a1 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 27 Dec 2007 19:23:10 +0100 Subject: [PATCH] focus_get_latest_client_for_tags() now supports Tag **, use it for widgets --- focus.c | 7 ++++--- focus.h | 2 +- layout.c | 2 +- screen.c | 2 +- widgets/focustitle.c | 6 +++++- widgets/netwmicon.c | 7 +++++-- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/focus.c b/focus.c index f101a248..5fb65def 100644 --- a/focus.c +++ b/focus.c @@ -95,13 +95,14 @@ focus_delete_client(Client *c) } Client * -focus_get_latest_client_for_tag(int screen, Tag *t) +focus_get_latest_client_for_tags(int screen, Tag **t) { FocusList *fl; for(fl = globalconf.focus; fl; fl = fl->prev) - if(is_client_tagged(fl->client, t, screen)) - return fl->client; + for(; *t; t++) + if(is_client_tagged(fl->client, *t, screen)) + return fl->client; return NULL; } diff --git a/focus.h b/focus.h index 2aa257ea..7946b8bc 100644 --- a/focus.h +++ b/focus.h @@ -26,7 +26,7 @@ void focus_add_client(Client *); void focus_delete_client(Client *); -Client * focus_get_latest_client_for_tag(int, Tag *); +Client * focus_get_latest_client_for_tags(int, Tag **); UICB_PROTO(uicb_focus_history); UICB_PROTO(uicb_focus_client_byname); diff --git a/layout.c b/layout.c index f937deb3..d0b8d34b 100644 --- a/layout.c +++ b/layout.c @@ -67,7 +67,7 @@ arrange(int screen) } curtags[0]->layout->arrange(screen); - focus(focus_get_latest_client_for_tag(screen, curtags[0]), + focus(focus_get_latest_client_for_tags(screen, curtags), True, screen); p_delete(&curtags); restack(screen); diff --git a/screen.c b/screen.c index c5b1ded0..39e91f40 100644 --- a/screen.c +++ b/screen.c @@ -264,7 +264,7 @@ uicb_screen_focus(int screen, char *arg) if (new_screen > (numscreens - 1)) new_screen = 0; - focus(focus_get_latest_client_for_tag(new_screen, curtags[0]), + focus(focus_get_latest_client_for_tags(new_screen, curtags), True, new_screen); p_delete(&curtags); diff --git a/widgets/focustitle.c b/widgets/focustitle.c index 7973b70d..778b39d9 100644 --- a/widgets/focustitle.c +++ b/widgets/focustitle.c @@ -25,6 +25,7 @@ #include "util.h" #include "widget.h" #include "layout.h" +#include "tag.h" #include "focus.h" extern AwesomeConf globalconf; @@ -33,7 +34,10 @@ static int focustitle_draw(Widget *widget, DrawCtx *ctx, int offset, int used) { VirtScreen vscreen = globalconf.screens[widget->statusbar->screen]; - Client *sel = globalconf.focus->client; + Tag **curtags = get_current_tags(widget->statusbar->screen); + Client *sel = focus_get_latest_client_for_tags(widget->statusbar->screen, curtags); + + p_delete(&curtags); widget->location = widget_calculate_offset(vscreen.statusbar->width, 0, diff --git a/widgets/netwmicon.c b/widgets/netwmicon.c index c32dc452..20308e47 100644 --- a/widgets/netwmicon.c +++ b/widgets/netwmicon.c @@ -24,7 +24,7 @@ #include #include "util.h" #include "focus.h" -#include "layout.h" +#include "tag.h" #include "widget.h" extern AwesomeConf globalconf; @@ -38,7 +38,10 @@ netwmicon_draw(Widget *widget, DrawCtx *ctx, int offset, int format, width, height, size, i; unsigned long items, rest; unsigned char *image, *imgdata; - Client *sel = globalconf.focus->client; + Tag **curtags = get_current_tags(widget->statusbar->screen); + Client *sel = focus_get_latest_client_for_tags(widget->statusbar->screen, curtags); + + p_delete(&curtags); if(!sel) return 0;