[client] Merge vertical and horizontalmax inside togglemax
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
03170abfe1
commit
b75e462223
74
client.c
74
client.c
|
@ -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,
|
|
||||||
globalconf.screens[screen].statusbar,
|
|
||||||
&globalconf.screens[screen].padding);
|
|
||||||
|
|
||||||
if(sel)
|
if(!globalconf.focus->client)
|
||||||
|
return;
|
||||||
|
|
||||||
|
area = screen_get_area(screen,
|
||||||
|
globalconf.screens[screen].statusbar,
|
||||||
|
&globalconf.screens[screen].padding);
|
||||||
|
if(arg[0] == 'v')
|
||||||
{
|
{
|
||||||
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_t area = screen_get_area(screen,
|
|
||||||
globalconf.screens[screen].statusbar,
|
|
||||||
&globalconf.screens[screen].padding);
|
|
||||||
|
|
||||||
if(sel)
|
|
||||||
{
|
{
|
||||||
area.x = sel->geometry.x;
|
area.y = globalconf.focus->client->geometry.y;
|
||||||
area.width = sel->geometry.width;
|
area.height = globalconf.focus->client->geometry.height;
|
||||||
area.height -= 2 * sel->border;
|
area.width -= 2 * globalconf.focus->client->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_t area = screen_get_area(screen,
|
|
||||||
globalconf.screens[screen].statusbar,
|
|
||||||
&globalconf.screens[screen].padding);
|
|
||||||
|
|
||||||
if(sel)
|
|
||||||
{
|
{
|
||||||
area.y = sel->geometry.y;
|
area.width -= 2 * globalconf.focus->client->border;
|
||||||
area.height = sel->geometry.height;
|
area.height -= 2 * globalconf.focus->client->border;
|
||||||
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.
|
||||||
|
|
2
client.h
2
client.h
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue