focus_get_latest_client_for_tags() now supports Tag **, use it for widgets

This commit is contained in:
Julien Danjou 2007-12-27 19:23:10 +01:00
parent a1f5e2ee22
commit 8f9be2289a
6 changed files with 17 additions and 9 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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,

View File

@ -24,7 +24,7 @@
#include <confuse.h>
#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;