From 361bf6af5c7de09f30f3cf4a220b3f84a3fe451d Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 15 May 2007 04:32:59 +0000 Subject: simplify focus handling a bit. no need to listen to focus going to the frame because if it ever does that, the window is unmapping and the frame will just unmap and send it to root. make focus fallback a lil more robust, it checks for errors when it sets focus on the window, and if an error occured it will focus the next option. --- openbox/client.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'openbox/client.c') diff --git a/openbox/client.c b/openbox/client.c index 837dd019..fa4aae95 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -2842,7 +2842,7 @@ void client_fullscreen(ObClient *self, gboolean fs) if (fs) { /* try focus us when we go into fullscreen mode */ - client_focus(self); + client_focus(self, FALSE); } } @@ -3336,10 +3336,8 @@ gboolean client_can_focus(ObClient *self) return TRUE; } -gboolean client_focus(ObClient *self) +gboolean client_focus(ObClient *self, gboolean checkinvalid) { - gboolean error; - /* choose the correct target */ self = client_focus_target(self); @@ -3365,8 +3363,9 @@ gboolean client_focus(ObClient *self) if (keyboard_interactively_grabbed()) keyboard_interactive_cancel(); - error = FALSE; - xerror_set_ignore(TRUE); + if (checkinvalid) + xerror_set_ignore(TRUE); + xerror_occured = FALSE; if (self->can_focus) { /* This can cause a BadMatch error with CurrentTime, or if an app @@ -3390,13 +3389,10 @@ gboolean client_focus(ObClient *self) XSendEvent(ob_display, self->window, FALSE, NoEventMask, &ce); } - /* This calls XSync, which will cause the FocusIn to come back to us. - That's important for desktop switches, since otherwise we'll have no - FocusIn on the queue and end up falling back again. */ - xerror_set_ignore(FALSE); - if (!xerror_occured) error = TRUE; + if (checkinvalid) + xerror_set_ignore(FALSE); - return !error; + return !xerror_occured; } /*! Present the client to the user. @@ -3430,7 +3426,7 @@ static void client_present(ObClient *self, gboolean here, gboolean raise) if (raise) stacking_raise(CLIENT_AS_WINDOW(self)); - client_focus(self); + client_focus(self, FALSE); } void client_activate(ObClient *self, gboolean here, gboolean user) -- cgit v1.2.3