[PATCH weston 12/16] shell: Implement XWayland shell surfaces

Tiago Vignatti tiago.vignatti at intel.com
Wed Dec 12 07:26:24 PST 2012


XWayland compositor counter-part is not implemented yet; next commit will
bring it on.

Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
 src/compositor.h |    3 +--
 src/shell.c      |   39 +++++++++++++++++++++++++++++++++++++--
 2 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/src/compositor.h b/src/compositor.h
index 15d6939..b1a91a1 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -82,8 +82,7 @@ struct weston_shell_interface {
 
 	void (*set_toplevel)(struct shell_surface *shsurf);
 
-	void (*set_transient)(struct shell_surface *shsurf,
-			      struct weston_surface *parent,
+	void (*set_xwayland)(struct shell_surface *shsurf,
 			      int x, int y, uint32_t flags);
 	int (*move)(struct shell_surface *shsurf, struct weston_seat *ws);
 	int (*resize)(struct shell_surface *shsurf,
diff --git a/src/shell.c b/src/shell.c
index aa1c7c1..2cc207f 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -143,7 +143,8 @@ enum shell_surface_type {
 	SHELL_SURFACE_TRANSIENT,
 	SHELL_SURFACE_FULLSCREEN,
 	SHELL_SURFACE_MAXIMIZED,
-	SHELL_SURFACE_POPUP
+	SHELL_SURFACE_POPUP,
+	SHELL_SURFACE_XWAYLAND
 };
 
 struct ping_timer {
@@ -192,6 +193,11 @@ struct shell_surface {
 		struct weston_surface *black_surface;
 	} fullscreen;
 
+	struct {
+		int32_t x, y;
+		uint32_t flags;
+	} xwayland;
+
 	struct ping_timer *ping_timer;
 
 	struct weston_transform workspace_transform;
@@ -1470,6 +1476,7 @@ reset_shell_surface_type(struct shell_surface *surface)
 	case SHELL_SURFACE_TOPLEVEL:
 	case SHELL_SURFACE_TRANSIENT:
 	case SHELL_SURFACE_POPUP:
+	case SHELL_SURFACE_XWAYLAND:
 		break;
 	}
 
@@ -1515,6 +1522,9 @@ set_surface_type(struct shell_surface *shsurf)
 			shsurf->saved_rotation_valid = true;
 		}
 		break;
+	case SHELL_SURFACE_XWAYLAND:
+		weston_surface_set_position(surface, shsurf->xwayland.x,
+					    shsurf->xwayland.y);
 
 	default:
 		break;
@@ -1560,6 +1570,25 @@ shell_surface_set_transient(struct wl_client *client,
 	set_transient(shsurf, parent, x, y, flags);
 }
 
+static void
+set_xwayland(struct shell_surface *shsurf, int x, int y, uint32_t flags)
+{
+	shsurf->xwayland.x = x;
+	shsurf->xwayland.y = y;
+	shsurf->xwayland.flags = flags;
+	shsurf->next_type = SHELL_SURFACE_XWAYLAND;
+}
+
+static void
+shell_surface_set_xwayland(struct wl_client *client,
+			   struct wl_resource *resource,
+			   int x, int y, uint32_t flags)
+{
+	struct shell_surface *shsurf = resource->data;
+
+	set_xwayland(shsurf, x, y, flags);
+}
+
 static struct desktop_shell *
 shell_surface_get_shell(struct shell_surface *shsurf)
 {
@@ -1923,6 +1952,7 @@ static const struct wl_shell_surface_interface shell_surface_implementation = {
 	shell_surface_set_fullscreen,
 	shell_surface_set_popup,
 	shell_surface_set_maximized,
+	shell_surface_set_xwayland,
 	shell_surface_set_title,
 	shell_surface_set_class
 };
@@ -2928,6 +2958,7 @@ map(struct desktop_shell *shell, struct weston_surface *surface,
 					    surface->geometry.x + sx,
 					    surface->geometry.y + sy);
 		break;
+	case SHELL_SURFACE_XWAYLAND:
 	default:
 		;
 	}
@@ -2942,6 +2973,7 @@ map(struct desktop_shell *shell, struct weston_surface *surface,
 	case SHELL_SURFACE_FULLSCREEN:
 	case SHELL_SURFACE_NONE:
 		break;
+	case SHELL_SURFACE_XWAYLAND:
 	default:
 		ws = get_current_workspace(shell);
 		wl_list_insert(&ws->layer.surface_list, &surface->layer_link);
@@ -2955,6 +2987,9 @@ map(struct desktop_shell *shell, struct weston_surface *surface,
 	}
 
 	switch (surface_type) {
+	case SHELL_SURFACE_XWAYLAND:
+		if (shsurf->xwayland.flags ==
+				WL_SHELL_SURFACE_XWAYLAND_INACTIVE)
 	case SHELL_SURFACE_TRANSIENT:
 		if (shsurf->transient.flags ==
 				WL_SHELL_SURFACE_TRANSIENT_INACTIVE)
@@ -3841,7 +3876,7 @@ module_init(struct weston_compositor *ec)
 	ec->shell_interface.shell = shell;
 	ec->shell_interface.create_shell_surface = create_shell_surface;
 	ec->shell_interface.set_toplevel = set_toplevel;
-	ec->shell_interface.set_transient = set_transient;
+	ec->shell_interface.set_xwayland = set_xwayland;
 	ec->shell_interface.move = surface_move;
 	ec->shell_interface.resize = surface_resize;
 
-- 
1.7.9.5



More information about the wayland-devel mailing list