aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2024-05-18 14:02:14 +0200
committerLibravatar Simon Zeni <simon@bl4ckb0ne.ca>2024-05-21 11:44:39 -0400
commit970415241497ceccfb013b6f8cb2395abee74e5c (patch)
tree4943b3c8e2794146f74e5f6871865c2231231f7a
parentsway/config/output.c: fix null deref on output config (diff)
downloadsway-970415241497ceccfb013b6f8cb2395abee74e5c.tar.gz
sway-970415241497ceccfb013b6f8cb2395abee74e5c.tar.zst
sway-970415241497ceccfb013b6f8cb2395abee74e5c.zip
build: drop xwayland option
Instead of having a build-time option to enable/disable xwayland support, just use the wlroots build config: enable xwayland in Sway if it was enabled when building wlroots. I don't see any use-case for disabling xwayland in Sway when enabled in wlroots: Sway doesn't pull in any additional dependency (just pulls in dependencies that wlroots already needs). We have a config command to disable xwayland at runtime anyways. This makes it so xwayland behaves the same way as other features such as libinput backend and session support. This also reduces the build matrix (less combinations of build options). I think we originally introduced the xwayland option when we didn't have a good way to figure out the wlroots build config from the Sway build system.
-rw-r--r--.builds/alpine.yml7
-rw-r--r--include/sway/criteria.h2
-rw-r--r--include/sway/server.h6
-rw-r--r--include/sway/tree/root.h4
-rw-r--r--include/sway/tree/view.h13
-rw-r--r--meson.build12
-rw-r--r--meson_options.txt1
-rw-r--r--sway/commands/swap.c4
-rw-r--r--sway/commands/xwayland.c2
-rw-r--r--sway/criteria.c18
-rw-r--r--sway/desktop/transaction.c2
-rw-r--r--sway/input/cursor.c2
-rw-r--r--sway/input/seat.c4
-rw-r--r--sway/input/seatop_default.c8
-rw-r--r--sway/ipc-json.c4
-rw-r--r--sway/meson.build2
-rw-r--r--sway/server.c8
-rw-r--r--sway/tree/root.c2
-rw-r--r--sway/tree/view.c14
19 files changed, 56 insertions, 59 deletions
diff --git a/.builds/alpine.yml b/.builds/alpine.yml
index 59df7737..055e5ffa 100644
--- a/.builds/alpine.yml
+++ b/.builds/alpine.yml
@@ -38,9 +38,14 @@ tasks:
38 cd sway 38 cd sway
39 ninja -C build 39 ninja -C build
40 - build-no-xwayland: | 40 - build-no-xwayland: |
41 cd sway 41 cd wlroots
42 meson configure build -Dxwayland=disabled 42 meson configure build -Dxwayland=disabled
43 ninja -C build 43 ninja -C build
44 sudo ninja -C build install
45
46 cd ../sway
47 meson configure build --clearcache
48 ninja -C build
44 - build-static: | 49 - build-static: |
45 cd sway 50 cd sway
46 mkdir subprojects 51 mkdir subprojects
diff --git a/include/sway/criteria.h b/include/sway/criteria.h
index 8da345ea..758d70ed 100644
--- a/include/sway/criteria.h
+++ b/include/sway/criteria.h
@@ -36,7 +36,7 @@ struct criteria {
36 struct pattern *app_id; 36 struct pattern *app_id;
37 struct pattern *con_mark; 37 struct pattern *con_mark;
38 uint32_t con_id; // internal ID 38 uint32_t con_id; // internal ID
39#if HAVE_XWAYLAND 39#if WLR_HAS_XWAYLAND
40 struct pattern *class; 40 struct pattern *class;
41 uint32_t id; // X11 window ID 41 uint32_t id; // X11 window ID
42 struct pattern *instance; 42 struct pattern *instance;
diff --git a/include/sway/server.h b/include/sway/server.h
index c71851f6..90f187fd 100644
--- a/include/sway/server.h
+++ b/include/sway/server.h
@@ -5,7 +5,7 @@
5#include "config.h" 5#include "config.h"
6#include "list.h" 6#include "list.h"
7#include "sway/desktop/idle_inhibit_v1.h" 7#include "sway/desktop/idle_inhibit_v1.h"
8#if HAVE_XWAYLAND 8#if WLR_HAS_XWAYLAND
9#include "sway/xwayland.h" 9#include "sway/xwayland.h"
10#endif 10#endif
11 11
@@ -59,7 +59,7 @@ struct sway_server {
59 59
60 struct wlr_tablet_manager_v2 *tablet_v2; 60 struct wlr_tablet_manager_v2 *tablet_v2;
61 61
62#if HAVE_XWAYLAND 62#if WLR_HAS_XWAYLAND
63 struct sway_xwayland xwayland; 63 struct sway_xwayland xwayland;
64 struct wl_listener xwayland_surface; 64 struct wl_listener xwayland_surface;
65 struct wl_listener xwayland_ready; 65 struct wl_listener xwayland_ready;
@@ -165,7 +165,7 @@ void sway_session_lock_add_output(struct sway_session_lock *lock,
165bool sway_session_lock_has_surface(struct sway_session_lock *lock, 165bool sway_session_lock_has_surface(struct sway_session_lock *lock,
166 struct wlr_surface *surface); 166 struct wlr_surface *surface);
167void handle_xdg_shell_toplevel(struct wl_listener *listener, void *data); 167void handle_xdg_shell_toplevel(struct wl_listener *listener, void *data);
168#if HAVE_XWAYLAND 168#if WLR_HAS_XWAYLAND
169void handle_xwayland_surface(struct wl_listener *listener, void *data); 169void handle_xwayland_surface(struct wl_listener *listener, void *data);
170#endif 170#endif
171void handle_server_decoration(struct wl_listener *listener, void *data); 171void handle_server_decoration(struct wl_listener *listener, void *data);
diff --git a/include/sway/tree/root.h b/include/sway/tree/root.h
index 15df0f55..7de0abcd 100644
--- a/include/sway/tree/root.h
+++ b/include/sway/tree/root.h
@@ -2,12 +2,12 @@
2#define _SWAY_ROOT_H 2#define _SWAY_ROOT_H
3#include <wayland-server-core.h> 3#include <wayland-server-core.h>
4#include <wayland-util.h> 4#include <wayland-util.h>
5#include <wlr/config.h>
5#include <wlr/types/wlr_output_layout.h> 6#include <wlr/types/wlr_output_layout.h>
6#include <wlr/types/wlr_scene.h> 7#include <wlr/types/wlr_scene.h>
7#include <wlr/render/wlr_texture.h> 8#include <wlr/render/wlr_texture.h>
8#include "sway/tree/container.h" 9#include "sway/tree/container.h"
9#include "sway/tree/node.h" 10#include "sway/tree/node.h"
10#include "config.h"
11#include "list.h" 11#include "list.h"
12 12
13extern struct sway_root *root; 13extern struct sway_root *root;
@@ -47,7 +47,7 @@ struct sway_root {
47 struct wlr_scene_tree *shell_top; 47 struct wlr_scene_tree *shell_top;
48 struct wlr_scene_tree *fullscreen; 48 struct wlr_scene_tree *fullscreen;
49 struct wlr_scene_tree *fullscreen_global; 49 struct wlr_scene_tree *fullscreen_global;
50#if HAVE_XWAYLAND 50#if WLR_HAS_XWAYLAND
51 struct wlr_scene_tree *unmanaged; 51 struct wlr_scene_tree *unmanaged;
52#endif 52#endif
53 struct wlr_scene_tree *shell_overlay; 53 struct wlr_scene_tree *shell_overlay;
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index 7faacdcc..3ae8cf22 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -1,10 +1,11 @@
1#ifndef _SWAY_VIEW_H 1#ifndef _SWAY_VIEW_H
2#define _SWAY_VIEW_H 2#define _SWAY_VIEW_H
3#include <wayland-server-core.h> 3#include <wayland-server-core.h>
4#include <wlr/config.h>
4#include <wlr/types/wlr_compositor.h> 5#include <wlr/types/wlr_compositor.h>
5#include <wlr/types/wlr_scene.h> 6#include <wlr/types/wlr_scene.h>
6#include "sway/config.h" 7#include "sway/config.h"
7#if HAVE_XWAYLAND 8#if WLR_HAS_XWAYLAND
8#include <wlr/xwayland.h> 9#include <wlr/xwayland.h>
9#endif 10#endif
10#include "sway/input/input-manager.h" 11#include "sway/input/input-manager.h"
@@ -15,7 +16,7 @@ struct sway_xdg_decoration;
15 16
16enum sway_view_type { 17enum sway_view_type {
17 SWAY_VIEW_XDG_SHELL, 18 SWAY_VIEW_XDG_SHELL,
18#if HAVE_XWAYLAND 19#if WLR_HAS_XWAYLAND
19 SWAY_VIEW_XWAYLAND, 20 SWAY_VIEW_XWAYLAND,
20#endif 21#endif
21}; 22};
@@ -27,7 +28,7 @@ enum sway_view_prop {
27 VIEW_PROP_INSTANCE, 28 VIEW_PROP_INSTANCE,
28 VIEW_PROP_WINDOW_TYPE, 29 VIEW_PROP_WINDOW_TYPE,
29 VIEW_PROP_WINDOW_ROLE, 30 VIEW_PROP_WINDOW_ROLE,
30#if HAVE_XWAYLAND 31#if WLR_HAS_XWAYLAND
31 VIEW_PROP_X11_WINDOW_ID, 32 VIEW_PROP_X11_WINDOW_ID,
32 VIEW_PROP_X11_PARENT_ID, 33 VIEW_PROP_X11_PARENT_ID,
33#endif 34#endif
@@ -98,7 +99,7 @@ struct sway_view {
98 99
99 union { 100 union {
100 struct wlr_xdg_toplevel *wlr_xdg_toplevel; 101 struct wlr_xdg_toplevel *wlr_xdg_toplevel;
101#if HAVE_XWAYLAND 102#if WLR_HAS_XWAYLAND
102 struct wlr_xwayland_surface *wlr_xwayland_surface; 103 struct wlr_xwayland_surface *wlr_xwayland_surface;
103#endif 104#endif
104 }; 105 };
@@ -127,7 +128,7 @@ struct sway_xdg_shell_view {
127 struct wl_listener unmap; 128 struct wl_listener unmap;
128 struct wl_listener destroy; 129 struct wl_listener destroy;
129}; 130};
130#if HAVE_XWAYLAND 131#if WLR_HAS_XWAYLAND
131struct sway_xwayland_view { 132struct sway_xwayland_view {
132 struct sway_view view; 133 struct sway_view view;
133 134
@@ -293,7 +294,7 @@ void view_center_and_clip_surface(struct sway_view *view);
293 294
294struct sway_view *view_from_wlr_xdg_surface( 295struct sway_view *view_from_wlr_xdg_surface(
295 struct wlr_xdg_surface *xdg_surface); 296 struct wlr_xdg_surface *xdg_surface);
296#if HAVE_XWAYLAND 297#if WLR_HAS_XWAYLAND
297struct sway_view *view_from_wlr_xwayland_surface( 298struct sway_view *view_from_wlr_xwayland_surface(
298 struct wlr_xwayland_surface *xsurface); 299 struct wlr_xwayland_surface *xsurface);
299#endif 300#endif
diff --git a/meson.build b/meson.build
index 1d143110..3c444e07 100644
--- a/meson.build
+++ b/meson.build
@@ -57,10 +57,6 @@ foreach name, _ : wlroots_features
57 wlroots_features += { name: have } 57 wlroots_features += { name: have }
58endforeach 58endforeach
59 59
60if get_option('xwayland').enabled() and not wlroots_features['xwayland']
61 error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support')
62endif
63
64null_dep = dependency('', required: false) 60null_dep = dependency('', required: false)
65 61
66jsonc = dependency('json-c', version: '>=0.13') 62jsonc = dependency('json-c', version: '>=0.13')
@@ -77,16 +73,14 @@ gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf'))
77pixman = dependency('pixman-1') 73pixman = dependency('pixman-1')
78libevdev = dependency('libevdev') 74libevdev = dependency('libevdev')
79libinput = wlroots_features['libinput_backend'] ? dependency('libinput', version: '>=1.21.0') : null_dep 75libinput = wlroots_features['libinput_backend'] ? dependency('libinput', version: '>=1.21.0') : null_dep
80xcb = dependency('xcb', required: get_option('xwayland')) 76xcb = wlroots_features['xwayland'] ? dependency('xcb') : null_dep
81drm = dependency('libdrm') 77drm = dependency('libdrm')
82libudev = wlroots_features['libinput_backend'] ? dependency('libudev') : null_dep 78libudev = wlroots_features['libinput_backend'] ? dependency('libudev') : null_dep
83math = cc.find_library('m') 79math = cc.find_library('m')
84rt = cc.find_library('rt') 80rt = cc.find_library('rt')
85xcb_icccm = dependency('xcb-icccm', required: get_option('xwayland')) 81xcb_icccm = wlroots_features['xwayland'] ? dependency('xcb-icccm') : null_dep
86threads = dependency('threads') # for pthread_setschedparam 82threads = dependency('threads') # for pthread_setschedparam
87 83
88have_xwayland = xcb.found() and xcb_icccm.found() and wlroots_features['xwayland']
89
90if get_option('sd-bus-provider') == 'auto' 84if get_option('sd-bus-provider') == 'auto'
91 if not get_option('tray').disabled() 85 if not get_option('tray').disabled()
92 assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto') 86 assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto')
@@ -110,7 +104,6 @@ have_tray = (not get_option('tray').disabled()) and tray_deps_found
110 104
111conf_data = configuration_data() 105conf_data = configuration_data()
112 106
113conf_data.set10('HAVE_XWAYLAND', have_xwayland)
114conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found()) 107conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found())
115conf_data.set10('HAVE_LIBSYSTEMD', sdbus.found() and sdbus.name() == 'libsystemd') 108conf_data.set10('HAVE_LIBSYSTEMD', sdbus.found() and sdbus.name() == 'libsystemd')
116conf_data.set10('HAVE_LIBELOGIND', sdbus.found() and sdbus.name() == 'libelogind') 109conf_data.set10('HAVE_LIBELOGIND', sdbus.found() and sdbus.name() == 'libelogind')
@@ -271,7 +264,6 @@ endif
271subdir('completions') 264subdir('completions')
272 265
273summary({ 266summary({
274 'xwayland': have_xwayland,
275 'gdk-pixbuf': gdk_pixbuf.found(), 267 'gdk-pixbuf': gdk_pixbuf.found(),
276 'tray': have_tray, 268 'tray': have_tray,
277 'man-pages': scdoc.found(), 269 'man-pages': scdoc.found(),
diff --git a/meson_options.txt b/meson_options.txt
index 8d0d6509..506ecc9a 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -4,7 +4,6 @@ option('bash-completions', type: 'boolean', value: true, description: 'Install b
4option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.') 4option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.')
5option('swaybar', type: 'boolean', value: true, description: 'Enable support for swaybar') 5option('swaybar', type: 'boolean', value: true, description: 'Enable support for swaybar')
6option('swaynag', type: 'boolean', value: true, description: 'Enable support for swaynag') 6option('swaynag', type: 'boolean', value: true, description: 'Enable support for swaynag')
7option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications')
8option('tray', type: 'feature', value: 'auto', description: 'Enable support for swaybar tray') 7option('tray', type: 'feature', value: 'auto', description: 'Enable support for swaybar tray')
9option('gdk-pixbuf', type: 'feature', value: 'auto', description: 'Enable support for more image formats in swaybar tray') 8option('gdk-pixbuf', type: 'feature', value: 'auto', description: 'Enable support for more image formats in swaybar tray')
10option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages') 9option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages')
diff --git a/sway/commands/swap.c b/sway/commands/swap.c
index e142eede..c0b0d0b9 100644
--- a/sway/commands/swap.c
+++ b/sway/commands/swap.c
@@ -18,7 +18,7 @@ static bool test_con_id(struct sway_container *container, void *data) {
18 return container->node.id == *con_id; 18 return container->node.id == *con_id;
19} 19}
20 20
21#if HAVE_XWAYLAND 21#if WLR_HAS_XWAYLAND
22static bool test_id(struct sway_container *container, void *data) { 22static bool test_id(struct sway_container *container, void *data) {
23 xcb_window_t *wid = data; 23 xcb_window_t *wid = data;
24 return (container->view && container->view->type == SWAY_VIEW_XWAYLAND 24 return (container->view && container->view->type == SWAY_VIEW_XWAYLAND
@@ -53,7 +53,7 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
53 53
54 char *value = join_args(argv + 3, argc - 3); 54 char *value = join_args(argv + 3, argc - 3);
55 if (strcasecmp(argv[2], "id") == 0) { 55 if (strcasecmp(argv[2], "id") == 0) {
56#if HAVE_XWAYLAND 56#if WLR_HAS_XWAYLAND
57 xcb_window_t id = strtol(value, NULL, 0); 57 xcb_window_t id = strtol(value, NULL, 0);
58 other = root_find_container(test_id, &id); 58 other = root_find_container(test_id, &id);
59#endif 59#endif
diff --git a/sway/commands/xwayland.c b/sway/commands/xwayland.c
index 584a8e3a..c0b175fc 100644
--- a/sway/commands/xwayland.c
+++ b/sway/commands/xwayland.c
@@ -10,7 +10,7 @@ struct cmd_results *cmd_xwayland(int argc, char **argv) {
10 return error; 10 return error;
11 } 11 }
12 12
13#ifdef HAVE_XWAYLAND 13#ifdef WLR_HAS_XWAYLAND
14 enum xwayland_mode xwayland; 14 enum xwayland_mode xwayland;
15 if (strcmp(argv[0], "force") == 0) { 15 if (strcmp(argv[0], "force") == 0) {
16 xwayland = XWAYLAND_MODE_IMMEDIATE; 16 xwayland = XWAYLAND_MODE_IMMEDIATE;
diff --git a/sway/criteria.c b/sway/criteria.c
index e16b4fa8..13f0530e 100644
--- a/sway/criteria.c
+++ b/sway/criteria.c
@@ -22,7 +22,7 @@ bool criteria_is_empty(struct criteria *criteria) {
22 && !criteria->app_id 22 && !criteria->app_id
23 && !criteria->con_mark 23 && !criteria->con_mark
24 && !criteria->con_id 24 && !criteria->con_id
25#if HAVE_XWAYLAND 25#if WLR_HAS_XWAYLAND
26 && !criteria->class 26 && !criteria->class
27 && !criteria->id 27 && !criteria->id
28 && !criteria->instance 28 && !criteria->instance
@@ -90,7 +90,7 @@ void criteria_destroy(struct criteria *criteria) {
90 pattern_destroy(criteria->title); 90 pattern_destroy(criteria->title);
91 pattern_destroy(criteria->shell); 91 pattern_destroy(criteria->shell);
92 pattern_destroy(criteria->app_id); 92 pattern_destroy(criteria->app_id);
93#if HAVE_XWAYLAND 93#if WLR_HAS_XWAYLAND
94 pattern_destroy(criteria->class); 94 pattern_destroy(criteria->class);
95 pattern_destroy(criteria->instance); 95 pattern_destroy(criteria->instance);
96 pattern_destroy(criteria->window_role); 96 pattern_destroy(criteria->window_role);
@@ -110,7 +110,7 @@ static int regex_cmp(const char *item, const pcre2_code *regex) {
110 return result; 110 return result;
111} 111}
112 112
113#if HAVE_XWAYLAND 113#if WLR_HAS_XWAYLAND
114static bool view_has_window_type(struct sway_view *view, enum atom_name name) { 114static bool view_has_window_type(struct sway_view *view, enum atom_name name) {
115 if (view->type != SWAY_VIEW_XWAYLAND) { 115 if (view->type != SWAY_VIEW_XWAYLAND) {
116 return false; 116 return false;
@@ -251,7 +251,7 @@ static bool criteria_matches_view(struct criteria *criteria,
251 return false; 251 return false;
252 } 252 }
253 253
254#if HAVE_XWAYLAND 254#if WLR_HAS_XWAYLAND
255 if (criteria->id) { // X11 window ID 255 if (criteria->id) { // X11 window ID
256 uint32_t x11_window_id = view_get_x11_window_id(view); 256 uint32_t x11_window_id = view_get_x11_window_id(view);
257 if (!x11_window_id || x11_window_id != criteria->id) { 257 if (!x11_window_id || x11_window_id != criteria->id) {
@@ -428,7 +428,7 @@ list_t *criteria_get_containers(struct criteria *criteria) {
428 return matches; 428 return matches;
429} 429}
430 430
431#if HAVE_XWAYLAND 431#if WLR_HAS_XWAYLAND
432static enum atom_name parse_window_type(const char *type) { 432static enum atom_name parse_window_type(const char *type) {
433 if (strcasecmp(type, "normal") == 0) { 433 if (strcasecmp(type, "normal") == 0) {
434 return NET_WM_WINDOW_TYPE_NORMAL; 434 return NET_WM_WINDOW_TYPE_NORMAL;
@@ -461,7 +461,7 @@ enum criteria_token {
461 T_CON_ID, 461 T_CON_ID,
462 T_CON_MARK, 462 T_CON_MARK,
463 T_FLOATING, 463 T_FLOATING,
464#if HAVE_XWAYLAND 464#if WLR_HAS_XWAYLAND
465 T_CLASS, 465 T_CLASS,
466 T_ID, 466 T_ID,
467 T_INSTANCE, 467 T_INSTANCE,
@@ -487,7 +487,7 @@ static enum criteria_token token_from_name(char *name) {
487 return T_CON_ID; 487 return T_CON_ID;
488 } else if (strcmp(name, "con_mark") == 0) { 488 } else if (strcmp(name, "con_mark") == 0) {
489 return T_CON_MARK; 489 return T_CON_MARK;
490#if HAVE_XWAYLAND 490#if WLR_HAS_XWAYLAND
491 } else if (strcmp(name, "class") == 0) { 491 } else if (strcmp(name, "class") == 0) {
492 return T_CLASS; 492 return T_CLASS;
493 } else if (strcmp(name, "id") == 0) { 493 } else if (strcmp(name, "id") == 0) {
@@ -566,7 +566,7 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) {
566 case T_CON_MARK: 566 case T_CON_MARK:
567 pattern_create(&criteria->con_mark, value); 567 pattern_create(&criteria->con_mark, value);
568 break; 568 break;
569#if HAVE_XWAYLAND 569#if WLR_HAS_XWAYLAND
570 case T_CLASS: 570 case T_CLASS:
571 pattern_create(&criteria->class, value); 571 pattern_create(&criteria->class, value);
572 break; 572 break;
@@ -674,7 +674,7 @@ struct criteria *criteria_parse(char *raw, char **error_arg) {
674 ++head; 674 ++head;
675 675
676 struct criteria *criteria = calloc(1, sizeof(struct criteria)); 676 struct criteria *criteria = calloc(1, sizeof(struct criteria));
677#if HAVE_XWAYLAND 677#if WLR_HAS_XWAYLAND
678 criteria->window_type = ATOM_LAST; // default value 678 criteria->window_type = ATOM_LAST; // default value
679#endif 679#endif
680 char *name = NULL, *value = NULL; 680 char *name = NULL, *value = NULL;
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index 042141ab..e464ff1a 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -761,7 +761,7 @@ static bool should_configure(struct sway_node *node,
761 } 761 }
762 struct sway_container_state *cstate = &node->sway_container->current; 762 struct sway_container_state *cstate = &node->sway_container->current;
763 struct sway_container_state *istate = &instruction->container_state; 763 struct sway_container_state *istate = &instruction->container_state;
764#if HAVE_XWAYLAND 764#if WLR_HAS_XWAYLAND
765 // Xwayland views are position-aware and need to be reconfigured 765 // Xwayland views are position-aware and need to be reconfigured
766 // when their position changes. 766 // when their position changes.
767 if (node->sway_container->view->type == SWAY_VIEW_XWAYLAND) { 767 if (node->sway_container->view->type == SWAY_VIEW_XWAYLAND) {
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 3d04826c..0b4a36d9 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -107,7 +107,7 @@ struct sway_node *node_at_coords(
107 return NULL; 107 return NULL;
108 } 108 }
109 109
110#if HAVE_XWAYLAND 110#if WLR_HAS_XWAYLAND
111 if (scene_descriptor_try_get(current, SWAY_SCENE_DESC_XWAYLAND_UNMANAGED)) { 111 if (scene_descriptor_try_get(current, SWAY_SCENE_DESC_XWAYLAND_UNMANAGED)) {
112 return NULL; 112 return NULL;
113 } 113 }
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 0c5672bc..da4bb12a 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -190,7 +190,7 @@ static void seat_send_focus(struct sway_node *node, struct sway_seat *seat) {
190 node->sway_container->view : NULL; 190 node->sway_container->view : NULL;
191 191
192 if (view && seat_is_input_allowed(seat, view->surface)) { 192 if (view && seat_is_input_allowed(seat, view->surface)) {
193#if HAVE_XWAYLAND 193#if WLR_HAS_XWAYLAND
194 if (view->type == SWAY_VIEW_XWAYLAND) { 194 if (view->type == SWAY_VIEW_XWAYLAND) {
195 struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland; 195 struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland;
196 wlr_xwayland_set_seat(xwayland, seat->wlr_seat); 196 wlr_xwayland_set_seat(xwayland, seat->wlr_seat);
@@ -1002,7 +1002,7 @@ void seat_configure_xcursor(struct sway_seat *seat) {
1002 setenv("XCURSOR_THEME", cursor_theme, 1); 1002 setenv("XCURSOR_THEME", cursor_theme, 1);
1003 } 1003 }
1004 1004
1005#if HAVE_XWAYLAND 1005#if WLR_HAS_XWAYLAND
1006 if (server.xwayland.wlr_xwayland && (!server.xwayland.xcursor_manager || 1006 if (server.xwayland.wlr_xwayland && (!server.xwayland.xcursor_manager ||
1007 !xcursor_manager_is_named(server.xwayland.xcursor_manager, 1007 !xcursor_manager_is_named(server.xwayland.xcursor_manager,
1008 cursor_theme) || 1008 cursor_theme) ||
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c
index 0c6f7c5e..e01fa933 100644
--- a/sway/input/seatop_default.c
+++ b/sway/input/seatop_default.c
@@ -15,7 +15,7 @@
15#include "sway/tree/view.h" 15#include "sway/tree/view.h"
16#include "sway/tree/workspace.h" 16#include "sway/tree/workspace.h"
17#include "log.h" 17#include "log.h"
18#if HAVE_XWAYLAND 18#if WLR_HAS_XWAYLAND
19#include "sway/xwayland.h" 19#include "sway/xwayland.h"
20#endif 20#endif
21 21
@@ -234,7 +234,7 @@ static void handle_tablet_tool_tip(struct sway_seat *seat,
234 node->sway_container : NULL; 234 node->sway_container : NULL;
235 235
236 struct wlr_layer_surface_v1 *layer; 236 struct wlr_layer_surface_v1 *layer;
237#if HAVE_XWAYLAND 237#if WLR_HAS_XWAYLAND
238 struct wlr_xwayland_surface *xsurface; 238 struct wlr_xwayland_surface *xsurface;
239#endif 239#endif
240 if ((layer = wlr_layer_surface_v1_try_from_wlr_surface(surface)) && 240 if ((layer = wlr_layer_surface_v1_try_from_wlr_surface(surface)) &&
@@ -268,7 +268,7 @@ static void handle_tablet_tool_tip(struct sway_seat *seat,
268 seat_set_focus_container(seat, cont); 268 seat_set_focus_container(seat, cont);
269 seatop_begin_down(seat, node->sway_container, sx, sy); 269 seatop_begin_down(seat, node->sway_container, sx, sy);
270 } 270 }
271#if HAVE_XWAYLAND 271#if WLR_HAS_XWAYLAND
272 // Handle tapping on an xwayland unmanaged view 272 // Handle tapping on an xwayland unmanaged view
273 else if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(surface)) && 273 else if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(surface)) &&
274 xsurface->override_redirect && 274 xsurface->override_redirect &&
@@ -514,7 +514,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
514 return; 514 return;
515 } 515 }
516 516
517#if HAVE_XWAYLAND 517#if WLR_HAS_XWAYLAND
518 // Handle clicking on xwayland unmanaged view 518 // Handle clicking on xwayland unmanaged view
519 struct wlr_xwayland_surface *xsurface; 519 struct wlr_xwayland_surface *xsurface;
520 if (surface && 520 if (surface &&
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index 81ca3483..b7370aa6 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -154,7 +154,7 @@ static json_object *ipc_json_output_mode_description(
154 return mode_object; 154 return mode_object;
155} 155}
156 156
157#if HAVE_XWAYLAND 157#if WLR_HAS_XWAYLAND
158static const char *ipc_json_xwindow_type_description(struct sway_view *view) { 158static const char *ipc_json_xwindow_type_description(struct sway_view *view) {
159 struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface; 159 struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
160 struct sway_xwayland *xwayland = &server.xwayland; 160 struct sway_xwayland *xwayland = &server.xwayland;
@@ -633,7 +633,7 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object
633 json_object_new_string(ipc_json_content_type_description(content_type))); 633 json_object_new_string(ipc_json_content_type_description(content_type)));
634 } 634 }
635 635
636#if HAVE_XWAYLAND 636#if WLR_HAS_XWAYLAND
637 if (c->view->type == SWAY_VIEW_XWAYLAND) { 637 if (c->view->type == SWAY_VIEW_XWAYLAND) {
638 json_object_object_add(object, "window", 638 json_object_object_add(object, "window",
639 json_object_new_int(view_get_x11_window_id(c->view))); 639 json_object_new_int(view_get_x11_window_id(c->view)));
diff --git a/sway/meson.build b/sway/meson.build
index d937e425..47b51d0c 100644
--- a/sway/meson.build
+++ b/sway/meson.build
@@ -231,7 +231,7 @@ sway_deps = [
231 xcb_icccm, 231 xcb_icccm,
232] 232]
233 233
234if have_xwayland 234if wlroots_features['xwayland']
235 sway_sources += 'desktop/xwayland.c' 235 sway_sources += 'desktop/xwayland.c'
236endif 236endif
237 237
diff --git a/sway/server.c b/sway/server.c
index 180d3a6b..4b48e8e5 100644
--- a/sway/server.c
+++ b/sway/server.c
@@ -56,7 +56,7 @@
56#include "sway/input/cursor.h" 56#include "sway/input/cursor.h"
57#include "sway/tree/root.h" 57#include "sway/tree/root.h"
58 58
59#if HAVE_XWAYLAND 59#if WLR_HAS_XWAYLAND
60#include <wlr/xwayland/shell.h> 60#include <wlr/xwayland/shell.h>
61#include "sway/xwayland.h" 61#include "sway/xwayland.h"
62#endif 62#endif
@@ -118,7 +118,7 @@ static bool is_privileged(const struct wl_global *global) {
118 118
119static bool filter_global(const struct wl_client *client, 119static bool filter_global(const struct wl_client *client,
120 const struct wl_global *global, void *data) { 120 const struct wl_global *global, void *data) {
121#if HAVE_XWAYLAND 121#if WLR_HAS_XWAYLAND
122 struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland; 122 struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland;
123 if (xwayland && global == xwayland->shell_v1->global) { 123 if (xwayland && global == xwayland->shell_v1->global) {
124 return xwayland->server != NULL && client == xwayland->server->client; 124 return xwayland->server != NULL && client == xwayland->server->client;
@@ -437,7 +437,7 @@ bool server_init(struct sway_server *server) {
437 437
438void server_fini(struct sway_server *server) { 438void server_fini(struct sway_server *server) {
439 // TODO: free sway-specific resources 439 // TODO: free sway-specific resources
440#if HAVE_XWAYLAND 440#if WLR_HAS_XWAYLAND
441 wlr_xwayland_destroy(server->xwayland.wlr_xwayland); 441 wlr_xwayland_destroy(server->xwayland.wlr_xwayland);
442#endif 442#endif
443 wl_display_destroy_clients(server->wl_display); 443 wl_display_destroy_clients(server->wl_display);
@@ -447,7 +447,7 @@ void server_fini(struct sway_server *server) {
447} 447}
448 448
449bool server_start(struct sway_server *server) { 449bool server_start(struct sway_server *server) {
450#if HAVE_XWAYLAND 450#if WLR_HAS_XWAYLAND
451 if (config->xwayland != XWAYLAND_MODE_DISABLED) { 451 if (config->xwayland != XWAYLAND_MODE_DISABLED) {
452 sway_log(SWAY_DEBUG, "Initializing Xwayland (lazy=%d)", 452 sway_log(SWAY_DEBUG, "Initializing Xwayland (lazy=%d)",
453 config->xwayland == XWAYLAND_MODE_LAZY); 453 config->xwayland == XWAYLAND_MODE_LAZY);
diff --git a/sway/tree/root.c b/sway/tree/root.c
index ae3c3cb2..20fcfa59 100644
--- a/sway/tree/root.c
+++ b/sway/tree/root.c
@@ -53,7 +53,7 @@ struct sway_root *root_create(struct wl_display *wl_display) {
53 root->layers.shell_top = alloc_scene_tree(root->layer_tree, &failed); 53 root->layers.shell_top = alloc_scene_tree(root->layer_tree, &failed);
54 root->layers.fullscreen = alloc_scene_tree(root->layer_tree, &failed); 54 root->layers.fullscreen = alloc_scene_tree(root->layer_tree, &failed);
55 root->layers.fullscreen_global = alloc_scene_tree(root->layer_tree, &failed); 55 root->layers.fullscreen_global = alloc_scene_tree(root->layer_tree, &failed);
56#if HAVE_XWAYLAND 56#if WLR_HAS_XWAYLAND
57 root->layers.unmanaged = alloc_scene_tree(root->layer_tree, &failed); 57 root->layers.unmanaged = alloc_scene_tree(root->layer_tree, &failed);
58#endif 58#endif
59 root->layers.shell_overlay = alloc_scene_tree(root->layer_tree, &failed); 59 root->layers.shell_overlay = alloc_scene_tree(root->layer_tree, &failed);
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 35b4b73f..9a87d9e2 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -1,6 +1,7 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <strings.h> 2#include <strings.h>
3#include <wayland-server-core.h> 3#include <wayland-server-core.h>
4#include <wlr/config.h>
4#include <wlr/render/wlr_renderer.h> 5#include <wlr/render/wlr_renderer.h>
5#include <wlr/types/wlr_buffer.h> 6#include <wlr/types/wlr_buffer.h>
6#include <wlr/types/wlr_ext_foreign_toplevel_list_v1.h> 7#include <wlr/types/wlr_ext_foreign_toplevel_list_v1.h>
@@ -9,8 +10,7 @@
9#include <wlr/types/wlr_server_decoration.h> 10#include <wlr/types/wlr_server_decoration.h>
10#include <wlr/types/wlr_subcompositor.h> 11#include <wlr/types/wlr_subcompositor.h>
11#include <wlr/types/wlr_xdg_decoration_v1.h> 12#include <wlr/types/wlr_xdg_decoration_v1.h>
12#include "config.h" 13#if WLR_HAS_XWAYLAND
13#if HAVE_XWAYLAND
14#include <wlr/xwayland.h> 14#include <wlr/xwayland.h>
15#endif 15#endif
16#include "list.h" 16#include "list.h"
@@ -126,7 +126,7 @@ const char *view_get_instance(struct sway_view *view) {
126 } 126 }
127 return NULL; 127 return NULL;
128} 128}
129#if HAVE_XWAYLAND 129#if WLR_HAS_XWAYLAND
130uint32_t view_get_x11_window_id(struct sway_view *view) { 130uint32_t view_get_x11_window_id(struct sway_view *view) {
131 if (view->impl->get_int_prop) { 131 if (view->impl->get_int_prop) {
132 return view->impl->get_int_prop(view, VIEW_PROP_X11_WINDOW_ID); 132 return view->impl->get_int_prop(view, VIEW_PROP_X11_WINDOW_ID);
@@ -159,7 +159,7 @@ const char *view_get_shell(struct sway_view *view) {
159 switch(view->type) { 159 switch(view->type) {
160 case SWAY_VIEW_XDG_SHELL: 160 case SWAY_VIEW_XDG_SHELL:
161 return "xdg_shell"; 161 return "xdg_shell";
162#if HAVE_XWAYLAND 162#if WLR_HAS_XWAYLAND
163 case SWAY_VIEW_XWAYLAND: 163 case SWAY_VIEW_XWAYLAND:
164 return "xwayland"; 164 return "xwayland";
165#endif 165#endif
@@ -499,7 +499,7 @@ void view_execute_criteria(struct sway_view *view) {
499static void view_populate_pid(struct sway_view *view) { 499static void view_populate_pid(struct sway_view *view) {
500 pid_t pid; 500 pid_t pid;
501 switch (view->type) { 501 switch (view->type) {
502#if HAVE_XWAYLAND 502#if WLR_HAS_XWAYLAND
503 case SWAY_VIEW_XWAYLAND:; 503 case SWAY_VIEW_XWAYLAND:;
504 struct wlr_xwayland_surface *surf = 504 struct wlr_xwayland_surface *surf =
505 wlr_xwayland_surface_try_from_wlr_surface(view->surface); 505 wlr_xwayland_surface_try_from_wlr_surface(view->surface);
@@ -838,7 +838,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
838 838
839 bool set_focus = should_focus(view); 839 bool set_focus = should_focus(view);
840 840
841#if HAVE_XWAYLAND 841#if WLR_HAS_XWAYLAND
842 struct wlr_xwayland_surface *xsurface; 842 struct wlr_xwayland_surface *xsurface;
843 if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(wlr_surface))) { 843 if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(wlr_surface))) {
844 set_focus &= wlr_xwayland_icccm_input_model(xsurface) != 844 set_focus &= wlr_xwayland_icccm_input_model(xsurface) !=
@@ -954,7 +954,7 @@ struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) {
954 if ((xdg_surface = wlr_xdg_surface_try_from_wlr_surface(wlr_surface))) { 954 if ((xdg_surface = wlr_xdg_surface_try_from_wlr_surface(wlr_surface))) {
955 return view_from_wlr_xdg_surface(xdg_surface); 955 return view_from_wlr_xdg_surface(xdg_surface);
956 } 956 }
957#if HAVE_XWAYLAND 957#if WLR_HAS_XWAYLAND
958 struct wlr_xwayland_surface *xsurface; 958 struct wlr_xwayland_surface *xsurface;
959 if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(wlr_surface))) { 959 if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(wlr_surface))) {
960 return view_from_wlr_xwayland_surface(xsurface); 960 return view_from_wlr_xwayland_surface(xsurface);