allow building without title bars

This commit is contained in:
seanpringle
2012-12-27 11:04:17 +10:00
parent 2014ca21cc
commit d8f65bb1d8
5 changed files with 38 additions and 25 deletions

View File

@@ -71,9 +71,10 @@ client* window_build_client(Window win)
? 1:0;
// detect our own title bars
for_monitors(i, m) for_spots(j)
if (m->bars[j] && m->bars[j]->window == c->window)
{ c->ours = 1; c->manage = 0; break; }
if (TITLE)
for_monitors(i, m) for_spots(j)
if (m->bars[j] && m->bars[j]->window == c->window)
{ c->ours = 1; c->manage = 0; break; }
if (c->manage)
{
@@ -272,7 +273,7 @@ void client_raise_family(client *c)
client_stack_family(c, &raise);
if (!c->full)
if (!c->full && TITLE)
{
// raise spot's title bar in case some other fullscreen or max v/h window has obscured
monitor *m = &monitors[c->monitor];

View File

@@ -6,8 +6,12 @@
#define BORDER_URGENT "Red"
#define GAP 2
// Title bar xft font
// Title bar xft font.
// Setting this to NULL will disable title bars
//#define TITLE NULL
#define TITLE "sans:size=8"
// Title bar style
#define TITLE_BLUR "Black"
#define TITLE_FOCUS "White"
#define TITLE_ELLIPSIS 32

View File

@@ -144,6 +144,7 @@ void button_press(XEvent *ev)
if (c && c->manage)
client_activate(c);
else
if (TITLE)
for_monitors(i, m) for_spots(j)
if (m->bars[j]->window == e->subwindow)
spot_focus_top_window(j, i, None);

19
setup.c
View File

@@ -185,16 +185,19 @@ void setup()
XGrabButton(display, Button3, AnyModifier, root, True, ButtonPressMask, GrabModeSync, GrabModeSync, None, None);
// create title bars
STACK_FREE(&windows);
for_monitors(i, m) for_spots(j)
if (TITLE)
{
m->bars[j] = textbox_create(root, TB_AUTOHEIGHT|TB_LEFT, m->spots[j].x, m->spots[j].y, m->spots[j].w, 0,
TITLE, TITLE_BLUR, BORDER_BLUR, NULL, NULL);
XSelectInput(display, m->bars[j]->window, ExposureMask);
STACK_FREE(&windows);
for_monitors(i, m) for_spots(j)
{
m->bars[j] = textbox_create(root, TB_AUTOHEIGHT|TB_LEFT, m->spots[j].x, m->spots[j].y, m->spots[j].w, 0,
TITLE, TITLE_BLUR, BORDER_BLUR, NULL, NULL);
XSelectInput(display, m->bars[j]->window, ExposureMask);
m->spots[j].y += m->bars[j]->h;
m->spots[j].h -= m->bars[j]->h;
spot_update_bar(j, i);
m->spots[j].y += m->bars[j]->h;
m->spots[j].h -= m->bars[j]->h;
spot_update_bar(j, i);
}
}
// setup existing managable windows

28
spot.c
View File

@@ -51,25 +51,29 @@ void spot_update_bar(int spot, int mon)
}
if (tmp) XFree(tmp);
}
if (c && !c->full && *title && m->bars[spot])
if (TITLE)
{
int focus = c->window == current || (spot == current_spot && mon == current_mon);
char *color = focus && c->window == current ? TITLE_FOCUS : TITLE_BLUR;
char *border = focus && c->window == current ? BORDER_FOCUS: BORDER_BLUR;
textbox_font(m->bars[spot], TITLE, color, border);
textbox_text(m->bars[spot], title);
textbox_draw(m->bars[spot]);
textbox_show(m->bars[spot]);
if (c && !c->full && *title && m->bars[spot])
{
int focus = c->window == current || (spot == current_spot && mon == current_mon);
char *color = focus && c->window == current ? TITLE_FOCUS : TITLE_BLUR;
char *border = focus && c->window == current ? BORDER_FOCUS: BORDER_BLUR;
textbox_font(m->bars[spot], TITLE, color, border);
textbox_text(m->bars[spot], title);
textbox_draw(m->bars[spot]);
textbox_show(m->bars[spot]);
}
else
if (m->bars[spot])
textbox_hide(m->bars[spot]);
}
else
if (m->bars[spot])
textbox_hide(m->bars[spot]);
}
void update_bars()
{
int i, j; monitor *m;
for_monitors(i, m) for_spots(j) spot_update_bar(j, i);
if (TITLE) for_monitors(i, m) for_spots(j)
spot_update_bar(j, i);
}
Window spot_focus_top_window(int spot, int mon, Window except)