[RFC weston 2/6] xwayland: Introduce a private struct for XWayland interface

Quentin Glidic sardemff7+wayland at sardemff7.net
Sun Jul 17 08:59:19 UTC 2016


From: Quentin Glidic <sardemff7+git at sardemff7.net>

libweston-desktop implements this private struct.

Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
---
 Makefile.am                            |  1 +
 libweston-desktop/xwayland.c           | 75 +++++++++++++++---------------
 libweston/compositor.h                 |  5 ++
 xwayland/window-manager.c              | 83 ++++++++++++++++++----------------
 xwayland/xwayland-internal-interface.h | 64 ++++++++++++++++++++++++++
 5 files changed, 152 insertions(+), 76 deletions(-)
 create mode 100644 xwayland/xwayland-internal-interface.h

diff --git a/Makefile.am b/Makefile.am
index 6c44f2b..0edc605 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1009,6 +1009,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				\
diff --git a/libweston-desktop/xwayland.c b/libweston-desktop/xwayland.c
index e7a73d4..09d8902 100644
--- a/libweston-desktop/xwayland.c
+++ b/libweston-desktop/xwayland.c
@@ -37,6 +37,7 @@
 
 #include "libweston-desktop.h"
 #include "internal.h"
+#include "xwayland/xwayland-internal-interface.h"
 
 enum shell_surface_state {
     TOPLEVEL,
@@ -52,11 +53,11 @@ struct weston_desktop_xwayland {
     struct wl_listener transform_listener;
 };
 
-struct shell_surface {
+struct weston_desktop_xwayland_surface {
     struct weston_desktop_xwayland *xwayland;
     struct weston_desktop *desktop;
     struct weston_desktop_surface *surface;
-    const struct weston_shell_client *client;
+    const struct weston_xwayland_client_interface *client;
     struct weston_desktop_surface_geometry next_geometry;
     struct weston_desktop_surface_geometry geometry;
     bool has_geometry;
@@ -66,7 +67,7 @@ struct shell_surface {
 static void
 _weston_desktop_xwayland_surface_commit(struct weston_desktop_surface *surface, void *user_data, int32_t sx, int32_t sy)
 {
-    struct shell_surface *self = user_data;
+    struct weston_desktop_xwayland_surface *self = user_data;
 
     if ( self->has_geometry )
         self->geometry = self->next_geometry;
@@ -77,7 +78,7 @@ _weston_desktop_xwayland_surface_commit(struct weston_desktop_surface *surface,
 static void
 _weston_desktop_xwayland_surface_set_size(struct weston_desktop_surface *surface, void *user_data, int32_t width, int32_t height)
 {
-    struct shell_surface *self = user_data;
+    struct weston_desktop_xwayland_surface *self = user_data;
 
     self->client->send_configure(weston_desktop_surface_get_surface(self->surface), width, height);
 }
@@ -85,7 +86,7 @@ _weston_desktop_xwayland_surface_set_size(struct weston_desktop_surface *surface
 static void
 _weston_desktop_xwayland_surface_free(struct weston_desktop_surface *surface, void *user_data)
 {
-    struct shell_surface *self = user_data;
+    struct weston_desktop_xwayland_surface *self = user_data;
 
     if ( ( self->state == TOPLEVEL ) || ( self->state == MAXIMIZED ) || ( self->state == FULLSCREEN ) )
         weston_desktop_api_surface_free(self->desktop, self->surface);
@@ -96,7 +97,7 @@ _weston_desktop_xwayland_surface_free(struct weston_desktop_surface *surface, vo
 static bool
 _weston_desktop_xwayland_surface_get_maximized(struct weston_desktop_surface *surface, void *user_data)
 {
-    struct shell_surface *self = user_data;
+    struct weston_desktop_xwayland_surface *self = user_data;
 
     return ( self->state == MAXIMIZED );
 }
@@ -104,7 +105,7 @@ _weston_desktop_xwayland_surface_get_maximized(struct weston_desktop_surface *su
 static bool
 _weston_desktop_xwayland_surface_get_fullscreen(struct weston_desktop_surface *surface, void *user_data)
 {
-    struct shell_surface *self = user_data;
+    struct weston_desktop_xwayland_surface *self = user_data;
 
     return ( self->state == FULLSCREEN );
 }
@@ -112,7 +113,7 @@ _weston_desktop_xwayland_surface_get_fullscreen(struct weston_desktop_surface *s
 static struct weston_desktop_surface_geometry
 _weston_desktop_xwayland_surface_get_geometry(struct weston_desktop_surface *surface, void *user_data)
 {
-    struct shell_surface *self = user_data;
+    struct weston_desktop_xwayland_surface *self = user_data;
 
     if ( self->has_geometry )
         return self->geometry;
@@ -129,13 +130,12 @@ static const struct weston_desktop_surface_implementation _weston_desktop_xwayla
 
     .free = _weston_desktop_xwayland_surface_free,
 };
-static struct shell_surface *
-create_shell_surface(void *shell, struct weston_surface *surface, const struct weston_shell_client *client)
+static struct weston_desktop_xwayland_surface *
+create_surface(struct weston_desktop_xwayland *xwayland, struct weston_surface *surface, const struct weston_xwayland_client_interface *client)
 {
-    struct weston_desktop_xwayland *xwayland = shell;
-    struct shell_surface *self;
+    struct weston_desktop_xwayland_surface *self;
 
-    self = zalloc(sizeof(struct shell_surface));
+    self = zalloc(sizeof(struct weston_desktop_xwayland_surface));
     if ( self == NULL )
         return NULL;
 
@@ -154,14 +154,14 @@ create_shell_surface(void *shell, struct weston_surface *surface, const struct w
 }
 
 static void
-set_toplevel(struct shell_surface *self)
+set_toplevel(struct weston_desktop_xwayland_surface *self)
 {
     weston_desktop_api_surface_new(self->desktop, self->surface);
 }
 
 
 static void
-set_transient(struct shell_surface *self, struct weston_surface *parent, int x, int y, uint32_t flags)
+set_transient(struct weston_desktop_xwayland_surface *self, struct weston_surface *parent, int x, int y, uint32_t flags)
 {
     if ( ! weston_surface_is_desktop_surface(parent) )
         return;
@@ -170,14 +170,14 @@ set_transient(struct shell_surface *self, struct weston_surface *parent, int x,
 }
 
 static void
-set_fullscreen(struct shell_surface *self, uint32_t method, uint32_t framerate, struct weston_output *output)
+set_fullscreen(struct weston_desktop_xwayland_surface *self, uint32_t method, uint32_t framerate, struct weston_output *output)
 {
     self->state = FULLSCREEN;
     weston_desktop_api_surface_new(self->desktop, self->surface);
 }
 
 static void
-set_xwayland(struct shell_surface *self, int x, int y, uint32_t flags)
+set_xwayland(struct weston_desktop_xwayland_surface *self, int x, int y, uint32_t flags)
 {
     struct weston_view *view = weston_desktop_surface_get_view(self->surface);
 
@@ -187,27 +187,27 @@ set_xwayland(struct shell_surface *self, int x, int y, uint32_t flags)
 }
 
 static int
-move(struct shell_surface *self, struct weston_pointer *pointer)
+move(struct weston_desktop_xwayland_surface *self, struct weston_pointer *pointer)
 {
     weston_desktop_api_move(self->desktop, self->surface, pointer->seat, pointer->grab_serial);
     return 0;
 }
 
 static int
-resize(struct shell_surface *self, struct weston_pointer *pointer, uint32_t edges)
+resize(struct weston_desktop_xwayland_surface *self, struct weston_pointer *pointer, uint32_t edges)
 {
     weston_desktop_api_resize(self->desktop, self->surface, pointer->seat, pointer->grab_serial, edges);
     return 0;
 }
 
 static void
-set_title(struct shell_surface *self, const char *title)
+set_title(struct weston_desktop_xwayland_surface *self, const char *title)
 {
     weston_desktop_surface_set_title(self->surface, title);
 }
 
 static void
-set_window_geometry(struct shell_surface *self, int32_t x, int32_t y, int32_t width, int32_t height)
+set_window_geometry(struct weston_desktop_xwayland_surface *self, int32_t x, int32_t y, int32_t width, int32_t height)
 {
     self->has_geometry = true;
     self->next_geometry.x = x;
@@ -217,14 +217,14 @@ set_window_geometry(struct shell_surface *self, int32_t x, int32_t y, int32_t wi
 }
 
 static void
-set_maximized(struct shell_surface *self)
+set_maximized(struct weston_desktop_xwayland_surface *self)
 {
     self->state = MAXIMIZED;
     weston_desktop_api_surface_new(self->desktop, self->surface);
 }
 
 static void
-set_pid(struct shell_surface *self, pid_t pid)
+set_pid(struct weston_desktop_xwayland_surface *self, pid_t pid)
 {
 }
 
@@ -233,7 +233,7 @@ transform_handler(struct wl_listener *listener, void *data)
 {
     struct weston_surface *surface = data;
     struct weston_desktop_surface *desktop_surface = weston_surface_get_desktop_surface(surface);
-    struct shell_surface *self;
+    struct weston_desktop_xwayland_surface *self;
     struct weston_view *view;
     int x, y;
 
@@ -254,6 +254,19 @@ transform_handler(struct wl_listener *listener, void *data)
     self->client->send_position(surface, x, y);
 }
 
+static const struct weston_desktop_xwayland_interface _weston_desktop_xwayland_interface = {
+    .create_surface = create_surface,
+    .set_toplevel = set_toplevel,
+    .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)
@@ -272,16 +285,6 @@ weston_desktop_xwayland_init(struct weston_desktop *desktop)
     self->transform_listener.notify = transform_handler;
     wl_signal_add(&compositor->transform_signal, &self->transform_listener);
 
-    compositor->shell_interface.shell = self;
-    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 = self;
+    compositor->xwayland_interface = &_weston_desktop_xwayland_interface;
 }
diff --git a/libweston/compositor.h b/libweston/compositor.h
index 557d2f5..e78d75c 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -721,10 +721,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 */
diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index f6f92bd..644448a 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -38,6 +38,7 @@
 #include <linux/input.h>
 
 #include "xwayland.h"
+#include "xwayland-internal-interface.h"
 
 #include "cairo-util.h"
 #include "compositor.h"
@@ -131,7 +132,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;
@@ -394,8 +395,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 {
@@ -539,11 +540,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
@@ -1041,8 +1042,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;
 
@@ -1104,7 +1105,7 @@ 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,
+		xwayland_interface->set_window_geometry(window->shsurf,
 						     input_x, input_y, input_w, input_h);
 	}
 }
@@ -1350,8 +1351,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
@@ -1361,7 +1362,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:
@@ -1371,7 +1372,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;
@@ -1413,10 +1414,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)
@@ -1437,8 +1438,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);
 
@@ -1453,7 +1454,7 @@ weston_wm_window_handle_state(struct weston_wm_window *window,
 			window->saved_height = window->height;
 
 			if (window->shsurf)
-				shell_interface->set_fullscreen(window->shsurf,
+				xwayland_interface->set_fullscreen(window->shsurf,
 								WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
 								0, NULL);
 		} else {
@@ -1474,7 +1475,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);
 			}
@@ -1751,8 +1752,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;
@@ -1792,13 +1793,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);
 	}
 
@@ -1813,7 +1814,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);
 		}
@@ -2429,7 +2430,7 @@ 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
 };
@@ -2498,8 +2499,10 @@ 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;
@@ -2519,7 +2522,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->configure) {
@@ -2530,29 +2533,29 @@ 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,
+		xwayland_interface->set_fullscreen(window->shsurf,
 						WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
 						0, NULL);
 		return;
 	} else if (legacy_fullscreen(wm, window, &output)) {
 		window->fullscreen = 1;
-		shell_interface->set_fullscreen(window->shsurf,
+		xwayland_interface->set_fullscreen(window->shsurf,
 						WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
 						0, output);
 	} else if (window->override_redirect) {
-		shell_interface->set_xwayland(window->shsurf,
+		xwayland_interface->set_xwayland(window->shsurf,
 					      window->x,
 					      window->y,
 					      WL_SHELL_SURFACE_TRANSIENT_INACTIVE);
@@ -2560,20 +2563,20 @@ xserver_map_shell_surface(struct weston_wm_window *window,
 		parent = window->transient_for;
 		if (weston_wm_window_type_inactive(window))
 			flags = WL_SHELL_SURFACE_TRANSIENT_INACTIVE;
-		shell_interface->set_transient(window->shsurf,
+		xwayland_interface->set_transient(window->shsurf,
 					       parent->surface,
 					       window->x - parent->x,
 					       window->y - parent->y, flags);
 	} 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,
+			xwayland_interface->set_xwayland(window->shsurf,
 							window->x,
 							window->y,
 							WL_SHELL_SURFACE_TRANSIENT_INACTIVE);
 		} else {
-			shell_interface->set_toplevel(window->shsurf);
+			xwayland_interface->set_toplevel(window->shsurf);
 		}
 	}
 }
diff --git a/xwayland/xwayland-internal-interface.h b/xwayland/xwayland-internal-interface.h
new file mode 100644
index 0000000..42b96fd
--- /dev/null
+++ b/xwayland/xwayland-internal-interface.h
@@ -0,0 +1,64 @@
+/*
+ * 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);
+	void (*send_position)(struct weston_surface *surface, int32_t x, int32_t y);
+};
+
+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_transient)(struct weston_desktop_xwayland_surface *shsurf,
+			      struct weston_surface *parent,
+			      int x, int y, uint32_t flags);
+	void (*set_fullscreen)(struct weston_desktop_xwayland_surface *shsurf,
+			       uint32_t method,
+			       uint32_t framerate,
+			       struct weston_output *output);
+	void (*set_xwayland)(struct weston_desktop_xwayland_surface *shsurf,
+			       int x, int y, uint32_t flags);
+	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
-- 
2.9.0



More information about the wayland-devel mailing list