tests/wayland/client/utils: Add way to mark surface as opaque
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3475>
This commit is contained in:
parent
594cdc5b49
commit
f23e1218e3
@ -550,11 +550,16 @@ handle_xdg_surface_configure (void *data,
|
|||||||
uint32_t serial)
|
uint32_t serial)
|
||||||
{
|
{
|
||||||
WaylandSurface *surface = data;
|
WaylandSurface *surface = data;
|
||||||
|
struct wl_region *opaque_region;
|
||||||
|
|
||||||
draw_surface (surface->display,
|
draw_surface (surface->display,
|
||||||
surface->wl_surface,
|
surface->wl_surface,
|
||||||
surface->width, surface->height,
|
surface->width, surface->height,
|
||||||
surface->color);
|
surface->color);
|
||||||
|
opaque_region = wl_compositor_create_region (surface->display->compositor);
|
||||||
|
wl_region_add (opaque_region, 0, 0, surface->width, surface->height);
|
||||||
|
wl_surface_set_opaque_region (surface->wl_surface, opaque_region);
|
||||||
|
wl_region_destroy (opaque_region);
|
||||||
|
|
||||||
xdg_surface_ack_configure (xdg_surface, serial);
|
xdg_surface_ack_configure (xdg_surface, serial);
|
||||||
wl_surface_commit (surface->wl_surface);
|
wl_surface_commit (surface->wl_surface);
|
||||||
@ -631,6 +636,12 @@ wayland_surface_has_state (WaylandSurface *surface,
|
|||||||
return g_hash_table_contains (surface->current_state, GUINT_TO_POINTER (state));
|
return g_hash_table_contains (surface->current_state, GUINT_TO_POINTER (state));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wayland_surface_set_opaque (WaylandSurface *surface)
|
||||||
|
{
|
||||||
|
surface->is_opaque = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
lookup_property_value (WaylandDisplay *display,
|
lookup_property_value (WaylandDisplay *display,
|
||||||
const char *name)
|
const char *name)
|
||||||
|
@ -79,6 +79,7 @@ typedef struct _WaylandSurface
|
|||||||
int height;
|
int height;
|
||||||
|
|
||||||
uint32_t color;
|
uint32_t color;
|
||||||
|
gboolean is_opaque;
|
||||||
} WaylandSurface;
|
} WaylandSurface;
|
||||||
|
|
||||||
#define WAYLAND_TYPE_SURFACE (wayland_surface_get_type ())
|
#define WAYLAND_TYPE_SURFACE (wayland_surface_get_type ())
|
||||||
@ -109,6 +110,8 @@ WaylandSurface * wayland_surface_new (WaylandDisplay *display,
|
|||||||
gboolean wayland_surface_has_state (WaylandSurface *surface,
|
gboolean wayland_surface_has_state (WaylandSurface *surface,
|
||||||
enum xdg_toplevel_state state);
|
enum xdg_toplevel_state state);
|
||||||
|
|
||||||
|
void wayland_surface_set_opaque (WaylandSurface *surface);
|
||||||
|
|
||||||
void draw_surface (WaylandDisplay *display,
|
void draw_surface (WaylandDisplay *display,
|
||||||
struct wl_surface *surface,
|
struct wl_surface *surface,
|
||||||
int width,
|
int width,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user