From dce6247e693a4880b1f77252460d445825efc13c Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 4 Aug 2006 19:56:42 +0000 Subject: [PATCH] really fix focus_last? --- openbox/action.c | 3 ++- openbox/client.c | 4 +++- openbox/focus.c | 3 ++- openbox/focus.h | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/openbox/action.c b/openbox/action.c index e98677b9..05a9e640 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -1071,7 +1071,8 @@ void action_focus(union ActionData *data) void action_unfocus (union ActionData *data) { - client_unfocus(data->client.any.c); + if (data->client.any.c == focus_client); + focus_fallback(OB_FOCUS_FALLBACK_UNFOCUSING); } void action_iconify(union ActionData *data) diff --git a/openbox/client.c b/openbox/client.c index fdc8c108..d4759bb9 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -2833,13 +2833,15 @@ gboolean client_focus(ObClient *self) return TRUE; } +/* Used when the current client is closed, focus_last will then prevent + * focus from going to the mouse pointer */ void client_unfocus(ObClient *self) { if (focus_client == self) { #ifdef DEBUG_FOCUS ob_debug("client_unfocus for %lx\n", self->window); #endif - focus_fallback(OB_FOCUS_FALLBACK_UNFOCUSING); + focus_fallback(OB_FOCUS_FALLBACK_CLOSED); } } diff --git a/openbox/focus.c b/openbox/focus.c index 07df3a56..6a56c2f8 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -249,7 +249,8 @@ ObClient* focus_fallback_target(ObFocusFallbackType type) old = focus_client; - if (type == OB_FOCUS_FALLBACK_UNFOCUSING && old) { + if ((type == OB_FOCUS_FALLBACK_UNFOCUSING + || type == OB_FOCUS_FALLBACK_CLOSED) && old) { if (old->transient_for) { gboolean trans = FALSE; diff --git a/openbox/focus.h b/openbox/focus.h index 345685c0..014350f9 100644 --- a/openbox/focus.h +++ b/openbox/focus.h @@ -48,6 +48,7 @@ void focus_set_client(struct _ObClient *client); typedef enum { OB_FOCUS_FALLBACK_UNFOCUSING, /*!< forcefully remove focus from the current window */ + OB_FOCUS_FALLBACK_CLOSED, /*!< closed the window with focus */ OB_FOCUS_FALLBACK_NOFOCUS /*!< nothing has focus for some reason */ } ObFocusFallbackType; -- 2.39.2