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

This commit is contained in:
Jonas Ådahl 2018-10-24 14:38:12 +02:00
parent 180bb02fa5
commit 4f3de88b3d

View File

@ -560,31 +560,27 @@ handle_popup_parent_destroyed (struct wl_listener *listener,
} }
static void static void
fill_states (struct wl_array *states, add_state_value (struct wl_array *states,
MetaWindow *window) enum zxdg_toplevel_v6_state state)
{ {
uint32_t *s; 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)) if (META_WINDOW_MAXIMIZED (window))
{ add_state_value (states, ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED);
s = wl_array_add (states, sizeof *s);
*s = ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED;
}
if (meta_window_is_fullscreen (window)) if (meta_window_is_fullscreen (window))
{ add_state_value (states, ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN);
s = wl_array_add (states, sizeof *s);
*s = ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN;
}
if (meta_grab_op_is_resizing (window->display->grab_op)) if (meta_grab_op_is_resizing (window->display->grab_op))
{ add_state_value (states, ZXDG_TOPLEVEL_V6_STATE_RESIZING);
s = wl_array_add (states, sizeof *s);
*s = ZXDG_TOPLEVEL_V6_STATE_RESIZING;
}
if (meta_window_appears_focused (window)) if (meta_window_appears_focused (window))
{ add_state_value (states, ZXDG_TOPLEVEL_V6_STATE_ACTIVATED);
s = wl_array_add (states, sizeof *s);
*s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED;
}
} }
static void static void