Finish rules for tag/screen/theme, free, max & ignoretag coming..
This commit is contained in:
parent
d5e5e79aca
commit
74ecfb48ab
38
src/client.c
38
src/client.c
@ -14,6 +14,7 @@
|
||||
#include "layout.h"
|
||||
#include "barwin.h"
|
||||
#include "draw.h"
|
||||
#include "screen.h"
|
||||
|
||||
#define CLIENT_MOUSE_MOD Mod1Mask
|
||||
|
||||
@ -327,7 +328,7 @@ client_frame_update(struct client *c, struct colpair *cp)
|
||||
|
||||
if(c->titlebar && c->title)
|
||||
{
|
||||
int w = draw_textw(THEME_DEFAULT, c->title);
|
||||
int w = draw_textw(c->theme, c->title);
|
||||
|
||||
c->titlebar->fg = cp->fg;
|
||||
c->titlebar->bg = cp->bg;
|
||||
@ -336,8 +337,8 @@ client_frame_update(struct client *c, struct colpair *cp)
|
||||
barwin_resize(c->titlebar, w + (PAD << 1), c->tbarw);
|
||||
barwin_refresh_color(c->titlebar);
|
||||
|
||||
draw_text(c->titlebar->dr, THEME_DEFAULT,
|
||||
PAD, TEXTY(THEME_DEFAULT, c->tbarw), cp->fg,
|
||||
draw_text(c->titlebar->dr, c->theme,
|
||||
PAD, TEXTY(c->theme, c->tbarw), cp->fg,
|
||||
c->title);
|
||||
|
||||
barwin_refresh(c->titlebar);
|
||||
@ -573,6 +574,22 @@ client_apply_rule(struct client *c)
|
||||
{
|
||||
if(flags & RROLE || flags & RNAME)
|
||||
{
|
||||
c->screen = screen_gb_id(r->screen);
|
||||
|
||||
c->tag = tag_gb_id(c->screen, r->tag);
|
||||
|
||||
c->theme = r->theme;
|
||||
|
||||
if(r->flags & RULE_FREE)
|
||||
{ /* TODO */ }
|
||||
|
||||
if(r->flags & RULE_MAX)
|
||||
{ /* TODO */ }
|
||||
|
||||
if(r->flags & RULE_IGNORE_TAG)
|
||||
{ /* TODO */ }
|
||||
|
||||
c->flags = r->flags | CLIENT_RULED;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -591,8 +608,9 @@ client_new(Window w, XWindowAttributes *wa, bool scan)
|
||||
|
||||
/* C attributes */
|
||||
c->win = w;
|
||||
c->screen = W->screen;
|
||||
c->flags = 0;
|
||||
c->screen = W->screen;
|
||||
c->theme = THEME_DEFAULT;
|
||||
c->tag = NULL;
|
||||
|
||||
/* struct geometry */
|
||||
@ -602,16 +620,18 @@ client_new(Window w, XWindowAttributes *wa, bool scan)
|
||||
c->geo.h = wa->height;
|
||||
c->tgeo = c->wgeo = c->rgeo = c->geo;
|
||||
|
||||
client_apply_rule(c);
|
||||
|
||||
/*
|
||||
* Conf option set per client, for possibility
|
||||
* to config only one client
|
||||
*/
|
||||
c->border = THEME_DEFAULT->client_border_width;
|
||||
if(!(c->tbarw = THEME_DEFAULT->client_titlebar_width))
|
||||
c->border = c->theme->client_border_width;
|
||||
if(!(c->tbarw = c->theme->client_titlebar_width))
|
||||
c->tbarw = c->border;
|
||||
|
||||
c->ncol = THEME_DEFAULT->client_n;
|
||||
c->scol = THEME_DEFAULT->client_s;
|
||||
c->ncol = c->theme->client_n;
|
||||
c->scol = c->theme->client_s;
|
||||
|
||||
client_frame_new(c);
|
||||
|
||||
@ -619,7 +639,7 @@ client_new(Window w, XWindowAttributes *wa, bool scan)
|
||||
client_get_sizeh(c);
|
||||
|
||||
if(!scan)
|
||||
tag_client(W->screen->seltag, c);
|
||||
tag_client((c->flags & CLIENT_RULED ? c->tag : c->screen->seltag), c);
|
||||
|
||||
/* X window attributes */
|
||||
XSelectInput(W->dpy, w, EnterWindowMask | LeaveWindowMask | StructureNotifyMask | PropertyChangeMask);
|
||||
|
||||
@ -77,7 +77,7 @@ void
|
||||
tag_client(struct tag *t, struct client *c)
|
||||
{
|
||||
/* Remove client from its previous tag */
|
||||
if(c->tag)
|
||||
if(c->tag && !(c->flags & CLIENT_RULED))
|
||||
{
|
||||
if(c->tag == t)
|
||||
return;
|
||||
@ -91,6 +91,8 @@ tag_client(struct tag *t, struct client *c)
|
||||
client_focus(client_next(c));
|
||||
}
|
||||
|
||||
c->flags &= ~CLIENT_RULED;
|
||||
|
||||
/* Client remove */
|
||||
if(!t)
|
||||
return;
|
||||
@ -98,7 +100,7 @@ tag_client(struct tag *t, struct client *c)
|
||||
c->tag = t;
|
||||
|
||||
/* Map / Unmap client */
|
||||
if(t == W->screen->seltag)
|
||||
if(t == c->screen->seltag)
|
||||
{
|
||||
WIN_STATE(c->frame, Map);
|
||||
ewmh_set_wm_state(c->win, NormalState);
|
||||
|
||||
@ -146,6 +146,7 @@ struct client
|
||||
struct barwin *titlebar;
|
||||
struct geo geo, wgeo, tgeo, ttgeo, rgeo;
|
||||
struct colpair ncol, scol;
|
||||
struct theme *theme;
|
||||
int sizeh[SHLAST];
|
||||
char *title;
|
||||
int border, tbarw;
|
||||
@ -154,6 +155,7 @@ struct client
|
||||
#define CLIENT_DID_WINSIZE 0x04
|
||||
#define CLIENT_FAC_APPLIED 0x08
|
||||
#define CLIENT_IGNORE_LAYOUT 0x10
|
||||
#define CLIENT_RULED 0x20
|
||||
Flags flags;
|
||||
Window win, frame;
|
||||
SLIST_ENTRY(client) next; /* Global list */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user