Port to wlroots layer shell

This commit is contained in:
Drew DeVault 2018-04-08 11:05:20 -04:00
parent 81e851369a
commit 17aa5e21bf
7 changed files with 1240 additions and 485 deletions

View File

@ -5,9 +5,10 @@ FIND_PACKAGE(XKBCommon)
if (WAYLAND_FOUND AND CAIRO_FOUND AND PANGO_FOUND AND XKBCOMMON_FOUND)
INCLUDE(Wayland)
WAYLAND_ADD_PROTOCOL_CLIENT(proto-layer-shell "wlr-layer-shell-unstable-v1.xml" layer-shell)
WAYLAND_ADD_PROTOCOL_CLIENT(proto-xdg-shell "xdg-shell.xml" xdg-shell)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${WAYLAND_CLIENT_INCLUDE_DIR} ${XKBCOMMON_INCLUDE_DIR} ${CAIRO_INCLUDE_DIRS} ${PANGO_INCLUDE_DIRS})
ADD_LIBRARY(bemenu-renderer-wayland SHARED wayland.c registry.c window.c ${proto-xdg-shell})
ADD_LIBRARY(bemenu-renderer-wayland SHARED wayland.c registry.c window.c ${proto-layer-shell} ${proto-xdg-shell})
SET_TARGET_PROPERTIES(bemenu-renderer-wayland PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(bemenu-renderer-wayland ${BEMENU_LIBRARIES} ${WAYLAND_CLIENT_LIBRARIES} ${XKBCOMMON_LIBRARIES} ${CAIRO_LIBRARIES} ${PANGO_LIBRARIES} m)
INSTALL(TARGETS bemenu-renderer-wayland DESTINATION "${CMAKE_INSTALL_LIBDIR}/bemenu")

View File

@ -26,17 +26,6 @@ const enum mod_bit BM_XKB_MODS[MASK_LAST] = {
MOD_MOD5
};
static void
xdg_shell_ping(void *data, struct xdg_shell *shell, uint32_t serial)
{
(void)data;
xdg_shell_pong(shell, serial);
}
static const struct xdg_shell_listener xdg_shell_listener = {
.ping = xdg_shell_ping,
};
static void
shm_format(void *data, struct wl_shm *wl_shm, uint32_t format)
{
@ -260,12 +249,11 @@ display_handle_scale(void *data, struct wl_output *wl_output, int32_t scale)
static void
display_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags, int width, int height, int refresh)
{
(void)wl_output, (void)refresh, (void)height;
struct wayland *wayland = data;
(void)wl_output, (void)refresh, (void)height, (void)width;
struct output *output = data;
if (flags & WL_OUTPUT_MODE_CURRENT) {
wayland->window.width = width;
wayland->window.max_height = height;
output->height = height;
}
}
@ -284,12 +272,8 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t id, co
if (strcmp(interface, "wl_compositor") == 0) {
wayland->compositor = wl_registry_bind(registry, id, &wl_compositor_interface, 1);
} else if (strcmp(interface, "xdg_shell") == 0) {
wayland->xdg_shell = wl_registry_bind(registry, id, &xdg_shell_interface, 1);
xdg_shell_use_unstable_version(wayland->xdg_shell, XDG_SHELL_VERSION_CURRENT);
xdg_shell_add_listener(wayland->xdg_shell, &xdg_shell_listener, data);
} else if (strcmp(interface, "wl_shell") == 0) {
wayland->shell = wl_registry_bind(registry, id, &wl_shell_interface, 1);
} else if (strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) {
wayland->layer_shell = wl_registry_bind(registry, id, &zwlr_layer_shell_v1_interface, 1);
} else if (strcmp(interface, "wl_seat") == 0) {
wayland->seat = wl_registry_bind(registry, id, &wl_seat_interface, 1);
wl_seat_add_listener(wayland->seat, &seat_listener, &wayland->input);
@ -297,8 +281,11 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t id, co
wayland->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
wl_shm_add_listener(wayland->shm, &shm_listener, data);
} else if (strcmp(interface, "wl_output") == 0) {
wayland->output = wl_registry_bind(registry, id, &wl_output_interface, 2);
wl_output_add_listener(wayland->output, &output_listener, wayland);
struct wl_output *wl_output = wl_registry_bind(registry, id, &wl_output_interface, 2);
struct output *output = calloc(1, sizeof(struct output));
output->output = wl_output;
wl_list_insert(&wayland->outputs, &output->link);
wl_output_add_listener(wl_output, &output_listener, output);
}
}
@ -334,11 +321,8 @@ bm_wl_registry_destroy(struct wayland *wayland)
if (wayland->shm)
wl_shm_destroy(wayland->shm);
if (wayland->shell)
wl_shell_destroy(wayland->shell);
if (wayland->xdg_shell)
xdg_shell_destroy(wayland->xdg_shell);
if (wayland->layer_shell)
zwlr_layer_shell_v1_destroy(wayland->layer_shell);
if (wayland->compositor)
wl_compositor_destroy(wayland->compositor);
@ -358,9 +342,11 @@ bm_wl_registry_register(struct wayland *wayland)
if (!(wayland->registry = wl_display_get_registry(wayland->display)))
return false;
wl_list_init(&wayland->outputs);
wl_list_init(&wayland->windows);
wl_registry_add_listener(wayland->registry, &registry_listener, wayland);
wl_display_roundtrip(wayland->display); // trip 1, registry globals
if (!wayland->compositor || !wayland->seat || !wayland->shm || !(wayland->shell || wayland->xdg_shell))
if (!wayland->compositor || !wayland->seat || !wayland->shm || !wayland->layer_shell)
return false;
wl_display_roundtrip(wayland->display); // trip 2, global listeners

