summaryrefslogtreecommitdiff
path: root/openbox/client.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-05-15 04:32:59 +0000
committerDana Jansens <danakj@orodu.net>2007-05-15 04:32:59 +0000
commit361bf6af5c7de09f30f3cf4a220b3f84a3fe451d (patch)
treef028b6185726e8ebf0518cac40477ac7f9b75d29 /openbox/client.c
parentf5597c060e0fda3b8fffc19c9b8974dde463a962 (diff)
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.
Diffstat (limited to 'openbox/client.c')
-rw-r--r--openbox/client.c22
1 files changed, 9 insertions, 13 deletions
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)