diff options
-rw-r--r-- | meson.build | 4 | ||||
-rw-r--r-- | src/entry.c | 108 | ||||
-rw-r--r-- | src/gl.c | 6 | ||||
-rw-r--r-- | src/image.h | 6 | ||||
-rw-r--r-- | src/main.c | 165 | ||||
-rw-r--r-- | src/surface.c | 8 | ||||
-rw-r--r-- | src/tofi.h | 8 | ||||
-rw-r--r-- | src/wlr-layer-shell-unstable-v1.c | 93 | ||||
-rw-r--r-- | src/wlr-layer-shell-unstable-v1.h | 668 |
9 files changed, 903 insertions, 163 deletions
diff --git a/meson.build b/meson.build index ad8d281..344cfcd 100644 --- a/meson.build +++ b/meson.build @@ -72,6 +72,7 @@ sources = files( 'src/log.c', 'src/string_vec.c', 'src/surface.c', + 'src/wlr-layer-shell-unstable-v1.c', ) cc = meson.get_compiler('c') @@ -80,7 +81,6 @@ glib = dependency('glib-2.0') json = dependency('json-c') pangocairo = dependency('pangocairo') png = dependency('libpng') -threads = dependency('threads') wayland_client = dependency('wayland-client') wayland_egl = dependency('wayland-egl') wayland_protocols = dependency('wayland-protocols', native: true) @@ -119,7 +119,7 @@ endforeach executable( 'tofi', sources, wl_proto_src, wl_proto_headers, - dependencies: [epoxy, json, glib, pangocairo, png, threads, wayland_egl, xkbcommon], + dependencies: [epoxy, json, glib, pangocairo, png, wayland_egl, xkbcommon], install: true ) diff --git a/src/entry.c b/src/entry.c index 9a92311..d6e6c81 100644 --- a/src/entry.c +++ b/src/entry.c @@ -16,8 +16,8 @@ void entry_init(struct entry *entry, uint32_t scale) { /* Calculate the size of the entry from our font and various widths. */ //calculate_font_extents(entry, scale); - entry->text_bounds.width = 500; - entry->text_bounds.height = 800; + entry->text_bounds.width = 200; + entry->text_bounds.height = 200; entry->surface.width = entry->text_bounds.width; entry->surface.height = entry->text_bounds.height; @@ -59,58 +59,58 @@ void entry_init(struct entry *entry, uint32_t scale) int32_t height = entry->surface.height / scale; /* Draw the outer outline */ - //struct color color = entry->border.outline_color; - //cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); - //cairo_paint(cr); - - ///* Move and clip following draws to be within this outline */ - //cairo_translate( - // cr, - // entry->border.outline_width, - // entry->border.outline_width); - //width -= 2 * entry->border.outline_width; - //height -= 2 * entry->border.outline_width; - //cairo_rectangle(cr, 0, 0, width, height); - //cairo_clip(cr); - - ///* Draw the border */ - //color = entry->border.color; - //cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); - //cairo_paint(cr); - - ///* Move and clip following draws to be within the border */ - //cairo_translate(cr, entry->border.width, entry->border.width); - //width -= 2 * entry->border.width; - //height -= 2 * entry->border.width; - //cairo_rectangle(cr, 0, 0, width, height); - //cairo_clip(cr); - - ///* Draw the inner outline */ - //color = entry->border.outline_color; - //cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); - //cairo_paint(cr); - - ///* Move and clip following draws to be within this outline */ - //cairo_translate( - // cr, - // entry->border.outline_width, - // entry->border.outline_width); - //width -= 2 * entry->border.outline_width; - //height -= 2 * entry->border.outline_width; - //cairo_rectangle(cr, 0, 0, width, height); - //cairo_clip(cr); - - ///* Draw the entry background */ - //color = entry->background_color; - //cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); - //cairo_paint(cr); - - ///* Move and clip following draws to be within the specified padding */ - //cairo_translate(cr, entry->padding, entry->padding); - //width -= 2 * entry->padding; - //height -= 2 * entry->padding; - //cairo_rectangle(cr, 0, 0, width, height); - //cairo_clip(cr); + struct color color = entry->border.outline_color; + cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); + cairo_paint(cr); + + /* Move and clip following draws to be within this outline */ + cairo_translate( + cr, + entry->border.outline_width, + entry->border.outline_width); + width -= 2 * entry->border.outline_width; + height -= 2 * entry->border.outline_width; + cairo_rectangle(cr, 0, 0, width, height); + cairo_clip(cr); + + /* Draw the border */ + color = entry->border.color; + cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); + cairo_paint(cr); + + /* Move and clip following draws to be within the border */ + cairo_translate(cr, entry->border.width, entry->border.width); + width -= 2 * entry->border.width; + height -= 2 * entry->border.width; + cairo_rectangle(cr, 0, 0, width, height); + cairo_clip(cr); + + /* Draw the inner outline */ + color = entry->border.outline_color; + cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); + cairo_paint(cr); + + /* Move and clip following draws to be within this outline */ + cairo_translate( + cr, + entry->border.outline_width, + entry->border.outline_width); + width -= 2 * entry->border.outline_width; + height -= 2 * entry->border.outline_width; + cairo_rectangle(cr, 0, 0, width, height); + cairo_clip(cr); + + /* Draw the entry background */ + color = entry->background_color; + cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); + cairo_paint(cr); + + /* Move and clip following draws to be within the specified padding */ + cairo_translate(cr, entry->padding, entry->padding); + width -= 2 * entry->padding; + height -= 2 * entry->padding; + cairo_rectangle(cr, 0, 0, width, height); + cairo_clip(cr); /* * Move the cursor back up, so that Pango draws in the correct place if @@ -26,9 +26,9 @@ static const char *gl_debug_severity_string(GLenum type); void gl_initialise(struct gl *gl, struct image *texture) { #ifdef DEBUG - glEnable(GL_DEBUG_OUTPUT); - glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); - glDebugMessageCallback(MessageCallback, 0); + //glEnable(GL_DEBUG_OUTPUT); + //glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); + //glDebugMessageCallback(MessageCallback, 0); #endif if (texture == NULL || texture->buffer == NULL) { return; diff --git a/src/image.h b/src/image.h index d5bd346..21b9100 100644 --- a/src/image.h +++ b/src/image.h @@ -10,6 +10,12 @@ struct image { uint32_t height; bool swizzle; bool redraw; + struct { + uint32_t x; + uint32_t y; + uint32_t width; + uint32_t height; + } damage; }; void image_load(struct image *image, const char *filename); @@ -42,12 +42,6 @@ static void resize(struct tofi *tofi) */ surface->width = tofi->window.width * tofi->window.scale; surface->height = tofi->window.height * tofi->window.scale; - wl_egl_window_resize( - surface->egl.window, - surface->width, - surface->height, - 0, - 0); /* * Need to redraw the background at the new size. This entails a @@ -60,62 +54,54 @@ static void resize(struct tofi *tofi) * Wayland wants "surface-local" width / height, so we have to divide * the entry's pixel size by the scale factor. */ - int32_t x = ( - tofi->window.width - - entry_surface->width / tofi->window.scale - ) / 2; - int32_t y = ( - tofi->window.height - - entry_surface->height / tofi->window.scale - ) / 2; - wl_subsurface_set_position(tofi->window.entry.wl_subsurface, x, y); - wl_surface_commit(tofi->window.entry.surface.wl_surface); -} - -static void xdg_toplevel_configure( + //int32_t x = ( + // tofi->window.width + // - entry_surface->width / tofi->window.scale + // ) / 2; + //int32_t y = ( + // tofi->window.height + // - entry_surface->height / tofi->window.scale + // ) / 2; + //wl_subsurface_set_position(tofi->window.entry.wl_subsurface, x, y); + //wl_surface_commit(tofi->window.entry.surface.wl_surface); +} + +static void zwlr_layer_surface_configure( void *data, - struct xdg_toplevel *xdg_toplevel, - int32_t width, - int32_t height, - struct wl_array *states) + struct zwlr_layer_surface_v1 *zwlr_layer_surface, + uint32_t serial, + uint32_t width, + uint32_t height) { struct tofi *tofi = data; if (width == 0 || height == 0) { /* Compositor is deferring to us, so don't do anything. */ - log_debug("XDG toplevel configure with no width or height.\n"); + log_debug("Layer surface configure with no width or height.\n"); return; } - log_debug("XDG toplevel configure, %d x %d.\n", width, height); + log_debug("Layer surface configure, %d x %d.\n", width, height); if (width != tofi->window.width || height != tofi->window.height) { tofi->window.width = width; tofi->window.height = height; tofi->window.resize = true; } + zwlr_layer_surface_v1_ack_configure( + tofi->window.zwlr_layer_surface, + serial); } -static void xdg_toplevel_close(void *data, struct xdg_toplevel *toplevel) +static void zwlr_layer_surface_close( + void *data, + struct zwlr_layer_surface_v1 *zwlr_layer_surface) { struct tofi *tofi = data; tofi->closed = true; - log_debug("XDG toplevel close.\n"); -} - -static const struct xdg_toplevel_listener xdg_toplevel_listener = { - .configure = xdg_toplevel_configure, - .close = xdg_toplevel_close -}; - -static void xdg_surface_configure( - void *data, - struct xdg_surface *xdg_surface, - uint32_t serial) -{ - xdg_surface_ack_configure(xdg_surface, serial); - log_debug("XDG surface configured.\n"); + log_debug("Layer surface close.\n"); } -static const struct xdg_surface_listener xdg_surface_listener = { - .configure = xdg_surface_configure, +static const struct zwlr_layer_surface_v1_listener zwlr_layer_surface_listener = { + .configure = zwlr_layer_surface_configure, + .closed = zwlr_layer_surface_close }; static void wl_keyboard_keymap( @@ -234,6 +220,7 @@ static void wl_keyboard_key( } entry_update(&tofi->window.entry); tofi->window.entry.surface.redraw = true; + tofi->window.surface.redraw = true; } @@ -424,18 +411,6 @@ static const struct wl_seat_listener wl_seat_listener = { .name = wl_seat_name, }; -static void xdg_wm_base_ping( - void *data, - struct xdg_wm_base *xdg_wm_base, - uint32_t serial) -{ - xdg_wm_base_pong(xdg_wm_base, serial); -} - -static const struct xdg_wm_base_listener xdg_wm_base_listener = { - .ping = xdg_wm_base_ping, -}; - static void output_geometry( void *data, struct wl_output *wl_output, @@ -492,7 +467,7 @@ static void registry_global( uint32_t version) { struct tofi *tofi = data; - log_debug("Registry %s %u.\n", interface, name); + //log_debug("Registry %s %u.\n", interface, name); if (!strcmp(interface, wl_compositor_interface.name)) { tofi->wl_compositor = wl_registry_bind( wl_registry, @@ -529,17 +504,13 @@ static void registry_global( &wl_output_listener, tofi); log_debug("Bound to output %u.\n", name); - } else if (!strcmp(interface, xdg_wm_base_interface.name)) { - tofi->xdg_wm_base = wl_registry_bind( + } else if (!strcmp(interface, zwlr_layer_shell_v1_interface.name)) { + tofi->zwlr_layer_shell = wl_registry_bind( wl_registry, name, - &xdg_wm_base_interface, + &zwlr_layer_shell_v1_interface, 1); - xdg_wm_base_add_listener( - tofi->xdg_wm_base, - &xdg_wm_base_listener, - tofi); - log_debug("Bound to xdg_wm_base %u.\n", name); + log_debug("Bound to zwlr_layer_shell_v1 %u.\n", name); } } @@ -795,10 +766,7 @@ int main(int argc, char *argv[]) * Next, we create the Wayland surfaces that we need - one for * the whole window, and another for the entry box. */ - /* - * The main window surface takes on the xdg_surface and xdg_toplevel - * roles, in order to receive configure events to change its size. - */ + /* The main window surface takes on the layer_shell_surface role. */ log_debug("Creating main window surface.\n"); tofi.window.surface.wl_surface = wl_compositor_create_surface(tofi.wl_compositor); @@ -810,25 +778,20 @@ int main(int argc, char *argv[]) tofi.window.surface.wl_surface, tofi.window.scale); - tofi.window.xdg_surface = xdg_wm_base_get_xdg_surface( - tofi.xdg_wm_base, - tofi.window.surface.wl_surface); - xdg_surface_add_listener( - tofi.window.xdg_surface, - &xdg_surface_listener, - &tofi); - - tofi.window.xdg_toplevel = - xdg_surface_get_toplevel(tofi.window.xdg_surface); - xdg_toplevel_add_listener( - tofi.window.xdg_toplevel, - &xdg_toplevel_listener, + tofi.window.zwlr_layer_surface = zwlr_layer_shell_v1_get_layer_surface( + tofi.zwlr_layer_shell, + tofi.window.surface.wl_surface, + tofi.wl_output, + ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY, + "launcher"); + zwlr_layer_surface_v1_set_keyboard_interactivity( + tofi.window.zwlr_layer_surface, + ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE + ); + zwlr_layer_surface_v1_add_listener( + tofi.window.zwlr_layer_surface, + &zwlr_layer_surface_listener, &tofi); - xdg_toplevel_set_title( - tofi.window.xdg_toplevel, - "Greetd mini wayland greeter"); - - wl_surface_commit(tofi.window.surface.wl_surface); /* * The entry surface takes on a subsurface role and is set to be @@ -864,20 +827,27 @@ int main(int argc, char *argv[]) log_debug("Pango / Cairo initialised.\n"); /* Tell the compositor not to make our window smaller than the entry. */ - xdg_toplevel_set_min_size( - tofi.window.xdg_toplevel, - tofi.window.entry.surface.width / tofi.window.scale, - tofi.window.entry.surface.height / tofi.window.scale); + //zwlr_layer_surface_v1_set_size( + // tofi.window.zwlr_layer_surface, + // 100, + // 100); + zwlr_layer_surface_v1_set_anchor( + tofi.window.zwlr_layer_surface, + 0x0Fu); + wl_surface_commit(tofi.window.surface.wl_surface); /* * Now that we've done all our Wayland-related setup, we do another - * roundtrip. This should cause the XDG toplevel window to be + * roundtrip. This should cause the layer surface window to be * configured, after which we're ready to start drawing to the screen. */ log_debug("Third roundtrip start.\n"); wl_display_roundtrip(tofi.wl_display); log_debug("Third roundtrip done.\n"); + /* Call resize() just to center the entry properly. */ + resize(&tofi); + /* * Create the various EGL and GL structures for each surface, and * perform an initial render of everything. @@ -905,16 +875,13 @@ int main(int argc, char *argv[]) &tofi.window.background_color, &tofi.window.entry.image); - /* Call resize() just to center the entry properly. */ - resize(&tofi); - /* * We've just rendered everything and resized, so we don't need to do * it again right now. */ - tofi.window.resize = false; - tofi.window.surface.redraw = false; - tofi.window.entry.surface.redraw = false; + //tofi.window.resize = false; + //tofi.window.surface.redraw = false; + //tofi.window.entry.surface.redraw = false; while (wl_display_dispatch(tofi.wl_display) != -1) { if (tofi.closed) { @@ -925,6 +892,7 @@ int main(int argc, char *argv[]) tofi.window.resize = false; } if (tofi.window.surface.redraw) { + log_debug("Redraw main window.\n"); surface_draw( &tofi.window.surface, &tofi.window.background_color, @@ -963,8 +931,6 @@ int main(int argc, char *argv[]) eglTerminate(tofi.window.surface.egl.display); wl_subsurface_destroy(tofi.window.entry.wl_subsurface); wl_surface_destroy(tofi.window.entry.surface.wl_surface); - xdg_toplevel_destroy(tofi.window.xdg_toplevel); - xdg_surface_destroy(tofi.window.xdg_surface); wl_surface_destroy(tofi.window.surface.wl_surface); if (tofi.wl_keyboard != NULL) { wl_keyboard_release(tofi.wl_keyboard); @@ -976,7 +942,6 @@ int main(int argc, char *argv[]) wl_subcompositor_destroy(tofi.wl_subcompositor); wl_seat_release(tofi.wl_seat); wl_output_release(tofi.wl_output); - xdg_wm_base_destroy(tofi.xdg_wm_base); xkb_state_unref(tofi.xkb_state); xkb_keymap_unref(tofi.xkb_keymap); xkb_context_unref(tofi.xkb_context); diff --git a/src/surface.c b/src/surface.c index 700074c..cbc6c94 100644 --- a/src/surface.c +++ b/src/surface.c @@ -30,6 +30,12 @@ void surface_draw( struct color *color, struct image *texture) { + wl_egl_window_resize( + surface->egl.window, + surface->width, + surface->height, + 0, + 0); egl_make_current(&surface->egl); gl_clear(&surface->gl, color); @@ -46,5 +52,7 @@ void surface_draw( gl_draw_texture(&surface->gl, texture, x, y, width, height); } + wl_surface_damage_buffer(surface->wl_surface, 0, 0, INT32_MAX, INT32_MAX); + egl_swap_buffers(&surface->egl); } @@ -8,6 +8,7 @@ #include "entry.h" #include "image.h" #include "surface.h" +#include "wlr-layer-shell-unstable-v1.h" struct tofi { /* Globals */ @@ -17,7 +18,7 @@ struct tofi { struct wl_subcompositor *wl_subcompositor; struct wl_seat *wl_seat; struct wl_output *wl_output; - struct xdg_wm_base *xdg_wm_base; + struct zwlr_layer_shell_v1 *zwlr_layer_shell; uint32_t wl_display_name; uint32_t wl_registry_name; @@ -25,7 +26,7 @@ struct tofi { uint32_t wl_subcompositor_name; uint32_t wl_seat_name; uint32_t wl_output_name; - uint32_t xdg_wm_base_name; + uint32_t zwlr_layer_shell_name; /* Objects */ struct wl_keyboard *wl_keyboard; @@ -35,8 +36,7 @@ struct tofi { bool closed; struct { struct surface surface; - struct xdg_surface *xdg_surface; - struct xdg_toplevel *xdg_toplevel; + struct zwlr_layer_surface_v1 *zwlr_layer_surface; struct image background_image; struct color background_color; struct entry entry; diff --git a/src/wlr-layer-shell-unstable-v1.c b/src/wlr-layer-shell-unstable-v1.c new file mode 100644 index 0000000..95ff317 --- /dev/null +++ b/src/wlr-layer-shell-unstable-v1.c @@ -0,0 +1,93 @@ +/* Generated by wayland-scanner 1.19.0 */ + +/* + * Copyright © 2017 Drew DeVault + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of + * the copyright holders not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ + +#include <stdlib.h> +#include <stdint.h> +#include "wayland-util.h" + +#ifndef __has_attribute +# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ +#endif + +#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4) +#define WL_PRIVATE __attribute__ ((visibility("hidden"))) +#else +#define WL_PRIVATE +#endif + +extern const struct wl_interface wl_output_interface; +extern const struct wl_interface wl_surface_interface; +extern const struct wl_interface xdg_popup_interface; +extern const struct wl_interface zwlr_layer_surface_v1_interface; + +static const struct wl_interface *wlr_layer_shell_unstable_v1_types[] = { + NULL, + NULL, + NULL, + NULL, + &zwlr_layer_surface_v1_interface, + &wl_surface_interface, + &wl_output_interface, + NULL, + NULL, + &xdg_popup_interface, +}; + +static const struct wl_message zwlr_layer_shell_v1_requests[] = { + { "get_layer_surface", "no?ous", wlr_layer_shell_unstable_v1_types + 4 }, + { "destroy", "3", wlr_layer_shell_unstable_v1_types + 0 }, +}; + +WL_PRIVATE const struct wl_interface zwlr_layer_shell_v1_interface = { + "zwlr_layer_shell_v1", 4, + 2, zwlr_layer_shell_v1_requests, + 0, NULL, +}; + +static const struct wl_message zwlr_layer_surface_v1_requests[] = { + { "set_size", "uu", wlr_layer_shell_unstable_v1_types + 0 }, + { "set_anchor", "u", wlr_layer_shell_unstable_v1_types + 0 }, + { "set_exclusive_zone", "i", wlr_layer_shell_unstable_v1_types + 0 }, + { "set_margin", "iiii", wlr_layer_shell_unstable_v1_types + 0 }, + { "set_keyboard_interactivity", "u", wlr_layer_shell_unstable_v1_types + 0 }, + { "get_popup", "o", wlr_layer_shell_unstable_v1_types + 9 }, + { "ack_configure", "u", wlr_layer_shell_unstable_v1_types + 0 }, + { "destroy", "", wlr_layer_shell_unstable_v1_types + 0 }, + { "set_layer", "2u", wlr_layer_shell_unstable_v1_types + 0 }, +}; + +static const struct wl_message zwlr_layer_surface_v1_events[] = { + { "configure", "uuu", wlr_layer_shell_unstable_v1_types + 0 }, + { "closed", "", wlr_layer_shell_unstable_v1_types + 0 }, +}; + +WL_PRIVATE const struct wl_interface zwlr_layer_surface_v1_interface = { + "zwlr_layer_surface_v1", 4, + 9, zwlr_layer_surface_v1_requests, + 2, zwlr_layer_surface_v1_events, +}; + diff --git a/src/wlr-layer-shell-unstable-v1.h b/src/wlr-layer-shell-unstable-v1.h new file mode 100644 index 0000000..3a13f59 --- /dev/null +++ b/src/wlr-layer-shell-unstable-v1.h @@ -0,0 +1,668 @@ +/* Generated by wayland-scanner 1.19.0 */ + +#ifndef WLR_LAYER_SHELL_UNSTABLE_V1_CLIENT_PROTOCOL_H +#define WLR_LAYER_SHELL_UNSTABLE_V1_CLIENT_PROTOCOL_H + +#include <stdint.h> +#include <stddef.h> +#include "wayland-client.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @page page_wlr_layer_shell_unstable_v1 The wlr_layer_shell_unstable_v1 protocol + * @section page_ifaces_wlr_layer_shell_unstable_v1 Interfaces + * - @subpage page_iface_zwlr_layer_shell_v1 - create surfaces that are layers of the desktop + * - @subpage page_iface_zwlr_layer_surface_v1 - layer metadata interface + * @section page_copyright_wlr_layer_shell_unstable_v1 Copyright + * <pre> + * + * Copyright © 2017 Drew DeVault + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of + * the copyright holders not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + * </pre> + */ +struct wl_output; +struct wl_surface; +struct xdg_popup; +struct zwlr_layer_shell_v1; +struct zwlr_layer_surface_v1; + +#ifndef ZWLR_LAYER_SHELL_V1_INTERFACE +#define ZWLR_LAYER_SHELL_V1_INTERFACE +/** + * @page page_iface_zwlr_layer_shell_v1 zwlr_layer_shell_v1 + * @section page_iface_zwlr_layer_shell_v1_desc Description + * + * Clients can use this interface to assign the surface_layer role to + * wl_surfaces. Such surfaces are assigned to a "layer" of the output and + * rendered with a defined z-depth respective to each other. They may also be + * anchored to the edges and corners of a screen and specify input handling + * semantics. This interface should be suitable for the implementation of + * many desktop shell components, and a broad number of other applications + * that interact with the desktop. + * @section page_iface_zwlr_layer_shell_v1_api API + * See @ref iface_zwlr_layer_shell_v1. + */ +/** + * @defgroup iface_zwlr_layer_shell_v1 The zwlr_layer_shell_v1 interface + * + * Clients can use this interface to assign the surface_layer role to + * wl_surfaces. Such surfaces are assigned to a "layer" of the output and + * rendered with a defined z-depth respective to each other. They may also be + * anchored to the edges and corners of a screen and specify input handling + * semantics. This interface should be suitable for the implementation of + * many desktop shell components, and a broad number of other applications + * that interact with the desktop. + */ +extern const struct wl_interface zwlr_layer_shell_v1_interface; +#endif +#ifndef ZWLR_LAYER_SURFACE_V1_INTERFACE +#define ZWLR_LAYER_SURFACE_V1_INTERFACE +/** + * @page page_iface_zwlr_layer_surface_v1 zwlr_layer_surface_v1 + * @section page_iface_zwlr_layer_surface_v1_desc Description + * + * An interface that may be implemented by a wl_surface, for surfaces that + * are designed to be rendered as a layer of a stacked desktop-like + * environment. + * + * Layer surface state (layer, size, anchor, exclusive zone, + * margin, interactivity) is double-buffered, and will be applied at the + * time wl_surface.commit of the corresponding wl_surface is called. + * + * Attaching a null buffer to a layer surface unmaps it. + * + * Unmapping a layer_surface means that the surface cannot be shown by the + * compositor until it is explicitly mapped again. The layer_surface + * returns to the state it had right after layer_shell.get_layer_surface. + * The client can re-map the surface by performing a commit without any + * buffer attached, waiting for a configure event and handling it as usual. + * @section page_iface_zwlr_layer_surface_v1_api API + * See @ref iface_zwlr_layer_surface_v1. + */ +/** + * @defgroup iface_zwlr_layer_surface_v1 The zwlr_layer_surface_v1 interface + * + * An interface that may be implemented by a wl_surface, for surfaces that + * are designed to be rendered as a layer of a stacked desktop-like + * environment. + * + * Layer surface state (layer, size, anchor, exclusive zone, + * margin, interactivity) is double-buffered, and will be applied at the + * time wl_surface.commit of the corresponding wl_surface is called. + * + * Attaching a null buffer to a layer surface unmaps it. + * + * Unmapping a layer_surface means that the surface cannot be shown by the + * compositor until it is explicitly mapped again. The layer_surface + * returns to the state it had right after layer_shell.get_layer_surface. + * The client can re-map the surface by performing a commit without any + * buffer attached, waiting for a configure event and handling it as usual. + */ +extern const struct wl_interface zwlr_layer_surface_v1_interface; +#endif + +#ifndef ZWLR_LAYER_SHELL_V1_ERROR_ENUM +#define ZWLR_LAYER_SHELL_V1_ERROR_ENUM +enum zwlr_layer_shell_v1_error { + /** + * wl_surface has another role + */ + ZWLR_LAYER_SHELL_V1_ERROR_ROLE = 0, + /** + * layer value is invalid + */ + ZWLR_LAYER_SHELL_V1_ERROR_INVALID_LAYER = 1, + /** + * wl_surface has a buffer attached or committed + */ + ZWLR_LAYER_SHELL_V1_ERROR_ALREADY_CONSTRUCTED = 2, +}; +#endif /* ZWLR_LAYER_SHELL_V1_ERROR_ENUM */ + +#ifndef ZWLR_LAYER_SHELL_V1_LAYER_ENUM +#define ZWLR_LAYER_SHELL_V1_LAYER_ENUM +/** + * @ingroup iface_zwlr_layer_shell_v1 + * available layers for surfaces + * + * These values indicate which layers a surface can be rendered in. They + * are ordered by z depth, bottom-most first. Traditional shell surfaces + * will typically be rendered between the bottom and top layers. + * Fullscreen shell surfaces are typically rendered at the top layer. + * Multiple surfaces can share a single layer, and ordering within a + * single layer is undefined. + */ +enum zwlr_layer_shell_v1_layer { + ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND = 0, + ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM = 1, + ZWLR_LAYER_SHELL_V1_LAYER_TOP = 2, + ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY = 3, +}; +#endif /* ZWLR_LAYER_SHELL_V1_LAYER_ENUM */ + +#define ZWLR_LAYER_SHELL_V1_GET_LAYER_SURFACE 0 +#define ZWLR_LAYER_SHELL_V1_DESTROY 1 + + +/** + * @ingroup iface_zwlr_layer_shell_v1 + */ +#define ZWLR_LAYER_SHELL_V1_GET_LAYER_SURFACE_SINCE_VERSION 1 +/** + * @ingroup iface_zwlr_layer_shell_v1 + */ +#define ZWLR_LAYER_SHELL_V1_DESTROY_SINCE_VERSION 3 + +/** @ingroup iface_zwlr_layer_shell_v1 */ +static inline void +zwlr_layer_shell_v1_set_user_data(struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) zwlr_layer_shell_v1, user_data); +} + +/** @ingroup iface_zwlr_layer_shell_v1 */ +static inline void * +zwlr_layer_shell_v1_get_user_data(struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1) +{ + return wl_proxy_get_user_data((struct wl_proxy *) zwlr_layer_shell_v1); +} + +static inline uint32_t +zwlr_layer_shell_v1_get_version(struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1) +{ + return wl_proxy_get_version((struct wl_proxy *) zwlr_layer_shell_v1); +} + +/** + * @ingroup iface_zwlr_layer_shell_v1 + * + * Create a layer surface for an existing surface. This assigns the role of + * layer_surface, or raises a protocol error if another role is already + * assigned. + * + * Creating a layer surface from a wl_surface which has a buffer attached + * or committed is a client error, and any attempts by a client to attach + * or manipulate a buffer prior to the first layer_surface.configure call + * must also be treated as errors. + * + * After creating a layer_surface object and setting it up, the client + * must perform an initial commit without any buffer attached. + * The compositor will reply with a layer_surface.configure event. + * The client must acknowledge it and is then allowed to attach a buffer + * to map the surface. + * + * You may pass NULL for output to allow the compositor to decide which + * output to use. Generally this will be the one that the user most + * recently interacted with. + * + * Clients can specify a namespace that defines the purpose of the layer + * surface. + */ +static inline struct zwlr_layer_surface_v1 * +zwlr_layer_shell_v1_get_layer_surface(struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1, struct wl_surface *surface, struct wl_output *output, uint32_t layer, const char *namespace) +{ + struct wl_proxy *id; + + id = wl_proxy_marshal_constructor((struct wl_proxy *) zwlr_layer_shell_v1, + ZWLR_LAYER_SHELL_V1_GET_LAYER_SURFACE, &zwlr_layer_surface_v1_interface, NULL, surface, output, layer, namespace); + + return (struct zwlr_layer_surface_v1 *) id; +} + +/** + * @ingroup iface_zwlr_layer_shell_v1 + * + * This request indicates that the client will not use the layer_shell + * object any more. Objects that have been created through this instance + * are not affected. + */ +static inline void +zwlr_layer_shell_v1_destroy(struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1) +{ + wl_proxy_marshal((struct wl_proxy *) zwlr_layer_shell_v1, + ZWLR_LAYER_SHELL_V1_DESTROY); + + wl_proxy_destroy((struct wl_proxy *) zwlr_layer_shell_v1); +} + +#ifndef ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ENUM +#define ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ENUM +/** + * @ingroup iface_zwlr_layer_surface_v1 + * request regular keyboard focus semantics + * + * This requests the compositor to allow this surface to be focused and + * unfocused by the user in an implementation-defined manner. The user + * should be able to unfocus this surface even regardless of the layer + * it is on. + * + * Typically, the compositor will want to use its normal mechanism to + * manage keyboard focus between layer shell surfaces with this setting + * and regular toplevels on the desktop layer (e.g. click to focus). + * Nevertheless, it is possible for a compositor to require a special + * interaction to focus or unfocus layer shell surfaces (e.g. requiring + * a click even if focus follows the mouse normally, or providing a + * keybinding to switch focus between layers). + * + * This setting is mainly intended for desktop shell components (e.g. + * panels) that allow keyboard interaction. Using this option can allow + * implementing a desktop shell that can be fully usable without the + * mouse. + */ +enum zwlr_layer_surface_v1_keyboard_interactivity { + ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE = 0, + ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE = 1, + /** + * @since 4 + */ + ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND = 2, +}; +/** + * @ingroup iface_zwlr_layer_surface_v1 + */ +#define ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND_SINCE_VERSION 4 +#endif /* ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ENUM */ + +#ifndef ZWLR_LAYER_SURFACE_V1_ERROR_ENUM +#define ZWLR_LAYER_SURFACE_V1_ERROR_ENUM +enum zwlr_layer_surface_v1_error { + /** + * provided surface state is invalid + */ + ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_SURFACE_STATE = 0, + /** + * size is invalid + */ + ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_SIZE = 1, + /** + * anchor bitfield is invalid + */ + ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_ANCHOR = 2, + /** + * keyboard interactivity is invalid + */ + ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_KEYBOARD_INTERACTIVITY = 3, +}; +#endif /* ZWLR_LAYER_SURFACE_V1_ERROR_ENUM */ + +#ifndef ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM +#define ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM +enum zwlr_layer_surface_v1_anchor { + /** + * the top edge of the anchor rectangle + */ + ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP = 1, + /** + * the bottom edge of the anchor rectangle + */ + ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM = 2, + /** + * the left edge of the anchor rectangle + */ + ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT = 4, + /** + * the right edge of the anchor rectangle + */ + ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT = 8, +}; +#endif /* ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM */ + +/** + * @ingroup iface_zwlr_layer_surface_v1 + * @struct zwlr_layer_surface_v1_listener + */ +struct zwlr_layer_surface_v1_listener { + /** + * suggest a surface change + * + * The configure event asks the client to resize its surface. + * + * Clients should arrange their surface for the new states, and + * then send an ack_configure request with the serial sent in this + * configure event at some point before committing the new surface. + * + * The client is free to dismiss all but the last configure event + * it received. + * + * The width and height arguments specify the size of the window in + * surface-local coordinates. + * + * The size is a hint, in the sense that the client is free to + * ignore it if it doesn't resize, pick a smaller size (to satisfy + * aspect ratio or resize in steps of NxM pixels). If the client + * picks a smaller size and is anchored to two opposite anchors + * (e.g. 'top' and 'bottom'), the surface will be centered on this + * axis. + * + * If the width or height arguments are zero, it means the client + * should decide its own window dimension. + */ + void (*configure)(void *data, + struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, + uint32_t serial, + uint32_t width, + uint32_t height); + /** + * surface should be closed + * + * The closed event is sent by the compositor when the surface + * will no longer be shown. The output may have been destroyed or + * the user may have asked for it to be removed. Further changes to + * the surface will be ignored. The client should destroy the + * resource after receiving this event, and create a new surface if + * they so choose. + */ + void (*closed)(void *data, + struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1); +}; + +/** + * @ingroup iface_zwlr_layer_surface_v1 + */ +static inline int +zwlr_layer_surface_v1_add_listener(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, + const struct zwlr_layer_surface_v1_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) zwlr_layer_surface_v1, + (void (**)(void)) listener, data); +} + +#define ZWLR_LAYER_SURFACE_V1_SET_SIZE 0 +#define ZWLR_LAYER_SURFACE_V1_SET_ANCHOR 1 +#define ZWLR_LAYER_SURFACE_V1_SET_EXCLUSIVE_ZONE 2 +#define ZWLR_LAYER_SURFACE_V1_SET_MARGIN 3 +#define ZWLR_LAYER_SURFACE_V1_SET_KEYBOARD_INTERACTIVITY 4 +#define ZWLR_LAYER_SURFACE_V1_GET_POPUP 5 +#define ZWLR_LAYER_SURFACE_V1_ACK_CONFIGURE 6 +#define ZWLR_LAYER_SURFACE_V1_DESTROY 7 +#define ZWLR_LAYER_SURFACE_V1_SET_LAYER 8 + +/** + * @ingroup iface_zwlr_layer_surface_v1 + */ +#define ZWLR_LAYER_SURFACE_V1_CONFIGURE_SINCE_VERSION 1 +/** + * @ingroup iface_zwlr_layer_surface_v1 + */ +#define ZWLR_LAYER_SURFACE_V1_CLOSED_SINCE_VERSION 1 + +/** + * @ingroup iface_zwlr_layer_surface_v1 + */ +#define ZWLR_LAYER_SURFACE_V1_SET_SIZE_SINCE_VERSION 1 +/** + * @ingroup iface_zwlr_layer_surface_v1 + */ +#define ZWLR_LAYER_SURFACE_V1_SET_ANCHOR_SINCE_VERSION 1 +/** + * @ingroup iface_zwlr_layer_surface_v1 + */ +#define ZWLR_LAYER_SURFACE_V1_SET_EXCLUSIVE_ZONE_SINCE_VERSION 1 +/** + * @ingroup iface_zwlr_layer_surface_v1 + */ +#define ZWLR_LAYER_SURFACE_V1_SET_MARGIN_SINCE_VERSION 1 +/** + * @ingroup iface_zwlr_layer_surface_v1 + */ +#define ZWLR_LAYER_SURFACE_V1_SET_KEYBOARD_INTERACTIVITY_SINCE_VERSION 1 +/** + * @ingroup iface_zwlr_layer_surface_v1 + */ +#define ZWLR_LAYER_SURFACE_V1_GET_POPUP_SINCE_VERSION 1 +/** + * @ingroup iface_zwlr_layer_surface_v1 + */ +#define ZWLR_LAYER_SURFACE_V1_ACK_CONFIGURE_SINCE_VERSION 1 +/** + * @ingroup iface_zwlr_layer_surface_v1 + */ +#define ZWLR_LAYER_SURFACE_V1_DESTROY_SINCE_VERSION 1 +/** + * @ingroup iface_zwlr_layer_surface_v1 + */ +#define ZWLR_LAYER_SURFACE_V1_SET_LAYER_SINCE_VERSION 2 + +/** @ingroup iface_zwlr_layer_surface_v1 */ +static inline void +zwlr_layer_surface_v1_set_user_data(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) zwlr_layer_surface_v1, user_data); +} + +/** @ingroup iface_zwlr_layer_surface_v1 */ +static inline void * +zwlr_layer_surface_v1_get_user_data(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1) +{ + return wl_proxy_get_user_data((struct wl_proxy *) zwlr_layer_surface_v1); +} + +static inline uint32_t +zwlr_layer_surface_v1_get_version(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1) +{ + return wl_proxy_get_version((struct wl_proxy *) zwlr_layer_surface_v1); +} + +/** + * @ingroup iface_zwlr_layer_surface_v1 + * + * Sets the size of the surface in surface-local coordinates. The + * compositor will display the surface centered with respect to its + * anchors. + * + * If you pass 0 for either value, the compositor will assign it and + * inform you of the assignment in the configure event. You must set your + * anchor to opposite edges in the dimensions you omit; not doing so is a + * protocol error. Both values are 0 by default. + * + * Size is double-buffered, see wl_surface.commit. + */ +static inline void +zwlr_layer_surface_v1_set_size(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t width, uint32_t height) +{ + wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1, + ZWLR_LAYER_SURFACE_V1_SET_SIZE, width, height); +} + +/** + * @ingroup iface_zwlr_layer_surface_v1 + * + * Requests that the compositor anchor the surface to the specified edges + * and corners. If two orthogonal edges are specified (e.g. 'top' and + * 'left'), then the anchor point will be the intersection of the edges + * (e.g. the top left corner of the output); otherwise the anchor point + * will be centered on that edge, or in the center if none is specified. + * + * Anchor is double-buffered, see wl_surface.commit. + */ +static inline void +zwlr_layer_surface_v1_set_anchor(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t anchor) +{ + wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1, + ZWLR_LAYER_SURFACE_V1_SET_ANCHOR, anchor); +} + +/** + * @ingroup iface_zwlr_layer_surface_v1 + * + * Requests that the compositor avoids occluding an area with other + * surfaces. The compositor's use of this information is + * implementation-dependent - do not assume that this region will not + * actually be occluded. + * + * A positive value is only meaningful if the surface is anchored to one + * edge or an edge and both perpendicular edges. If the surface is not + * anchored, anchored to only two perpendicular edges (a corner), anchored + * to only two parallel edges or anchored to all edges, a positive value + * will be treated the same as zero. + * + * A positive zone is the distance from the edge in surface-local + * coordinates to consider exclusive. + * + * Surfaces that do not wish to have an exclusive zone may instead specify + * how they should interact with surfaces that do. If set to zero, the + * surface indicates that it would like to be moved to avoid occluding + * surfaces with a positive exclusive zone. If set to -1, the surface + * indicates that it would not like to be moved to accommodate for other + * surfaces, and the compositor should extend it all the way to the edges + * it is anchored to. + * + * For example, a panel might set its exclusive zone to 10, so that + * maximized shell surfaces are not shown on top of it. A notification + * might set its exclusive zone to 0, so that it is moved to avoid + * occluding the panel, but shell surfaces are shown underneath it. A + * wallpaper or lock screen might set their exclusive zone to -1, so that + * they stretch below or over the panel. + * + * The default value is 0. + * + * Exclusive zone is double-buffered, see wl_surface.commit. + */ +static inline void +zwlr_layer_surface_v1_set_exclusive_zone(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, int32_t zone) +{ + wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1, + ZWLR_LAYER_SURFACE_V1_SET_EXCLUSIVE_ZONE, zone); +} + +/** + * @ingroup iface_zwlr_layer_surface_v1 + * + * Requests that the surface be placed some distance away from the anchor + * point on the output, in surface-local coordinates. Setting this value + * for edges you are not anchored to has no effect. + * + * The exclusive zone includes the margin. + * + * Margin is double-buffered, see wl_surface.commit. + */ +static inline void +zwlr_layer_surface_v1_set_margin(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, int32_t top, int32_t right, int32_t bottom, int32_t left) +{ + wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1, + ZWLR_LAYER_SURFACE_V1_SET_MARGIN, top, right, bottom, left); +} + +/** + * @ingroup iface_zwlr_layer_surface_v1 + * + * Set how keyboard events are delivered to this surface. By default, + * layer shell surfaces do not receive keyboard events; this request can + * be used to change this. + * + * This setting is inherited by child surfaces set by the get_popup + * request. + * + * Layer surfaces receive pointer, touch, and tablet events normally. If + * you do not want to receive them, set the input region on your surface + * to an empty region. + * + * Keyboard interactivity is double-buffered, see wl_surface.commit. + */ +static inline void +zwlr_layer_surface_v1_set_keyboard_interactivity(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t keyboard_interactivity) +{ + wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1, + ZWLR_LAYER_SURFACE_V1_SET_KEYBOARD_INTERACTIVITY, keyboard_interactivity); +} + +/** + * @ingroup iface_zwlr_layer_surface_v1 + * + * This assigns an xdg_popup's parent to this layer_surface. This popup + * should have been created via xdg_surface::get_popup with the parent set + * to NULL, and this request must be invoked before committing the popup's + * initial state. + * + * See the documentation of xdg_popup for more details about what an + * xdg_popup is and how it is used. + */ +static inline void +zwlr_layer_surface_v1_get_popup(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, struct xdg_popup *popup) +{ + wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1, + ZWLR_LAYER_SURFACE_V1_GET_POPUP, popup); +} + +/** + * @ingroup iface_zwlr_layer_surface_v1 + * + * When a configure event is received, if a client commits the + * surface in response to the configure event, then the client + * must make an ack_configure request sometime before the commit + * request, passing along the serial of the configure event. + * + * If the client receives multiple configure events before it + * can respond to one, it only has to ack the last configure event. + * + * A client is not required to commit immediately after sending + * an ack_configure request - it may even ack_configure several times + * before its next surface commit. + * + * A client may send multiple ack_configure requests before committing, but + * only the last request sent before a commit indicates which configure + * event the client really is responding to. + */ +static inline void +zwlr_layer_surface_v1_ack_configure(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t serial) +{ + wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1, + ZWLR_LAYER_SURFACE_V1_ACK_CONFIGURE, serial); +} + +/** + * @ingroup iface_zwlr_layer_surface_v1 + * + * This request destroys the layer surface. + */ +static inline void +zwlr_layer_surface_v1_destroy(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1) +{ + wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1, + ZWLR_LAYER_SURFACE_V1_DESTROY); + + wl_proxy_destroy((struct wl_proxy *) zwlr_layer_surface_v1); +} + +/** + * @ingroup iface_zwlr_layer_surface_v1 + * + * Change the layer that the surface is rendered on. + * + * Layer is double-buffered, see wl_surface.commit. + */ +static inline void +zwlr_layer_surface_v1_set_layer(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t layer) +{ + wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1, + ZWLR_LAYER_SURFACE_V1_SET_LAYER, layer); +} + +#ifdef __cplusplus +} +#endif + +#endif |