diff --git a/awesome.c b/awesome.c index 1ae0b80d..b3411aff 100644 --- a/awesome.c +++ b/awesome.c @@ -333,7 +333,7 @@ main(int argc, char *argv[]) XSync(dpy, False); globalconf.screens = p_new(VirtScreen, get_screen_count(dpy)); - focus_add_client(&globalconf.focus, NULL); + focus_add_client(NULL); /* store display */ globalconf.display = dpy; config_parse(confpath); diff --git a/client.c b/client.c index 0dc24126..63c521a3 100644 --- a/client.c +++ b/client.c @@ -224,7 +224,7 @@ focus(Client *c, Bool selscreen, int screen) return; /* save old sel in focus history */ - focus_add_client(&globalconf.focus, c); + focus_add_client(c); statusbar_draw(screen); @@ -493,7 +493,7 @@ client_unmanage(Client *c, long state) client_detach(c); if(globalconf.focus->client == c) focus(NULL, True, c->screen); - focus_delete_client(&globalconf.focus, c); + focus_delete_client(c); for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next) untag_client(c, tag, c->screen); XUngrabButton(c->display, AnyButton, AnyModifier, c->win); diff --git a/focus.c b/focus.c index 5e6c2cad..3816ce5a 100644 --- a/focus.c +++ b/focus.c @@ -27,11 +27,11 @@ extern awesome_config globalconf; static FocusList * -focus_get_node_by_client(FocusList *head, Client *c) +focus_get_node_by_client(Client *c) { FocusList *fh; - for(fh = head; fh; fh = fh->prev) + for(fh = globalconf.focus; fh; fh = fh->prev) if(fh->client == c) return fh; @@ -39,15 +39,15 @@ focus_get_node_by_client(FocusList *head, Client *c) } static FocusList * -focus_detach_node(FocusList **head, FocusList *fl) +focus_detach_node(FocusList *fl) { FocusList *tmp; - if(*head == fl) - *head = fl->prev; + if(globalconf.focus == fl) + globalconf.focus = fl->prev; else { - for(tmp = *head; tmp && tmp->prev != fl; tmp = tmp->prev); + for(tmp = globalconf.focus; tmp && tmp->prev != fl; tmp = tmp->prev); tmp->prev = fl->prev; } @@ -55,51 +55,51 @@ focus_detach_node(FocusList **head, FocusList *fl) } static FocusList * -focus_attach_node(FocusList **head, FocusList *fl) +focus_attach_node(FocusList *fl) { FocusList *old_head; - old_head = *head; - *head = fl; + old_head = globalconf.focus; + globalconf.focus = fl; fl->prev = old_head; return fl; } void -focus_add_client(FocusList **head, Client *c) +focus_add_client(Client *c) { FocusList *new_fh; /* if we don't find this node, create a new one */ - if(!(new_fh = focus_get_node_by_client(*head, c))) + if(!(new_fh = focus_get_node_by_client(c))) { new_fh = p_new(FocusList, 1); new_fh->client = c; } else /* if we've got a node, detach it */ - focus_detach_node(head, new_fh); + focus_detach_node(new_fh); - focus_attach_node(head, new_fh); + focus_attach_node(new_fh); } void -focus_delete_client(FocusList **head, Client *c) +focus_delete_client(Client *c) { - FocusList *fc = focus_get_node_by_client(*head, c), *target; + FocusList *fc = focus_get_node_by_client(c), *target; if (fc) { - target = focus_detach_node(head, fc); + target = focus_detach_node(fc); p_delete(&target); } } Client * -focus_get_latest_client_for_tag(FocusList *head, int screen, Tag *t) +focus_get_latest_client_for_tag(int screen, Tag *t) { FocusList *fl; - for(fl = head; fl; fl = fl->prev) + for(fl = globalconf.focus; fl; fl = fl->prev) if(is_client_tagged(fl->client, t, screen)) return fl->client; diff --git a/focus.h b/focus.h index d383136c..4181860f 100644 --- a/focus.h +++ b/focus.h @@ -24,9 +24,9 @@ #include "config.h" -void focus_add_client(FocusList **, Client *); -void focus_delete_client(FocusList **, Client *); -Client * focus_get_latest_client_for_tag(FocusList *, int, Tag *); +void focus_add_client(Client *); +void focus_delete_client(Client *); +Client * focus_get_latest_client_for_tag(int, Tag *); UICB_PROTO(uicb_focus_history); diff --git a/layout.c b/layout.c index 67390b9e..d6bae16d 100644 --- a/layout.c +++ b/layout.c @@ -83,7 +83,7 @@ arrange(int screen) } curtag->layout->arrange(screen); - focus(focus_get_latest_client_for_tag(globalconf.focus, screen, curtag), + focus(focus_get_latest_client_for_tag(screen, curtag), True, screen); restack(screen); } diff --git a/screen.c b/screen.c index b4eb38e7..377a7fe4 100644 --- a/screen.c +++ b/screen.c @@ -262,9 +262,7 @@ uicb_screen_focus(int screen, char *arg) if (new_screen > (numscreens - 1)) new_screen = 0; - focus(focus_get_latest_client_for_tag(globalconf.focus, - new_screen, - get_current_tag(new_screen)), + focus(focus_get_latest_client_for_tag(new_screen, get_current_tag(new_screen)), True, new_screen); move_mouse_pointer_to_screen(globalconf.display, new_screen); diff --git a/widgets/focustitle.c b/widgets/focustitle.c index f6241c00..7e4774e8 100644 --- a/widgets/focustitle.c +++ b/widgets/focustitle.c @@ -10,8 +10,7 @@ static int focustitle_draw(Widget *widget, DrawCtx *ctx, int offset, int used) { VirtScreen vscreen = globalconf.screens[widget->statusbar->screen]; - Client *sel = focus_get_latest_client_for_tag(globalconf.focus, - widget->statusbar->screen, + Client *sel = focus_get_latest_client_for_tag(widget->statusbar->screen, get_current_tag(widget->statusbar->screen)); int location = calculate_offset(vscreen.statusbar.width, 0,