diff options
author | Olivier Fourdan <fourdan.olivier@wanadoo.fr> | 2005-11-12 13:49:27 +0000 |
---|---|---|
committer | Olivier Fourdan <fourdan.olivier@wanadoo.fr> | 2005-11-12 13:49:27 +0000 |
commit | b27869c7758e1d893ec4b6c4f729c912f4c9980a (patch) | |
tree | d59a09381394c273b36e3fb208e4c8f8c6d9e992 /src/focus.c | |
parent | 21fef191c18fea21f0a09a3e6e786f5d4a37eab9 (diff) | |
download | xfwm4-b27869c7758e1d893ec4b6c4f729c912f4c9980a.tar.gz |
Fix stacking vs. focus stealing prevention.
(Old svn revision: 18834)
Diffstat (limited to 'src/focus.c')
-rw-r--r-- | src/focus.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/focus.c b/src/focus.c index 44038efcf..04e2f4229 100644 --- a/src/focus.c +++ b/src/focus.c @@ -129,23 +129,23 @@ clientFocusNew(Client * c) gboolean give_focus; gboolean prevent_focus_stealing; - g_return_if_fail (c != NULL); + g_return_val_if_fail (c != NULL, FALSE); - if (!clientAcceptFocus (c) || (c->type & WINDOW_TYPE_DONT_FOCUS)) - { - return FALSE; - } screen_info = c->screen_info; display_info = screen_info->display_info; give_focus = screen_info->params->focus_new; prevent_focus_stealing = screen_info->params->prevent_focus_stealing; /* Try to avoid focus stealing */ - if ((client_focus) && (prevent_focus_stealing)) + if (!clientAcceptFocus (c) || (c->type & WINDOW_TYPE_DONT_FOCUS)) + { + give_focus = FALSE; + } + else if ((client_focus) && (prevent_focus_stealing)) { if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_STARTUP_TIME) && (c->user_time == (Time) 0)) { - TRACE ("Given startup time is 0, no focusing"); + TRACE ("Given startup time is 0, not focusing"); give_focus = FALSE; } else if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_STARTUP_TIME | CLIENT_FLAG_HAS_USER_TIME)) @@ -158,7 +158,6 @@ clientFocusNew(Client * c) } } - clientGrabMouseButton (c); if ((give_focus) || FLAG_TEST(c->flags, CLIENT_FLAG_STATE_MODAL)) { give_focus = TRUE; @@ -179,7 +178,7 @@ clientFocusNew(Client * c) else { Client *c2 = clientGetFocus(); - if (c2) + if ((c2) && (c2->win_layer == c->win_layer)) { clientSortRing(c); clientLower (c, c2->frame); @@ -193,6 +192,7 @@ clientFocusNew(Client * c) clientShow (c, TRUE); FLAG_SET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION); clientSetNetState (c); + clientGrabMouseButton (c); } return (give_focus); |