xwayland: Introduce a private struct for XWayland interface

libweston-desktop implements this private struct.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Giulio Camuffo <giulio.camuffo@kdab.com>

Differential Revision: https://phabricator.freedesktop.org/D1208
dev
Quentin Glidic 8 years ago
parent 248dd10965
commit 955cec06c7
No known key found for this signature in database
GPG Key ID: AC203F96E2C34BB7
  1. 1
      Makefile.am
  2. 126
      libweston-desktop/xwayland.c
  3. 5
      libweston/compositor.h
  4. 17
      xwayland/launcher.c
  5. 128
      xwayland/window-manager.c
  6. 42
      xwayland/xwayland-api.h
  7. 62
      xwayland/xwayland-internal-interface.h

@ -1028,6 +1028,7 @@ xwayland_la_CFLAGS = \
$(CAIRO_CFLAGS)
xwayland_la_SOURCES = \
xwayland/xwayland.h \
xwayland/xwayland-internal-interface.h \
xwayland/window-manager.c \
xwayland/selection.c \
xwayland/dnd.c \

@ -35,6 +35,7 @@
#include "libweston-desktop.h"
#include "internal.h"
#include "xwayland/xwayland-internal-interface.h"
enum weston_desktop_xwayland_surface_state {
NONE,
@ -51,13 +52,13 @@ struct weston_desktop_xwayland {
struct weston_layer layer;
};
struct shell_surface {
struct weston_desktop_xwayland_surface {
struct weston_desktop_xwayland *xwayland;
struct weston_desktop *desktop;
struct weston_desktop_surface *surface;
struct wl_listener resource_destroy_listener;
struct weston_view *view;
const struct weston_shell_client *client;
const struct weston_xwayland_client_interface *client_interface;
struct weston_geometry next_geometry;
bool has_next_geometry;
bool added;
@ -65,7 +66,7 @@ struct shell_surface {
};
static void
weston_desktop_xwayland_surface_change_state(struct shell_surface *surface,
weston_desktop_xwayland_surface_change_state(struct weston_desktop_xwayland_surface *surface,
enum weston_desktop_xwayland_surface_state state,
struct weston_desktop_surface *parent,
int32_t x, int32_t y)
@ -114,7 +115,7 @@ weston_desktop_xwayland_surface_committed(struct weston_desktop_surface *dsurfac
void *user_data, bool new_buffer,
int32_t sx, int32_t sy)
{
struct shell_surface *surface = user_data;
struct weston_desktop_xwayland_surface *surface = user_data;
if (surface->has_next_geometry) {
surface->has_next_geometry = false;
@ -129,20 +130,21 @@ weston_desktop_xwayland_surface_committed(struct weston_desktop_surface *dsurfac
static void
weston_desktop_xwayland_surface_set_size(struct weston_desktop_surface *dsurface,
void *user_data,
int32_t width, int32_t height)
void *user_data,
int32_t width, int32_t height)
{
struct shell_surface *surface = user_data;
struct weston_desktop_xwayland_surface *surface = user_data;
struct weston_surface *wsurface =
weston_desktop_surface_get_surface(surface->surface);
surface->client->send_configure(weston_desktop_surface_get_surface(surface->surface),
width, height);
surface->client_interface->send_configure(wsurface, width, height);
}
static void
weston_desktop_xwayland_surface_destroy(struct weston_desktop_surface *dsurface,
void *user_data)
{
struct shell_surface *surface = user_data;
struct weston_desktop_xwayland_surface *surface = user_data;
wl_list_remove(&surface->resource_destroy_listener.link);
@ -158,18 +160,18 @@ weston_desktop_xwayland_surface_destroy(struct weston_desktop_surface *dsurface,
static bool
weston_desktop_xwayland_surface_get_maximized(struct weston_desktop_surface *dsurface,
void *user_data)
void *user_data)
{
struct shell_surface *surface = user_data;
struct weston_desktop_xwayland_surface *surface = user_data;
return surface->state == MAXIMIZED;
}
static bool
weston_desktop_xwayland_surface_get_fullscreen(struct weston_desktop_surface *dsurface,
void *user_data)
void *user_data)
{
struct shell_surface *surface = user_data;
struct weston_desktop_xwayland_surface *surface = user_data;
return surface->state == FULLSCREEN;
}
@ -188,27 +190,26 @@ static void
weston_destop_xwayland_resource_destroyed(struct wl_listener *listener,
void *data)
{
struct shell_surface *surface =
struct weston_desktop_xwayland_surface *surface =
wl_container_of(listener, surface, resource_destroy_listener);
weston_desktop_surface_destroy(surface->surface);
}
static struct shell_surface *
create_shell_surface(void *shell,
struct weston_surface *wsurface,
const struct weston_shell_client *client)
static struct weston_desktop_xwayland_surface *
create_surface(struct weston_desktop_xwayland *xwayland,
struct weston_surface *wsurface,
const struct weston_xwayland_client_interface *client_interface)
{
struct weston_desktop_xwayland *xwayland = shell;
struct shell_surface *surface;
struct weston_desktop_xwayland_surface *surface;
surface = zalloc(sizeof(struct shell_surface));
surface = zalloc(sizeof(struct weston_desktop_xwayland_surface));
if (surface == NULL)
return NULL;
surface->xwayland = xwayland;
surface->desktop = xwayland->desktop;
surface->client = client;
surface->client_interface = client_interface;
surface->surface =
weston_desktop_surface_create(surface->desktop,
@ -229,15 +230,15 @@ create_shell_surface(void *shell,
}
static void
set_toplevel(struct shell_surface *surface)
set_toplevel(struct weston_desktop_xwayland_surface *surface)
{
weston_desktop_xwayland_surface_change_state(surface, TOPLEVEL, NULL,
0, 0);
}
static void
set_transient(struct shell_surface *surface,
struct weston_surface *wparent, int x, int y, uint32_t flags)
set_parent(struct weston_desktop_xwayland_surface *surface,
struct weston_surface *wparent)
{
struct weston_desktop_surface *parent;
@ -245,20 +246,26 @@ set_transient(struct shell_surface *surface,
return;
parent = weston_surface_get_desktop_surface(wparent);
if (flags & WL_SHELL_SURFACE_TRANSIENT_INACTIVE) {
weston_desktop_xwayland_surface_change_state(surface, TRANSIENT,
parent, x, y);
} else {
weston_desktop_xwayland_surface_change_state(surface, TOPLEVEL,
NULL, 0, 0);
weston_desktop_api_set_parent(surface->desktop,
surface->surface, parent);
}
weston_desktop_api_set_parent(surface->desktop, surface->surface, parent);
}
static void
set_transient(struct weston_desktop_xwayland_surface *surface,
struct weston_surface *wparent, int x, int y)
{
struct weston_desktop_surface *parent;
if (!weston_surface_is_desktop_surface(wparent))
return;
parent = weston_surface_get_desktop_surface(wparent);
weston_desktop_xwayland_surface_change_state(surface, TRANSIENT, parent,
x, y);
}
static void
set_fullscreen(struct shell_surface *surface, uint32_t method,
uint32_t framerate, struct weston_output *output)
set_fullscreen(struct weston_desktop_xwayland_surface *surface,
struct weston_output *output)
{
weston_desktop_xwayland_surface_change_state(surface, FULLSCREEN, NULL,
0, 0);
@ -267,15 +274,14 @@ set_fullscreen(struct shell_surface *surface, uint32_t method,
}
static void
set_xwayland(struct shell_surface *surface, int x, int y,
uint32_t flags)
set_xwayland(struct weston_desktop_xwayland_surface *surface, int x, int y)
{
weston_desktop_xwayland_surface_change_state(surface, XWAYLAND, NULL,
x, y);
}
static int
move(struct shell_surface *surface,
move(struct weston_desktop_xwayland_surface *surface,
struct weston_pointer *pointer)
{
if (surface->state == TOPLEVEL ||
@ -287,7 +293,7 @@ move(struct shell_surface *surface,
}
static int
resize(struct shell_surface *surface,
resize(struct weston_desktop_xwayland_surface *surface,
struct weston_pointer *pointer, uint32_t edges)
{
if (surface->state == TOPLEVEL ||
@ -300,13 +306,13 @@ resize(struct shell_surface *surface,
}
static void
set_title(struct shell_surface *surface, const char *title)
set_title(struct weston_desktop_xwayland_surface *surface, const char *title)
{
weston_desktop_surface_set_title(surface->surface, title);
}
static void
set_window_geometry(struct shell_surface *surface,
set_window_geometry(struct weston_desktop_xwayland_surface *surface,
int32_t x, int32_t y, int32_t width, int32_t height)
{
surface->has_next_geometry = true;
@ -317,7 +323,7 @@ set_window_geometry(struct shell_surface *surface,
}
static void
set_maximized(struct shell_surface *surface)
set_maximized(struct weston_desktop_xwayland_surface *surface)
{
weston_desktop_xwayland_surface_change_state(surface, MAXIMIZED, NULL,
0, 0);
@ -326,10 +332,26 @@ set_maximized(struct shell_surface *surface)
}
static void
set_pid(struct shell_surface *surface, pid_t pid)
set_pid(struct weston_desktop_xwayland_surface *surface, pid_t pid)
{
weston_desktop_surface_set_pid(surface->surface, pid);
}
static const struct weston_desktop_xwayland_interface weston_desktop_xwayland_interface = {
.create_surface = create_surface,
.set_toplevel = set_toplevel,
.set_parent = set_parent,
.set_transient = set_transient,
.set_fullscreen = set_fullscreen,
.set_xwayland = set_xwayland,
.move = move,
.resize = resize,
.set_title = set_title,
.set_window_geometry = set_window_geometry,
.set_maximized = set_maximized,
.set_pid = set_pid,
};
void
weston_desktop_xwayland_init(struct weston_desktop *desktop)
{
@ -345,16 +367,6 @@ weston_desktop_xwayland_init(struct weston_desktop *desktop)
weston_layer_init(&xwayland->layer, &compositor->cursor_layer.link);
compositor->shell_interface.shell = xwayland;
compositor->shell_interface.create_shell_surface = create_shell_surface;
compositor->shell_interface.set_toplevel = set_toplevel;
compositor->shell_interface.set_transient = set_transient;
compositor->shell_interface.set_fullscreen = set_fullscreen;
compositor->shell_interface.set_xwayland = set_xwayland;
compositor->shell_interface.move = move;
compositor->shell_interface.resize = resize;
compositor->shell_interface.set_title = set_title;
compositor->shell_interface.set_window_geometry = set_window_geometry;
compositor->shell_interface.set_maximized = set_maximized;
compositor->shell_interface.set_pid = set_pid;
compositor->xwayland = xwayland;
compositor->xwayland_interface = &weston_desktop_xwayland_interface;
}

@ -778,10 +778,15 @@ struct weston_backend {
void (*restore)(struct weston_compositor *compositor);
};
struct weston_desktop_xwayland;
struct weston_desktop_xwayland_interface;
struct weston_compositor {
struct wl_signal destroy_signal;
struct wl_display *wl_display;
struct weston_desktop_xwayland *xwayland;
const struct weston_desktop_xwayland_interface *xwayland_interface;
struct weston_shell_interface shell_interface;
/* surface signals */

@ -341,6 +341,7 @@ const struct weston_xwayland_api api = {
weston_xwayland_xserver_loaded,
weston_xwayland_xserver_exited,
};
extern const struct weston_xwayland_surface_api surface_api;
WL_EXPORT int
module_init(struct weston_compositor *compositor,
@ -357,6 +358,13 @@ module_init(struct weston_compositor *compositor,
wxs->wl_display = display;
wxs->compositor = compositor;
if (weston_xwayland_get_api(compositor) != NULL ||
weston_xwayland_surface_get_api(compositor) != NULL) {
weston_log("The xwayland module APIs are already loaded.\n");
free(wxs);
return -1;
}
ret = weston_plugin_api_register(compositor, WESTON_XWAYLAND_API_NAME,
&api, sizeof(api));
if (ret < 0) {
@ -365,6 +373,15 @@ module_init(struct weston_compositor *compositor,
return -1;
}
ret = weston_plugin_api_register(compositor,
WESTON_XWAYLAND_SURFACE_API_NAME,
&surface_api, sizeof(surface_api));
if (ret < 0) {
weston_log("Failed to register the xwayland surface API.\n");
free(wxs);
return -1;
}
wxs->destroy_listener.notify = weston_xserver_destroy;
wl_signal_add(&compositor->destroy_signal, &wxs->destroy_listener);

@ -39,6 +39,7 @@
#include <linux/input.h>
#include "xwayland.h"
#include "xwayland-internal-interface.h"
#include "cairo-util.h"
#include "compositor.h"
@ -132,7 +133,7 @@ struct weston_wm_window {
cairo_surface_t *cairo_surface;
uint32_t surface_id;
struct weston_surface *surface;
struct shell_surface *shsurf;
struct weston_desktop_xwayland_surface *shsurf;
struct wl_listener surface_destroy_listener;
struct wl_event_source *repaint_source;
struct wl_event_source *configure_source;
@ -395,8 +396,8 @@ static void
weston_wm_window_read_properties(struct weston_wm_window *window)
{
struct weston_wm *wm = window->wm;
struct weston_shell_interface *shell_interface =
&wm->server->compositor->shell_interface;
const struct weston_desktop_xwayland_interface *xwayland_interface =
wm->server->compositor->xwayland_interface;
#define F(field) offsetof(struct weston_wm_window, field)
const struct {
@ -540,11 +541,11 @@ weston_wm_window_read_properties(struct weston_wm_window *window)
}
if (window->shsurf && window->name)
shell_interface->set_title(window->shsurf, window->name);
xwayland_interface->set_title(window->shsurf, window->name);
if (window->frame && window->name)
frame_set_title(window->frame, window->name);
if (window->shsurf && window->pid > 0)
shell_interface->set_pid(window->shsurf, window->pid);
xwayland_interface->set_pid(window->shsurf, window->pid);
}
static void
@ -1043,8 +1044,8 @@ weston_wm_window_draw_decoration(void *data)
cairo_t *cr;
int x, y, width, height;
int32_t input_x, input_y, input_w, input_h;
struct weston_shell_interface *shell_interface =
&wm->server->compositor->shell_interface;
const struct weston_desktop_xwayland_interface *xwayland_interface =
wm->server->compositor->xwayland_interface;
uint32_t flags = 0;
struct weston_view *view;
@ -1106,8 +1107,8 @@ weston_wm_window_draw_decoration(void *data)
pixman_region32_init_rect(&window->surface->pending.input,
input_x, input_y, input_w, input_h);
shell_interface->set_window_geometry(window->shsurf,
input_x, input_y, input_w, input_h);
xwayland_interface->set_window_geometry(window->shsurf,
input_x, input_y, input_w, input_h);
}
}
@ -1352,8 +1353,8 @@ weston_wm_window_handle_moveresize(struct weston_wm_window *window,
struct weston_seat *seat = weston_wm_pick_seat_for_window(window);
struct weston_pointer *pointer = weston_seat_get_pointer(seat);
int detail;
struct weston_shell_interface *shell_interface =
&wm->server->compositor->shell_interface;
const struct weston_desktop_xwayland_interface *xwayland_interface =
wm->server->compositor->xwayland_interface;
if (!pointer || pointer->button_count != 1
|| !pointer->focus
@ -1363,7 +1364,7 @@ weston_wm_window_handle_moveresize(struct weston_wm_window *window,
detail = client_message->data.data32[2];
switch (detail) {
case _NET_WM_MOVERESIZE_MOVE:
shell_interface->move(window->shsurf, pointer);
xwayland_interface->move(window->shsurf, pointer);
break;
case _NET_WM_MOVERESIZE_SIZE_TOPLEFT:
case _NET_WM_MOVERESIZE_SIZE_TOP:
@ -1373,7 +1374,7 @@ weston_wm_window_handle_moveresize(struct weston_wm_window *window,
case _NET_WM_MOVERESIZE_SIZE_BOTTOM:
case _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT:
case _NET_WM_MOVERESIZE_SIZE_LEFT:
shell_interface->resize(window->shsurf, pointer, map[detail]);
xwayland_interface->resize(window->shsurf, pointer, map[detail]);
break;
case _NET_WM_MOVERESIZE_CANCEL:
break;
@ -1415,10 +1416,10 @@ weston_wm_window_configure(void *data);
static void
weston_wm_window_set_toplevel(struct weston_wm_window *window)
{
struct weston_shell_interface *shell_interface =
&window->wm->server->compositor->shell_interface;
const struct weston_desktop_xwayland_interface *xwayland_interface =
window->wm->server->compositor->xwayland_interface;
shell_interface->set_toplevel(window->shsurf);
xwayland_interface->set_toplevel(window->shsurf);
window->width = window->saved_width;
window->height = window->saved_height;
if (window->frame)
@ -1439,8 +1440,8 @@ weston_wm_window_handle_state(struct weston_wm_window *window,
xcb_client_message_event_t *client_message)
{
struct weston_wm *wm = window->wm;
struct weston_shell_interface *shell_interface =
&wm->server->compositor->shell_interface;
const struct weston_desktop_xwayland_interface *xwayland_interface =
wm->server->compositor->xwayland_interface;
uint32_t action, property;
int maximized = weston_wm_window_is_maximized(window);
@ -1455,9 +1456,8 @@ weston_wm_window_handle_state(struct weston_wm_window *window,
window->saved_height = window->height;
if (window->shsurf)
shell_interface->set_fullscreen(window->shsurf,
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
0, NULL);
xwayland_interface->set_fullscreen(window->shsurf,
NULL);
} else {
if (window->shsurf)
weston_wm_window_set_toplevel(window);
@ -1476,7 +1476,7 @@ weston_wm_window_handle_state(struct weston_wm_window *window,
window->saved_height = window->height;
if (window->shsurf)
shell_interface->set_maximized(window->shsurf);
xwayland_interface->set_maximized(window->shsurf);
} else if (window->shsurf) {
weston_wm_window_set_toplevel(window);
}
@ -1753,8 +1753,8 @@ static void
weston_wm_handle_button(struct weston_wm *wm, xcb_generic_event_t *event)
{
xcb_button_press_event_t *button = (xcb_button_press_event_t *) event;
struct weston_shell_interface *shell_interface =
&wm->server->compositor->shell_interface;
const struct weston_desktop_xwayland_interface *xwayland_interface =
wm->server->compositor->xwayland_interface;
struct weston_seat *seat;
struct weston_pointer *pointer;
struct weston_wm_window *window;
@ -1794,13 +1794,13 @@ weston_wm_handle_button(struct weston_wm *wm, xcb_generic_event_t *event)
if (frame_status(window->frame) & FRAME_STATUS_MOVE) {
if (pointer)
shell_interface->move(window->shsurf, pointer);
xwayland_interface->move(window->shsurf, pointer);
frame_status_clear(window->frame, FRAME_STATUS_MOVE);
}
if (frame_status(window->frame) & FRAME_STATUS_RESIZE) {
if (pointer)
shell_interface->resize(window->shsurf, pointer, location);
xwayland_interface->resize(window->shsurf, pointer, location);
frame_status_clear(window->frame, FRAME_STATUS_RESIZE);
}
@ -1815,7 +1815,7 @@ weston_wm_handle_button(struct weston_wm *wm, xcb_generic_event_t *event)
if (weston_wm_window_is_maximized(window)) {
window->saved_width = window->width;
window->saved_height = window->height;
shell_interface->set_maximized(window->shsurf);
xwayland_interface->set_maximized(window->shsurf);
} else {
weston_wm_window_set_toplevel(window);
}
@ -2333,6 +2333,12 @@ get_wm_window(struct weston_surface *surface)
return NULL;
}
static bool
is_wm_window(struct weston_surface *surface)
{
return get_wm_window(surface) != NULL;
}
static void
weston_wm_window_configure(void *data)
{
@ -2431,9 +2437,8 @@ send_position(struct weston_surface *surface, int32_t x, int32_t y)
}
}
static const struct weston_shell_client shell_client = {
static const struct weston_xwayland_client_interface shell_client = {
send_configure,
send_position
};
static int
@ -2500,11 +2505,12 @@ xserver_map_shell_surface(struct weston_wm_window *window,
struct weston_surface *surface)
{
struct weston_wm *wm = window->wm;
struct weston_shell_interface *shell_interface =
&wm->server->compositor->shell_interface;
struct weston_desktop_xwayland *xwayland =
wm->server->compositor->xwayland;
const struct weston_desktop_xwayland_interface *xwayland_interface =
wm->server->compositor->xwayland_interface;
struct weston_output *output;
struct weston_wm_window *parent;
int flags = 0;
weston_wm_window_read_properties(window);
@ -2521,7 +2527,7 @@ xserver_map_shell_surface(struct weston_wm_window *window,
weston_wm_window_schedule_repaint(window);
if (!shell_interface->create_shell_surface)
if (!xwayland_interface)
return;
if (window->surface->committed) {
@ -2532,50 +2538,52 @@ xserver_map_shell_surface(struct weston_wm_window *window,
}
window->shsurf =
shell_interface->create_shell_surface(shell_interface->shell,
window->surface,
&shell_client);
xwayland_interface->create_surface(xwayland,
window->surface,
&shell_client);
if (window->name)
shell_interface->set_title(window->shsurf, window->name);
xwayland_interface->set_title(window->shsurf, window->name);
if (window->pid > 0)
shell_interface->set_pid(window->shsurf, window->pid);
xwayland_interface->set_pid(window->shsurf, window->pid);
if (window->fullscreen) {
window->saved_width = window->width;
window->saved_height = window->height;
shell_interface->set_fullscreen(window->shsurf,
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
0, NULL);
xwayland_interface->set_fullscreen(window->shsurf, NULL);
return;
} else if (legacy_fullscreen(wm, window, &output)) {
window->fullscreen = 1;
shell_interface->set_fullscreen(window->shsurf,
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
0, output);
xwayland_interface->set_fullscreen(window->shsurf, output);
} else if (window->override_redirect) {
shell_interface->set_xwayland(window->shsurf,
window->x,
window->y,
WL_SHELL_SURFACE_TRANSIENT_INACTIVE);
xwayland_interface->set_xwayland(window->shsurf,
window->x, window->y);
} else if (window->transient_for && window->transient_for->surface) {
parent = window->transient_for;
if (weston_wm_window_type_inactive(window))
flags = WL_SHELL_SURFACE_TRANSIENT_INACTIVE;
shell_interface->set_transient(window->shsurf,
parent->surface,
window->x - parent->x,
window->y - parent->y, flags);
if (weston_wm_window_type_inactive(window)) {
xwayland_interface->set_transient(window->shsurf,
parent->surface,
window->x - parent->x,
window->y - parent->y);
} else {
xwayland_interface->set_toplevel(window->shsurf);
xwayland_interface->set_parent(window->shsurf,
parent->surface);
}
} else if (weston_wm_window_is_maximized(window)) {
shell_interface->set_maximized(window->shsurf);
xwayland_interface->set_maximized(window->shsurf);
} else {
if (weston_wm_window_type_inactive(window)) {
shell_interface->set_xwayland(window->shsurf,
window->x,
window->y,
WL_SHELL_SURFACE_TRANSIENT_INACTIVE);
xwayland_interface->set_xwayland(window->shsurf,
window->x,
window->y);
} else {
shell_interface->set_toplevel(window->shsurf);
xwayland_interface->set_toplevel(window->shsurf);
}
}
}
const struct weston_xwayland_surface_api surface_api = {
is_wm_window,
send_position,
};

@ -38,6 +38,7 @@ struct weston_compositor;
struct weston_xwayland;
#define WESTON_XWAYLAND_API_NAME "weston_xwayland_v1"
#define WESTON_XWAYLAND_SURFACE_API_NAME "weston_xwayland_surface_v1"
typedef pid_t
(*weston_xwayland_spawn_xserver_func_t)(
@ -127,6 +128,47 @@ weston_xwayland_get_api(struct weston_compositor *compositor)
return (const struct weston_xwayland_api *)api;
}
/** The libweston Xwayland surface API
*
* This API allows control of the Xwayland libweston module surfaces.
* The module must be loaded at runtime with \a weston_compositor_load_xwayland,
* after which the API can be retrieved by using
* \a weston_xwayland_surface_get_api.
*/
struct weston_xwayland_surface_api {
/** Check if the surface is an Xwayland surface
*
* \param surface The surface.
*/
bool
(*is_xwayland_surface)(struct weston_surface *surface);
/** Notify the Xwayland surface that its position changed.
*
* \param surface The Xwayland surface.
* \param x The x-axis position.
* \param y The y-axis position.
*/
void
(*send_position)(struct weston_surface *surface, int32_t x, int32_t y);
};
/** Retrieve the API object for the libweston Xwayland surface.
*
* The module must have been previously loaded by calling
* \a weston_compositor_load_xwayland.
*
* \param compositor The compositor instance.
*/
static inline const struct weston_xwayland_surface_api *
weston_xwayland_surface_get_api(struct weston_compositor *compositor)
{
const void *api;
api = weston_plugin_api_get(compositor, WESTON_XWAYLAND_SURFACE_API_NAME,
sizeof(struct weston_xwayland_surface_api));
/* The cast is necessary to use this function in C++ code */
return (const struct weston_xwayland_surface_api *)api;
}
#ifdef __cplusplus
}
#endif

@ -0,0 +1,62 @@
/*
* 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 XWAYLAND_INTERNAL_INTERFACE_H
#define XWAYLAND_INTERNAL_INTERFACE_H
struct weston_desktop_xwayland;
struct weston_desktop_xwayland_surface;
struct weston_xwayland_client_interface {
void (*send_configure)(struct weston_surface *surface, int32_t width, int32_t height);
};
struct weston_desktop_xwayland_interface {
struct weston_desktop_xwayland_surface *(*create_surface)(struct weston_desktop_xwayland *xwayland,
struct weston_surface *surface,
const struct weston_xwayland_client_interface *client);
void (*set_toplevel)(struct weston_desktop_xwayland_surface *shsurf);
void (*set_parent)(struct weston_desktop_xwayland_surface *shsurf,
struct weston_surface *parent);
void (*set_transient)(struct weston_desktop_xwayland_surface *shsurf,
struct weston_surface *parent, int x, int y);
void (*set_fullscreen)(struct weston_desktop_xwayland_surface *shsurf,
struct weston_output *output);
void (*set_xwayland)(struct weston_desktop_xwayland_surface *shsurf,
int x, int y);
int (*move)(struct weston_desktop_xwayland_surface *shsurf,
struct weston_pointer *pointer);
int (*resize)(struct weston_desktop_xwayland_surface *shsurf,
struct weston_pointer *pointer, uint32_t edges);
void (*set_title)(struct weston_desktop_xwayland_surface *shsurf,
const char *title);
void (*set_window_geometry)(struct weston_desktop_xwayland_surface *shsurf,
int32_t x, int32_t y,
int32_t width, int32_t height);
void (*set_maximized)(struct weston_desktop_xwayland_surface *shsurf);
void (*set_pid)(struct weston_desktop_xwayland_surface *shsurf, pid_t pid);
};
#endif
Loading…
Cancel
Save