View File

@ -38,7 +38,10 @@ render(const struct bm_menu *menu)
}
if (wayland->input.code != wayland->input.last_code) {
bm_wl_window_render(&wayland->window, menu);
struct window *window;
wl_list_for_each(window, &wayland->windows, link) {
bm_wl_window_render(window, menu);
}
wayland->input.last_code = wayland->input.code;
}
}
@ -165,7 +168,13 @@ get_displayed_count(const struct bm_menu *menu)
{
struct wayland *wayland = menu->renderer->internal;
assert(wayland);
return wayland->window.displayed;
uint32_t max = 0;
struct window *window;
wl_list_for_each(window, &wayland->windows, link) {
if (window->displayed > max)
max = window->displayed;
}
return max;
}
static void
@ -176,7 +185,10 @@ destructor(struct bm_menu *menu)
if (!wayland)
return;
bm_wl_window_destroy(&wayland->window);
struct window *window;
wl_list_for_each(window, &wayland->windows, link) {
bm_wl_window_destroy(window);
}
bm_wl_registry_destroy(wayland);
xkb_context_unref(wayland->input.xkb.context);
@ -203,9 +215,6 @@ constructor(struct bm_menu *menu)
if (!(menu->renderer->internal = wayland = calloc(1, sizeof(struct wayland))))
goto fail;
wayland->window.width = 800;
wayland->window.height = 1;
if (!(wayland->display = wl_display_connect(NULL)))
goto fail;
@ -215,19 +224,26 @@ constructor(struct bm_menu *menu)
if (!bm_wl_registry_register(wayland))
goto fail;
struct wl_surface *surface;
if (!(surface = wl_compositor_create_surface(wayland->compositor)))
goto fail;
wayland->fds.display = wl_display_get_fd(wayland->display);
wayland->fds.repeat = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
wayland->input.repeat_fd = &wayland->fds.repeat;
if (!bm_wl_window_create(&wayland->window, wayland->shm, wayland->shell, wayland->xdg_shell, surface))
goto fail;
struct output *output;
wl_list_for_each(output, &wayland->outputs, link) {
struct wl_surface *surface;
if (!(surface = wl_compositor_create_surface(wayland->compositor)))
goto fail;
struct window *window = calloc(1, sizeof(struct window));
if (!bm_wl_window_create(window, wayland->display, wayland->shm, output->output, wayland->layer_shell, surface))
goto fail;
window->notify.render = bm_cairo_paint;
window->max_height = output->height;
wl_list_insert(&wayland->windows, &window->link);
}
if (!efd && (efd = epoll_create(EPOLL_CLOEXEC)) < 0)
goto fail;
wayland->fds.display = wl_display_get_fd(wayland->display);
wayland->fds.repeat = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
struct epoll_event ep;
ep.events = EPOLLIN | EPOLLERR | EPOLLHUP;
ep.data.ptr = &wayland->fds.display;
@ -237,9 +253,6 @@ constructor(struct bm_menu *menu)
ep2.events = EPOLLIN;
ep2.data.ptr = &wayland->fds.repeat;
epoll_ctl(efd, EPOLL_CTL_ADD, wayland->fds.repeat, &ep2);
wayland->window.notify.render = bm_cairo_paint;
wayland->input.repeat_fd = &wayland->fds.repeat;
return true;
fail:

