[mutter/wip/carlosg/xdnd-drop-focus: 2/2] stack: Add prerequisites to some stack API




commit fa31c97aec925056ef04162b2c172a7f5e74af68
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Dec 1 12:22:12 2021 +0100

    stack: Add prerequisites to some stack API
    
    Passing a NULL workspace does not make sense, since it silently
    returns no windows. Mandate that a workspace is explicitly requested,
    and while at it check the other arguments as well.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2124>

 src/core/stack.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/core/stack.c b/src/core/stack.c
index 645328dd9e..1af59f5be5 100644
--- a/src/core/stack.c
+++ b/src/core/stack.c
@@ -1088,6 +1088,10 @@ meta_stack_get_default_focus_window_at_point (MetaStack     *stack,
                                               int            root_x,
                                               int            root_y)
 {
+  g_return_val_if_fail (META_IS_STACK (stack), NULL);
+  g_return_val_if_fail (META_IS_WORKSPACE (workspace), NULL);
+  g_return_val_if_fail (!not_this_one || META_IS_WINDOW (not_this_one), NULL);
+
   return get_default_focus_window (stack, workspace, not_this_one,
                                    TRUE, root_x, root_y);
 }
@@ -1097,6 +1101,10 @@ meta_stack_get_default_focus_window (MetaStack     *stack,
                                      MetaWorkspace *workspace,
                                      MetaWindow    *not_this_one)
 {
+  g_return_val_if_fail (META_IS_STACK (stack), NULL);
+  g_return_val_if_fail (META_IS_WORKSPACE (workspace), NULL);
+  g_return_val_if_fail (!not_this_one || META_IS_WINDOW (not_this_one), NULL);
+
   return get_default_focus_window (stack, workspace, not_this_one,
                                    FALSE, 0, 0);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]