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.

This commit is contained in:
Dana Jansens 2003-09-02 18:53:08 +00:00
parent aeef656993
commit 02b0b1733a
4 changed files with 48 additions and 18 deletions

View file

@ -162,19 +162,25 @@ void client_menu_startup()
e = menu_add_submenu(menu, CLIENT_SEND_TO, SEND_TO_MENU_NAME); 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 = 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); menu_add_submenu(menu, CLIENT_LAYER, LAYER_MENU_NAME);
acts = g_slist_prepend(NULL, action_from_string("Iconify")); acts = g_slist_prepend(NULL, action_from_string("Iconify"));
e = menu_add_normal(menu, CLIENT_ICONIFY, _("Iconify"), acts); e = menu_add_normal(menu, CLIENT_ICONIFY, _("Iconify"), acts);
e->data.normal.mask = ob_rr_theme->iconify_mask; 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")); acts = g_slist_prepend(NULL, action_from_string("ToggleMaximizeFull"));
e = menu_add_normal(menu, CLIENT_MAXIMIZE, _("Maximize"), acts); e = menu_add_normal(menu, CLIENT_MAXIMIZE, _("Maximize"), acts);
e->data.normal.mask = ob_rr_theme->max_mask; e->data.normal.mask = ob_rr_theme->max_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("Raise")); acts = g_slist_prepend(NULL, action_from_string("Raise"));
menu_add_normal(menu, CLIENT_RAISE, _("Raise to top"), acts); 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")); acts = g_slist_prepend(NULL, action_from_string("ToggleShade"));
e = menu_add_normal(menu, CLIENT_SHADE, _("Roll up/down"), acts); e = menu_add_normal(menu, CLIENT_SHADE, _("Roll up/down"), acts);
e->data.normal.mask = ob_rr_theme->shade_mask; 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")); acts = g_slist_prepend(NULL, action_from_string("ToggleDecorations"));
menu_add_normal(menu, CLIENT_DECORATE, _("Decorate"), acts); 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")); acts = g_slist_prepend(NULL, action_from_string("Close"));
e = menu_add_normal(menu, CLIENT_CLOSE, _("Close"), acts); e = menu_add_normal(menu, CLIENT_CLOSE, _("Close"), acts);
e->data.normal.mask = ob_rr_theme->close_mask; 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;
} }

View file

@ -67,7 +67,9 @@ struct _ObNormalMenuEntry {
/* Mask icon */ /* Mask icon */
RrPixmapMask *mask; RrPixmapMask *mask;
RrColor *mask_color; RrColor *mask_normal_color;
RrColor *mask_disabled_color;
RrColor *mask_selected_color;
}; };
struct _ObSubmenuMenuEntry { struct _ObSubmenuMenuEntry {

View file

@ -103,7 +103,7 @@ static ObMenuEntryFrame* menu_entry_frame_new(ObMenuEntry *entry,
XMapWindow(ob_display, self->window); XMapWindow(ob_display, self->window);
XMapWindow(ob_display, self->text); 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_disabled = RrAppearanceCopy(ob_rr_theme->a_menu_disabled);
self->a_selected = RrAppearanceCopy(ob_rr_theme->a_menu_selected); 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_icon->texture[0].type = RR_TEXTURE_RGBA;
self->a_mask = RrAppearanceCopy(ob_rr_theme->a_clear_tex); self->a_mask = RrAppearanceCopy(ob_rr_theme->a_clear_tex);
self->a_mask->texture[0].type = RR_TEXTURE_MASK; 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 = self->a_text_normal =
RrAppearanceCopy(ob_rr_theme->a_menu_text_item); RrAppearanceCopy(ob_rr_theme->a_menu_text_normal);
self->a_text_disabled = self->a_text_disabled =
RrAppearanceCopy(ob_rr_theme->a_menu_text_disabled); RrAppearanceCopy(ob_rr_theme->a_menu_text_disabled);
self->a_text_selected = 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_normal);
RrAppearanceFree(self->a_text_disabled); RrAppearanceFree(self->a_text_disabled);
RrAppearanceFree(self->a_text_selected); RrAppearanceFree(self->a_text_selected);
RrAppearanceFree(self->a_bullet); RrAppearanceFree(self->a_bullet_normal);
RrAppearanceFree(self->a_bullet_selected);
g_free(self); 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 && } else if (self->entry->type != OB_MENU_ENTRY_TYPE_SEPARATOR &&
self->entry->data.normal.mask) self->entry->data.normal.mask)
{ {
RrColor *c;
XMoveResizeWindow(ob_display, self->icon, PADDING, 0, XMoveResizeWindow(ob_display, self->icon, PADDING, 0,
self->frame->item_h, self->frame->item_h,
self->frame->item_h); self->frame->item_h);
self->a_mask->texture[0].data.mask.mask = self->a_mask->texture[0].data.mask.mask =
self->entry->data.normal.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.parent = item_a;
self->a_mask->surface.parentx = PADDING; self->a_mask->surface.parentx = PADDING;
self->a_mask->surface.parenty = 0; self->a_mask->surface.parenty = 0;
@ -315,17 +328,21 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self)
XUnmapWindow(ob_display, self->icon); XUnmapWindow(ob_display, self->icon);
if (self->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU) { if (self->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU) {
RrAppearance *bullet_a;
XMoveResizeWindow(ob_display, self->bullet, XMoveResizeWindow(ob_display, self->bullet,
self->frame->text_x + self->frame->text_w self->frame->text_x + self->frame->text_w
- self->frame->item_h + PADDING, PADDING, - self->frame->item_h + PADDING, PADDING,
self->frame->item_h - 2*PADDING, self->frame->item_h - 2*PADDING,
self->frame->item_h - 2*PADDING); self->frame->item_h - 2*PADDING);
self->a_bullet->surface.parent = item_a; bullet_a = (self == self->frame->selected ?
self->a_bullet->surface.parentx = 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 self->frame->text_x + self->frame->text_w - self->frame->item_h
+ PADDING; + PADDING;
self->a_bullet->surface.parenty = PADDING; bullet_a->surface.parenty = PADDING;
RrPaint(self->a_bullet, self->bullet, RrPaint(bullet_a, self->bullet,
self->frame->item_h - 2*PADDING, self->frame->item_h - 2*PADDING,
self->frame->item_h - 2*PADDING); self->frame->item_h - 2*PADDING);
XMapWindow(ob_display, self->bullet); XMapWindow(ob_display, self->bullet);

View file

@ -70,7 +70,8 @@ struct _ObMenuEntryFrame
RrAppearance *a_icon; RrAppearance *a_icon;
RrAppearance *a_mask; RrAppearance *a_mask;
RrAppearance *a_bullet; RrAppearance *a_bullet_normal;
RrAppearance *a_bullet_selected;
RrAppearance *a_separator; RrAppearance *a_separator;
RrAppearance *a_text_normal; RrAppearance *a_text_normal;
RrAppearance *a_text_disabled; RrAppearance *a_text_disabled;