Is this better or worse?
authorMikael Magnusson <mikachu@gmail.com>
Wed, 10 Sep 2008 15:17:25 +0000 (17:17 +0200)
committerMikael Magnusson <mikachu@gmail.com>
Wed, 10 Sep 2008 15:17:25 +0000 (17:17 +0200)
openbox/menu.h
openbox/menuframe.c

index 2f1fce1..65836e9 100644 (file)
@@ -101,6 +101,10 @@ typedef enum
 } ObMenuEntryType;
 
 struct _ObNormalMenuEntry {
+    /* Icon stuff.  If you set this, make sure you RrImageRef() it too. */
+    RrImage *icon;
+    gint     icon_alpha;
+
     gchar *label;
     /*! The shortcut key that would be used to activate this menu entry */
     gunichar shortcut;
@@ -115,10 +119,6 @@ struct _ObNormalMenuEntry {
     /* List of ObActions */
     GSList *actions;
     
-    /* Icon stuff.  If you set this, make sure you RrImageRef() it too. */
-    RrImage *icon;
-    gint     icon_alpha;
-
     /* Mask icon */
     RrPixmapMask *mask;
     RrColor *mask_normal_color;
@@ -130,13 +130,13 @@ struct _ObNormalMenuEntry {
 };
 
 struct _ObSubmenuMenuEntry {
-    gchar *name;
-    ObMenu *submenu;
-    
     /* Icon stuff.  If you set this, make sure you RrImageRef() it too. */
     RrImage *icon;
     gint     icon_alpha;
 
+    gchar *name;
+    ObMenu *submenu;
+    
     guint show_from;
 };
 
index e317cd1..e02b291 100644 (file)
@@ -472,10 +472,9 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self)
         break;
     }
 
-    if (((self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL) &&
-         self->entry->data.normal.icon) ||
-        ((self->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU) &&
-          self->entry->data.submenu.icon))
+    if (((self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL) ||
+         (self->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU)) &&
+        self->entry->data.normal.icon)
     {
         RrAppearance *clear;
 
@@ -490,9 +489,9 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self)
         RrAppearanceClearTextures(clear);
         clear->texture[0].type = RR_TEXTURE_IMAGE;
         clear->texture[0].data.image.image =
-            self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL ? self->entry->data.normal.icon : self->entry->data.submenu.icon;
+            self->entry->data.normal.icon;
         clear->texture[0].data.image.alpha =
-            self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL ? self->entry->data.normal.icon_alpha : self->entry->data.submenu.icon_alpha;
+            self->entry->data.normal.icon_alpha;
         clear->surface.parent = item_a;
         clear->surface.parentx = PADDING;
         clear->surface.parenty = frame->item_margin.top;