Focus tabmaster client at tag_screen & click mouse1 on titlebar to focus in tabbing
This commit is contained in:
parent
9aaaf7ef63
commit
f694d9a967
@ -104,8 +104,7 @@ barwin_mousebind_new(struct barwin *b, unsigned int button, bool u, struct geo a
|
||||
m->use_area = u;
|
||||
m->area = a;
|
||||
m->func = func;
|
||||
|
||||
m->cmd = (cmd ? xstrdup(cmd) : NULL);
|
||||
m->cmd = cmd;
|
||||
|
||||
SLIST_INSERT_HEAD(&b->mousebinds, m, next);
|
||||
}
|
||||
|
||||
33
src/client.c
33
src/client.c
@ -454,12 +454,12 @@ client_untab(struct client *c)
|
||||
if(!(c->flags & (CLIENT_TABBED | CLIENT_TABMASTER)))
|
||||
return;
|
||||
|
||||
c->flags &= ~CLIENT_TABMASTER;
|
||||
|
||||
if(!cc)
|
||||
{
|
||||
SLIST_FOREACH(cc, &c->tag->clients, tnext)
|
||||
if(cc->tabmaster == c)
|
||||
break;
|
||||
}
|
||||
|
||||
if(cc)
|
||||
{
|
||||
@ -643,6 +643,26 @@ client_get_sizeh(struct client *c)
|
||||
c->flags |= CLIENT_HINT_FLAG;
|
||||
}
|
||||
|
||||
/* Window id (unsigned int) is casted in Uicb type (char*) and restored */
|
||||
void
|
||||
uicb_client_focus_with_wid(Uicb cmd)
|
||||
{
|
||||
struct client *c;
|
||||
size_t i;
|
||||
Window id = 0;
|
||||
|
||||
/* Re-build window id from cmd string */
|
||||
for(i = 0; i < sizeof(Window); ++i)
|
||||
((char*)&id)[i] = cmd[i];
|
||||
|
||||
SLIST_FOREACH(c, &W->h.client, next)
|
||||
if(c->win == id)
|
||||
{
|
||||
client_focus(c);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
client_frame_new(struct client *c)
|
||||
{
|
||||
@ -664,9 +684,18 @@ client_frame_new(struct client *c)
|
||||
| CWBackPixel | CWEventMask), &at);
|
||||
|
||||
if(c->tbarw > c->border)
|
||||
{
|
||||
struct geo g;
|
||||
Uicb cmd = (Uicb)&c->win;
|
||||
|
||||
c->titlebar = barwin_new(c->frame, 0, 0, 1, c->tbarw,
|
||||
c->ncol.fg, c->ncol.bg, true);
|
||||
|
||||
/* TODO: Refer to titlebar config */
|
||||
barwin_mousebind_new(c->titlebar, Button1, false, g,
|
||||
uicb_client_focus_with_wid, cmd);
|
||||
}
|
||||
|
||||
XReparentWindow(W->dpy, c->win, c->frame, c->border, c->tbarw);
|
||||
}
|
||||
|
||||
|
||||
22
src/tag.c
22
src/tag.c
@ -54,7 +54,12 @@ tag_screen(struct screen *s, struct tag *t)
|
||||
if(!SLIST_EMPTY(&t->clients))
|
||||
{
|
||||
SLIST_FOREACH(c, &t->clients, tnext)
|
||||
client_map(c);
|
||||
if(!(c->flags & CLIENT_TABBED))
|
||||
client_map(c);
|
||||
|
||||
if(t->sel->flags & CLIENT_TABBED)
|
||||
t->sel = t->sel->tabmaster;
|
||||
|
||||
client_focus(t->sel);
|
||||
}
|
||||
|
||||
@ -69,10 +74,12 @@ tag_screen(struct screen *s, struct tag *t)
|
||||
void
|
||||
tag_client(struct tag *t, struct client *c)
|
||||
{
|
||||
struct tag *ot = c->tag;
|
||||
|
||||
/* Remove client from its previous tag */
|
||||
if(c->tag && !(c->flags & CLIENT_RULED))
|
||||
{
|
||||
if(c->tag == t)
|
||||
if(c->tag == t || c->flags & CLIENT_TABBED)
|
||||
return;
|
||||
|
||||
if(!(c->flags & CLIENT_IGNORE_LAYOUT))
|
||||
@ -105,7 +112,16 @@ tag_client(struct tag *t, struct client *c)
|
||||
c->flags ^= CLIENT_IGNORE_LAYOUT;
|
||||
else
|
||||
layout_split_integrate(c, t->sel);
|
||||
}
|
||||
|
||||
if(c->flags & CLIENT_TABMASTER)
|
||||
{
|
||||
struct client *cc;
|
||||
|
||||
SLIST_FOREACH(cc, &ot->clients, tnext)
|
||||
if(cc->tabmaster == c)
|
||||
cc->tag = t;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
uicb_tag_set(Uicb cmd)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user