Continue to work on tabbing..
This commit is contained in:
parent
2638db3ebe
commit
3cbafa00f6
48
src/client.c
48
src/client.c
@ -63,6 +63,13 @@ CLIENT_ACTION_DIR(focus, Left)
|
||||
CLIENT_ACTION_DIR(focus, Top)
|
||||
CLIENT_ACTION_DIR(focus, Bottom)
|
||||
|
||||
/* uicb_client_tab_dir() */
|
||||
#define client_tab(c) client_moveresize(W->client, &c->geo)
|
||||
CLIENT_ACTION_DIR(tab, Right)
|
||||
CLIENT_ACTION_DIR(tab, Left)
|
||||
CLIENT_ACTION_DIR(tab, Top)
|
||||
CLIENT_ACTION_DIR(tab, Bottom)
|
||||
|
||||
/* uicb_client_swap_dir() */
|
||||
CLIENT_ACTION_IDIR(swap, Right)
|
||||
CLIENT_ACTION_IDIR(swap, Left)
|
||||
@ -320,24 +327,30 @@ client_grabbuttons(struct client *c, bool focused)
|
||||
}
|
||||
|
||||
static void
|
||||
client_tab_etablish(struct client *c)
|
||||
client_tab_etablish(struct client *c, struct geo *g)
|
||||
{
|
||||
struct chead cs;
|
||||
struct client *cc, *prev = c;
|
||||
|
||||
SLIST_INIT(&cs);
|
||||
SLIST_INSERT_HEAD(&cs, c, tbnext);
|
||||
struct client *cc;
|
||||
|
||||
SLIST_FOREACH(cc, &c->tag->clients, tnext)
|
||||
{
|
||||
if(c != cc && GEOCMP(c->geo, cc->geo))
|
||||
if(c != cc)
|
||||
{
|
||||
SLIST_INSERT_AFTER(prev, cc, tbnext);
|
||||
prev = cc;
|
||||
if(GEOCMP(c->geo, cc->geo))
|
||||
{
|
||||
c->flags |= CLIENT_TABBED | CLIENT_TABMASTER;
|
||||
cc->flags |= CLIENT_TABBED;
|
||||
}
|
||||
else if(GEOCMP(*g, cc->geo) && cc->flags & CLIENT_TABBED)
|
||||
{
|
||||
c->flags |= CLIENT_TABBED | CLIENT_TABMASTER;
|
||||
cc->flags |= CLIENT_TABBING;
|
||||
client_moveresize(cc, &c->geo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
c->tabhead = &cs;
|
||||
if(c->flags & CLIENT_TABMASTER)
|
||||
XRaiseWindow(W->dpy, c->frame);
|
||||
}
|
||||
|
||||
#define CCOL(c) (c == c->tag->sel ? &c->scol : &c->ncol)
|
||||
@ -662,6 +675,13 @@ client_new(Window w, XWindowAttributes *wa, bool scan)
|
||||
if(!scan)
|
||||
tag_client((c->flags & CLIENT_RULED ? c->tag : c->screen->seltag), c);
|
||||
|
||||
/* Map */
|
||||
if(c->tag == c->screen->seltag)
|
||||
{
|
||||
WIN_STATE(c->frame, Map);
|
||||
ewmh_set_wm_state(c->win, NormalState);
|
||||
}
|
||||
|
||||
/* X window attributes */
|
||||
XSelectInput(W->dpy, w, EnterWindowMask | LeaveWindowMask | StructureNotifyMask | PropertyChangeMask);
|
||||
XSetWindowBorderWidth(W->dpy, w, 0);
|
||||
@ -777,6 +797,8 @@ client_winsize(struct client *c, struct geo *g)
|
||||
void
|
||||
client_moveresize(struct client *c, struct geo *g)
|
||||
{
|
||||
struct geo og = c->geo;
|
||||
|
||||
c->ttgeo = c->tgeo = c->rgeo = c->geo = *g;
|
||||
|
||||
if(!(c->flags & CLIENT_DID_WINSIZE))
|
||||
@ -802,8 +824,10 @@ client_moveresize(struct client *c, struct geo *g)
|
||||
|
||||
c->flags &= ~CLIENT_DID_WINSIZE;
|
||||
|
||||
if(/* TABBING OPTION */ 1)
|
||||
client_tab_etablish(c);
|
||||
if(c->flags & CLIENT_TABBING)
|
||||
c->flags ^= CLIENT_TABBING;
|
||||
else
|
||||
client_tab_etablish(c, &og);
|
||||
|
||||
client_frame_update(c, CCOL(c));
|
||||
client_update_props(c, CPROP_GEO);
|
||||
|
||||
@ -47,6 +47,10 @@ void uicb_client_focus_Right(Uicb);
|
||||
void uicb_client_focus_Left(Uicb);
|
||||
void uicb_client_focus_Top(Uicb);
|
||||
void uicb_client_focus_Bottom(Uicb);
|
||||
void uicb_client_tab_Right(Uicb);
|
||||
void uicb_client_tab_Left(Uicb);
|
||||
void uicb_client_tab_Top(Uicb);
|
||||
void uicb_client_tab_Bottom(Uicb);
|
||||
void uicb_client_swap_Right(Uicb);
|
||||
void uicb_client_swap_Left(Uicb);
|
||||
void uicb_client_swap_Top(Uicb);
|
||||
|
||||
@ -48,6 +48,10 @@ static const struct { char *name; void (*func)(Uicb cmd); } uicb_list[] =
|
||||
{ "client_focus_left", uicb_client_focus_Left },
|
||||
{ "client_focus_top", uicb_client_focus_Top },
|
||||
{ "client_focus_bottom", uicb_client_focus_Bottom },
|
||||
{ "client_tab_right", uicb_client_tab_Right },
|
||||
{ "client_tab_left", uicb_client_tab_Left },
|
||||
{ "client_tab_top", uicb_client_tab_Top },
|
||||
{ "client_tab_bottom", uicb_client_tab_Bottom },
|
||||
{ "client_swap_right", uicb_client_swap_Right },
|
||||
{ "client_swap_left", uicb_client_swap_Left },
|
||||
{ "client_swap_top", uicb_client_swap_Top },
|
||||
|
||||
12
src/tag.c
12
src/tag.c
@ -99,18 +99,6 @@ tag_client(struct tag *t, struct client *c)
|
||||
|
||||
c->tag = t;
|
||||
|
||||
/* Map / Unmap client */
|
||||
if(t == c->screen->seltag)
|
||||
{
|
||||
WIN_STATE(c->frame, Map);
|
||||
ewmh_set_wm_state(c->win, NormalState);
|
||||
}
|
||||
else
|
||||
{
|
||||
WIN_STATE(c->frame, Unmap);
|
||||
ewmh_set_wm_state(c->win, IconicState);
|
||||
}
|
||||
|
||||
client_update_props(c, CPROP_LOC);
|
||||
|
||||
/*
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
#define MouseMask (ButtonMask | PointerMotionMask)
|
||||
#define KeyMask (KeyPressMask | KeyReleaseMask)
|
||||
|
||||
typedef unsigned int Flags;
|
||||
typedef unsigned long Flags;
|
||||
typedef unsigned int Color;
|
||||
typedef const char* Uicb;
|
||||
|
||||
@ -150,7 +150,6 @@ struct client
|
||||
struct geo geo, wgeo, tgeo, ttgeo, rgeo;
|
||||
struct colpair ncol, scol;
|
||||
struct theme *theme;
|
||||
struct chead *tabhead;
|
||||
int sizeh[SHLAST];
|
||||
char *title;
|
||||
int border, tbarw;
|
||||
@ -160,6 +159,9 @@ struct client
|
||||
#define CLIENT_FAC_APPLIED 0x08
|
||||
#define CLIENT_IGNORE_LAYOUT 0x10
|
||||
#define CLIENT_RULED 0x20
|
||||
#define CLIENT_TABBED 0x40
|
||||
#define CLIENT_TABMASTER 0x80
|
||||
#define CLIENT_TABBING 0x100
|
||||
Flags flags;
|
||||
Window win, frame;
|
||||
SLIST_ENTRY(client) next; /* Global list */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user