aboutsummaryrefslogtreecommitdiff
path: root/xwayland
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2017-08-20 14:18:29 +0200
committerDominique Martinet <asmadeus@codewreck.org>2017-08-23 22:03:49 +0200
commit1458a95e65248fede646051d2607c4553e8dcb0c (patch)
tree2905b0e6b183fec41e9ada40d78bebdf9c679776 /xwayland
parentf912316d9b1ed39352efb07e773128b6e4f554aa (diff)
example compositor: loop through xwayland surfaces
Diffstat (limited to 'xwayland')
-rw-r--r--xwayland/xwayland.c1
-rw-r--r--xwayland/xwm.c13
-rw-r--r--xwayland/xwm.h14
3 files changed, 7 insertions, 21 deletions
diff --git a/xwayland/xwayland.c b/xwayland/xwayland.c
index 764c0135..aa1c3f96 100644
--- a/xwayland/xwayland.c
+++ b/xwayland/xwayland.c
@@ -161,6 +161,7 @@ static bool wlr_xwayland_init(struct wlr_xwayland *wlr_xwayland,
wlr_xwayland->x_fd[0] = wlr_xwayland->x_fd[1] = -1;
wlr_xwayland->wl_fd[0] = wlr_xwayland->wl_fd[1] = -1;
wlr_xwayland->wm_fd[0] = wlr_xwayland->wm_fd[1] = -1;
+ wl_list_init(&wlr_xwayland->displayable_windows);
wlr_xwayland->display = open_display_sockets(wlr_xwayland->x_fd);
if (wlr_xwayland->display < 0) {
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index b9653f14..bcc5ea05 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -19,7 +19,7 @@ static struct wlr_x11_window *lookup_window(struct wl_list *list, xcb_window_t w
}
static struct wlr_x11_window *lookup_window_any(struct wlr_xwm *xwm, xcb_window_t window_id) {
struct wlr_x11_window *window;
- if ((window = lookup_window(&xwm->paired_windows, window_id)) ||
+ if ((window = lookup_window(&xwm->xwayland->displayable_windows, window_id)) ||
(window = lookup_window(&xwm->unpaired_windows, window_id)) ||
(window = lookup_window(&xwm->new_windows, window_id))) {
return window;
@@ -71,10 +71,10 @@ static void map_shell_surface(struct wlr_xwm *xwm, struct wlr_x11_window *window
struct wlr_surface *surface) {
// get xcb geometry for depth = alpha channel
- // TODO link to compositor somehow
+ window->surface = surface->resource;
wl_list_remove(&window->link);
- wl_list_insert(&xwm->paired_windows, &window->link);
+ wl_list_insert(&xwm->xwayland->displayable_windows, &window->link);
}
/* xcb event handlers */
@@ -96,7 +96,7 @@ static void handle_destroy_notify(struct wlr_xwm *xwm, xcb_destroy_notify_event_
static void handle_configure_request(struct wlr_xwm *xwm, xcb_configure_request_event_t *ev) {
struct wlr_x11_window *window;
wlr_log(L_DEBUG, "XCB_CONFIGURE_REQUEST (%u) [%ux%u+%d,%d]", ev->window,
- ev->width, ev->height, ev->x, ev->y);
+ ev->width, ev->height, ev->x, ev->y);
if (!(window = lookup_window_any(xwm, ev->window))) {
return;
}
@@ -211,7 +211,7 @@ static int x11_event_handler(int fd, uint32_t mask, void *data) {
static void create_surface_handler(struct wl_listener *listener, void *data)
{
struct wlr_surface *surface = data;
- struct wlr_xwm *xwm = wl_container_of(listener, xwm, surface_create_listener);
+ struct wlr_xwm *xwm = wl_container_of(listener, xwm, surface_create_listener);
struct wlr_x11_window *window;
uint32_t surface_id;
@@ -308,7 +308,6 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland) {
xwm->xwayland = wlr_xwayland;
wl_list_init(&xwm->new_windows);
wl_list_init(&xwm->unpaired_windows);
- wl_list_init(&xwm->paired_windows);
xwm->xcb_conn = xcb_connect_to_fd(wlr_xwayland->wm_fd[0], NULL);
if ((rc = xcb_connection_has_error(xwm->xcb_conn))) {
@@ -317,7 +316,7 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland) {
return NULL;
}
- struct wl_event_loop *event_loop = wl_display_get_event_loop(wlr_xwayland->wl_display);
+ struct wl_event_loop *event_loop = wl_display_get_event_loop(wlr_xwayland->wl_display);
xwm->event_source = wl_event_loop_add_fd(event_loop, wlr_xwayland->wm_fd[0],
WL_EVENT_READABLE, x11_event_handler, xwm);
// probably not needed
diff --git a/xwayland/xwm.h b/xwayland/xwm.h
index 51d60395..235145b9 100644
--- a/xwayland/xwm.h
+++ b/xwayland/xwm.h
@@ -1,6 +1,5 @@
#ifndef XWAYLAND_INTERNALS_H
#define XWAYLAND_INTERNALS_H
-#include <xcb/xcb.h>
#include <wayland-server-core.h>
#include <wlr/xwayland.h>
@@ -65,18 +64,6 @@ static const char * const atom_map[ATOM_LAST] = {
"_NET_WM_STATE",
};
-struct wlr_x11_window {
- xcb_window_t window_id;
- uint32_t surface_id;
- struct wl_list link;
-
- struct wl_resource *surface;
- struct wl_listener surface_destroy_listener;
- int16_t x, y;
- uint16_t width, height;
- bool override_redirect;
-};
-
struct wlr_xwm {
struct wlr_xwayland *xwayland;
struct wl_event_source *event_source;
@@ -89,7 +76,6 @@ struct wlr_xwm {
struct wl_list new_windows;
struct wl_list unpaired_windows;
- struct wl_list paired_windows;
};
void xwm_destroy(struct wlr_xwm *xwm);