[mutter] wayland/legacy-xdg-shell: Use helper to fill state array



commit 4f3de88b3da6ca31c8359f373caacaad2a839bf1
Author: Jonas Ådahl <jadahl gmail com>
Date:   Wed Oct 24 14:38:12 2018 +0200

    wayland/legacy-xdg-shell: Use helper to fill state array

 src/wayland/meta-wayland-legacy-xdg-shell.c | 32 +++++++++++++----------------
 1 file changed, 14 insertions(+), 18 deletions(-)
---
diff --git a/src/wayland/meta-wayland-legacy-xdg-shell.c b/src/wayland/meta-wayland-legacy-xdg-shell.c
index a88eaf544..9c7dbf373 100644
--- a/src/wayland/meta-wayland-legacy-xdg-shell.c
+++ b/src/wayland/meta-wayland-legacy-xdg-shell.c
@@ -560,31 +560,27 @@ handle_popup_parent_destroyed (struct wl_listener *listener,
 }
 
 static void
-fill_states (struct wl_array *states,
-             MetaWindow      *window)
+add_state_value (struct wl_array             *states,
+                 enum zxdg_toplevel_v6_state  state)
 {
   uint32_t *s;
 
+  s = wl_array_add (states, sizeof *s);
+  *s = state;
+}
+
+static void
+fill_states (struct wl_array *states,
+             MetaWindow      *window)
+{
   if (META_WINDOW_MAXIMIZED (window))
-    {
-      s = wl_array_add (states, sizeof *s);
-      *s = ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED;
-    }
+    add_state_value (states, ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED);
   if (meta_window_is_fullscreen (window))
-    {
-      s = wl_array_add (states, sizeof *s);
-      *s = ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN;
-    }
+    add_state_value (states, ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN);
   if (meta_grab_op_is_resizing (window->display->grab_op))
-    {
-      s = wl_array_add (states, sizeof *s);
-      *s = ZXDG_TOPLEVEL_V6_STATE_RESIZING;
-    }
+    add_state_value (states, ZXDG_TOPLEVEL_V6_STATE_RESIZING);
   if (meta_window_appears_focused (window))
-    {
-      s = wl_array_add (states, sizeof *s);
-      *s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED;
-    }
+    add_state_value (states, ZXDG_TOPLEVEL_V6_STATE_ACTIVATED);
 }
 
 static void


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