void parse_menu_full(xmlDocPtr doc, xmlNodePtr node, void *data,
gboolean newmenu)
{
- Action *act;
+ ObAction *act;
xmlNodePtr nact;
gchar *id = NULL, *title = NULL, *label = NULL, *plugin;
RrAppearanceFree(self->a_item);
RrAppearanceFree(self->a_disabled);
RrAppearanceFree(self->a_hilite);
+ RrAppearanceFree(self->a_submenu);
XDestroyWindow(ob_display, self->item);
-
+ XDestroyWindow(ob_display, self->submenu_pic);
g_free(self);
}
g_hash_table_remove(menu_hash, name);
}
-ObMenuEntry *menu_entry_new_full(char *label, Action *action,
+ObMenuEntry *menu_entry_new_full(char *label, ObAction *action,
ObMenuEntryRenderType render_type,
gpointer submenu)
{
attrib.event_mask = ENTRY_EVENTMASK;
entry->item = createWindow(menu->items, CWEventMask, &attrib);
+ entry->submenu_pic = createWindow(menu->items, CWEventMask, &attrib);
XMapWindow(ob_display, entry->item);
+ XMapWindow(ob_display, entry->submenu_pic);
- entry->a_item = entry->a_disabled = entry->a_hilite = NULL;
+ entry->a_item = entry->a_disabled = entry->a_hilite = entry->a_submenu
+ = NULL;
menu->invalid = TRUE;
g_hash_table_insert(window_map, &entry->item, menu);
+ g_hash_table_insert(window_map, &entry->submenu_pic, menu);
}
void menu_show(char *name, int x, int y, ObClient *client)
{
ObMenu *m;
- if (button > 3) return;
+ /* ignore wheel scrolling */
+ if (button == 4 || button == 5) return;
if (self->action) {
self->action->data.any.c = self->parent->client;
a = screen_physical_area_monitor(self->parent->xin_area);
- if (self->submenu->size.width + x >= a->x + a->width)
- x = self->parent->location.x - self->submenu->size.width -
- ob_rr_theme->bwidth + ob_rr_theme->menu_overlap;
+ if (self->submenu->size.width + x >= a->x + a->width) {
+ int newparentx = a->x + a->width
+ - self->submenu->size.width
+ - self->parent->size.width
+ - ob_rr_theme->bwidth
+ - ob_rr_theme->menu_overlap;
+
+ x = a->x + a->width - self->submenu->size.width
+ - ob_rr_theme->menu_overlap;
+ XWarpPointer(ob_display, None, None, 0, 0, 0, 0,
+ newparentx - self->parent->location.x, 0);
+
+ menu_show_full(self->parent, newparentx,
+ self->parent->location.y, self->parent->client);
+ }
menu_show_full(self->submenu, x,
self->parent->location.y + self->y,
break;
}
default:
- if (current_menu)
- current_menu->hide(current_menu);
+ ((ObMenu *)menu_visible->data)->hide(menu_visible->data);
+ current_menu = NULL;
}
return;
}