[PATCH weston 12/16] shell: Add transient XWayland shell surfaces
Tiago Vignatti
tiago.vignatti at intel.com
Wed Dec 19 11:32:22 PST 2012
Worth to note this type of shell surface is not exposed for clients but just
used internally. XWayland compositor counter-part is not implemented yet; next
commit will bring it on.
weston_shell_interface was also documented on this commit.
Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
src/compositor.h | 35 +++++++++++++++++++++++++++++++----
src/shell.c | 30 +++++++++++++++++++++++++++---
2 files changed, 58 insertions(+), 7 deletions(-)
diff --git a/src/compositor.h b/src/compositor.h
index 15d6939..5f5e47e 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -73,6 +73,25 @@ struct weston_shell_client {
uint32_t edges, int32_t width, int32_t height);
};
+enum weston_xwayland {
+ XWAYLAND_ACTIVE = (1 << 0),
+ XWAYLAND_INACTIVE = (1 << 1)
+};
+
+/*
+ * weston_shell_interface is the interface for the WM compositor module
+ * (window-manager.c) access the shell implementation. Its methods need to be
+ * implemented and hooked for XWayland usage only.
+ *
+ * Once a handler is received (create_shell_surface), window types are set by
+ * the WM, so windows are mapped on the screen (wm_xwin.set_window, 'flags'
+ * argument). The WM compositor module has in particular two types for
+ * mapping: set_toplevel and set_transient_xwayland. Worth to mention that the
+ * latter is an XWayland specific type and shells are not exposing it to
+ * regular clients via Wayland protocol; it differs from the regular
+ * set_transient protocol type because set_transient_xwayland maps a surface
+ * in a absolute coordinate on the screen, a peculiar feature of X.
+ */
struct weston_shell_interface {
void *shell; /* either desktop or tablet */
@@ -82,13 +101,21 @@ struct weston_shell_interface {
void (*set_toplevel)(struct shell_surface *shsurf);
- void (*set_transient)(struct shell_surface *shsurf,
- struct weston_surface *parent,
- int x, int y, uint32_t flags);
+ /*
+ * 'x' and 'y' arguments accept global absolute coordinates, while
+ * 'flags' is used for receiving keyboard focus or not.
+ *
+ * As a side note, ICCCM 'transient' has a slightly different meaning
+ * than this here. On that one it requires a parent top-level window,
+ * which is not the case here. So set_transient_xwayland is
+ * 'transient' in the sense of "lasting only for a short time;
+ * impermanent", used for tooltips, dropdown, dialogs, among others.
+ */
+ void (*set_transient_xwayland)(struct shell_surface *shsurf,
+ int x, int y, enum weston_xwayland flags);
int (*move)(struct shell_surface *shsurf, struct weston_seat *ws);
int (*resize)(struct shell_surface *shsurf,
struct weston_seat *ws, uint32_t edges);
-
};
struct weston_border {
diff --git a/src/shell.c b/src/shell.c
index aa1c7c1..7a0e24c 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -141,6 +141,7 @@ enum shell_surface_type {
SHELL_SURFACE_NONE,
SHELL_SURFACE_TOPLEVEL,
SHELL_SURFACE_TRANSIENT,
+ SHELL_SURFACE_TRANSIENT_XWAYLAND,
SHELL_SURFACE_FULLSCREEN,
SHELL_SURFACE_MAXIMIZED,
SHELL_SURFACE_POPUP
@@ -192,6 +193,11 @@ struct shell_surface {
struct weston_surface *black_surface;
} fullscreen;
+ struct {
+ int32_t x, y;
+ enum weston_xwayland flags;
+ } xwayland;
+
struct ping_timer *ping_timer;
struct weston_transform workspace_transform;
@@ -1469,6 +1475,7 @@ reset_shell_surface_type(struct shell_surface *surface)
case SHELL_SURFACE_NONE:
case SHELL_SURFACE_TOPLEVEL:
case SHELL_SURFACE_TRANSIENT:
+ case SHELL_SURFACE_TRANSIENT_XWAYLAND:
case SHELL_SURFACE_POPUP:
break;
}
@@ -1496,7 +1503,10 @@ set_surface_type(struct shell_surface *shsurf)
pes->geometry.x + shsurf->transient.x,
pes->geometry.y + shsurf->transient.y);
break;
-
+ case SHELL_SURFACE_TRANSIENT_XWAYLAND:
+ weston_surface_set_position(surface, shsurf->xwayland.x,
+ shsurf->xwayland.y);
+ break;
case SHELL_SURFACE_MAXIMIZED:
shsurf->saved_x = surface->geometry.x;
shsurf->saved_y = surface->geometry.y;
@@ -1515,7 +1525,6 @@ set_surface_type(struct shell_surface *shsurf)
shsurf->saved_rotation_valid = true;
}
break;
-
default:
break;
}
@@ -1560,6 +1569,16 @@ shell_surface_set_transient(struct wl_client *client,
set_transient(shsurf, parent, x, y, flags);
}
+static void
+set_transient_xwayland(struct shell_surface *shsurf, int x, int y,
+ enum weston_xwayland flags)
+{
+ shsurf->xwayland.x = x;
+ shsurf->xwayland.y = y;
+ shsurf->xwayland.flags = flags;
+ shsurf->next_type = SHELL_SURFACE_TRANSIENT_XWAYLAND;
+}
+
static struct desktop_shell *
shell_surface_get_shell(struct shell_surface *shsurf)
{
@@ -2928,6 +2947,7 @@ map(struct desktop_shell *shell, struct weston_surface *surface,
surface->geometry.x + sx,
surface->geometry.y + sy);
break;
+ case SHELL_SURFACE_TRANSIENT_XWAYLAND:
default:
;
}
@@ -2942,6 +2962,7 @@ map(struct desktop_shell *shell, struct weston_surface *surface,
case SHELL_SURFACE_FULLSCREEN:
case SHELL_SURFACE_NONE:
break;
+ case SHELL_SURFACE_TRANSIENT_XWAYLAND:
default:
ws = get_current_workspace(shell);
wl_list_insert(&ws->layer.surface_list, &surface->layer_link);
@@ -2959,6 +2980,9 @@ map(struct desktop_shell *shell, struct weston_surface *surface,
if (shsurf->transient.flags ==
WL_SHELL_SURFACE_TRANSIENT_INACTIVE)
break;
+ case SHELL_SURFACE_TRANSIENT_XWAYLAND:
+ if (shsurf->xwayland.flags == XWAYLAND_INACTIVE)
+ break;
case SHELL_SURFACE_TOPLEVEL:
case SHELL_SURFACE_FULLSCREEN:
case SHELL_SURFACE_MAXIMIZED:
@@ -3841,7 +3865,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_transient_xwayland = set_transient_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