From f37a9190959279d0f3c1cd7e62099e74930d36d2 Mon Sep 17 00:00:00 2001 From: Scott Moynes Date: Mon, 28 Jul 2003 02:52:56 +0000 Subject: [PATCH] Menu stuff. Testing may begin. --- openbox/event.c | 1 + openbox/menu.c | 33 +++++++++++++++++++++------------ plugins/menu/client_menu.c | 2 +- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/openbox/event.c b/openbox/event.c index 69c85100..ce5be14d 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1008,6 +1008,7 @@ static void event_handle_menu(ObClient *client, XEvent *e) e->xbutton.y_root); break; } + break; } } diff --git a/openbox/menu.c b/openbox/menu.c index 7220c37b..03bca026 100644 --- a/openbox/menu.c +++ b/openbox/menu.c @@ -297,7 +297,7 @@ void menu_show_full(ObMenu *self, int x, int y, ObClient *client) { g_assert(self != NULL); - menu_render(self); + self->update(self); self->client = client; @@ -319,7 +319,6 @@ void menu_hide(ObMenu *self) { if (self->open_submenu) menu_hide(self->open_submenu); if (self->parent && self->parent->open_submenu == self) { - self->over = NULL; self->parent->open_submenu = NULL; } @@ -328,6 +327,11 @@ void menu_hide(ObMenu *self) { grab_pointer(FALSE, None); } menu_visible = g_list_remove(menu_visible, self); + if (self->over) { + ((ObMenuEntry *)self->over->data)->hilite = FALSE; + menu_entry_render(self->over->data); + self->over = NULL; + } } } @@ -385,7 +389,7 @@ void menu_entry_fire(ObMenuEntry *self, unsigned int button, unsigned int x, { ObMenu *m; - if (button > 3) return; + if (button != 1) return; if (self->action) { self->action->data.any.c = self->parent->client; @@ -461,7 +465,7 @@ void menu_control_mouseover(ObMenuEntry *self, gboolean enter) ob_rr_theme->bwidth - ob_rr_theme->menu_overlap; /* need to get the width. is this bad?*/ - menu_render(self->submenu); + self->parent->update(self->submenu); a = screen_physical_area_monitor(self->parent->xin_area); @@ -485,6 +489,7 @@ void menu_control_mouseover(ObMenuEntry *self, gboolean enter) void menu_control_keyboard_nav(unsigned int key) { static ObMenu *current_menu = NULL; + ObMenuEntry *e = NULL; ObKey obkey = OB_NUM_KEYS; @@ -532,25 +537,29 @@ void menu_control_keyboard_nav(unsigned int key) break; } case OB_KEY_RIGHT: { - ObMenuEntry *e; if (current_menu->over == NULL) return; - e = (ObMenuEntry *)current_menu->over->data; if (e->submenu) { current_menu = e->submenu; current_menu->over = current_menu->entries; if (current_menu->over) current_menu->mouseover(current_menu->over->data, TRUE); - } else { - current_menu->mouseover(e, FALSE); - current_menu->over = NULL; - - /* zero is enter */ - menu_entry_fire(e, 0, 0, 0); } break; } + + case OB_KEY_RETURN: { + if (current_menu->over == NULL) + return; + e = (ObMenuEntry *)current_menu->over->data; + + current_menu->mouseover(e, FALSE); + current_menu->over = NULL; + /* zero is enter */ + menu_entry_fire(e, 0, 0, 0); + + } case OB_KEY_LEFT: { if (current_menu->over != NULL) { current_menu->mouseover(current_menu->over->data, FALSE); diff --git a/plugins/menu/client_menu.c b/plugins/menu/client_menu.c index 9edb3929..d48d1f05 100644 --- a/plugins/menu/client_menu.c +++ b/plugins/menu/client_menu.c @@ -52,7 +52,7 @@ void client_send_to_update(ObMenu *self) menu_add_entry(self, e); } - self->update(self); + menu_render(self); } } -- 2.45.2