aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2023-06-22 16:26:00 +0200
committerLibravatar Simon Ser <contact@emersion.fr>2023-07-04 17:10:36 +0200
commit87e864b39f4211818820aa81098a497862981d5f (patch)
treedfab7559403f46fe7adac36dfccc8308749f16c4
parentswaybar: don't set current workspace as not visible (diff)
downloadsway-xwl-shell-filter.tar.gz
sway-xwl-shell-filter.tar.zst
sway-xwl-shell-filter.zip
Hide xwayland_shell_v1 from regular clientsxwl-shell-filter
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.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sway/server.c b/sway/server.c
index cc4719d7..1fa16fd1 100644
--- a/sway/server.c
+++ b/sway/server.c
@@ -47,6 +47,7 @@
47#include "sway/tree/root.h" 47#include "sway/tree/root.h"
48 48
49#if HAVE_XWAYLAND 49#if HAVE_XWAYLAND
50#include <wlr/xwayland/shell.h>
50#include "sway/xwayland.h" 51#include "sway/xwayland.h"
51#endif 52#endif
52 53
@@ -71,11 +72,25 @@ static void handle_drm_lease_request(struct wl_listener *listener, void *data) {
71} 72}
72#endif 73#endif
73 74
75static bool filter_global(const struct wl_client *client,
76 const struct wl_global *global, void *data) {
77#if HAVE_XWAYLAND
78 struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland;
79 if (global == xwayland->shell_v1->global) {
80 return xwayland->server != NULL && client == xwayland->server->client;
81 }
82#endif
83
84 return true;
85}
86
74bool server_init(struct sway_server *server) { 87bool server_init(struct sway_server *server) {
75 sway_log(SWAY_DEBUG, "Initializing Wayland server"); 88 sway_log(SWAY_DEBUG, "Initializing Wayland server");
76 server->wl_display = wl_display_create(); 89 server->wl_display = wl_display_create();
77 server->wl_event_loop = wl_display_get_event_loop(server->wl_display); 90 server->wl_event_loop = wl_display_get_event_loop(server->wl_display);
78 91
92 wl_display_set_global_filter(server->wl_display, filter_global, NULL);
93
79 server->backend = wlr_backend_autocreate(server->wl_display, &server->session); 94 server->backend = wlr_backend_autocreate(server->wl_display, &server->session);
80 if (!server->backend) { 95 if (!server->backend) {
81 sway_log(SWAY_ERROR, "Unable to create backend"); 96 sway_log(SWAY_ERROR, "Unable to create backend");