From: Dana Jansens Date: Sat, 30 Aug 2003 19:03:06 +0000 (+0000) Subject: add suppot for showing pixmap masks in menus where the rgba icons go too X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=5d4cbbc67444c3955f705b3aeddf29be1c731866;p=chaz%2Fopenbox add suppot for showing pixmap masks in menus where the rgba icons go too --- diff --git a/openbox/menu.h b/openbox/menu.h index b0f39b7b..a3620e75 100644 --- a/openbox/menu.h +++ b/openbox/menu.h @@ -64,6 +64,10 @@ struct _ObNormalMenuEntry { gint icon_width; gint icon_height; RrPixel32 *icon_data; + + /* Mask icon */ + RrPixmapMask *mask; + RrColor *mask_color; }; struct _ObSubmenuMenuEntry { diff --git a/openbox/menuframe.c b/openbox/menuframe.c index df45b873..2b64aaa8 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -107,8 +107,9 @@ static ObMenuEntryFrame* menu_entry_frame_new(ObMenuEntry *entry, self->a_icon = RrAppearanceCopy(ob_rr_theme->a_clear_tex); 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->texture[0].type = RR_TEXTURE_MASK; self->a_text_normal = RrAppearanceCopy(ob_rr_theme->a_menu_text_item); @@ -133,6 +134,7 @@ static void menu_entry_frame_free(ObMenuEntryFrame *self) RrAppearanceFree(self->a_selected); RrAppearanceFree(self->a_icon); + RrAppearanceFree(self->a_mask); RrAppearanceFree(self->a_text_normal); RrAppearanceFree(self->a_text_disabled); RrAppearanceFree(self->a_text_selected); @@ -254,7 +256,7 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self) break; } - if (self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL && + if (self->entry->type != OB_MENU_ENTRY_TYPE_SEPARATOR && self->entry->data.normal.icon_data) { XMoveResizeWindow(ob_display, self->icon, PADDING, 0, @@ -272,6 +274,22 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self) RrPaint(self->a_icon, self->icon, self->frame->item_h, self->frame->item_h); XMapWindow(ob_display, self->icon); + } else if (self->entry->type != OB_MENU_ENTRY_TYPE_SEPARATOR && + self->entry->data.normal.mask) + { + 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; + self->a_mask->surface.parent = item_a; + self->a_mask->surface.parentx = PADDING; + self->a_mask->surface.parenty = 0; + RrPaint(self->a_mask, self->icon, + self->frame->item_h, self->frame->item_h); + XMapWindow(ob_display, self->icon); } else XUnmapWindow(ob_display, self->icon); @@ -353,7 +371,8 @@ static void menu_frame_render(ObMenuFrame *self) text_a->texture[0].data.text.string = e->entry->data.normal.label; RrMinsize(text_a, &tw, &th); - if (e->entry->data.normal.icon_data) + if (e->entry->data.normal.icon_data || + e->entry->data.normal.mask) has_icon = TRUE; break; case OB_MENU_ENTRY_TYPE_SUBMENU: @@ -361,6 +380,10 @@ static void menu_frame_render(ObMenuFrame *self) text_a->texture[0].data.text.string = sub ? sub->title : ""; RrMinsize(text_a, &tw, &th); + if (e->entry->data.normal.icon_data || + e->entry->data.normal.mask) + has_icon = TRUE; + tw += self->item_h - PADDING; break; case OB_MENU_ENTRY_TYPE_SEPARATOR: diff --git a/openbox/menuframe.h b/openbox/menuframe.h index 40b9f844..7d2c1f06 100644 --- a/openbox/menuframe.h +++ b/openbox/menuframe.h @@ -69,6 +69,7 @@ struct _ObMenuEntryFrame RrAppearance *a_selected; RrAppearance *a_icon; + RrAppearance *a_mask; RrAppearance *a_bullet; RrAppearance *a_text_normal; RrAppearance *a_text_disabled;