From: Dana Jansens Date: Tue, 2 Sep 2003 18:53:08 +0000 (+0000) Subject: use new menu.bullet.selected.imageColor. use the text colors for the menu mask icons... X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=02b0b1733ab09c0a465c26d6be7ab8c49ca39485;p=chaz%2Fopenbox use new menu.bullet.selected.imageColor. use the text colors for the menu mask icons instead of teh bullet color, and set it based on selected/disabled/normal like the text. --- diff --git a/openbox/client_menu.c b/openbox/client_menu.c index cc06422a..dc724383 100644 --- a/openbox/client_menu.c +++ b/openbox/client_menu.c @@ -162,19 +162,25 @@ void client_menu_startup() e = menu_add_submenu(menu, CLIENT_SEND_TO, SEND_TO_MENU_NAME); e->data.normal.mask = ob_rr_theme->desk_mask; - e->data.normal.mask_color = ob_rr_theme->menu_bullet_color; + e->data.normal.mask_normal_color = ob_rr_theme->menu_color; + e->data.normal.mask_disabled_color = ob_rr_theme->menu_disabled_color; + e->data.normal.mask_selected_color = ob_rr_theme->menu_selected_color; menu_add_submenu(menu, CLIENT_LAYER, LAYER_MENU_NAME); acts = g_slist_prepend(NULL, action_from_string("Iconify")); e = menu_add_normal(menu, CLIENT_ICONIFY, _("Iconify"), acts); e->data.normal.mask = ob_rr_theme->iconify_mask; - e->data.normal.mask_color = ob_rr_theme->menu_bullet_color; + e->data.normal.mask_normal_color = ob_rr_theme->menu_color; + e->data.normal.mask_disabled_color = ob_rr_theme->menu_disabled_color; + e->data.normal.mask_selected_color = ob_rr_theme->menu_selected_color; acts = g_slist_prepend(NULL, action_from_string("ToggleMaximizeFull")); e = menu_add_normal(menu, CLIENT_MAXIMIZE, _("Maximize"), acts); - e->data.normal.mask = ob_rr_theme->max_mask; - e->data.normal.mask_color = ob_rr_theme->menu_bullet_color; + e->data.normal.mask = ob_rr_theme->max_mask; + e->data.normal.mask_normal_color = ob_rr_theme->menu_color; + e->data.normal.mask_disabled_color = ob_rr_theme->menu_disabled_color; + e->data.normal.mask_selected_color = ob_rr_theme->menu_selected_color; acts = g_slist_prepend(NULL, action_from_string("Raise")); menu_add_normal(menu, CLIENT_RAISE, _("Raise to top"), acts); @@ -185,7 +191,9 @@ void client_menu_startup() acts = g_slist_prepend(NULL, action_from_string("ToggleShade")); e = menu_add_normal(menu, CLIENT_SHADE, _("Roll up/down"), acts); e->data.normal.mask = ob_rr_theme->shade_mask; - e->data.normal.mask_color = ob_rr_theme->menu_bullet_color; + e->data.normal.mask_normal_color = ob_rr_theme->menu_color; + e->data.normal.mask_disabled_color = ob_rr_theme->menu_disabled_color; + e->data.normal.mask_selected_color = ob_rr_theme->menu_selected_color; acts = g_slist_prepend(NULL, action_from_string("ToggleDecorations")); menu_add_normal(menu, CLIENT_DECORATE, _("Decorate"), acts); @@ -203,5 +211,7 @@ void client_menu_startup() acts = g_slist_prepend(NULL, action_from_string("Close")); e = menu_add_normal(menu, CLIENT_CLOSE, _("Close"), acts); e->data.normal.mask = ob_rr_theme->close_mask; - e->data.normal.mask_color = ob_rr_theme->menu_bullet_color; + e->data.normal.mask_normal_color = ob_rr_theme->menu_color; + e->data.normal.mask_disabled_color = ob_rr_theme->menu_disabled_color; + e->data.normal.mask_selected_color = ob_rr_theme->menu_selected_color; } diff --git a/openbox/menu.h b/openbox/menu.h index a3620e75..396596ae 100644 --- a/openbox/menu.h +++ b/openbox/menu.h @@ -67,7 +67,9 @@ struct _ObNormalMenuEntry { /* Mask icon */ RrPixmapMask *mask; - RrColor *mask_color; + RrColor *mask_normal_color; + RrColor *mask_disabled_color; + RrColor *mask_selected_color; }; struct _ObSubmenuMenuEntry { diff --git a/openbox/menuframe.c b/openbox/menuframe.c index 6f91e0b1..91b48a7e 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -103,7 +103,7 @@ static ObMenuEntryFrame* menu_entry_frame_new(ObMenuEntry *entry, XMapWindow(ob_display, self->window); XMapWindow(ob_display, self->text); - self->a_normal = RrAppearanceCopy(ob_rr_theme->a_menu_item); + self->a_normal = RrAppearanceCopy(ob_rr_theme->a_menu_normal); self->a_disabled = RrAppearanceCopy(ob_rr_theme->a_menu_disabled); self->a_selected = RrAppearanceCopy(ob_rr_theme->a_menu_selected); @@ -115,11 +115,14 @@ static ObMenuEntryFrame* menu_entry_frame_new(ObMenuEntry *entry, self->a_icon->texture[0].type = RR_TEXTURE_RGBA; self->a_mask = RrAppearanceCopy(ob_rr_theme->a_clear_tex); self->a_mask->texture[0].type = RR_TEXTURE_MASK; - self->a_bullet = RrAppearanceCopy(ob_rr_theme->a_menu_bullet); + self->a_bullet_normal = + RrAppearanceCopy(ob_rr_theme->a_menu_bullet_normal); + self->a_bullet_selected = + RrAppearanceCopy(ob_rr_theme->a_menu_bullet_selected); } self->a_text_normal = - RrAppearanceCopy(ob_rr_theme->a_menu_text_item); + RrAppearanceCopy(ob_rr_theme->a_menu_text_normal); self->a_text_disabled = RrAppearanceCopy(ob_rr_theme->a_menu_text_disabled); self->a_text_selected = @@ -148,7 +151,8 @@ static void menu_entry_frame_free(ObMenuEntryFrame *self) RrAppearanceFree(self->a_text_normal); RrAppearanceFree(self->a_text_disabled); RrAppearanceFree(self->a_text_selected); - RrAppearanceFree(self->a_bullet); + RrAppearanceFree(self->a_bullet_normal); + RrAppearanceFree(self->a_bullet_selected); g_free(self); } @@ -298,13 +302,22 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self) } else if (self->entry->type != OB_MENU_ENTRY_TYPE_SEPARATOR && self->entry->data.normal.mask) { + RrColor *c; + XMoveResizeWindow(ob_display, self->icon, PADDING, 0, self->frame->item_h, self->frame->item_h); self->a_mask->texture[0].data.mask.mask = self->entry->data.normal.mask; - self->a_mask->texture[0].data.mask.color = - self->entry->data.normal.mask_color; + + c = ((self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL && + !self->entry->data.normal.enabled) ? + self->entry->data.normal.mask_disabled_color : + (self == self->frame->selected ? + self->entry->data.normal.mask_selected_color : + self->entry->data.normal.mask_normal_color)); + self->a_mask->texture[0].data.mask.color = c; + self->a_mask->surface.parent = item_a; self->a_mask->surface.parentx = PADDING; self->a_mask->surface.parenty = 0; @@ -315,17 +328,21 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self) XUnmapWindow(ob_display, self->icon); if (self->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU) { + RrAppearance *bullet_a; XMoveResizeWindow(ob_display, self->bullet, self->frame->text_x + self->frame->text_w - self->frame->item_h + PADDING, PADDING, self->frame->item_h - 2*PADDING, self->frame->item_h - 2*PADDING); - self->a_bullet->surface.parent = item_a; - self->a_bullet->surface.parentx = + bullet_a = (self == self->frame->selected ? + self->a_bullet_selected : + self->a_bullet_normal); + bullet_a->surface.parent = item_a; + bullet_a->surface.parentx = self->frame->text_x + self->frame->text_w - self->frame->item_h + PADDING; - self->a_bullet->surface.parenty = PADDING; - RrPaint(self->a_bullet, self->bullet, + bullet_a->surface.parenty = PADDING; + RrPaint(bullet_a, self->bullet, self->frame->item_h - 2*PADDING, self->frame->item_h - 2*PADDING); XMapWindow(ob_display, self->bullet); diff --git a/openbox/menuframe.h b/openbox/menuframe.h index 92cd8793..f8a1da82 100644 --- a/openbox/menuframe.h +++ b/openbox/menuframe.h @@ -70,7 +70,8 @@ struct _ObMenuEntryFrame RrAppearance *a_icon; RrAppearance *a_mask; - RrAppearance *a_bullet; + RrAppearance *a_bullet_normal; + RrAppearance *a_bullet_selected; RrAppearance *a_separator; RrAppearance *a_text_normal; RrAppearance *a_text_disabled;