mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
wayland/gtk-shell: Use helper to fill state array
This commit is contained in:
parent
d59cf98690
commit
180bb02fa5
@ -201,12 +201,21 @@ send_configure_edges (MetaWaylandGtkSurface *gtk_surface,
|
|||||||
wl_array_release (&edge_states);
|
wl_array_release (&edge_states);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
add_state_value (struct wl_array *states,
|
||||||
|
enum gtk_surface1_state state)
|
||||||
|
{
|
||||||
|
uint32_t *s;
|
||||||
|
|
||||||
|
s = wl_array_add (states, sizeof *s);
|
||||||
|
*s = state;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fill_states (struct wl_array *states,
|
fill_states (struct wl_array *states,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
struct wl_resource *resource)
|
struct wl_resource *resource)
|
||||||
{
|
{
|
||||||
uint32_t *s;
|
|
||||||
int version;
|
int version;
|
||||||
|
|
||||||
version = wl_resource_get_version (resource);
|
version = wl_resource_get_version (resource);
|
||||||
@ -214,38 +223,23 @@ fill_states (struct wl_array *states,
|
|||||||
if (version < GTK_SURFACE1_CONFIGURE_EDGES_SINCE_VERSION &&
|
if (version < GTK_SURFACE1_CONFIGURE_EDGES_SINCE_VERSION &&
|
||||||
(window->tile_mode == META_TILE_LEFT ||
|
(window->tile_mode == META_TILE_LEFT ||
|
||||||
window->tile_mode == META_TILE_RIGHT))
|
window->tile_mode == META_TILE_RIGHT))
|
||||||
{
|
add_state_value (states, GTK_SURFACE1_STATE_TILED);
|
||||||
s = wl_array_add (states, sizeof *s);
|
|
||||||
*s = GTK_SURFACE1_STATE_TILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version >= GTK_SURFACE1_STATE_TILED_TOP_SINCE_VERSION &&
|
if (version >= GTK_SURFACE1_STATE_TILED_TOP_SINCE_VERSION &&
|
||||||
window->edge_constraints.top != META_EDGE_CONSTRAINT_NONE)
|
window->edge_constraints.top != META_EDGE_CONSTRAINT_NONE)
|
||||||
{
|
add_state_value (states, GTK_SURFACE1_STATE_TILED_TOP);
|
||||||
s = wl_array_add (states, sizeof *s);
|
|
||||||
*s = GTK_SURFACE1_STATE_TILED_TOP;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version >= GTK_SURFACE1_STATE_TILED_RIGHT_SINCE_VERSION &&
|
if (version >= GTK_SURFACE1_STATE_TILED_RIGHT_SINCE_VERSION &&
|
||||||
window->edge_constraints.right != META_EDGE_CONSTRAINT_NONE)
|
window->edge_constraints.right != META_EDGE_CONSTRAINT_NONE)
|
||||||
{
|
add_state_value (states, GTK_SURFACE1_STATE_TILED_RIGHT);
|
||||||
s = wl_array_add (states, sizeof *s);
|
|
||||||
*s = GTK_SURFACE1_STATE_TILED_RIGHT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version >= GTK_SURFACE1_STATE_TILED_BOTTOM_SINCE_VERSION &&
|
if (version >= GTK_SURFACE1_STATE_TILED_BOTTOM_SINCE_VERSION &&
|
||||||
window->edge_constraints.bottom != META_EDGE_CONSTRAINT_NONE)
|
window->edge_constraints.bottom != META_EDGE_CONSTRAINT_NONE)
|
||||||
{
|
add_state_value (states, GTK_SURFACE1_STATE_TILED_BOTTOM);
|
||||||
s = wl_array_add (states, sizeof *s);
|
|
||||||
*s = GTK_SURFACE1_STATE_TILED_BOTTOM;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version >= GTK_SURFACE1_STATE_TILED_LEFT_SINCE_VERSION &&
|
if (version >= GTK_SURFACE1_STATE_TILED_LEFT_SINCE_VERSION &&
|
||||||
window->edge_constraints.left != META_EDGE_CONSTRAINT_NONE)
|
window->edge_constraints.left != META_EDGE_CONSTRAINT_NONE)
|
||||||
{
|
add_state_value (states, GTK_SURFACE1_STATE_TILED_LEFT);
|
||||||
s = wl_array_add (states, sizeof *s);
|
|
||||||
*s = GTK_SURFACE1_STATE_TILED_LEFT;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user