all repos — openbox @ 8612fcfb99f4ed97f49c3617fd2ae291877c8c8e

openbox fork - make it a bit more like ryudo

better matching of the menu titles/separators to the theme
Dana Jansens danakj@orodu.net
commit

8612fcfb99f4ed97f49c3617fd2ae291877c8c8e

parent

5a3a7668d9e3ebe995603fadd2da22cbe1c31c83

4 files changed, 47 insertions(+), 26 deletions(-)

jump to
M openbox/menuframe.copenbox/menuframe.c

@@ -163,6 +163,8 @@ self->a_text_disabled =

RrAppearanceCopy(ob_rr_theme->a_menu_text_disabled); self->a_text_selected = RrAppearanceCopy(ob_rr_theme->a_menu_text_selected); + self->a_text_title = + RrAppearanceCopy(ob_rr_theme->a_menu_text_title); return self; }

@@ -193,6 +195,7 @@ RrAppearanceFree(self->a_mask);

RrAppearanceFree(self->a_text_normal); RrAppearanceFree(self->a_text_disabled); RrAppearanceFree(self->a_text_selected); + RrAppearanceFree(self->a_text_title); RrAppearanceFree(self->a_bullet_normal); RrAppearanceFree(self->a_bullet_selected);

@@ -290,9 +293,7 @@ break;

case OB_MENU_ENTRY_TYPE_SEPARATOR: if (self->entry->data.separator.label) { item_a = self->frame->a_title; - item_a->texture[0].data.text.string = - self->entry->data.separator.label; - th = self->frame->title_h; + th = ob_rr_theme->menu_title_height; } else { item_a = self->a_normal; th = SEPARATOR_HEIGHT + 2*PADDING;

@@ -326,7 +327,10 @@ sub = self->entry->data.submenu.submenu;

text_a->texture[0].data.text.string = sub ? sub->title : ""; break; case OB_MENU_ENTRY_TYPE_SEPARATOR: - text_a = self->a_text_normal; + if (self->entry->data.separator.label != NULL) + text_a = self->a_text_title; + else + text_a = self->a_text_normal; break; }

