[client] Merge vertical and horizontalmax inside togglemax

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-05-02 14:40:51 +02:00
parent 03170abfe1
commit b75e462223
2 changed files with 22 additions and 54 deletions

View File

@ -1101,69 +1101,39 @@ client_maximize(client_t *c, area_t geometry)
} }
/** Toggle maximization state for the focused client. /** Toggle maximization state for the focused client.
* \param screen Screen ID * \param screen Virtual screen number.
* \param arg Unused * \param arg Either "vertical", "horizontal" or nothing for both.
* \ingroup ui_callback * \ingroup ui_callback
*/ */
void 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;
area_t area = screen_get_area(screen,
if(!globalconf.focus->client)
return;
area = screen_get_area(screen,
globalconf.screens[screen].statusbar, globalconf.screens[screen].statusbar,
&globalconf.screens[screen].padding); &globalconf.screens[screen].padding);
if(arg[0] == 'v')
if(sel)
{ {
area.width -= 2 * sel->border; area.x = globalconf.focus->client->geometry.x;
area.height -= 2 * sel->border; area.width = globalconf.focus->client->geometry.width;
client_maximize(sel, area); area.height -= 2 * globalconf.focus->client->border;
} }
} else if(arg[0] == 'h')
/** 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.y = globalconf.focus->client->geometry.y;
area_t area = screen_get_area(screen, area.height = globalconf.focus->client->geometry.height;
globalconf.screens[screen].statusbar, area.width -= 2 * globalconf.focus->client->border;
&globalconf.screens[screen].padding);
if(sel)
{
area.x = sel->geometry.x;
area.width = sel->geometry.width;
area.height -= 2 * sel->border;
client_maximize(sel, area);
} }
} else
/** 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.width -= 2 * globalconf.focus->client->border;
area_t area = screen_get_area(screen, area.height -= 2 * globalconf.focus->client->border;
globalconf.screens[screen].statusbar,
&globalconf.screens[screen].padding);
if(sel)
{
area.y = sel->geometry.y;
area.height = sel->geometry.height;
area.width -= 2 * sel->border;
client_maximize(sel, area);
} }
client_maximize(globalconf.focus->client, area);
} }
/** Move the client to the master area. /** Move the client to the master area.

View File

@ -50,8 +50,6 @@ uicb_t uicb_client_moveresize;
uicb_t uicb_client_settrans; uicb_t uicb_client_settrans;
uicb_t uicb_client_swap; uicb_t uicb_client_swap;
uicb_t uicb_client_togglemax; uicb_t uicb_client_togglemax;
uicb_t uicb_client_toggleverticalmax;
uicb_t uicb_client_togglehorizontalmax;
uicb_t uicb_client_zoom; uicb_t uicb_client_zoom;
uicb_t uicb_client_focus; uicb_t uicb_client_focus;
uicb_t uicb_client_togglefloating; uicb_t uicb_client_togglefloating;