From b75e462223eeee534a7ed1ced214a9e21500482e Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 2 May 2008 14:40:51 +0200 Subject: [PATCH] [client] Merge vertical and horizontalmax inside togglemax Signed-off-by: Julien Danjou --- client.c | 74 +++++++++++++++++--------------------------------------- client.h | 2 -- 2 files changed, 22 insertions(+), 54 deletions(-) diff --git a/client.c b/client.c index 044038add..b4350d417 100644 --- a/client.c +++ b/client.c @@ -1101,69 +1101,39 @@ client_maximize(client_t *c, area_t geometry) } /** Toggle maximization state for the focused client. - * \param screen Screen ID - * \param arg Unused + * \param screen Virtual screen number. + * \param arg Either "vertical", "horizontal" or nothing for both. * \ingroup ui_callback */ void -uicb_client_togglemax(int screen, char *arg __attribute__ ((unused))) +uicb_client_togglemax(int screen, char *arg) { - client_t *sel = globalconf.focus->client; - area_t area = screen_get_area(screen, - globalconf.screens[screen].statusbar, - &globalconf.screens[screen].padding); + area_t area; + + if(!globalconf.focus->client) + return; - if(sel) + area = screen_get_area(screen, + globalconf.screens[screen].statusbar, + &globalconf.screens[screen].padding); + if(arg[0] == 'v') { - area.width -= 2 * sel->border; - area.height -= 2 * sel->border; - client_maximize(sel, area); + area.x = globalconf.focus->client->geometry.x; + area.width = globalconf.focus->client->geometry.width; + area.height -= 2 * globalconf.focus->client->border; } -} - -/** Toggle vertical maximization for the focused client. - * \param screen Screen ID - * \param arg Unused - * \ingroup ui_callback - */ -void -uicb_client_toggleverticalmax(int screen, char *arg __attribute__ ((unused))) -{ - client_t *sel = globalconf.focus->client; - area_t area = screen_get_area(screen, - globalconf.screens[screen].statusbar, - &globalconf.screens[screen].padding); - - if(sel) + else if(arg[0] == 'h') { - area.x = sel->geometry.x; - area.width = sel->geometry.width; - area.height -= 2 * sel->border; - client_maximize(sel, area); + area.y = globalconf.focus->client->geometry.y; + area.height = globalconf.focus->client->geometry.height; + area.width -= 2 * globalconf.focus->client->border; } -} - - -/** Toggle horizontal maximization for the focused client. - * \param screen Screen ID - * \param arg Unused - * \ingroup ui_callback - */ -void -uicb_client_togglehorizontalmax(int screen, char *arg __attribute__ ((unused))) -{ - client_t *sel = globalconf.focus->client; - area_t area = screen_get_area(screen, - globalconf.screens[screen].statusbar, - &globalconf.screens[screen].padding); - - if(sel) + else { - area.y = sel->geometry.y; - area.height = sel->geometry.height; - area.width -= 2 * sel->border; - client_maximize(sel, area); + area.width -= 2 * globalconf.focus->client->border; + area.height -= 2 * globalconf.focus->client->border; } + client_maximize(globalconf.focus->client, area); } /** Move the client to the master area. diff --git a/client.h b/client.h index 883b2cbdf..8504842f2 100644 --- a/client.h +++ b/client.h @@ -50,8 +50,6 @@ uicb_t uicb_client_moveresize; uicb_t uicb_client_settrans; uicb_t uicb_client_swap; uicb_t uicb_client_togglemax; -uicb_t uicb_client_toggleverticalmax; -uicb_t uicb_client_togglehorizontalmax; uicb_t uicb_client_zoom; uicb_t uicb_client_focus; uicb_t uicb_client_togglefloating;