From: Dana Jansens Date: Mon, 7 May 2007 23:38:10 +0000 (+0000) Subject: try reselect the same line. its not perfect though.. X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=fa332cc31474cf1337a0aba5b7d2e9bdd028d87c;p=chaz%2Fopenbox try reselect the same line. its not perfect though.. --- diff --git a/openbox/client_menu.c b/openbox/client_menu.c index acb52530..8375d396 100644 --- a/openbox/client_menu.c +++ b/openbox/client_menu.c @@ -178,8 +178,19 @@ static void desktop_change_callback(ObClient *c, gpointer data) if (frame->parent) { ObMenuEntryFrame *me = frame->parent_entry; ObMenuFrame *parent = frame->parent; + gint sel = + g_list_position(frame->entries, + g_list_find(frame->entries, frame->selected)); menu_frame_select(parent, NULL, TRUE); menu_frame_select(parent, me, TRUE); + + frame = parent->child; + /* reselect the same spot or the last one if it got shorter */ + sel = MIN(sel, (gint)g_list_length(frame->entries)); + if (sel >= 0) + menu_frame_select(frame, + g_list_nth(frame->entries, sel)->data, + TRUE); } else menu_frame_hide(frame); }