From 12653a4153bccd5d9a46998753e7a1bc17479505 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 11 Jan 2010 12:47:59 -0500 Subject: Redraw the focus cycle popup when the list of focusable windows changes, rather than closing it --- openbox/focus.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'openbox/focus.c') diff --git a/openbox/focus.c b/openbox/focus.c index a0e9c666..c82c4f62 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -98,6 +98,9 @@ void focus_set_client(ObClient *client) PROP_SET32(RootWindow(ob_display, ob_screen), net_active_window, window, active); } + + /* make sure the focus cycle popup shows things in the right order */ + focus_cycle_reorder(); } static ObClient* focus_fallback_target(gboolean allow_refocus, @@ -206,16 +209,14 @@ void focus_order_add_new(ObClient *c) focus_order = g_list_insert(focus_order, c, 1); } - /* in the middle of cycling..? kill it. */ - focus_cycle_stop(c); + focus_cycle_add(c); } void focus_order_remove(ObClient *c) { focus_order = g_list_remove(focus_order, c); - /* in the middle of cycling..? kill it. */ - focus_cycle_stop(c); + focus_cycle_remove(c); } void focus_order_to_top(ObClient *c) @@ -293,6 +294,9 @@ gboolean focus_valid_target(ObClient *ft, { gboolean ok = FALSE; + /* see if the window is still managed or is going away */ + if (!ft->managed) return FALSE; + /* it's on this desktop unless you want all desktops. do this check first because it will usually filter out the most -- cgit v1.2.3 From 14180a6b0dee05e73fd193db28fd94b4ef3046d1 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 11 Jan 2010 15:13:55 -0500 Subject: More work on refreshing the focus cycle dialog when windows are added/removed from the valid focus order --- openbox/focus.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'openbox/focus.c') diff --git a/openbox/focus.c b/openbox/focus.c index c82c4f62..36d754f4 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -90,6 +90,9 @@ void focus_set_client(ObClient *client) push_to_top(client); /* remove hiliting from the window when it gets focused */ client_hilite(client, FALSE); + + /* make sure the focus cycle popup shows things in the right order */ + focus_cycle_reorder(); } /* set the NET_ACTIVE_WINDOW hint, but preserve it on shutdown */ @@ -98,9 +101,6 @@ void focus_set_client(ObClient *client) PROP_SET32(RootWindow(ob_display, ob_screen), net_active_window, window, active); } - - /* make sure the focus cycle popup shows things in the right order */ - focus_cycle_reorder(); } static ObClient* focus_fallback_target(gboolean allow_refocus, @@ -201,7 +201,7 @@ void focus_order_add_new(ObClient *c) focus_order_to_top(c); else { g_assert(!g_list_find(focus_order, c)); - /* if there are any iconic windows, put this above them in the order, + /* if there are only iconic windows, put this above them in the order, but if there are not, then put it under the currently focused one */ if (focus_order && ((ObClient*)focus_order->data)->iconic) focus_order = g_list_insert(focus_order, c, 0); @@ -209,14 +209,20 @@ void focus_order_add_new(ObClient *c) focus_order = g_list_insert(focus_order, c, 1); } - focus_cycle_add(c); + focus_cycle_addremove(c, TRUE); } void focus_order_remove(ObClient *c) { focus_order = g_list_remove(focus_order, c); - focus_cycle_remove(c); + focus_cycle_addremove(c, TRUE); +} + +void focus_order_like_new(struct _ObClient *c) +{ + focus_order = g_list_remove(focus_order, c); + focus_order_add_new(c); } void focus_order_to_top(ObClient *c) @@ -232,6 +238,8 @@ void focus_order_to_top(ObClient *c) it && !((ObClient*)it->data)->iconic; it = g_list_next(it)); focus_order = g_list_insert_before(focus_order, it, c); } + + focus_cycle_reorder(); } void focus_order_to_bottom(ObClient *c) @@ -247,6 +255,8 @@ void focus_order_to_bottom(ObClient *c) it && !((ObClient*)it->data)->iconic; it = g_list_next(it)); focus_order = g_list_insert_before(focus_order, it, c); } + + focus_cycle_reorder(); } ObClient *focus_order_find_first(guint desktop) @@ -292,6 +302,10 @@ gboolean focus_valid_target(ObClient *ft, gboolean desktop_windows, gboolean user_request) { + /* NOTE: if any of these things change on a client, then they should call + focus_cycle_addremove() to make sure the client is not shown/hidden + when it should not be */ + gboolean ok = FALSE; /* see if the window is still managed or is going away */ -- cgit v1.2.3