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

View File

@@ -6,8 +6,12 @@
#define BORDER_URGENT "Red" #define BORDER_URGENT "Red"
#define GAP 2 #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" #define TITLE "sans:size=8"
// Title bar style
#define TITLE_BLUR "Black" #define TITLE_BLUR "Black"
#define TITLE_FOCUS "White" #define TITLE_FOCUS "White"
#define TITLE_ELLIPSIS 32 #define TITLE_ELLIPSIS 32

View File

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

View File

@@ -185,6 +185,8 @@ void setup()
XGrabButton(display, Button3, AnyModifier, root, True, ButtonPressMask, GrabModeSync, GrabModeSync, None, None); XGrabButton(display, Button3, AnyModifier, root, True, ButtonPressMask, GrabModeSync, GrabModeSync, None, None);
// create title bars // create title bars
if (TITLE)
{
STACK_FREE(&windows); STACK_FREE(&windows);
for_monitors(i, m) for_spots(j) for_monitors(i, m) for_spots(j)
{ {
@@ -196,6 +198,7 @@ void setup()
m->spots[j].h -= m->bars[j]->h; m->spots[j].h -= m->bars[j]->h;
spot_update_bar(j, i); spot_update_bar(j, i);
} }
}
// setup existing managable windows // setup existing managable windows
STACK_FREE(&windows); STACK_FREE(&windows);

6
spot.c
View File

@@ -51,6 +51,8 @@ void spot_update_bar(int spot, int mon)
} }
if (tmp) XFree(tmp); if (tmp) XFree(tmp);
} }
if (TITLE)
{
if (c && !c->full && *title && m->bars[spot]) if (c && !c->full && *title && m->bars[spot])
{ {
int focus = c->window == current || (spot == current_spot && mon == current_mon); int focus = c->window == current || (spot == current_spot && mon == current_mon);
@@ -64,12 +66,14 @@ void spot_update_bar(int spot, int mon)
else else
if (m->bars[spot]) if (m->bars[spot])
textbox_hide(m->bars[spot]); textbox_hide(m->bars[spot]);
}
} }
void update_bars() void update_bars()
{ {
int i, j; monitor *m; 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) Window spot_focus_top_window(int spot, int mon, Window except)