From 331990a4f24aec35c6212af874d70bcc9cace258 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 4 Jan 2010 16:25:13 -0500 Subject: Make the Focus action stop all interactive actions (Fixes bug #4436) Old < 3.4.8 Openbox versions would stop focus cycling when focus moved. Now that is not the case, but you should be able to stop it by Choosing a window explicitly still. --- openbox/actions/focus.c | 10 ++++++++++ openbox/focus_cycle.c | 7 ++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/openbox/actions/focus.c b/openbox/actions/focus.c index 8da8ed5e..1b544910 100644 --- a/openbox/actions/focus.c +++ b/openbox/actions/focus.c @@ -6,6 +6,7 @@ typedef struct { gboolean here; + gboolean stop_int; } Options; static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node); @@ -27,9 +28,12 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node) Options *o; o = g_new0(Options, 1); + o->stop_int = TRUE; if ((n = parse_find_node("here", node))) o->here = parse_bool(doc, n); + if ((n = parse_find_node("stopInteractive", node))) + o->stop_int = parse_bool(doc, n); return o; } @@ -56,11 +60,17 @@ static gboolean run_func(ObActionsData *data, gpointer options) (data->context != OB_FRAME_CONTEXT_CLIENT && data->context != OB_FRAME_CONTEXT_FRAME)) { + if (o->stop_int) + actions_interactive_cancel_act(); + actions_client_move(data, TRUE); client_activate(data->client, TRUE, o->here, FALSE, FALSE, TRUE); actions_client_move(data, FALSE); } } else if (data->context == OB_FRAME_CONTEXT_DESKTOP) { + if (o->stop_int) + actions_interactive_cancel_act(); + /* focus action on the root window. make keybindings work for this openbox instance, but don't focus any specific client */ focus_nothing(); diff --git a/openbox/focus_cycle.c b/openbox/focus_cycle.c index 8d047497..c92b5a54 100644 --- a/openbox/focus_cycle.c +++ b/openbox/focus_cycle.c @@ -55,9 +55,10 @@ void focus_cycle_stop(ObClient *ifclient) { /* stop focus cycling if the given client is a valid focus target, and so the cycling is being disrupted */ - if (focus_cycle_target && ifclient && - (ifclient == focus_cycle_target || - focus_cycle_popup_is_showing(ifclient))) + if (focus_cycle_target && + ((ifclient && (ifclient == focus_cycle_target || + focus_cycle_popup_is_showing(ifclient))) || + !ifclient)) { focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,TRUE); focus_directional_cycle(0, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE); -- cgit v1.2.3 From c6370aa48a2832eb4f26aa73662326e0fc4dc99f Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 5 Jan 2010 21:37:58 -0500 Subject: fix a broken if statement (bug #4464) --- data/xsession/openbox-gnome-session.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/xsession/openbox-gnome-session.in b/data/xsession/openbox-gnome-session.in index de46bec5..6765ae82 100644 --- a/data/xsession/openbox-gnome-session.in +++ b/data/xsession/openbox-gnome-session.in @@ -46,7 +46,7 @@ else OB_SESSION=$(gconftool-2 -g $SPATH/openbox_session 2> /dev/null) # update the GNOME/Openbox session if needed - if x$OB_SESSION != x$SESSION; then + if test x$OB_SESSION != x$SESSION; then # the default session changed or we didn't run GNOME/Openbox before gconftool-2 -t list --list-type=strings -s $SPATH/openbox_session \ "$SESSION" 2> /dev/null -- cgit v1.2.3 From 775f60852a82930e870102a3b3b5a073c3ad6401 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 22 Dec 2009 09:31:24 -0500 Subject: Revert "A fix for delayed hiding of submenus." This reverts commit 1fb198410e9d3ca660d91d1049249db0f2f47732. --- openbox/event.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openbox/event.c b/openbox/event.c index bbe7038e..a0d26ab7 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1838,7 +1838,8 @@ static gboolean event_handle_menu(XEvent *ev) break; if ((e = g_hash_table_lookup(menu_frame_map, &ev->xcrossing.window)) && - (f = find_active_menu()) && f->selected == e) + (f = find_active_menu()) && f->selected == e && + e->entry->type != OB_MENU_ENTRY_TYPE_SUBMENU) { ObMenuEntryFrame *u = menu_entry_frame_under(ev->xcrossing.x_root, ev->xcrossing.y_root); -- cgit v1.2.3 From 15802d87b18b8a7a741c2e8d80ab6e5f79ada13e Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 22 Dec 2009 09:31:38 -0500 Subject: Revert "Fix the delayed hiding of submenus, so that they don't end up hidden while the entry is selected" This reverts commit 8ada991d829671ab5e6dd4c5526b6a0238ba6a16. --- openbox/menuframe.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/openbox/menuframe.c b/openbox/menuframe.c index 8177f513..3d2bf829 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -1161,8 +1161,6 @@ void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry, } if (!entry && self->open_submenu) { - /* we moved out of the menu, so move the selection back to the open - submenu */ entry = self->open_submenu; oldchild = NULL; @@ -1180,16 +1178,12 @@ void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry, /* there is an open submenu */ if (config_submenu_show_delay && !immediate) { - if (entry == self->open_submenu) { - /* we moved onto the entry that has an open submenu, so stop - trying to close the submenu */ + if (old == self->open_submenu) { + /* close the open submenu after a delay if we don't have + it selected */ ob_main_loop_timeout_remove (ob_main_loop, menu_entry_frame_submenu_hide_timeout); - } - else if (old == self->open_submenu) { - /* we just moved off the entry with an open submenu, so - close the open submenu after a delay */ ob_main_loop_timeout_add(ob_main_loop, config_submenu_show_delay * 1000, menu_entry_frame_submenu_hide_timeout, @@ -1204,7 +1198,7 @@ void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry, if (self->selected) { menu_entry_frame_render(self->selected); - /* if we've selected a submenu and it wasn't already open, then + /* if we've selected a submenu and it wasn't always open, then show it */ if (self->selected->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU && self->selected != self->open_submenu) -- cgit v1.2.3 From e04522772694682ccd11fc465d861b169675312b Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 22 Dec 2009 09:31:50 -0500 Subject: Revert "Don't hide submenus immediately when unselecting the parent's entry" This reverts commit 828c095c8b5a2df96a38faaeb8a0df504e68e70f. --- openbox/event.c | 7 +---- openbox/menuframe.c | 76 +++++++++-------------------------------------------- openbox/menuframe.h | 3 --- 3 files changed, 13 insertions(+), 73 deletions(-) diff --git a/openbox/event.c b/openbox/event.c index a0d26ab7..41f8eb16 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1841,12 +1841,7 @@ static gboolean event_handle_menu(XEvent *ev) (f = find_active_menu()) && f->selected == e && e->entry->type != OB_MENU_ENTRY_TYPE_SUBMENU) { - ObMenuEntryFrame *u = menu_entry_frame_under(ev->xcrossing.x_root, - ev->xcrossing.y_root); - /* if we're just going from one entry in the menu to the next, - don't unselect stuff first */ - if (!u || e->frame != u->frame) - menu_frame_select(e->frame, NULL, FALSE); + menu_frame_select(e->frame, NULL, FALSE); } break; case MotionNotify: diff --git a/openbox/menuframe.c b/openbox/menuframe.c index 3d2bf829..e0f58956 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -49,8 +49,7 @@ static ObMenuEntryFrame* menu_entry_frame_new(ObMenuEntry *entry, ObMenuFrame *frame); static void menu_entry_frame_free(ObMenuEntryFrame *self); static void menu_frame_update(ObMenuFrame *self); -static gboolean menu_entry_frame_submenu_hide_timeout(gpointer data); -static gboolean menu_entry_frame_submenu_show_timeout(gpointer data); +static gboolean menu_entry_frame_submenu_timeout(gpointer data); static void menu_frame_hide(ObMenuFrame *self); static Window createWindow(Window parent, gulong mask, @@ -96,7 +95,6 @@ ObMenuFrame* menu_frame_new(ObMenu *menu, guint show_from, ObClient *client) self->type = Window_Menu; self->menu = menu; self->selected = NULL; - self->open_submenu = NULL; self->client = client; self->direction_right = TRUE; self->show_from = show_from; @@ -986,7 +984,6 @@ gboolean menu_frame_show_submenu(ObMenuFrame *self, ObMenuFrame *parent, self->monitor = parent->monitor; self->parent = parent; self->parent_entry = parent_entry; - parent->open_submenu = parent_entry; /* set up parent's child to be us */ if (parent->child) @@ -1032,10 +1029,8 @@ static void menu_frame_hide(ObMenuFrame *self) if (self->child) menu_frame_hide(self->child); - if (self->parent && self->parent->child == self) { + if (self->parent) self->parent->child = NULL; - self->parent->open_submenu = NULL; - } self->parent = NULL; self->parent_entry = NULL; @@ -1061,10 +1056,7 @@ void menu_frame_hide_all(void) if (config_submenu_show_delay) { /* remove any submenu open requests */ ob_main_loop_timeout_remove(ob_main_loop, - menu_entry_frame_submenu_show_timeout); - /* remove any submenu close delays */ - ob_main_loop_timeout_remove(ob_main_loop, - menu_entry_frame_submenu_hide_timeout); + menu_entry_frame_submenu_timeout); } if ((it = g_list_last(menu_frame_visible))) menu_frame_hide(it->data); @@ -1078,13 +1070,8 @@ void menu_frame_hide_all_client(ObClient *client) if (f->client == client) { if (config_submenu_show_delay) { /* remove any submenu open requests */ - ob_main_loop_timeout_remove - (ob_main_loop, - menu_entry_frame_submenu_show_timeout); - /* remove any submenu close delays */ - ob_main_loop_timeout_remove - (ob_main_loop, - menu_entry_frame_submenu_hide_timeout); + ob_main_loop_timeout_remove(ob_main_loop, + menu_entry_frame_submenu_timeout); } menu_frame_hide(f); } @@ -1119,6 +1106,7 @@ ObMenuEntryFrame* menu_entry_frame_under(gint x, gint y) for (it = frame->entries; it; it = g_list_next(it)) { ObMenuEntryFrame *e = it->data; + if (RECT_CONTAINS(e->area, x, y)) { ret = e; break; @@ -1128,15 +1116,7 @@ ObMenuEntryFrame* menu_entry_frame_under(gint x, gint y) return ret; } -static gboolean menu_entry_frame_submenu_hide_timeout(gpointer data) -{ - g_assert(menu_frame_visible); - g_assert(((ObMenuFrame*)data)->parent != NULL); - menu_frame_hide((ObMenuFrame*)data); - return FALSE; -} - -static gboolean menu_entry_frame_submenu_show_timeout(gpointer data) +static gboolean menu_entry_frame_submenu_timeout(gpointer data) { g_assert(menu_frame_visible); menu_entry_frame_show_submenu((ObMenuEntryFrame*)data); @@ -1157,57 +1137,25 @@ void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry, if (config_submenu_show_delay) { /* remove any submenu open requests */ ob_main_loop_timeout_remove(ob_main_loop, - menu_entry_frame_submenu_show_timeout); - } - - if (!entry && self->open_submenu) { - entry = self->open_submenu; - oldchild = NULL; - - /* remove any submenu close delays */ - ob_main_loop_timeout_remove(ob_main_loop, - menu_entry_frame_submenu_hide_timeout); + menu_entry_frame_submenu_timeout); } self->selected = entry; if (old) menu_entry_frame_render(old); - - if (oldchild) { - /* there is an open submenu */ - - if (config_submenu_show_delay && !immediate) { - if (old == self->open_submenu) { - /* close the open submenu after a delay if we don't have - it selected */ - ob_main_loop_timeout_remove - (ob_main_loop, - menu_entry_frame_submenu_hide_timeout); - ob_main_loop_timeout_add(ob_main_loop, - config_submenu_show_delay * 1000, - menu_entry_frame_submenu_hide_timeout, - self->child, g_direct_equal, - NULL); - } - } - else - menu_frame_hide(oldchild); - } + if (oldchild) + menu_frame_hide(oldchild); if (self->selected) { menu_entry_frame_render(self->selected); - /* if we've selected a submenu and it wasn't always open, then - show it */ - if (self->selected->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU && - self->selected != self->open_submenu) - { + if (self->selected->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU) { if (config_submenu_show_delay && !immediate) { /* initiate a new submenu open request */ ob_main_loop_timeout_add(ob_main_loop, config_submenu_show_delay * 1000, - menu_entry_frame_submenu_show_timeout, + menu_entry_frame_submenu_timeout, self->selected, g_direct_equal, NULL); } else { diff --git a/openbox/menuframe.h b/openbox/menuframe.h index 624c3f49..1b1dcc70 100644 --- a/openbox/menuframe.h +++ b/openbox/menuframe.h @@ -53,9 +53,6 @@ struct _ObMenuFrame GList *entries; ObMenuEntryFrame *selected; - /* if a submenu was selected, then this holds the entry for that submenu - until it is closed */ - ObMenuEntryFrame *open_submenu; /* show entries from the menu starting at this index */ guint show_from; -- cgit v1.2.3 From 8968b38338529cd0a7f2ad08a7c2e0d2e76b6e62 Mon Sep 17 00:00:00 2001 From: Alexey Korop Date: Mon, 4 Jan 2010 13:21:12 -0500 Subject: improve submenu hide delay --- data/rc.xml | 3 ++ openbox/config.c | 4 +++ openbox/config.h | 2 ++ openbox/menuframe.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++++---- openbox/menuframe.h | 3 ++ 5 files changed, 100 insertions(+), 6 deletions(-) diff --git a/data/rc.xml b/data/rc.xml index eaf3df7f..d6956287 100644 --- a/data/rc.xml +++ b/data/rc.xml @@ -635,6 +635,9 @@ 100 + 400 + yes yes diff --git a/openbox/config.c b/openbox/config.c index 73302dfd..a6417646 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -91,6 +91,7 @@ gint config_mouse_screenedgetime; guint config_menu_hide_delay; gboolean config_menu_middle; guint config_submenu_show_delay; +guint config_submenu_hide_delay; gboolean config_menu_client_list_icons; gboolean config_menu_manage_desktops; @@ -812,6 +813,8 @@ static void parse_menu(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, config_menu_middle = parse_bool(doc, n); if ((n = parse_find_node("submenuShowDelay", node))) config_submenu_show_delay = parse_int(doc, n); + if ((n = parse_find_node("submenuHideDelay", node))) + config_submenu_hide_delay = parse_int(doc, n); if ((n = parse_find_node("applicationIcons", node))) config_menu_client_list_icons = parse_bool(doc, n); if ((n = parse_find_node("manageDesktops", node))) @@ -1016,6 +1019,7 @@ void config_startup(ObParseInst *i) config_menu_hide_delay = 250; config_menu_middle = FALSE; config_submenu_show_delay = 0; + config_submenu_hide_delay = 750; config_menu_client_list_icons = TRUE; config_menu_manage_desktops = TRUE; config_menu_files = NULL; diff --git a/openbox/config.h b/openbox/config.h index 33fcd684..77139368 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -185,6 +185,8 @@ extern guint config_menu_hide_delay; extern gboolean config_menu_middle; /*! Delay before opening a submenu in milliseconds */ extern guint config_submenu_show_delay; +/*! Delay before closing a submenu in milliseconds */ +extern guint config_submenu_hide_delay; /*! Show icons in client_list_menu */ extern gboolean config_menu_client_list_icons; /*! Show manage desktops in client_list_menu */ diff --git a/openbox/menuframe.c b/openbox/menuframe.c index e0f58956..ff25100e 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -52,6 +52,8 @@ static void menu_frame_update(ObMenuFrame *self); static gboolean menu_entry_frame_submenu_timeout(gpointer data); static void menu_frame_hide(ObMenuFrame *self); +static gboolean menu_entry_frame_submenu_hide_timeout(gpointer data); + static Window createWindow(Window parent, gulong mask, XSetWindowAttributes *attrib) { @@ -972,6 +974,14 @@ gboolean menu_frame_show_topmenu(ObMenuFrame *self, gint x, gint y, return TRUE; } +static void remove_submenu_hide_timeout(ObMenuFrame *self /* parent of submenu to hide */) +{ + ob_main_loop_timeout_remove(ob_main_loop, + menu_entry_frame_submenu_hide_timeout); + if (self) + self->submenu_to_hide = NULL; +} + gboolean menu_frame_show_submenu(ObMenuFrame *self, ObMenuFrame *parent, ObMenuEntryFrame *parent_entry) { @@ -985,10 +995,14 @@ gboolean menu_frame_show_submenu(ObMenuFrame *self, ObMenuFrame *parent, self->parent = parent; self->parent_entry = parent_entry; + remove_submenu_hide_timeout(parent); + /* set up parent's child to be us */ - if (parent->child) - menu_frame_hide(parent->child); - parent->child = self; + if ((parent->child) != self) { + if (parent->child) + menu_frame_hide(parent->child); + parent->child = self; + } if (!menu_frame_show(self)) return FALSE; @@ -1020,6 +1034,8 @@ static void menu_frame_hide(ObMenuFrame *self) GList *it = g_list_find(menu_frame_visible, self); gulong ignore_start; + remove_submenu_hide_timeout(self->parent); + if (!it) return; @@ -1123,11 +1139,50 @@ static gboolean menu_entry_frame_submenu_timeout(gpointer data) return FALSE; } +static gboolean menu_entry_frame_submenu_hide_timeout(gpointer data) +{ + menu_frame_hide((ObMenuFrame*)data); + return FALSE; +} + void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry, gboolean immediate) { ObMenuEntryFrame *old = self->selected; ObMenuFrame *oldchild = self->child; + ObMenuEntryFrame *temp; + gboolean reselection; + + + if (!oldchild) { + /* self is the last visible (sub)menu */ + if (self->parent && self->parent_entry != self->parent->selected) { + /* Legend: + (config_submenu_hide_delay != 0) + In the parent menu corresponding entry "A" selected, + this submenu ('self') shown, cursor moved in the parent + menu to another entry "B", then cursor moved for the + first time into this submenu. + Results: + parent menu selection is "B" instead of "A", + */ + temp = self->parent->selected; + self->parent->selected = self->parent_entry; + if (temp) + menu_entry_frame_render(temp); + menu_entry_frame_render(self->parent_entry); + } + remove_submenu_hide_timeout(self->parent); + } + else if (oldchild->child) { + /* self is the (at least) grandparent of the last visible submenu */ + menu_frame_hide(oldchild->child); + if (temp = oldchild->selected) { + oldchild->selected = NULL; + menu_entry_frame_render(temp); + } + } + if (entry && entry->entry->type == OB_MENU_ENTRY_TYPE_SEPARATOR) entry = old; @@ -1144,13 +1199,40 @@ void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry, if (old) menu_entry_frame_render(old); - if (oldchild) - menu_frame_hide(oldchild); + + reselection = FALSE; + if (oldchild) { + if (self->submenu_to_hide == entry) { + /* Legend: + (config_submenu_hide_delay != 0) + Some entry "A" selected; corresponding submenu shown; + cursor moved to another entry "B" and moved back + to the entry "A", when submenu hide request added, + but submenu not hided. + */ + reselection = TRUE; + remove_submenu_hide_timeout(self); + } + else if (!immediate && config_submenu_hide_delay) { + if (self->submenu_to_hide == NULL) { + ob_main_loop_timeout_add(ob_main_loop, + config_submenu_hide_delay * 1000, + menu_entry_frame_submenu_hide_timeout, + oldchild, g_direct_equal, + NULL); + self->submenu_to_hide = old; + } + } + else + menu_frame_hide(oldchild); + } if (self->selected) { menu_entry_frame_render(self->selected); - if (self->selected->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU) { + if (!reselection && + (self->selected->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU)) + { if (config_submenu_show_delay && !immediate) { /* initiate a new submenu open request */ ob_main_loop_timeout_add(ob_main_loop, diff --git a/openbox/menuframe.h b/openbox/menuframe.h index 1b1dcc70..62df87ca 100644 --- a/openbox/menuframe.h +++ b/openbox/menuframe.h @@ -80,6 +80,9 @@ struct _ObMenuFrame menu until it has seen a KeyPress. this is to avoid having the keybinding used to show the menu end up running something inside the menu */ + ObMenuEntryFrame * submenu_to_hide; /* if exist (single!) submenu hide request + then this variable hold a copy of 'selected' field of the parent menu, + otherwice NULL */ }; struct _ObMenuEntryFrame -- cgit v1.2.3 From b88cf22bc0084bc611453443b5d8355edbe33bfa Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 4 Jan 2010 15:07:10 -0500 Subject: Some fixes for the submenu hide delay code When nothing in a menu is selected, go back to selecting the open submenu. Adjust the LeaveNotify event handling to only respond when there is not a EnterNotify coming for the same menu frame. Change the default submenu show/hide delays. Have the default values for submenu show/hide match the default rc.xml --- data/rc.xml | 2 +- openbox/config.c | 4 +- openbox/event.c | 23 ++++++++-- openbox/menuframe.c | 126 ++++++++++++++++++++-------------------------------- openbox/menuframe.h | 4 +- 5 files changed, 72 insertions(+), 87 deletions(-) diff --git a/data/rc.xml b/data/rc.xml index d6956287..cf6d47cd 100644 --- a/data/rc.xml +++ b/data/rc.xml @@ -632,7 +632,7 @@ menu is hidden again --> no - 100 + 200 400 diff --git a/openbox/config.c b/openbox/config.c index a6417646..240606a4 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -1018,8 +1018,8 @@ void config_startup(ObParseInst *i) config_menu_hide_delay = 250; config_menu_middle = FALSE; - config_submenu_show_delay = 0; - config_submenu_hide_delay = 750; + config_submenu_show_delay = 200; + config_submenu_hide_delay = 400; config_menu_client_list_icons = TRUE; config_menu_manage_desktops = TRUE; config_menu_files = NULL; diff --git a/openbox/event.c b/openbox/event.c index 41f8eb16..c77d968a 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1800,6 +1800,15 @@ static gboolean event_handle_menu_keyboard(XEvent *ev) return ret; } +static Bool event_look_for_menu_enter(Display *d, XEvent *ev, XPointer arg) +{ + ObMenuFrame *f = (ObMenuFrame*)arg; + ObMenuEntryFrame *e; + return ev->type == EnterNotify && + (e = g_hash_table_lookup(menu_frame_map, &ev->xcrossing.window)) && + !e->ignore_enters && e->frame == f; +} + static gboolean event_handle_menu(XEvent *ev) { ObMenuFrame *f; @@ -1837,11 +1846,17 @@ static gboolean event_handle_menu(XEvent *ev) if (ev->xcrossing.detail == NotifyInferior) break; - if ((e = g_hash_table_lookup(menu_frame_map, &ev->xcrossing.window)) && - (f = find_active_menu()) && f->selected == e && - e->entry->type != OB_MENU_ENTRY_TYPE_SUBMENU) + if ((e = g_hash_table_lookup(menu_frame_map, &ev->xcrossing.window))) { - menu_frame_select(e->frame, NULL, FALSE); + XEvent ce; + + /* check if an EnterNotify event is coming, and if not, then select + nothing in the menu */ + if (XCheckIfEvent(ob_display, &ce, event_look_for_menu_enter, + (XPointer)e->frame)) + XPutBackEvent(ob_display, &ce); + else + menu_frame_select(e->frame, NULL, FALSE); } break; case MotionNotify: diff --git a/openbox/menuframe.c b/openbox/menuframe.c index ff25100e..9e8c8918 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -49,10 +49,10 @@ static ObMenuEntryFrame* menu_entry_frame_new(ObMenuEntry *entry, ObMenuFrame *frame); static void menu_entry_frame_free(ObMenuEntryFrame *self); static void menu_frame_update(ObMenuFrame *self); -static gboolean menu_entry_frame_submenu_timeout(gpointer data); +static gboolean submenu_show_timeout(gpointer data); static void menu_frame_hide(ObMenuFrame *self); -static gboolean menu_entry_frame_submenu_hide_timeout(gpointer data); +static gboolean submenu_hide_timeout(gpointer data); static Window createWindow(Window parent, gulong mask, XSetWindowAttributes *attrib) @@ -974,12 +974,13 @@ gboolean menu_frame_show_topmenu(ObMenuFrame *self, gint x, gint y, return TRUE; } -static void remove_submenu_hide_timeout(ObMenuFrame *self /* parent of submenu to hide */) +/*! Stop hiding an open submenu. + @child The OnMenuFrame of the submenu to be hidden +*/ +static void remove_submenu_hide_timeout(ObMenuFrame *child) { - ob_main_loop_timeout_remove(ob_main_loop, - menu_entry_frame_submenu_hide_timeout); - if (self) - self->submenu_to_hide = NULL; + ob_main_loop_timeout_remove_data(ob_main_loop, submenu_hide_timeout, + child, FALSE); } gboolean menu_frame_show_submenu(ObMenuFrame *self, ObMenuFrame *parent, @@ -995,13 +996,12 @@ gboolean menu_frame_show_submenu(ObMenuFrame *self, ObMenuFrame *parent, self->parent = parent; self->parent_entry = parent_entry; - remove_submenu_hide_timeout(parent); - /* set up parent's child to be us */ if ((parent->child) != self) { if (parent->child) menu_frame_hide(parent->child); parent->child = self; + parent->child_entry = parent_entry; } if (!menu_frame_show(self)) @@ -1034,8 +1034,6 @@ static void menu_frame_hide(ObMenuFrame *self) GList *it = g_list_find(menu_frame_visible, self); gulong ignore_start; - remove_submenu_hide_timeout(self->parent); - if (!it) return; @@ -1045,8 +1043,12 @@ static void menu_frame_hide(ObMenuFrame *self) if (self->child) menu_frame_hide(self->child); - if (self->parent) + if (self->parent) { + remove_submenu_hide_timeout(self); + self->parent->child = NULL; + self->parent->child_entry = NULL; + } self->parent = NULL; self->parent_entry = NULL; @@ -1071,8 +1073,7 @@ void menu_frame_hide_all(void) if (config_submenu_show_delay) { /* remove any submenu open requests */ - ob_main_loop_timeout_remove(ob_main_loop, - menu_entry_frame_submenu_timeout); + ob_main_loop_timeout_remove(ob_main_loop, submenu_show_timeout); } if ((it = g_list_last(menu_frame_visible))) menu_frame_hide(it->data); @@ -1087,7 +1088,7 @@ void menu_frame_hide_all_client(ObClient *client) if (config_submenu_show_delay) { /* remove any submenu open requests */ ob_main_loop_timeout_remove(ob_main_loop, - menu_entry_frame_submenu_timeout); + submenu_show_timeout); } menu_frame_hide(f); } @@ -1132,15 +1133,16 @@ ObMenuEntryFrame* menu_entry_frame_under(gint x, gint y) return ret; } -static gboolean menu_entry_frame_submenu_timeout(gpointer data) +static gboolean submenu_show_timeout(gpointer data) { g_assert(menu_frame_visible); menu_entry_frame_show_submenu((ObMenuEntryFrame*)data); return FALSE; } -static gboolean menu_entry_frame_submenu_hide_timeout(gpointer data) +static gboolean submenu_hide_timeout(gpointer data) { + g_assert(menu_frame_visible); menu_frame_hide((ObMenuFrame*)data); return FALSE; } @@ -1150,49 +1152,24 @@ void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry, { ObMenuEntryFrame *old = self->selected; ObMenuFrame *oldchild = self->child; + ObMenuEntryFrame *oldchild_entry = self->child_entry; ObMenuEntryFrame *temp; - gboolean reselection; - - - if (!oldchild) { - /* self is the last visible (sub)menu */ - if (self->parent && self->parent_entry != self->parent->selected) { - /* Legend: - (config_submenu_hide_delay != 0) - In the parent menu corresponding entry "A" selected, - this submenu ('self') shown, cursor moved in the parent - menu to another entry "B", then cursor moved for the - first time into this submenu. - Results: - parent menu selection is "B" instead of "A", - */ - temp = self->parent->selected; - self->parent->selected = self->parent_entry; - if (temp) - menu_entry_frame_render(temp); - menu_entry_frame_render(self->parent_entry); - } - remove_submenu_hide_timeout(self->parent); - } - else if (oldchild->child) { - /* self is the (at least) grandparent of the last visible submenu */ - menu_frame_hide(oldchild->child); - if (temp = oldchild->selected) { - oldchild->selected = NULL; - menu_entry_frame_render(temp); - } - } - + /* if the user selected a separator, ignore it and reselect what we had + selected before */ if (entry && entry->entry->type == OB_MENU_ENTRY_TYPE_SEPARATOR) entry = old; if (old == entry) return; + /* if the user left this menu but we have a submenu open, move the + selection back to that submenu */ + if (!entry && oldchild_entry) + entry = oldchild_entry; + if (config_submenu_show_delay) { /* remove any submenu open requests */ - ob_main_loop_timeout_remove(ob_main_loop, - menu_entry_frame_submenu_timeout); + ob_main_loop_timeout_remove(ob_main_loop, submenu_show_timeout); } self->selected = entry; @@ -1200,49 +1177,44 @@ void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry, if (old) menu_entry_frame_render(old); - reselection = FALSE; - if (oldchild) { - if (self->submenu_to_hide == entry) { - /* Legend: - (config_submenu_hide_delay != 0) - Some entry "A" selected; corresponding submenu shown; - cursor moved to another entry "B" and moved back - to the entry "A", when submenu hide request added, - but submenu not hided. - */ - reselection = TRUE; - remove_submenu_hide_timeout(self); + if (oldchild_entry) { + /* There is an open submenu */ + if (oldchild_entry == self->selected) { + /* The open submenu has been reselected, so stop hiding the + submenu */ + remove_submenu_hide_timeout(oldchild); } - else if (!immediate && config_submenu_hide_delay) { - if (self->submenu_to_hide == NULL) { + else if (oldchild_entry == old) { + /* The open submenu was selected and is no longer, so hide the + submenu */ + if (!immediate && config_submenu_hide_delay) { ob_main_loop_timeout_add(ob_main_loop, - config_submenu_hide_delay * 1000, - menu_entry_frame_submenu_hide_timeout, - oldchild, g_direct_equal, - NULL); - self->submenu_to_hide = old; + config_submenu_hide_delay * 1000, + submenu_hide_timeout, + oldchild, g_direct_equal, + NULL); } + else + menu_frame_hide(oldchild); } - else - menu_frame_hide(oldchild); } if (self->selected) { menu_entry_frame_render(self->selected); - if (!reselection && - (self->selected->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU)) + /* only show if the submenu isn't already showing */ + if (oldchild_entry != self->selected && + self->selected->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU) { if (config_submenu_show_delay && !immediate) { /* initiate a new submenu open request */ ob_main_loop_timeout_add(ob_main_loop, config_submenu_show_delay * 1000, - menu_entry_frame_submenu_timeout, + submenu_show_timeout, self->selected, g_direct_equal, NULL); - } else { + } else menu_entry_frame_show_submenu(self->selected); - } } } } diff --git a/openbox/menuframe.h b/openbox/menuframe.h index 62df87ca..926b844e 100644 --- a/openbox/menuframe.h +++ b/openbox/menuframe.h @@ -50,6 +50,7 @@ struct _ObMenuFrame ObMenuFrame *parent; ObMenuEntryFrame *parent_entry; ObMenuFrame *child; + ObMenuEntryFrame *child_entry; GList *entries; ObMenuEntryFrame *selected; @@ -80,9 +81,6 @@ struct _ObMenuFrame menu until it has seen a KeyPress. this is to avoid having the keybinding used to show the menu end up running something inside the menu */ - ObMenuEntryFrame * submenu_to_hide; /* if exist (single!) submenu hide request - then this variable hold a copy of 'selected' field of the parent menu, - otherwice NULL */ }; struct _ObMenuEntryFrame -- cgit v1.2.3 From e8588737c944f4dc5f94ca67bf0c7e3ff7133004 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 4 Jan 2010 15:26:10 -0500 Subject: Allow infinite delay for submenu show/hide by using a negative value. --- data/rc.xml | 8 ++++++-- openbox/menuframe.c | 18 +++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/data/rc.xml b/data/rc.xml index cf6d47cd..c89625dd 100644 --- a/data/rc.xml +++ b/data/rc.xml @@ -633,11 +633,15 @@ no 200 - + 400 + if this is a negative value, then the delay is infinite and the + submenu will not be hidden until a different submenu is opened --> yes yes diff --git a/openbox/menuframe.c b/openbox/menuframe.c index 9e8c8918..d8c1691e 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -1160,7 +1160,9 @@ void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry, if (entry && entry->entry->type == OB_MENU_ENTRY_TYPE_SEPARATOR) entry = old; - if (old == entry) return; + if (old == entry && (old->entry->type != OB_MENU_ENTRY_TYPE_SUBMENU || + old == oldchild_entry)) + return; /* if the user left this menu but we have a submenu open, move the selection back to that submenu */ @@ -1187,15 +1189,14 @@ void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry, else if (oldchild_entry == old) { /* The open submenu was selected and is no longer, so hide the submenu */ - if (!immediate && config_submenu_hide_delay) { + if (immediate || config_submenu_hide_delay == 0) + menu_frame_hide(oldchild); + else if (config_submenu_hide_delay > 0) ob_main_loop_timeout_add(ob_main_loop, config_submenu_hide_delay * 1000, submenu_hide_timeout, oldchild, g_direct_equal, NULL); - } - else - menu_frame_hide(oldchild); } } @@ -1206,15 +1207,14 @@ void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry, if (oldchild_entry != self->selected && self->selected->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU) { - if (config_submenu_show_delay && !immediate) { - /* initiate a new submenu open request */ + if (immediate || config_submenu_hide_delay == 0) + menu_entry_frame_show_submenu(self->selected); + else if (config_submenu_hide_delay > 0) ob_main_loop_timeout_add(ob_main_loop, config_submenu_show_delay * 1000, submenu_show_timeout, self->selected, g_direct_equal, NULL); - } else - menu_entry_frame_show_submenu(self->selected); } } } -- cgit v1.2.3 From e070a051c6a78a1737da5456b9747c8cb05e8396 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 6 Jan 2010 13:24:41 -0500 Subject: Add a --root option for obxprop --- tools/obxprop/obxprop.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/obxprop/obxprop.c b/tools/obxprop/obxprop.c index 26851544..6ea8a4d3 100644 --- a/tools/obxprop/obxprop.c +++ b/tools/obxprop/obxprop.c @@ -16,7 +16,8 @@ gint fail(const gchar *s) { "Options:\n" " --help Display this help and exit\n" " --display DISPLAY Connect to this X display\n" - " --id ID Show the properties for this window\n"); + " --id ID Show the properties for this window\n" + " --root Show the properties for the root window\n"); return 1; } @@ -256,11 +257,14 @@ int main(int argc, char **argv) Window id, userid = None; int i; char *dname = NULL; + gboolean root = FALSE; for (i = 1; i < argc; ++i) { if (!strcmp(argv[i], "--help")) { return fail(0); } + else if (!strcmp(argv[i], "--root")) + root = TRUE; else if (!strcmp(argv[i], "--id")) { if (++i == argc) return fail(0); @@ -287,6 +291,9 @@ int main(int argc, char **argv) "Ensure you have permission to connect to the display."); } + if (root) + userid = RootWindow(d, DefaultScreen(d)); + if (userid == None) { i = XGrabPointer(d, RootWindow(d, DefaultScreen(d)), False, ButtonPressMask, -- cgit v1.2.3 From e65411aa0de52f8d2af1c22646e7a8397f7357b8 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 6 Jan 2010 13:39:02 -0500 Subject: add a manpage for obxprop --- Makefile.am | 2 + doc/obxprop.1.in | 42 +++++++++++++++++++ doc/obxprop.1.sgml | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 160 insertions(+) create mode 100644 doc/obxprop.1.in create mode 100644 doc/obxprop.1.sgml diff --git a/Makefile.am b/Makefile.am index 60c22321..14786f57 100644 --- a/Makefile.am +++ b/Makefile.am @@ -493,6 +493,8 @@ dist_noinst_DATA = \ doc/openbox-gnome-session.1.in \ doc/openbox-kde-session.1.sgml \ doc/openbox-kde-session.1.in \ + doc/obxprop.1.sgml \ + doc/obxprop.1.in \ render/obrender-3.0.pc.in \ parser/obparser-3.0.pc.in \ tools/themeupdate/themeupdate.py \ diff --git a/doc/obxprop.1.in b/doc/obxprop.1.in new file mode 100644 index 00000000..f3ac096c --- /dev/null +++ b/doc/obxprop.1.in @@ -0,0 +1,42 @@ +.TH "OBXPROP" "1" +.SH "NAME" +openbox \(em A minimalistic, highly configurable, next generation window +manager with extensive standards support. +.SH "SYNOPSIS" +.PP +\fBopenbox\fR [\fB\-\-help\fP] [\fB\-\-display\fP] [DISPLAY] [\fB\-\-id\fP] [ID] [\fB\-\-root\fP] +.SH "DESCRIPTION" +.PP +obxprop is a tool for displaying the properties on an x +window. +.PP +This tool has a similar functionality to \fBxprop\fR, +but obxprop allows you to see UTF-8 strings as text. +.PP +You may use the \fB\-\-id\fR option to specify a window +identifier, otherwise obxprop will allow you to select a window by +clicking on it. +.PP +Primarily, this tool exists for Openbox users to see the value of the +_OB_NAME, _OB_CLASS, and _OB_ROLE properties, which Openbox uses for +matching windows against user-defined application rules. +.SH "OPTIONS" +.PP +These are the possible options that \fBopenbox\fR accepts: +.IP "\fB\-\-help\fP" 10 +Show a summary of the options available. +.IP "\fB\-\-display\fP" 10 +.IP "DISPLAY" 10 +Specify the X display to use. +.IP "\fB\-\-id\fP" 10 +.IP "ID" 10 +Specify the window identifier for the window whose properties +will be displayed. +.SH "SEE ALSO" +.PP +openbox (1), openbox-session(1), openbox-gnome-session(1), +openbox-kde-session(1). +.PP +Please report bugs to: \fBhttp://bugzilla.icculus.org/ +\fP +.\" created by instant / docbook-to-man, Wed 06 Jan 2010, 13:40 diff --git a/doc/obxprop.1.sgml b/doc/obxprop.1.sgml new file mode 100644 index 00000000..06e78175 --- /dev/null +++ b/doc/obxprop.1.sgml @@ -0,0 +1,116 @@ + manpage.1'. You may view + the manual page with: `docbook-to-man manpage.sgml | nroff -man | + less'. A typical entry in a Makefile or Makefile.am is: + +manpage.1: manpage.sgml + docbook-to-man $< > $@ + + + The docbook-to-man binary is found in the docbook-to-man package. + Please remember that if you create the nroff version in one of the + debian/rules file targets (such as build), you will need to include + docbook-to-man in your Build-Depends control field. + + --> + + 1"> + OBXPROP"> + +]> + + + + &dhucpackage; + + &dhsection; + + + &dhpackage; + + A minimalistic, highly configurable, next generation window + manager with extensive standards support. + + + + &dhpackage; + + DISPLAY + ID + + + + + DESCRIPTION + + obxprop is a tool for displaying the properties on an x + window. + + This tool has a similar functionality to xprop, + but obxprop allows you to see UTF-8 strings as text. + + You may use the --id option to specify a window + identifier, otherwise obxprop will allow you to select a window by + clicking on it. + + Primarily, this tool exists for Openbox users to see the value of the + _OB_NAME, _OB_CLASS, and _OB_ROLE properties, which Openbox uses for + matching windows against user-defined application rules. + + + OPTIONS + + These are the possible options that &dhpackage; accepts: + + + + + Show a summary of the options available. + + + + DISPLAY + + Specify the X display to use. + + + + ID + + Specify the window identifier for the window whose properties + will be displayed. + + + + + + SEE ALSO + + openbox (1), openbox-session(1), openbox-gnome-session(1), + openbox-kde-session(1). + + Please report bugs to: http://bugzilla.icculus.org/ + + + + + + + -- cgit v1.2.3 From 8ed0970b65e2a74c122059aed8c69057c129db35 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 6 Jan 2010 13:41:15 -0500 Subject: Change the openbox website to openbox.org --- debian/control | 2 +- doc/openbox-gnome-session.1.in | 4 ++-- doc/openbox-gnome-session.1.sgml | 2 +- doc/openbox-kde-session.1.in | 4 ++-- doc/openbox-kde-session.1.sgml | 2 +- doc/openbox-session.1.in | 4 ++-- doc/openbox-session.1.sgml | 2 +- doc/openbox.1.in | 4 ++-- doc/openbox.1.sgml | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/debian/control b/debian/control index 0a15a771..61f72ccf 100644 --- a/debian/control +++ b/debian/control @@ -13,4 +13,4 @@ Suggests: menu, x-display-manager, ksmserver | gnome-session, kdm | gdm Conflicts: menu (<< 2.1.12) Provides: x-window-manager Description: A minimalistic, highly configurable, next generation window manager with extensive standards support. - http://icculus.org/openbox/ + http://openbox.org/ diff --git a/doc/openbox-gnome-session.1.in b/doc/openbox-gnome-session.1.in index f38c9bf6..7256874b 100644 --- a/doc/openbox-gnome-session.1.in +++ b/doc/openbox-gnome-session.1.in @@ -15,8 +15,8 @@ openbox(1), openbox-kde-session(1), openbox-session(1). .PP The program's full documentation is available on the website: -\fBhttp://icculus.org/openbox/\fP +\fBhttp://openbox.org/\fP .PP Please report bugs to: \fBhttp://bugzilla.icculus.org/ \fP -.\" created by instant / docbook-to-man, Wed 23 May 2007, 14:03 +.\" created by instant / docbook-to-man, Wed 06 Jan 2010, 13:40 diff --git a/doc/openbox-gnome-session.1.sgml b/doc/openbox-gnome-session.1.sgml index c72865a7..66add1b3 100644 --- a/doc/openbox-gnome-session.1.sgml +++ b/doc/openbox-gnome-session.1.sgml @@ -49,7 +49,7 @@ manpage.1: manpage.sgml The program's full documentation is available on the website: - http://icculus.org/openbox/ + http://openbox.org/ Please report bugs to: http://bugzilla.icculus.org/ diff --git a/doc/openbox-kde-session.1.in b/doc/openbox-kde-session.1.in index d46d14b4..9a96275d 100644 --- a/doc/openbox-kde-session.1.in +++ b/doc/openbox-kde-session.1.in @@ -15,8 +15,8 @@ openbox(1), openbox-gnome-session(1), openbox-session(1). .PP The program's full documentation is available on the website: -\fBhttp://icculus.org/openbox/\fP +\fBhttp://openbox.org/\fP .PP Please report bugs to: \fBhttp://bugzilla.icculus.org/ \fP -.\" created by instant / docbook-to-man, Wed 23 May 2007, 14:03 +.\" created by instant / docbook-to-man, Wed 06 Jan 2010, 13:40 diff --git a/doc/openbox-kde-session.1.sgml b/doc/openbox-kde-session.1.sgml index e4f049db..70c5117e 100644 --- a/doc/openbox-kde-session.1.sgml +++ b/doc/openbox-kde-session.1.sgml @@ -49,7 +49,7 @@ manpage.1: manpage.sgml The program's full documentation is available on the website: - http://icculus.org/openbox/ + http://openbox.org/ Please report bugs to: http://bugzilla.icculus.org/ diff --git a/doc/openbox-session.1.in b/doc/openbox-session.1.in index 26232474..483cdfda 100644 --- a/doc/openbox-session.1.in +++ b/doc/openbox-session.1.in @@ -35,8 +35,8 @@ openbox(1), openbox-session(1), openbox-gnome-session(1). .PP The program's full documentation is available on the website: -\fBhttp://icculus.org/openbox/\fP +\fBhttp://openbox.org/\fP .PP Please report bugs to: \fBhttp://bugzilla.icculus.org/ \fP -.\" created by instant / docbook-to-man, Wed 23 May 2007, 14:03 +.\" created by instant / docbook-to-man, Wed 06 Jan 2010, 13:40 diff --git a/doc/openbox-session.1.sgml b/doc/openbox-session.1.sgml index 3c31755e..ccece7a2 100644 --- a/doc/openbox-session.1.sgml +++ b/doc/openbox-session.1.sgml @@ -66,7 +66,7 @@ manpage.1: manpage.sgml The program's full documentation is available on the website: - http://icculus.org/openbox/ + http://openbox.org/ Please report bugs to: http://bugzilla.icculus.org/ diff --git a/doc/openbox.1.in b/doc/openbox.1.in index 2a5446f3..d508e8c6 100644 --- a/doc/openbox.1.in +++ b/doc/openbox.1.in @@ -88,8 +88,8 @@ obconf (1), openbox-session(1), openbox-gnome-session(1), openbox-kde-session(1). .PP The program's full documentation is available on the website: -\fBhttp://icculus.org/openbox/\fP +\fBhttp://openbox.org/\fP .PP Please report bugs to: \fBhttp://bugzilla.icculus.org/ \fP -.\" created by instant / docbook-to-man, Tue 22 May 2007, 00:06 +.\" created by instant / docbook-to-man, Wed 06 Jan 2010, 13:40 diff --git a/doc/openbox.1.sgml b/doc/openbox.1.sgml index 6921a666..275c3246 100644 --- a/doc/openbox.1.sgml +++ b/doc/openbox.1.sgml @@ -177,7 +177,7 @@ manpage.1: manpage.sgml openbox-kde-session(1). The program's full documentation is available on the website: - http://icculus.org/openbox/ + http://openbox.org/ Please report bugs to: http://bugzilla.icculus.org/ -- cgit v1.2.3 From f3285a3d0bf118ce0eba0014ea53b11f47d710d6 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 6 Jan 2010 17:30:42 -0500 Subject: Improved menu behaviour Make 'left' key in a menu close it's visible child menu and move to the parent properly. Make clicking on a menu item in a menu close any of its grandchildren and remove focus from its children, effectively focusing the menu item you clicked on. --- openbox/event.c | 7 ++++++- openbox/menuframe.c | 34 +++++++++++++++++++--------------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/openbox/event.c b/openbox/event.c index c77d968a..ad9dade6 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1700,8 +1700,13 @@ static gboolean event_handle_menu_keyboard(XEvent *ev) else if (ob_keycode_match(keycode, OB_KEY_LEFT)) { /* Left goes to the parent menu */ - if (frame->parent) + if (frame->parent) { + /* remove focus from the child */ menu_frame_select(frame, NULL, TRUE); + /* and put it in the parent */ + menu_frame_select(frame->parent, frame->parent->selected, + TRUE); + } ret = TRUE; } diff --git a/openbox/menuframe.c b/openbox/menuframe.c index d8c1691e..088986f8 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -1153,15 +1153,13 @@ void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry, ObMenuEntryFrame *old = self->selected; ObMenuFrame *oldchild = self->child; ObMenuEntryFrame *oldchild_entry = self->child_entry; - ObMenuEntryFrame *temp; /* if the user selected a separator, ignore it and reselect what we had selected before */ if (entry && entry->entry->type == OB_MENU_ENTRY_TYPE_SEPARATOR) entry = old; - if (old == entry && (old->entry->type != OB_MENU_ENTRY_TYPE_SUBMENU || - old == oldchild_entry)) + if (old == entry && (old->entry->type != OB_MENU_ENTRY_TYPE_SUBMENU)) return; /* if the user left this menu but we have a submenu open, move the @@ -1203,18 +1201,24 @@ void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry, if (self->selected) { menu_entry_frame_render(self->selected); - /* only show if the submenu isn't already showing */ - if (oldchild_entry != self->selected && - self->selected->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU) - { - if (immediate || config_submenu_hide_delay == 0) - menu_entry_frame_show_submenu(self->selected); - else if (config_submenu_hide_delay > 0) - ob_main_loop_timeout_add(ob_main_loop, - config_submenu_show_delay * 1000, - submenu_show_timeout, - self->selected, g_direct_equal, - NULL); + if (self->selected->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU) { + /* only show if the submenu isn't already showing */ + if (oldchild_entry != self->selected) { + if (immediate || config_submenu_hide_delay == 0) + menu_entry_frame_show_submenu(self->selected); + else if (config_submenu_hide_delay > 0) + ob_main_loop_timeout_add(ob_main_loop, + config_submenu_show_delay * 1000, + submenu_show_timeout, + self->selected, g_direct_equal, + NULL); + } + /* hide the grandchildren of this menu. and move the cursor to + the current menu */ + else if (immediate && self->child && self->child->child) { + menu_frame_hide(self->child->child); + menu_frame_select(self->child, NULL, TRUE); + } } } } -- cgit v1.2.3 From f163c46eaf01ced8405fa36a3bf4a5c488f0f5aa Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 6 Jan 2010 18:58:27 -0500 Subject: Fix a crash when moving into a menu on top of a separator and nothing is selected --- openbox/menuframe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openbox/menuframe.c b/openbox/menuframe.c index 088986f8..076fe6ef 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -1159,7 +1159,8 @@ void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry, if (entry && entry->entry->type == OB_MENU_ENTRY_TYPE_SEPARATOR) entry = old; - if (old == entry && (old->entry->type != OB_MENU_ENTRY_TYPE_SUBMENU)) + if (old == entry && + (!old || old->entry->type != OB_MENU_ENTRY_TYPE_SUBMENU)) return; /* if the user left this menu but we have a submenu open, move the -- cgit v1.2.3