Replace layout_toggle_free by client_toggle_free, fix re-integration in tiled layout
This commit is contained in:
parent
6b349bb4e4
commit
dc377e30bd
26
src/client.c
26
src/client.c
@ -581,7 +581,7 @@ client_focus(struct client *c)
|
||||
client_tab_focus(c);
|
||||
client_frame_update(c, CCOL(c));
|
||||
|
||||
if(c->flags & CLIENT_FREE)
|
||||
if(c->flags & CLIENT_FREE && !(c->flags & CLIENT_FULLSCREEN))
|
||||
XRaiseWindow(W->dpy, c->frame);
|
||||
|
||||
XSetInputFocus(W->dpy, c->win, RevertToPointerRoot, CurrentTime);
|
||||
@ -950,7 +950,7 @@ client_update_props(struct client *c, Flags f)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
client_geo_hints(struct geo *g, int *s)
|
||||
{
|
||||
/* base */
|
||||
@ -1326,6 +1326,28 @@ client_remove(struct client *c)
|
||||
free(c);
|
||||
}
|
||||
|
||||
void
|
||||
uicb_client_toggle_free(Uicb cmd)
|
||||
{
|
||||
struct client *c;
|
||||
(void)cmd;
|
||||
|
||||
if(!(W->client))
|
||||
return;
|
||||
|
||||
W->client->flags ^= CLIENT_FREE;
|
||||
|
||||
/* Set tabbed client of toggled client as free */
|
||||
if(W->client->flags & CLIENT_TABMASTER)
|
||||
{
|
||||
SLIST_FOREACH(c, &W->client->tag->clients, tnext)
|
||||
if(c->tabmaster == W->client)
|
||||
c->flags ^= CLIENT_FREE;
|
||||
}
|
||||
|
||||
layout_client(W->client);
|
||||
}
|
||||
|
||||
void
|
||||
client_free(void)
|
||||
{
|
||||
|
||||
@ -37,6 +37,7 @@ void client_get_name(struct client *c);
|
||||
void client_close(struct client *c);
|
||||
void uicb_client_close(Uicb cmd);
|
||||
struct client *client_new(Window w, XWindowAttributes *wa, bool scan);
|
||||
void client_geo_hints(struct geo *g, int *s);
|
||||
void client_get_sizeh(struct client *c);
|
||||
bool client_winsize(struct client *c, struct geo *geo);
|
||||
bool client_moveresize(struct client *c, struct geo *g);
|
||||
@ -56,6 +57,7 @@ void client_update_props(struct client *c, Flags f);
|
||||
|
||||
inline void client_fac_hint(struct client *c);
|
||||
void uicb_client_untab(Uicb cmd);
|
||||
void uicb_client_toggle_free(Uicb cmd);
|
||||
|
||||
/* Generated */
|
||||
void uicb_client_resize_Right(Uicb);
|
||||
|
||||
@ -46,7 +46,6 @@ static const struct { char *name; void (*func)(Uicb cmd); } uicb_list[] =
|
||||
{ "layout_rotate_right", uicb_layout_rotate_right },
|
||||
{ "layout_prev_set", uicb_layout_prev_set },
|
||||
{ "layout_next_set", uicb_layout_next_set },
|
||||
{ "layout_toggle_free", uicb_layout_toggle_free },
|
||||
|
||||
/* Client */
|
||||
{ "client_close", uicb_client_close },
|
||||
@ -74,6 +73,7 @@ static const struct { char *name; void (*func)(Uicb cmd); } uicb_list[] =
|
||||
{ "client_focus_next_tab", uicb_client_focus_next_tab },
|
||||
{ "client_focus_prev_tab", uicb_client_focus_prev_tab },
|
||||
{ "client_focus_click", uicb_client_focus_click },
|
||||
{ "client_toggle_free", uicb_client_toggle_free },
|
||||
|
||||
/* Status */
|
||||
{ "status" , uicb_status },
|
||||
|
||||
31
src/layout.c
31
src/layout.c
@ -371,17 +371,27 @@ layout_split_integrate(struct client *c, struct client *sc)
|
||||
|| sc->flags & CLIENT_FREE)
|
||||
{
|
||||
/*
|
||||
* Not even a first client in list, then
|
||||
* check for the first tiled client or
|
||||
* maximize the lonely client
|
||||
*/
|
||||
if(!(sc = SLIST_NEXT(SLIST_FIRST(&c->tag->clients), tnext))
|
||||
|| sc->flags & CLIENT_FREE)
|
||||
FOREACH_NFCLIENT(sc, &c->tag->clients, tnext)
|
||||
{
|
||||
if(!(sc->flags & CLIENT_TILED) || sc == c)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Ok there is no client to integrate in */
|
||||
if(!sc)
|
||||
{
|
||||
client_maximize(c);
|
||||
c->flags |= CLIENT_TILED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
c->flags |= CLIENT_TILED;
|
||||
|
||||
g = layout_split(sc, (sc->geo.h < sc->geo.w));
|
||||
|
||||
client_moveresize(c, &g);
|
||||
@ -555,6 +565,7 @@ layout_client(struct client *c)
|
||||
|
||||
if(c->flags & CLIENT_FREE)
|
||||
{
|
||||
c->flags &= ~CLIENT_TILED;
|
||||
layout_split_arrange_closed(c);
|
||||
client_moveresize(c, &c->fgeo);
|
||||
XRaiseWindow(W->dpy, c->frame);
|
||||
@ -562,17 +573,3 @@ layout_client(struct client *c)
|
||||
else if(!(c->flags & CLIENT_TABBED))
|
||||
layout_split_integrate(c, c->tag->sel);
|
||||
}
|
||||
|
||||
void
|
||||
uicb_layout_toggle_free(Uicb cmd)
|
||||
{
|
||||
(void)cmd;
|
||||
|
||||
if(!(W->client))
|
||||
return;
|
||||
|
||||
W->client->flags ^= CLIENT_FREE;
|
||||
layout_client(W->client);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -41,7 +41,6 @@ void uicb_layout_rotate_left(Uicb cmd);
|
||||
void uicb_layout_rotate_right(Uicb cmd);
|
||||
void uicb_layout_prev_set(Uicb cmd);
|
||||
void uicb_layout_next_set(Uicb cmd);
|
||||
void uicb_layout_toggle_free(Uicb cmd);
|
||||
|
||||
#endif /* LAYOUT_H */
|
||||
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
#include "client.h"
|
||||
#include "draw.h"
|
||||
|
||||
|
||||
#define _REV_SBORDER(c) draw_reversed_rect(W->root, c, false);
|
||||
|
||||
#define _REV_BORDER() \
|
||||
|
||||
@ -197,6 +197,7 @@ struct client
|
||||
#define CLIENT_MAPPED 0x400
|
||||
#define CLIENT_FULLSCREEN 0x800
|
||||
#define CLIENT_FREE 0x1000
|
||||
#define CLIENT_TILED 0x2000
|
||||
Flags flags;
|
||||
Window win, frame, tmp;
|
||||
SLIST_ENTRY(client) next; /* Global list */
|
||||
|
||||
3
wmfsrc
3
wmfsrc
@ -240,6 +240,9 @@
|
||||
[key] mod = {"Super"} key = "o" func = "layout_prev_set" [/key]
|
||||
[key] mod = {"Super", "Shift"} key = "o" func = "layout_next_set" [/key]
|
||||
|
||||
# Toggle client free/tile
|
||||
[key] mod = {"Super"} key = "f" func = "client_toggle_free" [/key]
|
||||
|
||||
# Launcher
|
||||
[key] mod = {"Super"} key = "p" func = "launcher" cmd = "exec" [/key]
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user