stack-tracker: Fix coding style of meta_stack_op_apply()

Change tabs to spaces, clean up variable declarations.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1300
This commit is contained in:
Jonas Ådahl 2020-06-09 19:07:47 +02:00 committed by Georges Basile Stavracas Neto
parent 268336c21a
commit 74c0d9140c

View File

@ -365,103 +365,113 @@ move_window_above (GArray *stack,
static gboolean static gboolean
meta_stack_op_apply (MetaStackTracker *tracker, meta_stack_op_apply (MetaStackTracker *tracker,
MetaStackOp *op, MetaStackOp *op,
GArray *stack, GArray *stack,
ApplyFlags apply_flags) ApplyFlags apply_flags)
{ {
switch (op->any.type) switch (op->any.type)
{ {
case STACK_OP_ADD: case STACK_OP_ADD:
{ {
int old_pos;
if (META_STACK_ID_IS_X11 (op->add.window) && if (META_STACK_ID_IS_X11 (op->add.window) &&
(apply_flags & NO_RESTACK_X_WINDOWS) != 0) (apply_flags & NO_RESTACK_X_WINDOWS) != 0)
return FALSE; return FALSE;
int old_pos = find_window (stack, op->add.window); old_pos = find_window (stack, op->add.window);
if (old_pos >= 0) if (old_pos >= 0)
{ {
g_warning ("STACK_OP_ADD: window %s already in stack", g_warning ("STACK_OP_ADD: window %s already in stack",
get_window_desc (tracker, op->add.window)); get_window_desc (tracker, op->add.window));
return FALSE; return FALSE;
} }
g_array_append_val (stack, op->add.window); g_array_append_val (stack, op->add.window);
return TRUE; return TRUE;
} }
case STACK_OP_REMOVE: case STACK_OP_REMOVE:
{ {
int old_pos;
if (META_STACK_ID_IS_X11 (op->remove.window) && if (META_STACK_ID_IS_X11 (op->remove.window) &&
(apply_flags & NO_RESTACK_X_WINDOWS) != 0) (apply_flags & NO_RESTACK_X_WINDOWS) != 0)
return FALSE; return FALSE;
int old_pos = find_window (stack, op->remove.window); old_pos = find_window (stack, op->remove.window);
if (old_pos < 0) if (old_pos < 0)
{ {
g_warning ("STACK_OP_REMOVE: window %s not in stack", g_warning ("STACK_OP_REMOVE: window %s not in stack",
get_window_desc (tracker, op->remove.window)); get_window_desc (tracker, op->remove.window));
return FALSE; return FALSE;
} }
g_array_remove_index (stack, old_pos); g_array_remove_index (stack, old_pos);
return TRUE; return TRUE;
} }
case STACK_OP_RAISE_ABOVE: case STACK_OP_RAISE_ABOVE:
{ {
int old_pos = find_window (stack, op->raise_above.window); int old_pos;
int above_pos; int above_pos;
if (old_pos < 0)
{ old_pos = find_window (stack, op->raise_above.window);
g_warning ("STACK_OP_RAISE_ABOVE: window %s not in stack", if (old_pos < 0)
get_window_desc (tracker, op->raise_above.window)); {
return FALSE; g_warning ("STACK_OP_RAISE_ABOVE: window %s not in stack",
} get_window_desc (tracker, op->raise_above.window));
return FALSE;
}
if (op->raise_above.sibling) if (op->raise_above.sibling)
{ {
above_pos = find_window (stack, op->raise_above.sibling); above_pos = find_window (stack, op->raise_above.sibling);
if (above_pos < 0) if (above_pos < 0)
{ {
g_warning ("STACK_OP_RAISE_ABOVE: sibling window %s not in stack", g_warning ("STACK_OP_RAISE_ABOVE: sibling window %s not in stack",
get_window_desc (tracker, op->raise_above.sibling)); get_window_desc (tracker, op->raise_above.sibling));
return FALSE; return FALSE;
} }
} }
else else
{ {
above_pos = -1; above_pos = -1;
} }
return move_window_above (stack, op->raise_above.window, old_pos, above_pos, return move_window_above (stack, op->raise_above.window, old_pos, above_pos,
apply_flags); apply_flags);
} }
case STACK_OP_LOWER_BELOW: case STACK_OP_LOWER_BELOW:
{ {
int old_pos = find_window (stack, op->lower_below.window); int old_pos;
int above_pos; int above_pos;
if (old_pos < 0)
{ old_pos = find_window (stack, op->raise_above.window);
g_warning ("STACK_OP_LOWER_BELOW: window %s not in stack", if (old_pos < 0)
get_window_desc (tracker, op->lower_below.window)); {
return FALSE; g_warning ("STACK_OP_LOWER_BELOW: window %s not in stack",
} get_window_desc (tracker, op->lower_below.window));
return FALSE;
}
if (op->lower_below.sibling) if (op->lower_below.sibling)
{ {
int below_pos = find_window (stack, op->lower_below.sibling); int below_pos;
if (below_pos < 0)
{
g_warning ("STACK_OP_LOWER_BELOW: sibling window %s not in stack",
get_window_desc (tracker, op->lower_below.sibling));
return FALSE;
}
above_pos = below_pos - 1; below_pos = find_window (stack, op->lower_below.sibling);
} if (below_pos < 0)
else {
{ g_warning ("STACK_OP_LOWER_BELOW: sibling window %s not in stack",
above_pos = stack->len - 1; get_window_desc (tracker, op->lower_below.sibling));
} return FALSE;
}
return move_window_above (stack, op->lower_below.window, old_pos, above_pos, above_pos = below_pos - 1;
}
else
{
above_pos = stack->len - 1;
}
return move_window_above (stack, op->lower_below.window, old_pos, above_pos,
apply_flags); apply_flags);
} }
} }