properly layout the titlebar, with proper separatation

This commit is contained in:
Dana Jansens 2003-03-17 01:31:39 +00:00
parent b6ad10764e
commit 9dc2a9171c

View file

@ -594,28 +594,30 @@ void frame_release_client(ObFrame *self, Client *client)
static void layout_title(ObFrame *self) static void layout_title(ObFrame *self)
{ {
const char *lc; const char *lc;
int x; int x, sep;
gboolean n, d, i, l, m ,c; gboolean n, d, i, l, m ,c;
n = d = i = l = m = c = FALSE; n = d = i = l = m = c = FALSE;
sep = s_bevel + 1;
/* figure out whats being shown, and the width of the label */ /* figure out whats being shown, and the width of the label */
self->label_width = self->width - s_bevel * 2; self->label_width = self->width - sep * 2;
for (lc = themerc_titlebar_layout; *lc != '\0'; ++lc) { for (lc = themerc_titlebar_layout; *lc != '\0'; ++lc) {
switch (*lc) { switch (*lc) {
case 'N': case 'N':
if (!(self->frame.client->decorations & Decor_Icon)) break; if (!(self->frame.client->decorations & Decor_Icon)) break;
n = TRUE; n = TRUE;
self->label_width -= BUTTON_SIZE + s_bevel; self->label_width -= BUTTON_SIZE + sep;
break; break;
case 'D': case 'D':
if (!(self->frame.client->decorations & Decor_AllDesktops)) break; if (!(self->frame.client->decorations & Decor_AllDesktops)) break;
d = TRUE; d = TRUE;
self->label_width -= BUTTON_SIZE + s_bevel; self->label_width -= BUTTON_SIZE + sep;
break; break;
case 'I': case 'I':
if (!(self->frame.client->decorations & Decor_Iconify)) break; if (!(self->frame.client->decorations & Decor_Iconify)) break;
i = TRUE; i = TRUE;
self->label_width -= BUTTON_SIZE + s_bevel; self->label_width -= BUTTON_SIZE + sep;
break; break;
case 'L': case 'L':
l = TRUE; l = TRUE;
@ -623,12 +625,12 @@ static void layout_title(ObFrame *self)
case 'M': case 'M':
if (!(self->frame.client->decorations & Decor_Maximize)) break; if (!(self->frame.client->decorations & Decor_Maximize)) break;
m = TRUE; m = TRUE;
self->label_width -= BUTTON_SIZE + s_bevel; self->label_width -= BUTTON_SIZE + sep;
break; break;
case 'C': case 'C':
if (!(self->frame.client->decorations & Decor_Close)) break; if (!(self->frame.client->decorations & Decor_Close)) break;
c = TRUE; c = TRUE;
self->label_width -= BUTTON_SIZE + s_bevel; self->label_width -= BUTTON_SIZE + sep;
break; break;
} }
} }
@ -667,50 +669,50 @@ static void layout_title(ObFrame *self)
self->close_x = -1; self->close_x = -1;
} }
x = s_bevel; x = sep;
for (lc = themerc_titlebar_layout; *lc != '\0'; ++lc) { for (lc = themerc_titlebar_layout; *lc != '\0'; ++lc) {
switch (*lc) { switch (*lc) {
case 'N': case 'N':
if (!n) break; if (!n) break;
self->icon_x = x; self->icon_x = x;
XMapWindow(ob_display, self->icon); XMapWindow(ob_display, self->icon);
XMoveWindow(ob_display, self->icon, x, s_bevel + 1); XMoveWindow(ob_display, self->icon, x, sep + 1);
x += BUTTON_SIZE + s_bevel; x += BUTTON_SIZE + sep;
break; break;
case 'D': case 'D':
if (!d) break; if (!d) break;
self->desk_x = x; self->desk_x = x;
XMapWindow(ob_display, self->desk); XMapWindow(ob_display, self->desk);
XMoveWindow(ob_display, self->desk, x, s_bevel + 1); XMoveWindow(ob_display, self->desk, x, s_bevel + 1);
x += BUTTON_SIZE + s_bevel; x += BUTTON_SIZE + sep;
break; break;
case 'I': case 'I':
if (!i) break; if (!i) break;
self->iconify_x = x; self->iconify_x = x;
XMapWindow(ob_display, self->iconify); XMapWindow(ob_display, self->iconify);
XMoveWindow(ob_display, self->iconify, x, s_bevel + 1); XMoveWindow(ob_display, self->iconify, x, s_bevel + 1);
x += BUTTON_SIZE + s_bevel; x += BUTTON_SIZE + sep;
break; break;
case 'L': case 'L':
if (!l) break; if (!l) break;
self->label_x = x; self->label_x = x;
XMapWindow(ob_display, self->label); XMapWindow(ob_display, self->label);
XMoveWindow(ob_display, self->label, x, s_bevel); XMoveWindow(ob_display, self->label, x, s_bevel);
x += self->label_width + s_bevel; x += self->label_width + sep;
break; break;
case 'M': case 'M':
if (!m) break; if (!m) break;
self->max_x = x; self->max_x = x;
XMapWindow(ob_display, self->max); XMapWindow(ob_display, self->max);
XMoveWindow(ob_display, self->max, x, s_bevel + 1); XMoveWindow(ob_display, self->max, x, s_bevel + 1);
x += BUTTON_SIZE + s_bevel; x += BUTTON_SIZE + sep;
break; break;
case 'C': case 'C':
if (!c) break; if (!c) break;
self->close_x = x; self->close_x = x;
XMapWindow(ob_display, self->close); XMapWindow(ob_display, self->close);
XMoveWindow(ob_display, self->close, x, s_bevel + 1); XMoveWindow(ob_display, self->close, x, s_bevel + 1);
x += BUTTON_SIZE + s_bevel; x += BUTTON_SIZE + sep;
break; break;
} }
} }