New titlebar style for tabbed client: the selected titlebar is not only the first anymore
This commit is contained in:
parent
9ce29181e7
commit
9953f1b4b8
2
COPYING
2
COPYING
@ -23,4 +23,4 @@
|
|||||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
SUCH DAMAGE.5~
|
SUCH DAMAGE.
|
||||||
|
|||||||
93
src/client.c
93
src/client.c
@ -345,29 +345,35 @@ client_grabbuttons(struct client *c, bool focused)
|
|||||||
void
|
void
|
||||||
client_frame_update(struct client *c, struct colpair *cp)
|
client_frame_update(struct client *c, struct colpair *cp)
|
||||||
{
|
{
|
||||||
|
struct client *cc;
|
||||||
|
int y, f, xt, w, n = 1;
|
||||||
|
|
||||||
if(c->flags & CLIENT_TABBED)
|
if(c->flags & CLIENT_TABBED)
|
||||||
c = c->tabmaster;
|
c = c->tabmaster;
|
||||||
|
|
||||||
XSetWindowBackground(W->dpy, c->frame, cp->bg);
|
XSetWindowBackground(W->dpy, c->frame, cp->bg);
|
||||||
XClearWindow(W->dpy, c->frame);
|
XClearWindow(W->dpy, c->frame);
|
||||||
|
|
||||||
if(c->titlebar && c->title)
|
if(!c->titlebar || !c->title)
|
||||||
|
return;
|
||||||
|
|
||||||
|
c->titlebar->fg = cp->fg;
|
||||||
|
c->titlebar->bg = cp->bg;
|
||||||
|
|
||||||
|
/* Get number of tabbed client if c is tabmaster */
|
||||||
|
if(c->flags & CLIENT_TABMASTER)
|
||||||
{
|
{
|
||||||
struct client *cc;
|
SLIST_FOREACH(cc, &c->tag->clients, tnext)
|
||||||
int y, f, n = 1, xt, w = draw_textw(c->theme, c->title);
|
if(c == cc->tabmaster)
|
||||||
|
++n;
|
||||||
|
}
|
||||||
|
|
||||||
c->titlebar->fg = cp->fg;
|
f = c->geo.w / n;
|
||||||
c->titlebar->bg = cp->bg;
|
y = TEXTY(c->theme, c->tbarw);
|
||||||
|
|
||||||
/* Get number of tabbed client if c is tabmaster */
|
|
||||||
if(c->flags & CLIENT_TABMASTER)
|
|
||||||
SLIST_FOREACH(cc, &c->tag->clients, tnext)
|
|
||||||
if(c == cc->tabmaster)
|
|
||||||
++n;
|
|
||||||
|
|
||||||
f = (c->geo.w - (c->border * (n - 1))) / n;
|
|
||||||
y = TEXTY(c->theme, c->tbarw);
|
|
||||||
|
|
||||||
|
if(n == 1)
|
||||||
|
{
|
||||||
|
w = draw_textw(c->theme, c->title);
|
||||||
_XTEXT();
|
_XTEXT();
|
||||||
|
|
||||||
barwin_reparent(c->titlebar, c->frame);
|
barwin_reparent(c->titlebar, c->frame);
|
||||||
@ -376,39 +382,46 @@ client_frame_update(struct client *c, struct colpair *cp)
|
|||||||
barwin_refresh_color(c->titlebar);
|
barwin_refresh_color(c->titlebar);
|
||||||
draw_text(c->titlebar->dr, c->theme, xt, y, cp->fg, c->title);
|
draw_text(c->titlebar->dr, c->theme, xt, y, cp->fg, c->title);
|
||||||
barwin_refresh(c->titlebar);
|
barwin_refresh(c->titlebar);
|
||||||
|
}
|
||||||
|
/* Tabbing case, multiple titlebar in frame */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
struct geo g = { 0, 0, 1, c->titlebar->geo.h };
|
||||||
|
int x = 0;
|
||||||
|
|
||||||
/* Tabbing case, multiple titlebar in frame */
|
SLIST_FOREACH(cc, &c->tag->clients, tnext)
|
||||||
if(c->flags & CLIENT_TABMASTER && n > 1)
|
|
||||||
{
|
{
|
||||||
int x = f;
|
w = (cc->title ? draw_textw(c->theme, cc->title) : 0);
|
||||||
struct geo g = { 0, 0, 1, c->titlebar->geo.h };
|
_XTEXT();
|
||||||
|
|
||||||
SLIST_FOREACH(cc, &c->tag->clients, tnext)
|
if(cc == c)
|
||||||
if(c == cc->tabmaster && cc->titlebar)
|
{
|
||||||
{
|
barwin_reparent(c->titlebar, c->frame);
|
||||||
cc->titlebar->bg = c->ncol.bg;
|
barwin_move(c->titlebar, x, 0);
|
||||||
|
barwin_resize(c->titlebar, f, c->tbarw);
|
||||||
w = draw_textw(c->theme, cc->title);
|
barwin_refresh_color(c->titlebar);
|
||||||
_XTEXT();
|
draw_text(c->titlebar->dr, c->theme, xt, y, cp->fg, c->title);
|
||||||
|
barwin_refresh(c->titlebar);
|
||||||
barwin_reparent(cc->titlebar, c->frame);
|
barwin_refresh(cc->titlebar);
|
||||||
barwin_map(cc->titlebar)
|
x += f;
|
||||||
barwin_move(cc->titlebar, x, 1);
|
}
|
||||||
barwin_resize(cc->titlebar, f, c->tbarw - 2);
|
if(cc->tabmaster == c)
|
||||||
barwin_refresh_color(cc->titlebar);
|
{
|
||||||
|
barwin_reparent(cc->titlebar, c->frame);
|
||||||
draw_rect(cc->titlebar->dr, g, c->scol.bg);
|
barwin_map(cc->titlebar);
|
||||||
draw_text(cc->titlebar->dr, c->theme, xt, y - 1,
|
barwin_move(cc->titlebar, x, 1);
|
||||||
c->ncol.fg, cc->title);
|
barwin_resize(cc->titlebar, f, c->tbarw - 2);
|
||||||
|
barwin_refresh_color(cc->titlebar);
|
||||||
barwin_refresh(cc->titlebar);
|
draw_rect(cc->titlebar->dr, g, c->scol.bg);
|
||||||
|
draw_text(cc->titlebar->dr, c->theme, xt, y - 1, c->ncol.fg, cc->title);
|
||||||
x += f;
|
barwin_refresh(cc->titlebar);
|
||||||
}
|
x += f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
client_tab_focus(struct client *c)
|
client_tab_focus(struct client *c)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user