aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Bozhinov <ammen99@gmail.com>2020-11-27 14:16:23 +0100
committerSimon Ser <contact@emersion.fr>2020-11-30 11:29:28 +0100
commitd2329ac07a45c4c3b45c68e24f39456bfc2822fd (patch)
tree090a1faedbdb54c6d44c01da55a6740316e3126b
parent83a5d03bf361ab9ffa29fb2b809a8e81c4a75d0f (diff)
xwm: add wlr_xwayland_surface_restack()
-rw-r--r--include/wlr/xwayland.h8
-rw-r--r--xwayland/xwm.c17
2 files changed, 25 insertions, 0 deletions
diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h
index 8de9ed07..5488971a 100644
--- a/include/wlr/xwayland.h
+++ b/include/wlr/xwayland.h
@@ -252,6 +252,14 @@ void wlr_xwayland_set_cursor(struct wlr_xwayland *wlr_xwayland,
void wlr_xwayland_surface_activate(struct wlr_xwayland_surface *surface,
bool activated);
+/**
+ * Restack surface relative to sibling.
+ * If sibling is NULL, then the surface is moved to the top or the bottom
+ * of the stack (depending on the mode).
+ */
+void wlr_xwayland_surface_restack(struct wlr_xwayland_surface *surface,
+ struct wlr_xwayland_surface *sibling, enum xcb_stack_mode_t mode);
+
void wlr_xwayland_surface_configure(struct wlr_xwayland_surface *surface,
int16_t x, int16_t y, uint16_t width, uint16_t height);
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index fefba7fc..f258ab00 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -1548,6 +1548,23 @@ void wlr_xwayland_surface_activate(struct wlr_xwayland_surface *xsurface,
}
}
+void wlr_xwayland_surface_restack(struct wlr_xwayland_surface *surface,
+ struct wlr_xwayland_surface *sibling, enum xcb_stack_mode_t mode) {
+ struct wlr_xwm *xwm = surface->xwm;
+ uint32_t values[2];
+ size_t idx = 0;
+ uint32_t flags = XCB_CONFIG_WINDOW_STACK_MODE;
+
+ if (sibling != NULL) {
+ values[idx++] = sibling->window_id;
+ flags |= XCB_CONFIG_WINDOW_SIBLING;
+ }
+ values[idx++] = mode;
+
+ xcb_configure_window(xwm->xcb_conn, surface->window_id, flags, values);
+ xcb_flush(xwm->xcb_conn);
+}
+
void wlr_xwayland_surface_configure(struct wlr_xwayland_surface *xsurface,
int16_t x, int16_t y, uint16_t width, uint16_t height) {
xsurface->x = x;