View File

@ -4,7 +4,7 @@
#include <wayland-client.h>
#include <xkbcommon/xkbcommon.h>
#include "wayland-xdg-shell-client-protocol.h"
#include "wayland-layer-shell-client-protocol.h"
#include "renderers/cairo.h"
@ -76,19 +76,25 @@ struct buffer {
struct window {
struct wl_surface *surface;
struct wl_shell_surface *shell_surface;
struct wl_callback *frame_cb;
struct xdg_surface *xdg_surface;
struct zwlr_layer_surface_v1 *layer_surface;
struct wl_shm *shm;
struct buffer buffers[2];
uint32_t width, height, max_height;
uint32_t displayed;
struct wl_list link;
struct {
void (*render)(struct cairo *cairo, uint32_t width, uint32_t height, uint32_t max_height, const struct bm_menu *menu, struct cairo_paint_result *result);
} notify;
};
struct output {
struct wl_output *output;
struct wl_list link;
int height;
};
struct wayland {
struct {
int32_t display;
@ -98,13 +104,12 @@ struct wayland {
struct wl_display *display;
struct wl_registry *registry;
struct wl_compositor *compositor;
struct wl_output *output;
struct wl_list outputs;
struct wl_seat *seat;
struct xdg_shell *xdg_shell;
struct wl_shell *shell;
struct zwlr_layer_shell_v1 *layer_shell;
struct wl_shm *shm;
struct input input;
struct window window;
struct wl_list windows;
uint32_t formats;
};
@ -112,7 +117,7 @@ void bm_wl_repeat(struct wayland *wayland);
bool bm_wl_registry_register(struct wayland *wayland);
void bm_wl_registry_destroy(struct wayland *wayland);
void bm_wl_window_render(struct window *window, const struct bm_menu *menu);
bool bm_wl_window_create(struct window *window, struct wl_shm *shm, struct wl_shell *shell, struct xdg_shell *xdg_shell, struct wl_surface *surface);
bool bm_wl_window_create(struct window *window, struct wl_display *display, struct wl_shm *shm, struct wl_output *output, struct zwlr_layer_shell_v1 *layer_shell, struct wl_surface *surface);
void bm_wl_window_destroy(struct window *window);
#endif /* _BM_WAYLAND_H_ */

View File

@ -7,8 +7,6 @@
#include <stdlib.h>
#include <sys/mman.h>
#define USE_XDG_SHELL false
static int
set_cloexec_or_close(int fd)
{
@ -192,49 +190,6 @@ next_buffer(struct window *window)
return buffer;
}
static void
shell_surface_ping(void *data, struct wl_shell_surface *surface, uint32_t serial)
{
(void)data;
wl_shell_surface_pong(surface, serial);
}
static void
shell_surface_configure(void *data, struct wl_shell_surface *surface, uint32_t edges, int32_t width, int32_t height)
{
(void)data, (void)surface, (void)edges, (void)width, (void)height;
}
static void
shell_surface_popup_done(void *data, struct wl_shell_surface *surface)
{
(void)data, (void)surface;
}
static const struct wl_shell_surface_listener shell_surface_listener = {
.ping = shell_surface_ping,
.configure = shell_surface_configure,
.popup_done = shell_surface_popup_done,
};
static void
xdg_surface_configure(void *data, struct xdg_surface *surface, int32_t width, int32_t height, struct wl_array *states, uint32_t serial)
{
(void)data, (void)states, (void)width, (void)height, (void)states, (void)serial;
xdg_surface_ack_configure(surface, serial);
}
static void
xdg_surface_close(void *data, struct xdg_surface *surface)
{
(void)data, (void)surface;
}
static const struct xdg_surface_listener xdg_surface_listener = {
.configure = xdg_surface_configure,
.close = xdg_surface_close,
};
static void
frame_callback(void *data, struct wl_callback *callback, uint32_t time)
{
@ -294,29 +249,48 @@ bm_wl_window_destroy(struct window *window)
for (int32_t i = 0; i < 2; ++i)
destroy_buffer(&window->buffers[i]);
if (window->xdg_surface)
xdg_surface_destroy(window->xdg_surface);
if (window->shell_surface)
wl_shell_surface_destroy(window->shell_surface);
if (window->layer_surface)
zwlr_layer_surface_v1_destroy(window->layer_surface);
if (window->surface)
wl_surface_destroy(window->surface);
}
static void
layer_surface_configure(void *data, struct zwlr_layer_surface_v1 *layer_surface, uint32_t serial, uint32_t width, uint32_t height)
{
struct window *window = data;
window->width = width;
window->height = height;
zwlr_layer_surface_v1_ack_configure(layer_surface, serial);
}
static void
layer_surface_closed(void *data, struct zwlr_layer_surface_v1 *layer_surface)
{
struct window *window = data;
zwlr_layer_surface_v1_destroy(layer_surface);
wl_surface_destroy(window->surface);
exit(1);
}
static const struct zwlr_layer_surface_v1_listener layer_surface_listener = {
.configure = layer_surface_configure,
.closed = layer_surface_closed,
};
bool
bm_wl_window_create(struct window *window, struct wl_shm *shm, struct wl_shell *shell, struct xdg_shell *xdg_shell, struct wl_surface *surface)
bm_wl_window_create(struct window *window, struct wl_display *display, struct wl_shm *shm, struct wl_output *output, struct zwlr_layer_shell_v1 *layer_shell, struct wl_surface *surface)
{
assert(window);
if (USE_XDG_SHELL && xdg_shell && (window->xdg_surface = xdg_shell_get_xdg_surface(xdg_shell, surface))) {
xdg_surface_add_listener(window->xdg_surface, &xdg_surface_listener, window);
xdg_surface_set_title(window->xdg_surface, "bemenu");
} else if (shell && (window->shell_surface = wl_shell_get_shell_surface(shell, surface))) {
wl_shell_surface_add_listener(window->shell_surface, &shell_surface_listener, window);
wl_shell_surface_set_title(window->shell_surface, "bemenu");
wl_shell_surface_set_class(window->shell_surface, "bemenu");
wl_shell_surface_set_toplevel(window->shell_surface);
if (layer_shell && (window->layer_surface = zwlr_layer_shell_v1_get_layer_surface(layer_shell, surface, output, ZWLR_LAYER_SHELL_V1_LAYER_TOP, "menu"))) {
zwlr_layer_surface_v1_add_listener(window->layer_surface, &layer_surface_listener, window);
zwlr_layer_surface_v1_set_anchor(window->layer_surface, ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT);
zwlr_layer_surface_v1_set_size(window->layer_surface, 0, 32);
zwlr_layer_surface_v1_set_keyboard_interactivity(window->layer_surface, true);
wl_surface_commit(surface);
wl_display_roundtrip(display);
} else {
return false;
}

View File

@ -0,0 +1,281 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="wlr_layer_shell_unstable_v1">
<copyright>
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.
</copyright>
<interface name="zwlr_layer_shell_v1" version="1">
<description summary="create surfaces that are layers of the desktop">
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.
</description>
<request name="get_layer_surface">
<description summary="create a layer_surface from a surface">
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.
Clients can specify a namespace that defines the purpose of the layer
surface.
</description>
<arg name="id" type="new_id" interface="zwlr_layer_surface_v1"/>
<arg name="surface" type="object" interface="wl_surface"/>
<arg name="output" type="object" interface="wl_output"/>
<arg name="layer" type="uint" enum="layer" summary="layer to add this surface to"/>
<arg name="namespace" type="string" summary="namespace for the layer surface"/>
</request>
<enum name="error">
<entry name="role" value="0" summary="wl_surface has another role"/>
<entry name="invalid_layer" value="1" summary="layer value is invalid"/>
<entry name="already_constructed" value="2" summary="wl_surface has a buffer attached or committed"/>
</enum>
<enum name="layer">
<description summary="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.
</description>
<entry name="background" value="0"/>
<entry name="bottom" value="1"/>
<entry name="top" value="2"/>
<entry name="overlay" value="3"/>
</enum>
</interface>
<interface name="zwlr_layer_surface_v1" version="1">
<description summary="layer metadata 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 (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.
</description>
<request name="set_size">
<description summary="sets the size of the surface">
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.
</description>
<arg name="width" type="uint"/>
<arg name="height" type="uint"/>
</request>
<request name="set_anchor">
<description summary="configures the anchor point of the surface">
Requests that the compositor anchor the surface to the specified edges
and corners. If two orthoginal 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.
</description>
<arg name="anchor" type="uint" enum="anchor"/>
</request>
<request name="set_exclusive_zone">
<description summary="configures the exclusive geometry of this surface">
Requests that the compositor avoids occluding an area of the surface
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 an
edge, rather than a corner. The zone is the number of surface-local
coordinates from the edge that are considered 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 excluzive zone. If set to -1, the surface
indicates that it would not like to be moved to accomodate 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.
</description>
<arg name="zone" type="int"/>
</request>
<request name="set_margin">
<description summary="sets a margin from the anchor point">
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.
</description>
<arg name="top" type="int"/>
<arg name="right" type="int"/>
<arg name="bottom" type="int"/>
<arg name="left" type="int"/>
</request>
<request name="set_keyboard_interactivity">
<description summary="requests keyboard events">
Set to 1 to request that the seat send keyboard events to this layer
surface. For layers below the shell surface layer, the seat will use
normal focus semantics. For layers above the shell surface layers, the
seat will always give exclusive keyboard focus to the top-most layer
which has keyboard interactivity set to true.
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.
Events is double-buffered, see wl_surface.commit.
</description>
<arg name="keyboard_interactivity" type="uint"/>
</request>
<request name="get_popup">
<description summary="assign this layer_surface as an xdg_popup parent">
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.
</description>
<arg name="popup" type="object" interface="xdg_popup"/>
</request>
<request name="ack_configure">
<description summary="ack a configure event">
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.
</description>
<arg name="serial" type="uint" summary="the serial from the configure event"/>
</request>
<request name="destroy" type="destructor">
<description summary="destroy the layer_surface">
This request destroys the layer surface.
</description>
</request>
<event name="configure">
<description summary="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.
</description>
<arg name="serial" type="uint"/>
<arg name="width" type="uint"/>
<arg name="height" type="uint"/>
</event>
<event name="closed">
<description summary="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.
</description>
</event>
<enum name="error">
<entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/>
<entry name="invalid_size" value="1" summary="size is invalid"/>
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
</enum>
<enum name="anchor" bitfield="true">
<entry name="top" value="1" summary="the top edge of the anchor rectangle"/>
<entry name="bottom" value="2" summary="the bottom edge of the anchor rectangle"/>
<entry name="left" value="4" summary="the left edge of the anchor rectangle"/>
<entry name="right" value="8" summary="the right edge of the anchor rectangle"/>
</enum>
</interface>
</protocol>

File diff suppressed because it is too large Load Diff