X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=openbox%2Fmenu.c;h=c66a1b0d711bc644a190a57e05dba4a42a77da52;hb=c0c06e3828981cacc96b27a87d7803f603241d15;hp=0905cb161dcb6560ec8ab99c1aaf2b1be90a5ac1;hpb=b0855c19bc358be53282c8f9f842dd29f69bc7b1;p=chaz%2Fopenbox diff --git a/openbox/menu.c b/openbox/menu.c index 0905cb16..c66a1b0d 100644 --- a/openbox/menu.c +++ b/openbox/menu.c @@ -20,6 +20,8 @@ GList *menu_visible = NULL; #define ENTRY_EVENTMASK (EnterWindowMask | LeaveWindowMask | \ ButtonPressMask | ButtonReleaseMask) +void menu_control_show(ObMenu *self, int x, int y, ObClient *client); + static void parse_menu(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, gpointer data) { @@ -35,7 +37,7 @@ void parse_menu_full(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, xmlNodePtr nact; gchar *id = NULL, *title = NULL, *label = NULL, *plugin; - ObMenu *menu = NULL, *parent; + ObMenu *menu = NULL, *parent = NULL; if (newmenu == TRUE) { if (!parse_attr_string("id", node, &id)) @@ -52,12 +54,12 @@ void parse_menu_full(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, data.parent = menu; if (plugin_open_reopen(plugin, i)) - parent = plugin_create(plugin, &data); + menu = plugin_create(plugin, &data); g_free(plugin); } else menu = menu_new(title, id, data ? *((ObMenu**)data) : NULL); - if (data) + if (data && menu) *((ObMenu**)data) = menu; } else { menu = (ObMenu *)data; @@ -78,9 +80,11 @@ void parse_menu_full(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, } else { parent = menu; parse_menu(i, doc, node, &parent); + } + + if (parent) menu_add_entry(menu, menu_entry_new_submenu(parent->label, parent)); - } } else if (!xmlStrcasecmp(node->name, (const xmlChar*) "item")) { @@ -104,8 +108,6 @@ parse_menu_fail: g_free(title); } -void menu_control_show(ObMenu *self, int x, int y, ObClient *client); - void menu_destroy_hash_key(ObMenu *menu) { g_free(menu); @@ -521,11 +523,12 @@ void menu_control_mouseover(ObMenuEntry *self, gboolean enter) a = screen_physical_area_monitor(self->parent->xin_area); - if (self->submenu->size.width + x >= a->x + a->width) { + if (self->submenu->size.width + x + ob_rr_theme->bwidth >= + 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->bwidth * 2 - ob_rr_theme->menu_overlap; x = a->x + a->width - self->submenu->size.width @@ -538,7 +541,8 @@ void menu_control_mouseover(ObMenuEntry *self, gboolean enter) } menu_show_full(self->submenu, x, - self->parent->location.y + self->y, + self->parent->location.y + self->y + + self->parent->title_h + ob_rr_theme->bwidth, self->parent->client); } self->hilite = TRUE;