]> Dogcows Code - chaz/openbox/blobdiff - openbox/menu_render.c
dont show titles on submenus. kill the extra 1px at the top of titleless menus
[chaz/openbox] / openbox / menu_render.c
index 42c7f965a4bdde5c210494a72bb00c3eb08d19db..1f03459c368897ca4fcba7a01a72b0db3704d2d3 100644 (file)
@@ -29,13 +29,14 @@ void menu_render(ObMenu *self) {
     }
     
     /* set texture data and size them mofos out */
-    if (self->label) {
+    if (self->label && !(self->parent && self->parent->shown)) {
        self->a_title->texture[0].data.text.string = self->label;
        RrMinsize(self->a_title, &self->title_min_w, &self->title_h);
        self->title_min_w += ob_rr_theme->bevel * 2;
        self->title_h += ob_rr_theme->bevel * 2;
        self->size.width = MAX(self->size.width, self->title_min_w);
-    }
+    } else
+        self->title_h = -ob_rr_theme->bwidth;
 
     for (it = self->entries; it; it = it->next) {
         ObMenuEntry *e = it->data;
@@ -72,16 +73,19 @@ void menu_render(ObMenu *self) {
 
     self->size.height = MAX(self->title_h + items_h + ob_rr_theme->bwidth, 1);
     XResizeWindow(ob_display, self->frame, self->size.width,self->size.height);
-    if (self->label)
+    if (self->label && !(self->parent && self->parent->shown)) {
        XMoveResizeWindow(ob_display, self->title, -ob_rr_theme->bwidth,
                          -ob_rr_theme->bwidth,
                           self->size.width, self->title_h);
+        XMapWindow(ob_display, self->title);
+    } else
+        XUnmapWindow(ob_display, self->title);
 
     XMoveResizeWindow(ob_display, self->items, 0, 
                      self->title_h + ob_rr_theme->bwidth, self->size.width, 
                      items_h);
 
-    if (self->label)
+    if (self->label && !(self->parent && self->parent->shown))
        RrPaint(self->a_title, self->title, self->size.width, self->title_h);
     RrPaint(self->a_items, self->items, self->size.width, items_h);
 
@@ -126,16 +130,25 @@ void menu_entry_render(ObMenuEntry *self)
 
     XMoveResizeWindow(ob_display, self->item, 0, self->y,
                       menu->size.width, menu->item_h);
-    XMoveResizeWindow(ob_display, self->submenu_pic, menu->size.width - ob_rr_theme->bevel - 1, self->y,
-                      8, 8);
+    if (s) {
+        XMoveResizeWindow(ob_display, self->submenu_pic,
+                          menu->size.width -
+                          menu->bullet_w + (menu->bullet_w - 8) / 2,
+                          self->y + (menu->item_h - 8) / 2,
+                          8, 8);
+        XMapWindow(ob_display, self->submenu_pic);
+    } else
+        XUnmapWindow(ob_display, self->submenu_pic);
+
     a->surface.parent = menu->a_items;
     a->surface.parentx = 0;
     a->surface.parenty = self->y;
 
     if (s) {
         s->surface.parent = a;
-        s->surface.parentx = menu->size.width - 8;
-        s->surface.parenty = 0;
+        s->surface.parentx = menu->size.width -
+            menu->bullet_w + (menu->bullet_w - 8) / 2,
+        s->surface.parenty = (menu->item_h - 8) / 2;
     }
 
     RrPaint(a, self->item, menu->size.width, menu->item_h);
This page took 0.024407 seconds and 4 git commands to generate.