From fe317164865f5a08e18bb0b4fa9519fa4ca48a45 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 11 Mar 2007 17:05:07 +0000 Subject: [PATCH] fallback to transient parents properly --- openbox/focus.c | 8 +++----- openbox/focus.h | 3 ++- openbox/screen.c | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/openbox/focus.c b/openbox/focus.c index 73cb6f52..a84d253a 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -244,14 +244,11 @@ static ObClient* focus_fallback_transient(ObClient *top, ObClient *old) return NULL; } -ObClient* focus_fallback_target(ObFocusFallbackType type) +ObClient* focus_fallback_target(ObFocusFallbackType type, ObClient *old) { GList *it; - ObClient *old = NULL; ObClient *target = NULL; - old = focus_client; - if ((type == OB_FOCUS_FALLBACK_UNFOCUSING || type == OB_FOCUS_FALLBACK_CLOSED) && old) { if (old->transient_for) { @@ -336,6 +333,7 @@ ObClient* focus_fallback_target(ObFocusFallbackType type) void focus_fallback(ObFocusFallbackType type) { ObClient *new; + ObClient *old = focus_client; /* unfocus any focused clients.. they can be focused by Pointer events and such, and then when I try focus them, I won't get a FocusIn event @@ -343,7 +341,7 @@ void focus_fallback(ObFocusFallbackType type) */ focus_set_client(NULL); - if ((new = focus_fallback_target(type))) + if ((new = focus_fallback_target(type, old))) client_focus(new); } diff --git a/openbox/focus.h b/openbox/focus.h index 1c95faa0..2846c978 100644 --- a/openbox/focus.h +++ b/openbox/focus.h @@ -53,7 +53,8 @@ typedef enum { OB_FOCUS_FALLBACK_NOFOCUS /*!< nothing has focus for some reason */ } ObFocusFallbackType; -struct _ObClient* focus_fallback_target(ObFocusFallbackType type); +struct _ObClient* focus_fallback_target(ObFocusFallbackType type, + struct _ObClient *old); /*! Call this when you need to focus something! */ void focus_fallback(ObFocusFallbackType type); diff --git a/openbox/screen.c b/openbox/screen.c index ca3e1273..d97a732b 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -465,7 +465,7 @@ void screen_set_desktop(guint num) event_ignore_queued_enters(); - focus_hilite = focus_fallback_target(OB_FOCUS_FALLBACK_NOFOCUS); + focus_hilite = focus_fallback_target(OB_FOCUS_FALLBACK_NOFOCUS, NULL); if (focus_hilite) { frame_adjust_focus(focus_hilite->frame, TRUE); -- 2.39.2