diff --git a/client.c b/client.c index cab9ea6d..5cf1df85 100644 --- a/client.c +++ b/client.c @@ -929,4 +929,69 @@ uicb_client_zoom(int screen, char *arg __attribute__ ((unused))) arrange(screen); } +/** Send focus to next client in stack + * \param screen Screen ID + * \param arg Unused + * \ingroup ui_callback + */ +void +uicb_client_focusnext(int screen, char *arg __attribute__ ((unused))) +{ + Client *c, *sel = globalconf.focus->client; + + if(!sel) + return; + for(c = sel->next; c && (c->skip || !client_isvisible(c, screen)); c = c->next); + if(!c) + for(c = globalconf.clients; c && (c->skip || !client_isvisible(c, screen)); c = c->next); + if(c) + { + focus(c, True, screen); + restack(screen); + } +} + +/** Send focus to previous client in stack + * \param screen Screen ID + * \param arg Unused + * \ingroup ui_callback + */ +void +uicb_client_focusprev(int screen, char *arg __attribute__ ((unused))) +{ + Client *prev; + + if((prev = client_find_prev_visible(globalconf.focus->client))) + { + focus(prev, True, screen); + restack(screen); + } +} + +/** Toggle floating state of a client + * \param screen Screen ID + * \param arg unused + * \ingroup ui_callback + */ +void +uicb_client_togglefloating(int screen, char *arg) +{ + Client *sel = globalconf.focus->client; + + if(!sel) + return; + + if((sel->isfloating = !sel->isfloating)) + { + if(!arg) + client_resize(sel, sel->f_geometry, False); + } + else if(sel->ismax) + client_resize(sel, sel->m_geometry, False); + + widget_invalidate_cache(sel->screen, WIDGET_CACHE_CLIENTS); + client_saveprops(sel); + arrange(screen); +} + // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/client.h b/client.h index dc2b6e1f..42e3f998 100644 --- a/client.h +++ b/client.h @@ -50,6 +50,9 @@ Uicb uicb_client_togglemax; Uicb uicb_client_toggleverticalmax; Uicb uicb_client_togglehorizontalmax; Uicb uicb_client_zoom; +Uicb uicb_client_focusnext; +Uicb uicb_client_focusprev; +Uicb uicb_client_togglefloating; DO_SLIST(Client, client, p_delete); diff --git a/layout.c b/layout.c index f45750ff..dfcb0638 100644 --- a/layout.c +++ b/layout.c @@ -89,45 +89,6 @@ get_current_layout(int screen) return l; } -/** Send focus to next client in stack - * \param screen Screen ID - * \param arg Unused - * \ingroup ui_callback - */ -void -uicb_client_focusnext(int screen, char *arg __attribute__ ((unused))) -{ - Client *c, *sel = globalconf.focus->client; - - if(!sel) - return; - for(c = sel->next; c && (c->skip || !client_isvisible(c, screen)); c = c->next); - if(!c) - for(c = globalconf.clients; c && (c->skip || !client_isvisible(c, screen)); c = c->next); - if(c) - { - focus(c, True, screen); - restack(screen); - } -} - -/** Send focus to previous client in stack - * \param screen Screen ID - * \param arg Unused - * \ingroup ui_callback - */ -void -uicb_client_focusprev(int screen, char *arg __attribute__ ((unused))) -{ - Client *prev; - - if((prev = client_find_prev_visible(globalconf.focus->client))) - { - focus(prev, True, screen); - restack(screen); - } -} - void loadawesomeprops(int screen) { @@ -260,30 +221,4 @@ uicb_tag_setlayout(int screen, char *arg) saveawesomeprops(screen); } -/** Toggle floating state of a client - * \param screen Screen ID - * \param arg unused - * \ingroup ui_callback - */ -void -uicb_client_togglefloating(int screen, char *arg) -{ - Client *sel = globalconf.focus->client; - - if(!sel) - return; - - if((sel->isfloating = !sel->isfloating)) - { - if(!arg) - client_resize(sel, sel->f_geometry, False); - } - else if(sel->ismax) - client_resize(sel, sel->m_geometry, False); - - widget_invalidate_cache(sel->screen, WIDGET_CACHE_CLIENTS); - client_saveprops(sel); - arrange(screen); -} - // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/layout.h b/layout.h index e78c1bb8..e9d0ec53 100644 --- a/layout.h +++ b/layout.h @@ -44,10 +44,7 @@ void restack(int); void loadawesomeprops(int); void saveawesomeprops(int); -Uicb uicb_client_focusnext; -Uicb uicb_client_focusprev; Uicb uicb_tag_setlayout; -Uicb uicb_client_togglefloating; #endif // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80