Commit 248dd109 authored by Quentin Glidic's avatar Quentin Glidic

Introduce libweston-desktop

libweston-desktop is an abstraction library for compositors wanting to
support desktop-like shells.

The API is designed from xdg_shell features, as it will eventually be
the recommended shell for modern applications to use.
In the future, adding new shell protocols support will be easier, as
limited to libweston-desktop.

The library versioning is the same as libweston. If one of them break
ABI compatibility, the other will too.

The compositor will only ever see toplevel surfaces (“windows”), with
all the other being internal implementation details.
Thus, popups and associated grabs are handled entirely in
libweston-desktop.
Xwayland special surfaces (override-redirect) are special-cased to a
dedicated layer, as the compositor should not know about them.

All the shell error checking is taken care of too, as well as some
specification rules (e.g. sizes constraint for maximized and fullscreen
surfaces).

All the compositor has to do is define a few callbacks in the interface
struct, and manage toplevel surfaces.
Signed-off-by: Quentin Glidic's avatarQuentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl's avatarJonas Ådahl <jadahl@gmail.com>
Acked-by: default avatarGiulio Camuffo <giulio.camuffo@kdab.com>

Differential Revision: https://phabricator.freedesktop.org/D1207
parent 2edc3d54
......@@ -105,6 +105,29 @@ libweston_@LIBWESTON_MAJOR@_la_SOURCES = \
shared/platform.h \
libweston/weston-egl-ext.h
lib_LTLIBRARIES += libweston-desktop-@LIBWESTON_MAJOR@.la
libweston_desktop_@LIBWESTON_MAJOR@_la_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON
libweston_desktop_@LIBWESTON_MAJOR@_la_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS)
libweston_desktop_@LIBWESTON_MAJOR@_la_LIBADD = libweston-@LIBWESTON_MAJOR@.la $(COMPOSITOR_LIBS)
libweston_desktop_@LIBWESTON_MAJOR@_la_LDFLAGS = -version-info $(LT_VERSION_INFO)
libweston_desktop_@LIBWESTON_MAJOR@_la_SOURCES = \
libweston-desktop/client.c \
libweston-desktop/internal.h \
libweston-desktop/libweston-desktop.c \
libweston-desktop/libweston-desktop.h \
libweston-desktop/seat.c \
libweston-desktop/surface.c \
libweston-desktop/wl-shell.c \
libweston-desktop/xdg-shell-v5.c \
libweston-desktop/xwayland.c
nodist_libweston_desktop_@LIBWESTON_MAJOR@_la_SOURCES = \
protocol/xdg-shell-unstable-v5-protocol.c \
protocol/xdg-shell-unstable-v5-server-protocol.h
libweston-desktop-@LIBWESTON_MAJOR@.la libweston-desktop/libweston_desktop_@LIBWESTON_MAJOR@_la-xdg-shell-v5.lo: protocol/xdg-shell-unstable-v5-server-protocol.h
if SYSTEMD_NOTIFY_SUPPORT
module_LTLIBRARIES += systemd-notify.la
systemd_notify_la_LDFLAGS = -module -avoid-version
......@@ -230,7 +253,10 @@ endif
endif # BUILD_WESTON_LAUNCH
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = compositor/weston.pc libweston/libweston-${LIBWESTON_MAJOR}.pc
pkgconfig_DATA = \
libweston/libweston-${LIBWESTON_MAJOR}.pc \
libweston-desktop/libweston-desktop-${LIBWESTON_MAJOR}.pc \
compositor/weston.pc
wayland_sessiondir = $(datadir)/wayland-sessions
dist_wayland_session_DATA = compositor/weston.desktop
......@@ -251,6 +277,9 @@ libwestoninclude_HEADERS = \
shared/config-parser.h \
shared/zalloc.h
libwestoninclude_HEADERS += \
libweston-desktop/libweston-desktop.h
westonincludedir = $(includedir)/weston
westoninclude_HEADERS = compositor/weston.h
......
......@@ -646,6 +646,7 @@ AC_CONFIG_FILES([Makefile libweston/version.h compositor/weston.pc])
# AC_CONFIG_FILES needs the full name when running autoconf, so we need to use
# libweston_abi_version here, and outside [] because of m4 quoting rules
AC_CONFIG_FILES([libweston/libweston-]libweston_major_version[.pc:libweston/libweston.pc.in])
AC_CONFIG_FILES([libweston-desktop/libweston-desktop-]libweston_major_version[.pc:libweston-desktop/libweston-desktop.pc.in])
AM_CONDITIONAL([HAVE_GIT_REPO], [test -f $srcdir/.git/logs/HEAD])
......
/*
* Copyright © 2016 Quentin "Sardem FF7" Glidic
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "config.h"
#include <wayland-server.h>
#include "compositor.h"
#include "zalloc.h"
#include "libweston-desktop.h"
#include "internal.h"
struct weston_desktop_client {
struct weston_desktop *desktop;
struct wl_client *client;
struct wl_resource *resource;
struct wl_list surface_list;
uint32_t ping_serial;
struct wl_event_source *ping_timer;
struct wl_signal destroy_signal;
};
void
weston_desktop_client_add_destroy_listener(struct weston_desktop_client *client,
struct wl_listener *listener)
{
wl_signal_add(&client->destroy_signal, listener);
}
static void
weston_desktop_client_destroy(struct wl_resource *resource)
{
struct weston_desktop_client *client =
wl_resource_get_user_data(resource);
struct wl_list *list = &client->surface_list;
struct wl_list *link, *tmp;
wl_signal_emit(&client->destroy_signal, client);
for (link = list->next, tmp = link->next;
link != list;
link = tmp, tmp = link->next) {
wl_list_remove(link);
wl_list_init(link);
}
if (client->ping_timer != NULL)
wl_event_source_remove(client->ping_timer);
free(client);
}
static int
weston_desktop_client_ping_timeout(void *user_data)
{
struct weston_desktop_client *client = user_data;
weston_desktop_api_ping_timeout(client->desktop, client);
return 1;
}
struct weston_desktop_client *
weston_desktop_client_create(struct weston_desktop *desktop,
struct wl_client *wl_client,
wl_dispatcher_func_t dispatcher,
const struct wl_interface *interface,
const void *implementation, uint32_t version,
uint32_t id)
{
struct weston_desktop_client *client;
struct wl_display *display;
struct wl_event_loop *loop;
client = zalloc(sizeof(struct weston_desktop_client));
if (client == NULL) {
if (wl_client != NULL)
wl_client_post_no_memory(wl_client);
return NULL;
}
client->desktop = desktop;
client->client = wl_client;
wl_list_init(&client->surface_list);
wl_signal_init(&client->destroy_signal);
if (wl_client == NULL)
return client;
client->resource = wl_resource_create(wl_client, interface, version, id);
if (client->resource == NULL) {
wl_client_post_no_memory(wl_client);
free(client);
return NULL;
}
if (dispatcher != NULL)
wl_resource_set_dispatcher(client->resource, dispatcher,
weston_desktop_client_destroy, client,
weston_desktop_client_destroy);
else
wl_resource_set_implementation(client->resource, implementation,
client,
weston_desktop_client_destroy);
display = wl_client_get_display(client->client);
loop = wl_display_get_event_loop(display);
client->ping_timer =
wl_event_loop_add_timer(loop,
weston_desktop_client_ping_timeout,
client);
if (client->ping_timer == NULL)
wl_client_post_no_memory(wl_client);
return client;
}
struct weston_desktop *
weston_desktop_client_get_desktop(struct weston_desktop_client *client)
{
return client->desktop;
}
struct wl_resource *
weston_desktop_client_get_resource(struct weston_desktop_client *client)
{
return client->resource;
}
struct wl_list *
weston_desktop_client_get_surface_list(struct weston_desktop_client *client)
{
return &client->surface_list;
}
WL_EXPORT struct wl_client *
weston_desktop_client_get_client(struct weston_desktop_client *client)
{
return client->client;
}
WL_EXPORT void
weston_desktop_client_for_each_surface(struct weston_desktop_client *client,
void (*callback)(struct weston_desktop_surface *surface, void *user_data),
void *user_data)
{
struct wl_list *list = &client->surface_list;
struct wl_list *link;
for (link = list->next; link != list; link = link->next)
callback(weston_desktop_surface_from_client_link(link),
user_data);
}
WL_EXPORT int
weston_desktop_client_ping(struct weston_desktop_client *client)
{
struct weston_desktop_surface *surface =
weston_desktop_surface_from_client_link(client->surface_list.next);
const struct weston_desktop_surface_implementation *implementation =
weston_desktop_surface_get_implementation(surface);
void *implementation_data =
weston_desktop_surface_get_implementation_data(surface);
if (implementation->ping == NULL)
return -1;
if (client->ping_serial != 0)
return 1;
client->ping_serial =
wl_display_next_serial(wl_client_get_display(client->client));
wl_event_source_timer_update(client->ping_timer, 10000);
implementation->ping(surface, client->ping_serial, implementation_data);
return 0;
}
void
weston_desktop_client_pong(struct weston_desktop_client *client, uint32_t serial)
{
if (client->ping_serial != serial)
return;
weston_desktop_api_pong(client->desktop, client);
wl_event_source_timer_update(client->ping_timer, 0);
client->ping_serial = 0;
}
/*
* Copyright © 2016 Quentin "Sardem FF7" Glidic
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef WESTON_DESKTOP_INTERNAL_H
#define WESTON_DESKTOP_INTERNAL_H
#include "compositor.h"
struct weston_desktop_seat;
struct weston_desktop_client;
struct weston_compositor *
weston_desktop_get_compositor(struct weston_desktop *desktop);
struct wl_display *
weston_desktop_get_display(struct weston_desktop *desktop);
void
weston_desktop_api_ping_timeout(struct weston_desktop *desktop,
struct weston_desktop_client *client);
void
weston_desktop_api_pong(struct weston_desktop *desktop,
struct weston_desktop_client *client);
void
weston_desktop_api_surface_added(struct weston_desktop *desktop,
struct weston_desktop_surface *surface);
void
weston_desktop_api_surface_removed(struct weston_desktop *desktop,
struct weston_desktop_surface *surface);
void
weston_desktop_api_committed(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
int32_t sx, int32_t sy);
void
weston_desktop_api_show_window_menu(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
struct weston_seat *seat,
int32_t x, int32_t y);
void
weston_desktop_api_set_parent(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
struct weston_desktop_surface *parent);
void
weston_desktop_api_move(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
struct weston_seat *seat, uint32_t serial);
void
weston_desktop_api_resize(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
struct weston_seat *seat, uint32_t serial,
enum weston_desktop_surface_edge edges);
void
weston_desktop_api_fullscreen_requested(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
bool fullscreen,
struct weston_output *output);
void
weston_desktop_api_maximized_requested(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
bool maximized);
void
weston_desktop_api_minimized_requested(struct weston_desktop *desktop,
struct weston_desktop_surface *surface);
struct weston_desktop_seat *
weston_desktop_seat_from_seat(struct weston_seat *wseat);
struct weston_desktop_surface_implementation {
void (*set_activated)(struct weston_desktop_surface *surface,
void *user_data, bool activated);
void (*set_fullscreen)(struct weston_desktop_surface *surface,
void *user_data, bool fullscreen);
void (*set_maximized)(struct weston_desktop_surface *surface,
void *user_data, bool maximized);
void (*set_resizing)(struct weston_desktop_surface *surface,
void *user_data, bool resizing);
void (*set_size)(struct weston_desktop_surface *surface,
void *user_data, int32_t width, int32_t height);
void (*committed)(struct weston_desktop_surface *surface, void *user_data,
bool new_buffer, int32_t sx, int32_t sy);
void (*update_position)(struct weston_desktop_surface *surface,
void *user_data);
void (*ping)(struct weston_desktop_surface *surface, uint32_t serial,
void *user_data);
void (*close)(struct weston_desktop_surface *surface, void *user_data);
bool (*get_activated)(struct weston_desktop_surface *surface,
void *user_data);
bool (*get_fullscreen)(struct weston_desktop_surface *surface,
void *user_data);
bool (*get_maximized)(struct weston_desktop_surface *surface,
void *user_data);
bool (*get_resizing)(struct weston_desktop_surface *surface,
void *user_data);
struct weston_size
(*get_max_size)(struct weston_desktop_surface *surface,
void *user_data);
struct weston_size
(*get_min_size)(struct weston_desktop_surface *surface,
void *user_data);
void (*destroy)(struct weston_desktop_surface *surface,
void *user_data);
};
struct weston_desktop_client *
weston_desktop_client_create(struct weston_desktop *desktop,
struct wl_client *client,
wl_dispatcher_func_t dispatcher,
const struct wl_interface *interface,
const void *implementation, uint32_t version,
uint32_t id);
void
weston_desktop_client_add_destroy_listener(struct weston_desktop_client *client,
struct wl_listener *listener);
struct weston_desktop *
weston_desktop_client_get_desktop(struct weston_desktop_client *client);
struct wl_resource *
weston_desktop_client_get_resource(struct weston_desktop_client *client);
struct wl_list *
weston_desktop_client_get_surface_list(struct weston_desktop_client *client);
void
weston_desktop_client_pong(struct weston_desktop_client *client,
uint32_t serial);
struct weston_desktop_surface *
weston_desktop_surface_create(struct weston_desktop *desktop,
struct weston_desktop_client *client,
struct weston_surface *surface,
const struct weston_desktop_surface_implementation *implementation,
void *implementation_data);
void
weston_desktop_surface_destroy(struct weston_desktop_surface *surface);
void
weston_desktop_surface_resource_destroy(struct wl_resource *resource);
struct wl_resource *
weston_desktop_surface_add_resource(struct weston_desktop_surface *surface,
const struct wl_interface *interface,
const void *implementation, uint32_t id,
wl_resource_destroy_func_t destroy);
struct weston_desktop_surface *
weston_desktop_surface_from_grab_link(struct wl_list *grab_link);
struct wl_list *
weston_desktop_surface_get_client_link(struct weston_desktop_surface *surface);
struct weston_desktop_surface *
weston_desktop_surface_from_client_link(struct wl_list *link);
bool
weston_desktop_surface_has_implementation(struct weston_desktop_surface *surface,
const struct weston_desktop_surface_implementation *implementation);
const struct weston_desktop_surface_implementation *
weston_desktop_surface_get_implementation(struct weston_desktop_surface *surface);
void *
weston_desktop_surface_get_implementation_data(struct weston_desktop_surface *surface);
struct weston_desktop_surface *
weston_desktop_surface_get_parent(struct weston_desktop_surface *surface);
bool
weston_desktop_surface_get_grab(struct weston_desktop_surface *surface);
void
weston_desktop_surface_set_title(struct weston_desktop_surface *surface,
const char *title);
void
weston_desktop_surface_set_app_id(struct weston_desktop_surface *surface,
const char *app_id);
void
weston_desktop_surface_set_pid(struct weston_desktop_surface *surface,
pid_t pid);
void
weston_desktop_surface_set_geometry(struct weston_desktop_surface *surface,
struct weston_geometry geometry);
void
weston_desktop_surface_set_relative_to(struct weston_desktop_surface *surface,
struct weston_desktop_surface *parent,
int32_t x, int32_t y, bool use_geometry);
void
weston_desktop_surface_unset_relative_to(struct weston_desktop_surface *surface);
void
weston_desktop_surface_popup_grab(struct weston_desktop_surface *popup,
struct weston_desktop_seat *seat,
uint32_t serial);
void
weston_desktop_surface_popup_ungrab(struct weston_desktop_surface *popup,
struct weston_desktop_seat *seat);
void
weston_desktop_surface_popup_dismiss(struct weston_desktop_surface *surface);
struct weston_desktop_surface *
weston_desktop_seat_popup_grab_get_topmost_surface(struct weston_desktop_seat *seat);
bool
weston_desktop_seat_popup_grab_start(struct weston_desktop_seat *seat,
struct wl_client *client, uint32_t serial);
void
weston_desktop_seat_popup_grab_add_surface(struct weston_desktop_seat *seat,
struct wl_list *link);
void
weston_desktop_seat_popup_grab_remove_surface(struct weston_desktop_seat *seat,
struct wl_list *link);
void
weston_desktop_destroy_request(struct wl_client *client,
struct wl_resource *resource);
struct wl_global *
weston_desktop_xdg_shell_v6_create(struct weston_desktop *desktop,
struct wl_display *display);
struct wl_global *
weston_desktop_xdg_shell_v5_create(struct weston_desktop *desktop,
struct wl_display *display);
struct wl_global *
weston_desktop_wl_shell_create(struct weston_desktop *desktop,
struct wl_display *display);
void
weston_desktop_xwayland_init(struct weston_desktop *desktop);
#endif /* WESTON_DESKTOP_INTERNAL_H */
/*
* Copyright © 2016 Quentin "Sardem FF7" Glidic
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "config.h"
#include <string.h>
#include <wayland-server.h>
#include <assert.h>
#include "compositor.h"
#include "zalloc.h"
#include "helpers.h"
#include "libweston-desktop.h"
#include "internal.h"
struct weston_desktop {
struct weston_compositor *compositor;
struct weston_desktop_api api;
void *user_data;
struct wl_global *xdg_shell_v5;
struct wl_global *wl_shell;
};
void
weston_desktop_destroy_request(struct wl_client *client,
struct wl_resource *resource)
{
wl_resource_destroy(resource);
}
WL_EXPORT struct weston_desktop *
weston_desktop_create(struct weston_compositor *compositor,
const struct weston_desktop_api *api, void *user_data)
{
struct weston_desktop *desktop;
struct wl_display *display = compositor->wl_display;
assert(api->surface_added);
assert(api->surface_removed);
desktop = zalloc(sizeof(struct weston_desktop));
desktop->compositor = compositor;
desktop->user_data = user_data;
desktop->api.struct_size =
MIN(sizeof(struct weston_desktop_api), api->struct_size);
memcpy(&desktop->api, api, desktop->api.struct_size);
desktop->xdg_shell_v5 =
weston_desktop_xdg_shell_v5_create(desktop, display);
if (desktop->xdg_shell_v5 == NULL) {
weston_desktop_destroy(desktop);
return NULL;
}
desktop->wl_shell =
weston_desktop_wl_shell_create(desktop, display);
if (desktop->wl_shell == NULL) {
weston_desktop_destroy(desktop);
return NULL;
}
weston_desktop_xwayland_init(desktop);
return desktop;
}
WL_EXPORT void
weston_desktop_destroy(struct weston_desktop *desktop)
{
if (desktop == NULL)
return;
if (desktop->wl_shell != NULL)
wl_global_destroy(desktop->wl_shell);
if (desktop->xdg_shell_v5 != NULL)
wl_global_destroy(desktop->xdg_shell_v5);
free(desktop);
}
struct weston_compositor *
weston_desktop_get_compositor(struct weston_desktop *desktop)
{
return desktop->compositor;
}
struct wl_display *
weston_desktop_get_display(struct weston_desktop *desktop)
{
return desktop->compositor->wl_display;
}
void
weston_desktop_api_ping_timeout(struct weston_desktop *desktop,
struct weston_desktop_client *client)
{
if (desktop->api.ping_timeout != NULL)
desktop->api.ping_timeout(client, desktop->user_data);
}
void
weston_desktop_api_pong(struct weston_desktop *desktop,
struct weston_desktop_client *client)
{
if (desktop->api.pong != NULL)
desktop->api.pong(client, desktop->user_data);
}
void
weston_desktop_api_surface_added(struct weston_desktop *desktop,
struct weston_desktop_surface *surface)
{
struct weston_desktop_client *client =
weston_desktop_surface_get_client(surface);
struct wl_list *list = weston_desktop_client_get_surface_list(client);
struct wl_list *link = weston_desktop_surface_get_client_link(surface);
desktop->api.surface_added(surface, desktop->user_data);
wl_list_insert(list, link);
}
void
weston_desktop_api_surface_removed(struct weston_desktop *desktop,
struct weston_desktop_surface *surface)
{
struct wl_list *link = weston_desktop_surface_get_client_link(surface);
wl_list_remove(link);
wl_list_init(link);
desktop->api.surface_removed(surface, desktop->user_data);
}
void
weston_desktop_api_committed(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
int32_t sx, int32_t sy)
{
if (desktop->api.committed != NULL)
desktop->api.committed(surface, sx, sy, desktop->user_data);
}
void
weston_desktop_api_show_window_menu(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
struct weston_seat *seat,
int32_t x, int32_t y)
{
if (desktop->api.show_window_menu != NULL)
desktop->api.show_window_menu(surface, seat, x, y,
desktop->user_data);
}
void
weston_desktop_api_set_parent(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
struct weston_desktop_surface *parent)
{
if (desktop->api.set_parent != NULL)
desktop->api.set_parent(surface, parent, desktop->user_data);
}
void
weston_desktop_api_move(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
struct weston_seat *seat, uint32_t serial)
{
if (desktop->api.move != NULL)
desktop->api.move(surface, seat, serial, desktop->user_data);
}
void
weston_desktop_api_resize(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
struct weston_seat *seat, uint32_t serial,
enum weston_desktop_surface_edge edges)
{
if (desktop->api.resize != NULL)
desktop->api.resize(surface, seat, serial, edges,
desktop->user_data);
}
void
weston_desktop_api_fullscreen_requested(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
bool fullscreen,
struct weston_output *output)
{
if (desktop->api.fullscreen_requested != NULL)
desktop->api.fullscreen_requested(surface, fullscreen, output,
desktop->user_data);
}
void
weston_desktop_api_maximized_requested(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,</