|
|
79df40 |
From 599d5241c927ecc716dd5c45f3bf447701161980 Mon Sep 17 00:00:00 2001
|
|
|
79df40 |
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
|
79df40 |
Date: Tue, 9 Jun 2020 19:07:47 +0200
|
|
|
79df40 |
Subject: [PATCH 1/2] stack-tracker: Fix coding style of meta_stack_op_apply()
|
|
|
79df40 |
|
|
|
79df40 |
Change tabs to spaces, clean up variable declarations.
|
|
|
79df40 |
|
|
|
79df40 |
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1300
|
|
|
79df40 |
---
|
|
|
79df40 |
src/core/stack-tracker.c | 142 +++++++++++++++++++++------------------
|
|
|
79df40 |
1 file changed, 76 insertions(+), 66 deletions(-)
|
|
|
79df40 |
|
|
|
79df40 |
diff --git a/src/core/stack-tracker.c b/src/core/stack-tracker.c
|
|
|
79df40 |
index 82afd644a5..8f0164692f 100644
|
|
|
79df40 |
--- a/src/core/stack-tracker.c
|
|
|
79df40 |
+++ b/src/core/stack-tracker.c
|
|
|
79df40 |
@@ -356,103 +356,113 @@ move_window_above (GArray *stack,
|
|
|
79df40 |
static gboolean
|
|
|
79df40 |
meta_stack_op_apply (MetaStackTracker *tracker,
|
|
|
79df40 |
MetaStackOp *op,
|
|
|
79df40 |
- GArray *stack,
|
|
|
79df40 |
+ GArray *stack,
|
|
|
79df40 |
ApplyFlags apply_flags)
|
|
|
79df40 |
{
|
|
|
79df40 |
switch (op->any.type)
|
|
|
79df40 |
{
|
|
|
79df40 |
case STACK_OP_ADD:
|
|
|
79df40 |
{
|
|
|
79df40 |
+ int old_pos;
|
|
|
79df40 |
+
|
|
|
79df40 |
if (META_STACK_ID_IS_X11 (op->add.window) &&
|
|
|
79df40 |
(apply_flags & NO_RESTACK_X_WINDOWS) != 0)
|
|
|
79df40 |
return FALSE;
|
|
|
79df40 |
|
|
|
79df40 |
- int old_pos = find_window (stack, op->add.window);
|
|
|
79df40 |
- if (old_pos >= 0)
|
|
|
79df40 |
- {
|
|
|
79df40 |
- g_warning ("STACK_OP_ADD: window %s already in stack",
|
|
|
79df40 |
- get_window_desc (tracker, op->add.window));
|
|
|
79df40 |
- return FALSE;
|
|
|
79df40 |
- }
|
|
|
79df40 |
+ old_pos = find_window (stack, op->add.window);
|
|
|
79df40 |
+ if (old_pos >= 0)
|
|
|
79df40 |
+ {
|
|
|
79df40 |
+ g_warning ("STACK_OP_ADD: window %s already in stack",
|
|
|
79df40 |
+ get_window_desc (tracker, op->add.window));
|
|
|
79df40 |
+ return FALSE;
|
|
|
79df40 |
+ }
|
|
|
79df40 |
|
|
|
79df40 |
- g_array_append_val (stack, op->add.window);
|
|
|
79df40 |
- return TRUE;
|
|
|
79df40 |
+ g_array_append_val (stack, op->add.window);
|
|
|
79df40 |
+ return TRUE;
|
|
|
79df40 |
}
|
|
|
79df40 |
case STACK_OP_REMOVE:
|
|
|
79df40 |
{
|
|
|
79df40 |
+ int old_pos;
|
|
|
79df40 |
+
|
|
|
79df40 |
if (META_STACK_ID_IS_X11 (op->remove.window) &&
|
|
|
79df40 |
(apply_flags & NO_RESTACK_X_WINDOWS) != 0)
|
|
|
79df40 |
return FALSE;
|
|
|
79df40 |
|
|
|
79df40 |
- int old_pos = find_window (stack, op->remove.window);
|
|
|
79df40 |
- if (old_pos < 0)
|
|
|
79df40 |
- {
|
|
|
79df40 |
- g_warning ("STACK_OP_REMOVE: window %s not in stack",
|
|
|
79df40 |
- get_window_desc (tracker, op->remove.window));
|
|
|
79df40 |
- return FALSE;
|
|
|
79df40 |
- }
|
|
|
79df40 |
+ old_pos = find_window (stack, op->remove.window);
|
|
|
79df40 |
+ if (old_pos < 0)
|
|
|
79df40 |
+ {
|
|
|
79df40 |
+ g_warning ("STACK_OP_REMOVE: window %s not in stack",
|
|
|
79df40 |
+ get_window_desc (tracker, op->remove.window));
|
|
|
79df40 |
+ return FALSE;
|
|
|
79df40 |
+ }
|
|
|
79df40 |
|
|
|
79df40 |
- g_array_remove_index (stack, old_pos);
|
|
|
79df40 |
- return TRUE;
|
|
|
79df40 |
+ g_array_remove_index (stack, old_pos);
|
|
|
79df40 |
+ return TRUE;
|
|
|
79df40 |
}
|
|
|
79df40 |
case STACK_OP_RAISE_ABOVE:
|
|
|
79df40 |
{
|
|
|
79df40 |
- int old_pos = find_window (stack, op->raise_above.window);
|
|
|
79df40 |
- int above_pos;
|
|
|
79df40 |
- if (old_pos < 0)
|
|
|
79df40 |
- {
|
|
|
79df40 |
- g_warning ("STACK_OP_RAISE_ABOVE: window %s not in stack",
|
|
|
79df40 |
- get_window_desc (tracker, op->raise_above.window));
|
|
|
79df40 |
- return FALSE;
|
|
|
79df40 |
- }
|
|
|
79df40 |
+ int old_pos;
|
|
|
79df40 |
+ int above_pos;
|
|
|
79df40 |
+
|
|
|
79df40 |
+ old_pos = find_window (stack, op->raise_above.window);
|
|
|
79df40 |
+ if (old_pos < 0)
|
|
|
79df40 |
+ {
|
|
|
79df40 |
+ g_warning ("STACK_OP_RAISE_ABOVE: window %s not in stack",
|
|
|
79df40 |
+ get_window_desc (tracker, op->raise_above.window));
|
|
|
79df40 |
+ return FALSE;
|
|
|
79df40 |
+ }
|
|
|
79df40 |
|
|
|
79df40 |
if (op->raise_above.sibling)
|
|
|
79df40 |
- {
|
|
|
79df40 |
- above_pos = find_window (stack, op->raise_above.sibling);
|
|
|
79df40 |
- if (above_pos < 0)
|
|
|
79df40 |
- {
|
|
|
79df40 |
- g_warning ("STACK_OP_RAISE_ABOVE: sibling window %s not in stack",
|
|
|
79df40 |
+ {
|
|
|
79df40 |
+ above_pos = find_window (stack, op->raise_above.sibling);
|
|
|
79df40 |
+ if (above_pos < 0)
|
|
|
79df40 |
+ {
|
|
|
79df40 |
+ g_warning ("STACK_OP_RAISE_ABOVE: sibling window %s not in stack",
|
|
|
79df40 |
get_window_desc (tracker, op->raise_above.sibling));
|
|
|
79df40 |
- return FALSE;
|
|
|
79df40 |
- }
|
|
|
79df40 |
- }
|
|
|
79df40 |
- else
|
|
|
79df40 |
- {
|
|
|
79df40 |
- above_pos = -1;
|
|
|
79df40 |
- }
|
|
|
79df40 |
-
|
|
|
79df40 |
- return move_window_above (stack, op->raise_above.window, old_pos, above_pos,
|
|
|
79df40 |
+ return FALSE;
|
|
|
79df40 |
+ }
|
|
|
79df40 |
+ }
|
|
|
79df40 |
+ else
|
|
|
79df40 |
+ {
|
|
|
79df40 |
+ above_pos = -1;
|
|
|
79df40 |
+ }
|
|
|
79df40 |
+
|
|
|
79df40 |
+ return move_window_above (stack, op->raise_above.window, old_pos, above_pos,
|
|
|
79df40 |
apply_flags);
|
|
|
79df40 |
}
|
|
|
79df40 |
case STACK_OP_LOWER_BELOW:
|
|
|
79df40 |
{
|
|
|
79df40 |
- int old_pos = find_window (stack, op->lower_below.window);
|
|
|
79df40 |
- int above_pos;
|
|
|
79df40 |
- if (old_pos < 0)
|
|
|
79df40 |
- {
|
|
|
79df40 |
- g_warning ("STACK_OP_LOWER_BELOW: window %s not in stack",
|
|
|
79df40 |
- get_window_desc (tracker, op->lower_below.window));
|
|
|
79df40 |
- return FALSE;
|
|
|
79df40 |
- }
|
|
|
79df40 |
+ int old_pos;
|
|
|
79df40 |
+ int above_pos;
|
|
|
79df40 |
+
|
|
|
79df40 |
+ old_pos = find_window (stack, op->raise_above.window);
|
|
|
79df40 |
+ if (old_pos < 0)
|
|
|
79df40 |
+ {
|
|
|
79df40 |
+ g_warning ("STACK_OP_LOWER_BELOW: window %s not in stack",
|
|
|
79df40 |
+ get_window_desc (tracker, op->lower_below.window));
|
|
|
79df40 |
+ return FALSE;
|
|
|
79df40 |
+ }
|
|
|
79df40 |
|
|
|
79df40 |
if (op->lower_below.sibling)
|
|
|
79df40 |
- {
|
|
|
79df40 |
- int below_pos = find_window (stack, op->lower_below.sibling);
|
|
|
79df40 |
- if (below_pos < 0)
|
|
|
79df40 |
- {
|
|
|
79df40 |
- g_warning ("STACK_OP_LOWER_BELOW: sibling window %s not in stack",
|
|
|
79df40 |
- get_window_desc (tracker, op->lower_below.sibling));
|
|
|
79df40 |
- return FALSE;
|
|
|
79df40 |
- }
|
|
|
79df40 |
-
|
|
|
79df40 |
- above_pos = below_pos - 1;
|
|
|
79df40 |
- }
|
|
|
79df40 |
- else
|
|
|
79df40 |
- {
|
|
|
79df40 |
- above_pos = stack->len - 1;
|
|
|
79df40 |
- }
|
|
|
79df40 |
-
|
|
|
79df40 |
- return move_window_above (stack, op->lower_below.window, old_pos, above_pos,
|
|
|
79df40 |
+ {
|
|
|
79df40 |
+ int below_pos;
|
|
|
79df40 |
+
|
|
|
79df40 |
+ below_pos = find_window (stack, op->lower_below.sibling);
|
|
|
79df40 |
+ if (below_pos < 0)
|
|
|
79df40 |
+ {
|
|
|
79df40 |
+ g_warning ("STACK_OP_LOWER_BELOW: sibling window %s not in stack",
|
|
|
79df40 |
+ get_window_desc (tracker, op->lower_below.sibling));
|
|
|
79df40 |
+ return FALSE;
|
|
|
79df40 |
+ }
|
|
|
79df40 |
+
|
|
|
79df40 |
+ above_pos = below_pos - 1;
|
|
|
79df40 |
+ }
|
|
|
79df40 |
+ else
|
|
|
79df40 |
+ {
|
|
|
79df40 |
+ above_pos = stack->len - 1;
|
|
|
79df40 |
+ }
|
|
|
79df40 |
+
|
|
|
79df40 |
+ return move_window_above (stack, op->lower_below.window, old_pos, above_pos,
|
|
|
79df40 |
apply_flags);
|
|
|
79df40 |
}
|
|
|
79df40 |
}
|
|
|
79df40 |
--
|
|
|
79df40 |
2.26.2
|
|
|
79df40 |
|