fix client ignore_tag rule not beeing applied

This commit is contained in:
Jérémy Anger
2012-04-15 22:55:02 +02:00
6 changed files with 74 additions and 27 deletions

View File

@@ -847,6 +847,34 @@ client_frame_new(struct client *c)
XReparentWindow(W->dpy, c->win, c->frame, c->border, c->tbarw);
}
static void
_apply_rule(struct client *c, struct rule *r)
{
if(r->screen != -1)
c->screen = screen_gb_id(r->screen);
c->tag = c->screen->seltag;
if(r->tag != -1)
c->tag = tag_gb_id(c->screen, r->tag);
c->theme = r->theme;
/* free = false for originally free client */
if(r->flags & RULE_FREE)
c->flags |= CLIENT_FREE;
else
c->flags &= ~CLIENT_FREE;
/* Free rule is not compatible with tab rule */
if(r->flags & RULE_TAB)
W->flags ^= WMFS_TABNOC; /* < can be disable by client_tab_next_opened */
if(r->flags & RULE_IGNORE_TAG)
c->flags |= CLIENT_IGNORE_TAG;
c->flags |= CLIENT_RULED;
}
#define RINSTANCE 0x01
#define RCLASS 0x02
#define RROLE 0x04
@@ -855,6 +883,7 @@ static void
client_apply_rule(struct client *c)
{
struct rule *r;
struct rule *defaultr = NULL;
char *wmname = NULL;
char *role = NULL;
int f;
@@ -883,8 +912,11 @@ client_apply_rule(struct client *c)
XFree(data);
}
/* Apply a specific rule */
SLIST_FOREACH(r, &W->h.rule, next)
{
if (r->instance && !strcmp(r->instance, "*"))
defaultr = r;
if(s)
{
FLAGAPPLY(flags, (xch.res_name && r->instance && !strcmp(xch.res_name, r->instance)), RINSTANCE);
@@ -895,31 +927,7 @@ client_apply_rule(struct client *c)
FLAGAPPLY(flags, ((role && r->role && !strcmp(role, r->role)) || !role || !r->role), RROLE);
if(flags & (RINSTANCE | RCLASS | RNAME) && flags & RROLE)
{
if(r->screen != -1)
c->screen = screen_gb_id(r->screen);
c->tag = c->screen->seltag;
if(r->tag != -1)
c->tag = tag_gb_id(c->screen, r->tag);
c->theme = r->theme;
/* free = false for originally free client */
if(r->flags & RULE_FREE)
c->flags |= CLIENT_FREE;
else
c->flags &= ~CLIENT_FREE;
/* Free rule is not compatible with tab rule */
if(r->flags & RULE_TAB)
W->flags ^= WMFS_TABNOC; /* < can be disable by client_tab_next_opened */
if(r->flags & RULE_IGNORE_TAG)
c->flags |= CLIENT_IGNORE_TAG;
c->flags |= CLIENT_RULED;
}
_apply_rule(c, r);
flags = 0;
}
@@ -928,6 +936,10 @@ client_apply_rule(struct client *c)
if(wmname)
free(wmname);
/* Apply default rule */
if (!(c->flags & CLIENT_RULED) && defaultr != NULL)
_apply_rule(c, defaultr);
}
struct client*

View File

@@ -235,9 +235,19 @@ config_client(void)
sec = fetch_section_first(NULL, "client");
W->client_mod = modkey_keysym(fetch_opt_first(sec, "Super", "key_modifier").str);
/* Get theme */
tmp = fetch_opt_first(sec, "default", "theme").str;
W->ctheme = name_to_theme(tmp);
/* Get focus configuration */
W->cfocus = 0;
tmp = fetch_opt_first(sec, "enter", "focus").str;
if(strstr(tmp, "enter"))
W->cfocus |= CFOCUS_ENTER;
if(strstr(tmp, "click"))
W->cfocus |= CFOCUS_CLICK;
/* [mouse] */
/* for client frame AND titlebar */
if((mb = fetch_section(sec, "mouse")))

View File

@@ -27,6 +27,7 @@ event_buttonpress(XEvent *e)
XButtonEvent *ev = &e->xbutton;
struct mousebind *m;
struct barwin *b;
struct client *c;
screen_update_sel();
status_flush_surface();
@@ -44,6 +45,9 @@ event_buttonpress(XEvent *e)
break;
}
if((c = client_gb_win(ev->window)) && c != W->client
&& ev->button == 1 && W->cfocus & CFOCUS_CLICK)
client_focus(c);
}
static void
@@ -67,7 +71,8 @@ event_enternotify(XEvent *e)
c->flags ^= CLIENT_IGNORE_ENTER;
else if(c->tag->flags & TAG_IGNORE_ENTER)
c->tag->flags ^= TAG_IGNORE_ENTER;
else if(c != W->client && !(c->flags & CLIENT_TABBED))
else if(c != W->client && !(c->flags & CLIENT_TABBED)
&& W->cfocus & CFOCUS_ENTER)
client_focus(c);
}
}

View File

@@ -350,6 +350,9 @@ struct wmfs
char *confpath;
struct barwin *last_clicked_barwin;
struct theme *ctheme;
#define CFOCUS_ENTER 0x01
#define CFOCUS_CLICK 0x02
Flags cfocus; /* Focus configuration, can be set to 0, CFOCUS_ENTER or CFOCUS_CLICK*/
/* Log file */
FILE *log;