@@ -354,7 +358,22 @@ RrPaint(text_a, self->text, self->frame->text_w - self->frame->item_h,

self->frame->item_h - 2*PADDING); break; case OB_MENU_ENTRY_TYPE_SEPARATOR: - if (self->entry->data.separator.label == NULL) { + if (self->entry->data.separator.label != NULL) { + /* labeled separator */ + XMoveResizeWindow(ob_display, self->text, + ob_rr_theme->paddingx, ob_rr_theme->paddingy, + self->area.width - 2*ob_rr_theme->paddingx, + ob_rr_theme->menu_title_height - + 2*ob_rr_theme->paddingy); + text_a->surface.parent = item_a; + text_a->surface.parentx = ob_rr_theme->paddingx; + text_a->surface.parenty = ob_rr_theme->paddingy; + RrPaint(text_a, self->text, + self->area.width - 2*ob_rr_theme->paddingx, + ob_rr_theme->menu_title_height - + 2*ob_rr_theme->paddingy); + } else { + /* unlabeled separaator */ XMoveResizeWindow(ob_display, self->text, PADDING, PADDING, self->area.width - 2*PADDING, SEPARATOR_HEIGHT); self->a_separator->surface.parent = item_a;

@@ -483,12 +502,6 @@ tw += 2*PADDING;

th += 2*PADDING; self->item_h = th; - self->a_title->texture[0].data.text.string = ""; - RrMinsize(self->a_title, &tw, &th); - tw += 2*PADDING; - th += 2*PADDING; - self->title_h = th; - RrMargins(e->a_normal, &l, &t, &r, &b); STRUT_SET(self->item_margin, MAX(self->item_margin.left, l),

@@ -567,11 +580,12 @@ tw += self->item_h - PADDING;

break; case OB_MENU_ENTRY_TYPE_SEPARATOR: if (e->entry->data.separator.label != NULL) { - self->a_title->texture[0].data.text.string = + e->a_text_title->texture[0].data.text.string = e->entry->data.separator.label; - RrMinsize(self->a_title, &tw, &th); + RrMinsize(e->a_text_title, &tw, &th); tw = MIN(tw, MAX_MENU_WIDTH); - th += ob_rr_theme->mbwidth * 2; + th = ob_rr_theme->menu_title_height + + (ob_rr_theme->mbwidth - PADDING) *2; } else { tw = 0; th = SEPARATOR_HEIGHT;
M openbox/menuframe.hopenbox/menuframe.h

@@ -99,6 +99,7 @@ RrAppearance *a_separator;

RrAppearance *a_text_normal; RrAppearance *a_text_disabled; RrAppearance *a_text_selected; + RrAppearance *a_text_title; }; extern GHashTable *menu_frame_map;
M render/theme.crender/theme.c

@@ -115,7 +115,8 @@ theme->a_icon = RrAppearanceNew(inst, 1);

theme->a_focused_handle = RrAppearanceNew(inst, 0); theme->a_unfocused_handle = RrAppearanceNew(inst, 0); theme->a_menu = RrAppearanceNew(inst, 0); - theme->a_menu_title = RrAppearanceNew(inst, 1); + theme->a_menu_title = RrAppearanceNew(inst, 0); + theme->a_menu_text_title = RrAppearanceNew(inst, 1); theme->a_menu_normal = RrAppearanceNew(inst, 0); theme->a_menu_disabled = RrAppearanceNew(inst, 0); theme->a_menu_selected = RrAppearanceNew(inst, 0);

@@ -567,7 +568,7 @@ theme->a_unfocused_grip, TRUE))

set_default_appearance(theme->a_unfocused_grip); if (!FIND(appearance, L("menu","entries"), theme->a_menu, FALSE)) set_default_appearance(theme->a_menu); - if (!FIND(appearance, L("menu","title"), theme->a_menu_title, FALSE)) + if (!FIND(appearance, L("menu","title"), theme->a_menu_title, TRUE)) set_default_appearance(theme->a_menu_title); if (!FIND(appearance, L("menu", "active"), theme->a_menu_selected, TRUE)) set_default_appearance(theme->a_menu_selected);

@@ -752,6 +753,7 @@

theme->a_icon->surface.grad = theme->a_clear->surface.grad = theme->a_clear_tex->surface.grad = + theme->a_menu_text_title->surface.grad = theme->a_menu_normal->surface.grad = theme->a_menu_disabled->surface.grad = theme->a_menu_text_normal->surface.grad =

@@ -811,18 +813,20 @@ theme->title_unfocused_shadow_color;

theme->a_unfocused_label->texture[0].data.text.shadow_alpha = theme->title_unfocused_shadow_alpha; - theme->a_menu_title->texture[0].type = RR_TEXTURE_TEXT; - theme->a_menu_title->texture[0].data.text.justify = mtitlejust; - theme->a_menu_title->texture[0].data.text.font = theme->menu_title_font; - theme->a_menu_title->texture[0].data.text.color = theme->menu_title_color; + theme->a_menu_text_title->texture[0].type = RR_TEXTURE_TEXT; + theme->a_menu_text_title->texture[0].data.text.justify = mtitlejust; + theme->a_menu_text_title->texture[0].data.text.font = + theme->menu_title_font; + theme->a_menu_text_title->texture[0].data.text.color = + theme->menu_title_color; if (!FIND(shadow, L("menu","title","text","shadow","offset"), - theme->a_menu_title)) - theme->a_menu_title->texture[0].data.text.shadow_offset_x = - theme->a_menu_title->texture[0].data.text.shadow_offset_y = 0; - theme->a_menu_title->texture[0].data.text.shadow_color = + theme->a_menu_text_title)) + theme->a_menu_text_title->texture[0].data.text.shadow_offset_x = + theme->a_menu_text_title->texture[0].data.text.shadow_offset_y = 0; + theme->a_menu_text_title->texture[0].data.text.shadow_color = theme->menu_title_shadow_color; - theme->a_menu_title->texture[0].data.text.shadow_alpha = + theme->a_menu_text_title->texture[0].data.text.shadow_alpha = theme->menu_title_shadow_alpha; theme->a_menu_text_normal->texture[0].type =

@@ -1117,7 +1121,7 @@ theme->win_font_height =

MAX(theme->win_font_height, RrFontHeight(theme->win_font_unfocused, a->texture[0].data.text.shadow_offset_y)); - a = theme->a_menu_title; + a = theme->a_menu_text_title; theme->menu_title_font_height = RrFontHeight(theme->menu_title_font, a->texture[0].data.text.shadow_offset_y);

@@ -1294,6 +1298,7 @@ RrAppearanceFree(theme->a_focused_handle);

RrAppearanceFree(theme->a_unfocused_handle); RrAppearanceFree(theme->a_menu); RrAppearanceFree(theme->a_menu_title); + RrAppearanceFree(theme->a_menu_text_title); RrAppearanceFree(theme->a_menu_normal); RrAppearanceFree(theme->a_menu_disabled); RrAppearanceFree(theme->a_menu_selected);
M render/theme.hrender/theme.h

@@ -201,6 +201,7 @@ /* always parentrelative, so no focused/unfocused */

RrAppearance *a_icon; RrAppearance *a_focused_handle; RrAppearance *a_unfocused_handle; + RrAppearance *a_menu_text_title; RrAppearance *a_menu_title; RrAppearance *a_menu; RrAppearance *a_menu_normal;