[mutter/wayland] stack: Flatten and simplify the default focus window logic
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wayland] stack: Flatten and simplify the default focus window logic
- Date: Tue, 18 Mar 2014 14:26:20 +0000 (UTC)
commit f11bf445259913a56462cf2239e875e5e858ac98
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Mar 18 10:17:34 2014 -0400
stack: Flatten and simplify the default focus window logic
src/core/stack.c | 81 +++++++++++++++++++++++++++--------------------------
1 files changed, 41 insertions(+), 40 deletions(-)
---
diff --git a/src/core/stack.c b/src/core/stack.c
index 6cf078c..4a34811 100644
--- a/src/core/stack.c
+++ b/src/core/stack.c
@@ -1705,8 +1705,8 @@ get_default_focus_window (MetaStack *stack,
MetaWindow *topmost_in_group;
MetaWindow *topmost_overall;
MetaGroup *not_this_one_group;
- GList *link;
-
+ GList *l;
+
transient_parent = NULL;
topmost_in_group = NULL;
topmost_overall = NULL;
@@ -1718,49 +1718,50 @@ get_default_focus_window (MetaStack *stack,
stack_ensure_sorted (stack);
/* top of this layer is at the front of the list */
- link = stack->sorted;
-
- while (link)
+ for (l = stack->sorted; l != NULL; l = l->next)
{
- MetaWindow *window = link->data;
+ MetaWindow *window = l->data;
- if (window &&
- window != not_this_one &&
- (window->unmaps_pending == 0) &&
- !window->minimized &&
- (window->input || window->take_focus) &&
- (workspace == NULL ||
- meta_window_located_on_workspace (window, workspace)))
- {
- if (not_this_one != NULL)
- {
- if (transient_parent == NULL &&
- not_this_one->xtransient_for != None &&
- not_this_one->xtransient_for == window->xwindow &&
- (!must_be_at_point ||
- window_contains_point (window, root_x, root_y)))
- transient_parent = window;
-
- if (topmost_in_group == NULL &&
- not_this_one_group != NULL &&
- not_this_one_group == meta_window_get_group (window) &&
- (!must_be_at_point ||
- window_contains_point (window, root_x, root_y)))
- topmost_in_group = window;
- }
+ if (!window)
+ continue;
- if (topmost_overall == NULL &&
- window->type != META_WINDOW_DOCK &&
- (!must_be_at_point ||
- window_contains_point (window, root_x, root_y)))
- topmost_overall = window;
+ if (window == not_this_one)
+ continue;
- /* We could try to bail out early here for efficiency in
- * some cases, but it's just not worth the code.
- */
+ if (window->unmaps_pending > 0)
+ continue;
+
+ if (window->minimized)
+ continue;
+
+ if (!(window->input || window->take_focus))
+ continue;
+
+ if (workspace != NULL && !meta_window_located_on_workspace (window, workspace))
+ continue;
+
+ if (must_be_at_point && !window_contains_point (window, root_x, root_y))
+ continue;
+
+ if (not_this_one != NULL)
+ {
+ if (transient_parent == NULL &&
+ not_this_one->xtransient_for != None &&
+ not_this_one->xtransient_for == window->xwindow)
+ transient_parent = window;
+
+ if (topmost_in_group == NULL &&
+ not_this_one_group != NULL &&
+ not_this_one_group == meta_window_get_group (window))
+ topmost_in_group = window;
}
- link = link->next;
+ if (topmost_overall == NULL && window->type != META_WINDOW_DOCK)
+ topmost_overall = window;
+
+ /* We could try to bail out early here for efficiency in
+ * some cases, but it's just not worth the code.
+ */
}
if (transient_parent)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]