From a4f023cf3a085d414a03e2d074e6eaa5258e4391 Mon Sep 17 00:00:00 2001 From: Scott Moynes Date: Mon, 11 Aug 2003 21:19:17 +0000 Subject: Some fixes and new bugs. Someone else can do the menus because it is clear no one gives a fuck what I think and no one else wants a window manager that doesn't suck the same balls as every other window manager. --- openbox/menu.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'openbox/menu.c') diff --git a/openbox/menu.c b/openbox/menu.c index c6c3a4a3..00a2bc2b 100644 --- a/openbox/menu.c +++ b/openbox/menu.c @@ -142,8 +142,9 @@ void menu_entry_free(ObMenuEntry *self) 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); } @@ -273,13 +274,17 @@ void menu_add_entry(ObMenu *menu, ObMenuEntry *entry) 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) @@ -473,9 +478,21 @@ 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) - 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, -- cgit v1.2.3