aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2019-03-02 15:14:23 +0100
committerDrew DeVault <sir@cmpwn.com>2019-03-04 12:54:06 -0700
commit9601019192a411aca889db48e6dc6c856d1e2a64 (patch)
tree0fbbefba42a0590496d429ae3b6313bcdab7c459
parentfb106eb97925d16ed6744481a9798d068a6f6690 (diff)
xwayland: don't set DISPLAY
Let the compositor set it. This allows for multiple Xwayland instances to run at the same time. Fixes https://github.com/swaywm/wlroots/issues/1442
-rw-r--r--include/wlr/xwayland.h10
-rw-r--r--rootston/desktop.c2
-rw-r--r--xwayland/xwayland.c11
3 files changed, 10 insertions, 13 deletions
diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h
index 40cc8848..e2c8d81b 100644
--- a/include/wlr/xwayland.h
+++ b/include/wlr/xwayland.h
@@ -24,7 +24,6 @@ struct wlr_xwayland {
pid_t pid;
struct wl_client *client;
struct wl_event_source *sigusr1_source;
- struct wl_listener client_destroy;
struct wlr_xwm *xwm;
struct wlr_xwayland_cursor *cursor;
int wm_fd[2], wl_fd[2];
@@ -34,10 +33,9 @@ struct wlr_xwayland {
/* Anything above display is reset on Xwayland restart, rest is conserved */
int display;
+ char display_name[16];
int x_fd[2];
struct wl_event_source *x_fd_read_event[2];
- struct wl_listener display_destroy;
-
bool lazy;
struct wl_display *wl_display;
@@ -49,8 +47,6 @@ struct wlr_xwayland {
struct wl_signal new_surface;
} events;
- struct wl_listener seat_destroy;
-
/**
* Add a custom event handler to xwayland. Return 1 if the event was
* handled or 0 to use the default wlr-xwayland handler. wlr-xwayland will
@@ -58,6 +54,10 @@ struct wlr_xwayland {
*/
int (*user_event_handler)(struct wlr_xwm *xwm, xcb_generic_event_t *event);
+ struct wl_listener client_destroy;
+ struct wl_listener display_destroy;
+ struct wl_listener seat_destroy;
+
void *data;
};
diff --git a/rootston/desktop.c b/rootston/desktop.c
index 9a14395d..b0530ea1 100644
--- a/rootston/desktop.c
+++ b/rootston/desktop.c
@@ -382,6 +382,8 @@ struct roots_desktop *desktop_create(struct roots_server *server,
&desktop->xwayland_surface);
desktop->xwayland_surface.notify = handle_xwayland_surface;
+ setenv("DISPLAY", desktop->xwayland->display_name, true);
+
if (wlr_xcursor_manager_load(desktop->xcursor_manager, 1)) {
wlr_log(WLR_ERROR, "Cannot load XWayland XCursor theme");
}
diff --git a/xwayland/xwayland.c b/xwayland/xwayland.c
index c01acb33..015c33e7 100644
--- a/xwayland/xwayland.c
+++ b/xwayland/xwayland.c
@@ -165,12 +165,9 @@ static void xwayland_finish_display(struct wlr_xwayland *wlr_xwayland) {
unlink_display_sockets(wlr_xwayland->display);
wlr_xwayland->display = -1;
- unsetenv("DISPLAY");
+ wlr_xwayland->display_name[0] = '\0';
}
-static bool xwayland_start_display(struct wlr_xwayland *wlr_xwayland,
- struct wl_display *wl_display);
-
static bool xwayland_start_server(struct wlr_xwayland *wlr_xwayland);
static bool xwayland_start_server_lazy(struct wlr_xwayland *wlr_xwayland);
@@ -284,10 +281,8 @@ static bool xwayland_start_display(struct wlr_xwayland *wlr_xwayland,
return false;
}
- char display_name[16];
- snprintf(display_name, sizeof(display_name), ":%d", wlr_xwayland->display);
- setenv("DISPLAY", display_name, true);
-
+ snprintf(wlr_xwayland->display_name, sizeof(wlr_xwayland->display_name),
+ ":%d", wlr_xwayland->display);
return true;
}