diff options
author | Simon Ser <contact@emersion.fr> | 2023-06-22 16:26:00 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-08-24 18:27:22 +0200 |
commit | 4a2210577c7c4f84a99ca03386b8910d2f419ab6 (patch) | |
tree | 830d52342ceabb1724d1ea9a671ccf7df37e6960 | |
parent | Fix typo (diff) | |
download | sway-4a2210577c7c4f84a99ca03386b8910d2f419ab6.tar.gz sway-4a2210577c7c4f84a99ca03386b8910d2f419ab6.tar.zst sway-4a2210577c7c4f84a99ca03386b8910d2f419ab6.zip |
Hide xwayland_shell_v1 from regular clients
Regular clients are not allowed to use this interface. wlroots
already sends a protocol error if a non-Xwayland client tries to
use this interface, but let's remove all temptation by hiding it
completely.
-rw-r--r-- | sway/server.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sway/server.c b/sway/server.c index 50f0a702..db873dca 100644 --- a/sway/server.c +++ b/sway/server.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include "sway/tree/root.h" | 49 | #include "sway/tree/root.h" |
50 | 50 | ||
51 | #if HAVE_XWAYLAND | 51 | #if HAVE_XWAYLAND |
52 | #include <wlr/xwayland/shell.h> | ||
52 | #include "sway/xwayland.h" | 53 | #include "sway/xwayland.h" |
53 | #endif | 54 | #endif |
54 | 55 | ||
@@ -73,11 +74,25 @@ static void handle_drm_lease_request(struct wl_listener *listener, void *data) { | |||
73 | } | 74 | } |
74 | #endif | 75 | #endif |
75 | 76 | ||
77 | static bool filter_global(const struct wl_client *client, | ||
78 | const struct wl_global *global, void *data) { | ||
79 | #if HAVE_XWAYLAND | ||
80 | struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland; | ||
81 | if (global == xwayland->shell_v1->global) { | ||
82 | return xwayland->server != NULL && client == xwayland->server->client; | ||
83 | } | ||
84 | #endif | ||
85 | |||
86 | return true; | ||
87 | } | ||
88 | |||
76 | bool server_init(struct sway_server *server) { | 89 | bool server_init(struct sway_server *server) { |
77 | sway_log(SWAY_DEBUG, "Initializing Wayland server"); | 90 | sway_log(SWAY_DEBUG, "Initializing Wayland server"); |
78 | server->wl_display = wl_display_create(); | 91 | server->wl_display = wl_display_create(); |
79 | server->wl_event_loop = wl_display_get_event_loop(server->wl_display); | 92 | server->wl_event_loop = wl_display_get_event_loop(server->wl_display); |
80 | 93 | ||
94 | wl_display_set_global_filter(server->wl_display, filter_global, NULL); | ||
95 | |||
81 | server->backend = wlr_backend_autocreate(server->wl_display, &server->session); | 96 | server->backend = wlr_backend_autocreate(server->wl_display, &server->session); |
82 | if (!server->backend) { | 97 | if (!server->backend) { |
83 | sway_log(SWAY_ERROR, "Unable to create backend"); | 98 | sway_log(SWAY_ERROR, "Unable to create backend"); |