store screen in tag

This commit is contained in:
Julien Danjou 2008-01-17 18:43:55 +01:00
parent 67c155c0dd
commit 3b1526ea5b
3 changed files with 20 additions and 16 deletions

View File

@ -206,6 +206,8 @@ struct Tag
{ {
/** Tag name */ /** Tag name */
char *name; char *name;
/** Screen */
int screen;
/** True if selected */ /** True if selected */
Bool selected; Bool selected;
/** True if was selected before selecting others tags */ /** True if was selected before selecting others tags */

32
tag.c
View File

@ -50,6 +50,7 @@ tag_new(const char *name, Layout *layout, double mwfact, int nmaster, int ncol)
static void static void
tag_append_to_screen(Tag *tag, int screen) tag_append_to_screen(Tag *tag, int screen)
{ {
tag->screen = screen;
tag_list_append(&globalconf.screens[screen].tags, tag); tag_list_append(&globalconf.screens[screen].tags, tag);
widget_invalidate_cache(screen, WIDGET_CACHE_TAGS); widget_invalidate_cache(screen, WIDGET_CACHE_TAGS);
} }
@ -57,6 +58,7 @@ tag_append_to_screen(Tag *tag, int screen)
void void
tag_push_to_screen(Tag *tag, int screen) tag_push_to_screen(Tag *tag, int screen)
{ {
tag->screen = screen;
tag_list_push(&globalconf.screens[screen].tags, tag); tag_list_push(&globalconf.screens[screen].tags, tag);
widget_invalidate_cache(screen, WIDGET_CACHE_TAGS); widget_invalidate_cache(screen, WIDGET_CACHE_TAGS);
} }
@ -286,16 +288,16 @@ uicb_tag_toggleview(int screen, char *arg)
} }
static void static void
tag_view_only(Tag *target, int screen) tag_view_only(Tag *target)
{ {
Tag *tag; Tag *tag;
if(!target) return; if(!target) return;
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next) for(tag = globalconf.screens[target->screen].tags; tag; tag = tag->next)
tag_view(tag, False, screen); tag_view(tag, False);
tag_view(target, True, screen); tag_view(target, True);
} }
void void
@ -308,16 +310,16 @@ tag_view_only_byindex(int screen, int dindex)
for(tag = globalconf.screens[screen].tags; tag && dindex > 0; for(tag = globalconf.screens[screen].tags; tag && dindex > 0;
tag = tag->next, dindex--); tag = tag->next, dindex--);
tag_view_only(tag, screen); tag_view_only(tag);
} }
void void
tag_view(Tag *tag, Bool view, int screen) tag_view(Tag *tag, Bool view)
{ {
tag->selected = view; tag->selected = view;
ewmh_update_net_current_desktop(get_phys_screen(screen)); ewmh_update_net_current_desktop(get_phys_screen(tag->screen));
widget_invalidate_cache(screen, WIDGET_CACHE_TAGS); widget_invalidate_cache(tag->screen, WIDGET_CACHE_TAGS);
saveawesomeprops(screen); saveawesomeprops(tag->screen);
} }
/** View tag /** View tag
@ -334,7 +336,7 @@ uicb_tag_view(int screen, char *arg)
tag_view_only_byindex(screen, atoi(arg) - 1); tag_view_only_byindex(screen, atoi(arg) - 1);
else else
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next) for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
tag_view(tag, True, screen); tag_view(tag, True);
arrange(screen); arrange(screen);
} }
@ -353,7 +355,7 @@ uicb_tag_prev_selected(int screen, char *arg __attribute__ ((unused)))
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next) for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
{ {
t = tag->selected; t = tag->selected;
tag_view(tag, tag->was_selected, screen); tag_view(tag, tag->was_selected);
tag->was_selected = t; tag->was_selected = t;
} }
@ -375,8 +377,8 @@ uicb_tag_viewnext(int screen, char *arg __attribute__ ((unused)))
else else
tag = globalconf.screens[screen].tags; tag = globalconf.screens[screen].tags;
tag_view(curtags[0], False, screen); tag_view(curtags[0], False);
tag_view(tag, True, screen); tag_view(tag, True);
p_delete(&curtags); p_delete(&curtags);
arrange(screen); arrange(screen);
@ -394,8 +396,8 @@ uicb_tag_viewprev(int screen, char *arg __attribute__ ((unused)))
tag = tag_list_prev_cycle(&globalconf.screens[screen].tags, curtags[0]); tag = tag_list_prev_cycle(&globalconf.screens[screen].tags, curtags[0]);
tag_view(curtags[0], False, screen); tag_view(curtags[0], False);
tag_view(tag, True, screen); tag_view(tag, True);
p_delete(&curtags); p_delete(&curtags);
arrange(screen); arrange(screen);

2
tag.h
View File

@ -28,7 +28,7 @@
#define IS_TILED(client, screen) (client && !client->isfloating && client_isvisible(client, screen)) #define IS_TILED(client, screen) (client && !client->isfloating && client_isvisible(client, screen))
Tag * tag_new(const char *, Layout *, double, int, int); Tag * tag_new(const char *, Layout *, double, int, int);
void tag_view(Tag *, Bool, int); void tag_view(Tag *, Bool);
void tag_push_to_screen(Tag *, int); void tag_push_to_screen(Tag *, int);
Tag ** get_current_tags(int); Tag ** get_current_tags(int);
void tag_client(Client *, Tag *); void tag_client(Client *, Tag *);