mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
Remove unused meta_stack_get/set_positions
Unused since 9e51d98f4a
("Remove tabpopup and friends").
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3154>
This commit is contained in:
parent
f2f9e63568
commit
b0c6864b28
105
src/core/stack.c
105
src/core/stack.c
@ -1056,111 +1056,6 @@ meta_stack_windows_cmp (MetaStack *stack,
|
||||
return 0; /* not reached */
|
||||
}
|
||||
|
||||
static int
|
||||
compare_just_window_stack_position (void *a,
|
||||
void *b)
|
||||
{
|
||||
MetaWindow *window_a = a;
|
||||
MetaWindow *window_b = b;
|
||||
|
||||
if (window_a->stack_position < window_b->stack_position)
|
||||
return -1; /* move window_a earlier in list */
|
||||
else if (window_a->stack_position > window_b->stack_position)
|
||||
return 1;
|
||||
else
|
||||
return 0; /* not reached */
|
||||
}
|
||||
|
||||
GList *
|
||||
meta_stack_get_positions (MetaStack *stack)
|
||||
{
|
||||
GList *tmp;
|
||||
|
||||
/* Make sure to handle any adds or removes */
|
||||
stack_ensure_sorted (stack);
|
||||
|
||||
tmp = g_list_copy (stack->sorted);
|
||||
tmp = g_list_sort (tmp, (GCompareFunc) compare_just_window_stack_position);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static gint
|
||||
compare_pointers (gconstpointer a,
|
||||
gconstpointer b)
|
||||
{
|
||||
if (a > b)
|
||||
return 1;
|
||||
else if (a < b)
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
lists_contain_same_windows (GList *a,
|
||||
GList *b)
|
||||
{
|
||||
GList *copy1, *copy2;
|
||||
GList *tmp1, *tmp2;
|
||||
|
||||
if (g_list_length (a) != g_list_length (b))
|
||||
return FALSE;
|
||||
|
||||
tmp1 = copy1 = g_list_sort (g_list_copy (a), compare_pointers);
|
||||
tmp2 = copy2 = g_list_sort (g_list_copy (b), compare_pointers);
|
||||
|
||||
while (tmp1 && tmp1->data == tmp2->data) /* tmp2 is non-NULL if tmp1 is */
|
||||
{
|
||||
tmp1 = tmp1->next;
|
||||
tmp2 = tmp2->next;
|
||||
}
|
||||
|
||||
g_list_free (copy1);
|
||||
g_list_free (copy2);
|
||||
|
||||
return (tmp1 == NULL); /* tmp2 is non-NULL if tmp1 is */
|
||||
}
|
||||
|
||||
void
|
||||
meta_stack_set_positions (MetaStack *stack,
|
||||
GList *windows)
|
||||
{
|
||||
int i;
|
||||
GList *tmp;
|
||||
|
||||
/* Make sure any adds or removes aren't in limbo -- is this needed? */
|
||||
stack_ensure_sorted (stack);
|
||||
|
||||
if (!lists_contain_same_windows (windows, stack->sorted))
|
||||
{
|
||||
meta_warning ("This list of windows has somehow changed; not resetting "
|
||||
"positions of the windows.");
|
||||
return;
|
||||
}
|
||||
|
||||
g_list_free (stack->sorted);
|
||||
stack->sorted = g_list_copy (windows);
|
||||
|
||||
stack->need_resort = TRUE;
|
||||
stack->need_constrain = TRUE;
|
||||
|
||||
i = 0;
|
||||
tmp = windows;
|
||||
while (tmp != NULL)
|
||||
{
|
||||
MetaWindow *w = tmp->data;
|
||||
w->stack_position = i++;
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
meta_topic (META_DEBUG_STACK,
|
||||
"Reset the stack positions of (nearly) all windows");
|
||||
|
||||
meta_stack_changed (stack);
|
||||
meta_stack_update_window_tile_matches (stack, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_set_stack_position_no_sync (MetaWindow *window,
|
||||
int position)
|
||||
|
@ -309,31 +309,5 @@ int meta_stack_windows_cmp (MetaStack *stack,
|
||||
void meta_window_set_stack_position (MetaWindow *window,
|
||||
int position);
|
||||
|
||||
/**
|
||||
* meta_stack_get_positions:
|
||||
* @stack: The stack to examine.
|
||||
*
|
||||
* Returns the current stack state, allowing rudimentary transactions.
|
||||
*
|
||||
* Returns: (transfer container) (element-type Meta.Window):
|
||||
* An opaque #GList representing the current stack sort order;
|
||||
* it is the caller's responsibility to free it.
|
||||
* Pass this to meta_stack_set_positions() later if you want to restore
|
||||
* the state to where it was when you called this function.
|
||||
*/
|
||||
GList * meta_stack_get_positions (MetaStack *stack);
|
||||
|
||||
/**
|
||||
* meta_stack_set_positions:
|
||||
* @stack: The stack to roll back.
|
||||
* @windows: The list returned from meta_stack_get_positions().
|
||||
*
|
||||
* Rolls back a transaction, given the list returned from
|
||||
* meta_stack_get_positions().
|
||||
*
|
||||
*/
|
||||
void meta_stack_set_positions (MetaStack *stack,
|
||||
GList *windows);
|
||||
|
||||
void meta_stack_update_window_tile_matches (MetaStack *stack,
|
||||
MetaWorkspace *workspace);
|
||||
|
Loading…
Reference in New Issue
Block a user