Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
xwayland: split server
Browse files Browse the repository at this point in the history
Split the server part of wlr_xwayland into wlr_xwayland_server. This
allows compositors to implement their own XWM when wlroots' isn't a good
fit.
  • Loading branch information
emersion committed May 8, 2020
1 parent 46c83cb commit 7b95ec8
Show file tree
Hide file tree
Showing 6 changed files with 505 additions and 411 deletions.
39 changes: 33 additions & 6 deletions include/wlr/xwayland.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@

struct wlr_xwm;
struct wlr_xwayland_cursor;
struct wlr_gtk_primary_selection_device_manager;

struct wlr_xwayland {
struct wlr_xwayland_server {
pid_t pid;
struct wl_client *client;
struct wl_event_source *sigusr1_source;
struct wlr_xwm *xwm;
struct wlr_xwayland_cursor *cursor;
int wm_fd[2], wl_fd[2];

time_t server_start;
Expand All @@ -38,6 +35,29 @@ struct wlr_xwayland {
struct wl_event_source *x_fd_read_event[2];
bool lazy;

struct wl_display *wl_display;

struct {
struct wl_signal ready;
struct wl_signal destroy;
} events;

struct wl_listener client_destroy;
struct wl_listener display_destroy;

void *data;
};

struct wlr_xwayland_server_ready_event {
struct wlr_xwayland_server *server;
int wm_fd;
};

struct wlr_xwayland {
struct wlr_xwayland_server *server;
struct wlr_xwm *xwm;
struct wlr_xwayland_cursor *cursor;

struct wl_display *wl_display;
struct wlr_compositor *compositor;
struct wlr_seat *seat;
Expand All @@ -54,8 +74,9 @@ struct wlr_xwayland {
*/
int (*user_event_handler)(struct wlr_xwm *xwm, xcb_generic_event_t *event);

struct wl_listener server_ready;
struct wl_listener server_destroy;
struct wl_listener client_destroy;
struct wl_listener display_destroy;
struct wl_listener seat_destroy;

void *data;
Expand Down Expand Up @@ -192,7 +213,11 @@ struct wlr_xwayland_resize_event {
uint32_t edges;
};

/** Create an Xwayland server.
struct wlr_xwayland_server *wlr_xwayland_server_create(
struct wl_display *display, bool lazy);
void wlr_xwayland_server_destroy(struct wlr_xwayland_server *server);

/** Create an Xwayland server and XWM.
*
* The server supports a lazy mode in which Xwayland is only started when a
* client tries to connect.
Expand All @@ -205,6 +230,8 @@ struct wlr_xwayland *wlr_xwayland_create(struct wl_display *wl_display,

void wlr_xwayland_destroy(struct wlr_xwayland *wlr_xwayland);

const char *wlr_xwayland_display_name(struct wlr_xwayland *xwayland);

void wlr_xwayland_set_cursor(struct wlr_xwayland *wlr_xwayland,
uint8_t *pixels, uint32_t stride, uint32_t width, uint32_t height,
int32_t hotspot_x, int32_t hotspot_y);
Expand Down
2 changes: 1 addition & 1 deletion include/xwayland/xwm.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ struct wlr_xwm {
struct wl_listener seat_drag_source_destroy;
};

struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland);
struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland, int wm_fd);

void xwm_destroy(struct wlr_xwm *xwm);

Expand Down
1 change: 1 addition & 0 deletions xwayland/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ wlr_files += files(
'selection/incoming.c',
'selection/outgoing.c',
'selection/selection.c',
'server.c',
'sockets.c',
'xwayland.c',
'xwm.c',
Expand Down
Loading

0 comments on commit 7b95ec8

Please sign in to comment.