From cda66e9a263d8467b6d1857808305d5e9f7bc3cd Mon Sep 17 00:00:00 2001 From: emersion Date: Mon, 18 Jun 2018 22:49:28 +0100 Subject: Automatically float xwayland windows --- include/sway/server.h | 9 +++------ include/sway/xwayland.h | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 include/sway/xwayland.h (limited to 'include') diff --git a/include/sway/server.h b/include/sway/server.h index 65d96e7a..96cad69d 100644 --- a/include/sway/server.h +++ b/include/sway/server.h @@ -11,7 +11,7 @@ #include #include // TODO WLR: make Xwayland optional -#include +#include "sway/xwayland.h" struct sway_server { struct wl_display *wl_display; @@ -37,12 +37,9 @@ struct sway_server { struct wlr_xdg_shell *xdg_shell; struct wl_listener xdg_shell_surface; - struct wlr_xwayland *xwayland; - struct wlr_xcursor_manager *xcursor_manager; + struct sway_xwayland xwayland; struct wl_listener xwayland_surface; - - struct wlr_wl_shell *wl_shell; - struct wl_listener wl_shell_surface; + struct wl_listener xwayland_ready; }; struct sway_server server; diff --git a/include/sway/xwayland.h b/include/sway/xwayland.h new file mode 100644 index 00000000..78d1053b --- /dev/null +++ b/include/sway/xwayland.h @@ -0,0 +1,25 @@ +#ifndef SWAY_XWAYLAND_H +#define SWAY_XWAYLAND_H + +#include +#include + +enum atom_name { + NET_WM_WINDOW_TYPE_DIALOG, + NET_WM_WINDOW_TYPE_UTILITY, + NET_WM_WINDOW_TYPE_TOOLBAR, + NET_WM_WINDOW_TYPE_SPLASH, + NET_WM_STATE_MODAL, + ATOM_LAST, +}; + +struct sway_xwayland { + struct wlr_xwayland *wlr_xwayland; + struct wlr_xcursor_manager *xcursor_manager; + + xcb_atom_t atoms[ATOM_LAST]; +}; + +void handle_xwayland_ready(struct wl_listener *listener, void *data); + +#endif -- cgit v1.2.3-54-g00ecf From 6856866a612c9f0708a42cbe6d9627173d9e3569 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Tue, 26 Jun 2018 21:19:38 +0900 Subject: layer_shell: order destroying before sway_output Both sway_output and sway_layer_shell listen to wlr's output destroy event, but sway_layer_shell needs to access into sway_output's data strucure and needs to be destroyed first. Resolve this by making sway_layer_shell listen to a new event that happens at start of sway_output's destroy handler --- include/sway/output.h | 4 ++++ sway/desktop/layer_shell.c | 7 +++---- sway/desktop/output.c | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/sway/output.h b/include/sway/output.h index 70f746dc..8180ce3d 100644 --- a/include/sway/output.h +++ b/include/sway/output.h @@ -32,6 +32,10 @@ struct sway_output { struct wl_list link; pid_t bg_pid; + + struct { + struct wl_signal destroy; + } events; }; void output_damage_whole(struct sway_output *output); diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index 94dc22e7..b57d1ee6 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c @@ -352,10 +352,6 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { wl_signal_add(&layer_surface->surface->events.commit, &sway_layer->surface_commit); - sway_layer->output_destroy.notify = handle_output_destroy; - wl_signal_add(&layer_surface->output->events.destroy, - &sway_layer->output_destroy); - sway_layer->destroy.notify = handle_destroy; wl_signal_add(&layer_surface->events.destroy, &sway_layer->destroy); sway_layer->map.notify = handle_map; @@ -368,6 +364,9 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { layer_surface->data = sway_layer; struct sway_output *output = layer_surface->output->data; + sway_layer->output_destroy.notify = handle_output_destroy; + wl_signal_add(&output->events.destroy, &sway_layer->output_destroy); + wl_list_insert(&output->layers[layer_surface->layer], &sway_layer->link); // Temporarily set the layer's current state to client_pending diff --git a/sway/desktop/output.c b/sway/desktop/output.c index d4115be8..f0f1603a 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -1199,6 +1199,8 @@ static void damage_handle_destroy(struct wl_listener *listener, void *data) { static void handle_destroy(struct wl_listener *listener, void *data) { struct sway_output *output = wl_container_of(listener, output, destroy); + wl_signal_emit(&output->events.destroy, output); + if (output->swayc) { container_destroy(output->swayc); } @@ -1277,6 +1279,7 @@ void output_enable(struct sway_output *output) { for (size_t i = 0; i < len; ++i) { wl_list_init(&output->layers[i]); } + wl_signal_init(&output->events.destroy); input_manager_configure_xcursor(input_manager); -- cgit v1.2.3-54-g00ecf