From 02e3eb8de82303f92f8ba549d8bceb0c4704f7ab Mon Sep 17 00:00:00 2001 From: Mattia Formichetti Date: Mon, 16 Dec 2024 22:19:08 +0100 Subject: [PATCH] core: Drop meta_stack_windows_cmp and derived functions Since these will not be used from now on, we can finally clean up meta_stack_windows_cmp, window_stack_cmp and meta_display_stack_cmp. Now the only comparison function is meta_window_stack_position_compare. Part-of: --- src/core/display-private.h | 4 ---- src/core/display.c | 21 --------------------- src/core/stack.c | 21 --------------------- src/core/stack.h | 23 ----------------------- 4 files changed, 69 deletions(-) diff --git a/src/core/display-private.h b/src/core/display-private.h index 15f3e38ee..bcfee4918 100644 --- a/src/core/display-private.h +++ b/src/core/display-private.h @@ -196,10 +196,6 @@ MetaDisplay * meta_display_new (MetaContext *context, void meta_display_manage_all_xwindows (MetaDisplay *display); #endif -/* Utility function to compare the stacking of two windows */ -int meta_display_stack_cmp (const void *a, - const void *b); - /* Each MetaWindow is uniquely identified by a 64-bit "stamp"; unlike a * a MetaWindow *, a stamp will never be recycled */ diff --git a/src/core/display.c b/src/core/display.c index 7257231a7..ae66a0cfc 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -2383,16 +2383,6 @@ meta_display_unmanage_windows (MetaDisplay *display, g_slist_free (winlist); } -int -meta_display_stack_cmp (const void *a, - const void *b) -{ - MetaWindow *aw = (void*) a; - MetaWindow *bw = (void*) b; - - return meta_stack_windows_cmp (aw->display->stack, aw, bw); -} - /** * meta_display_sort_windows_by_stacking: * @display: a #MetaDisplay @@ -3552,17 +3542,6 @@ static const char* meta_window_queue_names[META_N_QUEUE_TYPES] = }; #endif -static int -window_stack_cmp (gconstpointer a, - gconstpointer b) -{ - MetaWindow *aw = (gpointer) a; - MetaWindow *bw = (gpointer) b; - - return meta_stack_windows_cmp (aw->display->stack, - aw, bw); -} - static void warn_on_incorrectly_unmanaged_window (MetaWindow *window) { diff --git a/src/core/stack.c b/src/core/stack.c index 4a8e1092f..e434cb276 100644 --- a/src/core/stack.c +++ b/src/core/stack.c @@ -942,27 +942,6 @@ meta_stack_list_windows (MetaStack *stack, return workspace_windows; } -int -meta_stack_windows_cmp (MetaStack *stack, - MetaWindow *window_a, - MetaWindow *window_b) -{ - /* -1 means a below b */ - - meta_stack_ensure_sorted (stack); /* update constraints, layers */ - - if (window_a->layer < window_b->layer) - return -1; - else if (window_a->layer > window_b->layer) - return 1; - else if (window_a->stack_position < window_b->stack_position) - return -1; - else if (window_a->stack_position > window_b->stack_position) - return 1; - else - return 0; /* not reached */ -} - void meta_window_set_stack_position_no_sync (MetaWindow *window, int position) diff --git a/src/core/stack.h b/src/core/stack.h index 3a677247a..898dc193c 100644 --- a/src/core/stack.h +++ b/src/core/stack.h @@ -257,29 +257,6 @@ MetaWindow * meta_stack_get_below (MetaStack *stack, GList * meta_stack_list_windows (MetaStack *stack, MetaWorkspace *workspace); -/** - * meta_stack_windows_cmp: - * @stack: A stack containing both window_a and window_b - * @window_a: A window - * @window_b Another window - * - * Comparison function for windows within a stack. This is not directly - * suitable for use within a standard comparison routine, because it takes - * an extra parameter; you will need to wrap it. - * - * (FIXME: We could remove the stack parameter and use the stack of - * the screen of window A, and complain if the stack of the screen of - * window B differed; then this would be a usable general comparison function.) - * - * (FIXME: Apparently identical to compare_window_position(). Merge them.) - * - * \return -1 if window_a is below window_b, honouring layers; 1 if it's - * above it; 0 if you passed in the same window twice! - */ -int meta_stack_windows_cmp (MetaStack *stack, - MetaWindow *window_a, - MetaWindow *window_b); - /** * meta_window_set_stack_position: * @window: The window which is moving.