summaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-07-25 08:27:40 -0400
committerLibravatar GitHub <noreply@github.com>2018-07-25 08:27:40 -0400
commitfc718f629af231f8a0ae795b2f7529e213cab183 (patch)
tree7917aadbfb09d02d3d60045f0ba8d5028f0c4bb4 /sway
parentMerge pull request #2354 from RyanDwyer/fix-crash-on-tab-reap (diff)
parentmore style fixes, reorder config.h include (diff)
downloadsway-fc718f629af231f8a0ae795b2f7529e213cab183.tar.gz
sway-fc718f629af231f8a0ae795b2f7529e213cab183.tar.zst
sway-fc718f629af231f8a0ae795b2f7529e213cab183.zip
Merge pull request #2350 from ppascher/xwayland-optional
Added meson option to allow building sway without xwayland support
Diffstat (limited to 'sway')
-rw-r--r--sway/commands/swap.c7
-rw-r--r--sway/criteria.c13
-rw-r--r--sway/desktop/output.c14
-rw-r--r--sway/desktop/render.c11
-rw-r--r--sway/input/cursor.c4
-rw-r--r--sway/input/seat.c3
-rw-r--r--sway/meson.build5
-rw-r--r--sway/server.c5
-rw-r--r--sway/tree/container.c2
-rw-r--r--sway/tree/layout.c3
-rw-r--r--sway/tree/view.c17
11 files changed, 71 insertions, 13 deletions
diff --git a/sway/commands/swap.c b/sway/commands/swap.c
index 2fc88308..4e3a9cce 100644
--- a/sway/commands/swap.c
+++ b/sway/commands/swap.c
@@ -1,5 +1,6 @@
1#include <strings.h> 1#include <strings.h>
2#include <wlr/util/log.h> 2#include <wlr/util/log.h>
3#include "config.h"
3#include "sway/commands.h" 4#include "sway/commands.h"
4#include "sway/tree/arrange.h" 5#include "sway/tree/arrange.h"
5#include "sway/tree/layout.h" 6#include "sway/tree/layout.h"
@@ -14,10 +15,14 @@ static bool test_con_id(struct sway_container *container, void *con_id) {
14} 15}
15 16
16static bool test_id(struct sway_container *container, void *id) { 17static bool test_id(struct sway_container *container, void *id) {
18#ifdef HAVE_XWAYLAND
17 xcb_window_t *wid = id; 19 xcb_window_t *wid = id;
18 return (container->type == C_VIEW 20 return (container->type == C_VIEW
19 && container->sway_view->type == SWAY_VIEW_XWAYLAND 21 && container->sway_view->type == SWAY_VIEW_XWAYLAND
20 && container->sway_view->wlr_xwayland_surface->window_id == *wid); 22 && container->sway_view->wlr_xwayland_surface->window_id == *wid);
23#else
24 return false;
25#endif
21} 26}
22 27
23static bool test_mark(struct sway_container *container, void *mark) { 28static bool test_mark(struct sway_container *container, void *mark) {
@@ -43,8 +48,10 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
43 48
44 char *value = join_args(argv + 3, argc - 3); 49 char *value = join_args(argv + 3, argc - 3);
45 if (strcasecmp(argv[2], "id") == 0) { 50 if (strcasecmp(argv[2], "id") == 0) {
51#ifdef HAVE_XWAYLAND
46 xcb_window_t id = strtol(value, NULL, 0); 52 xcb_window_t id = strtol(value, NULL, 0);
47 other = container_find(&root_container, test_id, (void *)&id); 53 other = container_find(&root_container, test_id, (void *)&id);
54#endif
48 } else if (strcasecmp(argv[2], "con_id") == 0) { 55 } else if (strcasecmp(argv[2], "con_id") == 0) {
49 size_t con_id = atoi(value); 56 size_t con_id = atoi(value);
50 other = container_find(&root_container, test_con_id, (void *)con_id); 57 other = container_find(&root_container, test_con_id, (void *)con_id);
diff --git a/sway/criteria.c b/sway/criteria.c
index c2e9c07e..39d300ea 100644
--- a/sway/criteria.c
+++ b/sway/criteria.c
@@ -10,6 +10,7 @@
10#include "stringop.h" 10#include "stringop.h"
11#include "list.h" 11#include "list.h"
12#include "log.h" 12#include "log.h"
13#include "config.h"
13 14
14bool criteria_is_empty(struct criteria *criteria) { 15bool criteria_is_empty(struct criteria *criteria) {
15 return !criteria->title 16 return !criteria->title
@@ -19,7 +20,9 @@ bool criteria_is_empty(struct criteria *criteria) {
19 && !criteria->instance 20 && !criteria->instance
20 && !criteria->con_mark 21 && !criteria->con_mark
21 && !criteria->con_id 22 && !criteria->con_id
23#ifdef HAVE_XWAYLAND
22 && !criteria->id 24 && !criteria->id
25#endif
23 && !criteria->window_role 26 && !criteria->window_role
24 && !criteria->window_type 27 && !criteria->window_type
25 && !criteria->floating 28 && !criteria->floating
@@ -127,12 +130,14 @@ static bool criteria_matches_view(struct criteria *criteria,
127 } 130 }
128 } 131 }
129 132
133#ifdef HAVE_XWAYLAND
130 if (criteria->id) { // X11 window ID 134 if (criteria->id) { // X11 window ID
131 uint32_t x11_window_id = view_get_x11_window_id(view); 135 uint32_t x11_window_id = view_get_x11_window_id(view);
132 if (!x11_window_id || x11_window_id != criteria->id) { 136 if (!x11_window_id || x11_window_id != criteria->id) {
133 return false; 137 return false;
134 } 138 }
135 } 139 }
140#endif
136 141
137 if (criteria->window_role) { 142 if (criteria->window_role) {
138 // TODO 143 // TODO
@@ -265,7 +270,9 @@ enum criteria_token {
265 T_CON_ID, 270 T_CON_ID,
266 T_CON_MARK, 271 T_CON_MARK,
267 T_FLOATING, 272 T_FLOATING,
273#ifdef HAVE_XWAYLAND
268 T_ID, 274 T_ID,
275#endif
269 T_INSTANCE, 276 T_INSTANCE,
270 T_SHELL, 277 T_SHELL,
271 T_TILING, 278 T_TILING,
@@ -287,8 +294,10 @@ static enum criteria_token token_from_name(char *name) {
287 return T_CON_ID; 294 return T_CON_ID;
288 } else if (strcmp(name, "con_mark") == 0) { 295 } else if (strcmp(name, "con_mark") == 0) {
289 return T_CON_MARK; 296 return T_CON_MARK;
297#ifdef HAVE_XWAYLAND
290 } else if (strcmp(name, "id") == 0) { 298 } else if (strcmp(name, "id") == 0) {
291 return T_ID; 299 return T_ID;
300#endif
292 } else if (strcmp(name, "instance") == 0) { 301 } else if (strcmp(name, "instance") == 0) {
293 return T_INSTANCE; 302 return T_INSTANCE;
294 } else if (strcmp(name, "shell") == 0) { 303 } else if (strcmp(name, "shell") == 0) {
@@ -355,7 +364,9 @@ static char *get_focused_prop(enum criteria_token token) {
355 case T_CON_ID: // These do not support __focused__ 364 case T_CON_ID: // These do not support __focused__
356 case T_CON_MARK: 365 case T_CON_MARK:
357 case T_FLOATING: 366 case T_FLOATING:
367#ifdef HAVE_XWAYLAND
358 case T_ID: 368 case T_ID:
369#endif
359 case T_TILING: 370 case T_TILING:
360 case T_URGENT: 371 case T_URGENT:
361 case T_WINDOW_TYPE: 372 case T_WINDOW_TYPE:
@@ -426,12 +437,14 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) {
426 case T_WINDOW_TYPE: 437 case T_WINDOW_TYPE:
427 // TODO: This is a string but will be stored as an enum or integer 438 // TODO: This is a string but will be stored as an enum or integer
428 break; 439 break;
440#ifdef HAVE_XWAYLAND
429 case T_ID: 441 case T_ID:
430 criteria->id = strtoul(effective_value, &endptr, 10); 442 criteria->id = strtoul(effective_value, &endptr, 10);
431 if (*endptr != 0) { 443 if (*endptr != 0) {
432 error = strdup("The value for 'id' should be numeric"); 444 error = strdup("The value for 'id' should be numeric");
433 } 445 }
434 break; 446 break;
447#endif
435 case T_FLOATING: 448 case T_FLOATING:
436 criteria->floating = true; 449 criteria->floating = true;
437 break; 450 break;
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index a206ac6b..1512408e 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -14,6 +14,7 @@
14#include <wlr/types/wlr_surface.h> 14#include <wlr/types/wlr_surface.h>
15#include <wlr/util/region.h> 15#include <wlr/util/region.h>
16#include "log.h" 16#include "log.h"
17#include "config.h"
17#include "sway/config.h" 18#include "sway/config.h"
18#include "sway/input/input-manager.h" 19#include "sway/input/input-manager.h"
19#include "sway/input/seat.h" 20#include "sway/input/seat.h"
@@ -128,7 +129,7 @@ void output_layer_for_each_surface(struct wl_list *layer_surfaces,
128 user_data); 129 user_data);
129 } 130 }
130} 131}
131 132#ifdef HAVE_XWAYLAND
132void output_unmanaged_for_each_surface(struct wl_list *unmanaged, 133void output_unmanaged_for_each_surface(struct wl_list *unmanaged,
133 struct sway_output *output, struct root_geometry *geo, 134 struct sway_output *output, struct root_geometry *geo,
134 wlr_surface_iterator_func_t iterator, void *user_data) { 135 wlr_surface_iterator_func_t iterator, void *user_data) {
@@ -143,7 +144,7 @@ void output_unmanaged_for_each_surface(struct wl_list *unmanaged,
143 iterator, user_data); 144 iterator, user_data);
144 } 145 }
145} 146}
146 147#endif
147void output_drag_icons_for_each_surface(struct wl_list *drag_icons, 148void output_drag_icons_for_each_surface(struct wl_list *drag_icons,
148 struct sway_output *output, struct root_geometry *geo, 149 struct sway_output *output, struct root_geometry *geo,
149 wlr_surface_iterator_func_t iterator, void *user_data) { 150 wlr_surface_iterator_func_t iterator, void *user_data) {
@@ -244,13 +245,13 @@ static void send_frame_done_layer(struct send_frame_done_data *data,
244 output_layer_for_each_surface(layer_surfaces, &data->root_geo, 245 output_layer_for_each_surface(layer_surfaces, &data->root_geo,
245 send_frame_done_iterator, data); 246 send_frame_done_iterator, data);
246} 247}
247 248#ifdef HAVE_XWAYLAND
248static void send_frame_done_unmanaged(struct send_frame_done_data *data, 249static void send_frame_done_unmanaged(struct send_frame_done_data *data,
249 struct wl_list *unmanaged) { 250 struct wl_list *unmanaged) {
250 output_unmanaged_for_each_surface(unmanaged, data->output, &data->root_geo, 251 output_unmanaged_for_each_surface(unmanaged, data->output, &data->root_geo,
251 send_frame_done_iterator, data); 252 send_frame_done_iterator, data);
252} 253}
253 254#endif
254static void send_frame_done_drag_icons(struct send_frame_done_data *data, 255static void send_frame_done_drag_icons(struct send_frame_done_data *data,
255 struct wl_list *drag_icons) { 256 struct wl_list *drag_icons) {
256 output_drag_icons_for_each_surface(drag_icons, data->output, &data->root_geo, 257 output_drag_icons_for_each_surface(drag_icons, data->output, &data->root_geo,
@@ -291,11 +292,12 @@ static void send_frame_done(struct sway_output *output, struct timespec *when) {
291 if (workspace->current.ws_fullscreen) { 292 if (workspace->current.ws_fullscreen) {
292 send_frame_done_container_iterator( 293 send_frame_done_container_iterator(
293 workspace->current.ws_fullscreen->swayc, &data); 294 workspace->current.ws_fullscreen->swayc, &data);
294 295#ifdef HAVE_XWAYLAND
295 if (workspace->current.ws_fullscreen->type == SWAY_VIEW_XWAYLAND) { 296 if (workspace->current.ws_fullscreen->type == SWAY_VIEW_XWAYLAND) {
296 send_frame_done_unmanaged(&data, 297 send_frame_done_unmanaged(&data,
297 &root_container.sway_root->xwayland_unmanaged); 298 &root_container.sway_root->xwayland_unmanaged);
298 } 299 }
300#endif
299 } else { 301 } else {
300 send_frame_done_layer(&data, 302 send_frame_done_layer(&data,
301 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]); 303 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]);
@@ -305,8 +307,10 @@ static void send_frame_done(struct sway_output *output, struct timespec *when) {
305 send_frame_done_container(&data, workspace); 307 send_frame_done_container(&data, workspace);
306 send_frame_done_container(&data, workspace->sway_workspace->floating); 308 send_frame_done_container(&data, workspace->sway_workspace->floating);
307 309
310#ifdef HAVE_XWAYLAND
308 send_frame_done_unmanaged(&data, 311 send_frame_done_unmanaged(&data,
309 &root_container.sway_root->xwayland_unmanaged); 312 &root_container.sway_root->xwayland_unmanaged);
313#endif
310 send_frame_done_layer(&data, 314 send_frame_done_layer(&data,
311 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); 315 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
312 } 316 }
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index 7da54594..3e7bd94b 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -14,6 +14,7 @@
14#include <wlr/types/wlr_surface.h> 14#include <wlr/types/wlr_surface.h>
15#include <wlr/util/region.h> 15#include <wlr/util/region.h>
16#include "log.h" 16#include "log.h"
17#include "config.h"
17#include "sway/config.h" 18#include "sway/config.h"
18#include "sway/debug.h" 19#include "sway/debug.h"
19#include "sway/input/input-manager.h" 20#include "sway/input/input-manager.h"
@@ -132,7 +133,7 @@ static void render_layer(struct sway_output *output,
132 output_layer_for_each_surface(layer_surfaces, &data.root_geo, 133 output_layer_for_each_surface(layer_surfaces, &data.root_geo,
133 render_surface_iterator, &data); 134 render_surface_iterator, &data);
134} 135}
135 136#ifdef HAVE_XWAYLAND
136static void render_unmanaged(struct sway_output *output, 137static void render_unmanaged(struct sway_output *output,
137 pixman_region32_t *damage, struct wl_list *unmanaged) { 138 pixman_region32_t *damage, struct wl_list *unmanaged) {
138 struct render_data data = { 139 struct render_data data = {
@@ -143,7 +144,7 @@ static void render_unmanaged(struct sway_output *output,
143 output_unmanaged_for_each_surface(unmanaged, output, &data.root_geo, 144 output_unmanaged_for_each_surface(unmanaged, output, &data.root_geo,
144 render_surface_iterator, &data); 145 render_surface_iterator, &data);
145} 146}
146 147#endif
147static void render_drag_icons(struct sway_output *output, 148static void render_drag_icons(struct sway_output *output,
148 pixman_region32_t *damage, struct wl_list *drag_icons) { 149 pixman_region32_t *damage, struct wl_list *drag_icons) {
149 struct render_data data = { 150 struct render_data data = {
@@ -866,11 +867,12 @@ void output_render(struct sway_output *output, struct timespec *when,
866 } else { 867 } else {
867 render_view_surfaces(fullscreen_view, output, damage, 1.0f); 868 render_view_surfaces(fullscreen_view, output, damage, 1.0f);
868 } 869 }
869 870#ifdef HAVE_XWAYLAND
870 if (fullscreen_view->type == SWAY_VIEW_XWAYLAND) { 871 if (fullscreen_view->type == SWAY_VIEW_XWAYLAND) {
871 render_unmanaged(output, damage, 872 render_unmanaged(output, damage,
872 &root_container.sway_root->xwayland_unmanaged); 873 &root_container.sway_root->xwayland_unmanaged);
873 } 874 }
875#endif
874 } else { 876 } else {
875 float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f}; 877 float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f};
876 878
@@ -888,9 +890,10 @@ void output_render(struct sway_output *output, struct timespec *when,
888 890
889 render_container(output, damage, workspace, workspace->current.focused); 891 render_container(output, damage, workspace, workspace->current.focused);
890 render_floating(output, damage); 892 render_floating(output, damage);
891 893#ifdef HAVE_XWAYLAND
892 render_unmanaged(output, damage, 894 render_unmanaged(output, damage,
893 &root_container.sway_root->xwayland_unmanaged); 895 &root_container.sway_root->xwayland_unmanaged);
896#endif
894 render_layer(output, damage, 897 render_layer(output, damage,
895 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); 898 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
896 } 899 }
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index d94a707c..02bd2239 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -11,6 +11,7 @@
11#include <wlr/types/wlr_idle.h> 11#include <wlr/types/wlr_idle.h>
12#include "list.h" 12#include "list.h"
13#include "log.h" 13#include "log.h"
14#include "config.h"
14#include "sway/desktop.h" 15#include "sway/desktop.h"
15#include "sway/desktop/transaction.h" 16#include "sway/desktop/transaction.h"
16#include "sway/input/cursor.h" 17#include "sway/input/cursor.h"
@@ -54,6 +55,7 @@ static struct sway_container *container_at_coords(
54 struct sway_seat *seat, double lx, double ly, 55 struct sway_seat *seat, double lx, double ly,
55 struct wlr_surface **surface, double *sx, double *sy) { 56 struct wlr_surface **surface, double *sx, double *sy) {
56 // check for unmanaged views first 57 // check for unmanaged views first
58#ifdef HAVE_XWAYLAND
57 struct wl_list *unmanaged = &root_container.sway_root->xwayland_unmanaged; 59 struct wl_list *unmanaged = &root_container.sway_root->xwayland_unmanaged;
58 struct sway_xwayland_unmanaged *unmanaged_surface; 60 struct sway_xwayland_unmanaged *unmanaged_surface;
59 wl_list_for_each_reverse(unmanaged_surface, unmanaged, link) { 61 wl_list_for_each_reverse(unmanaged_surface, unmanaged, link) {
@@ -69,7 +71,7 @@ static struct sway_container *container_at_coords(
69 return NULL; 71 return NULL;
70 } 72 }
71 } 73 }
72 74#endif
73 // find the output the cursor is on 75 // find the output the cursor is on
74 struct wlr_output_layout *output_layout = 76 struct wlr_output_layout *output_layout =
75 root_container.sway_root->output_layout; 77 root_container.sway_root->output_layout;
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 8c634e5f..8698d69e 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -12,6 +12,7 @@
12#include <wlr/types/wlr_output_layout.h> 12#include <wlr/types/wlr_output_layout.h>
13#include <wlr/types/wlr_xcursor_manager.h> 13#include <wlr/types/wlr_xcursor_manager.h>
14#include "log.h" 14#include "log.h"
15#include "config.h"
15#include "sway/debug.h" 16#include "sway/debug.h"
16#include "sway/desktop.h" 17#include "sway/desktop.h"
17#include "sway/input/cursor.h" 18#include "sway/input/cursor.h"
@@ -103,11 +104,13 @@ static void seat_send_focus(struct sway_container *con,
103 104
104 if (con->type == C_VIEW 105 if (con->type == C_VIEW
105 && seat_is_input_allowed(seat, con->sway_view->surface)) { 106 && seat_is_input_allowed(seat, con->sway_view->surface)) {
107#ifdef HAVE_XWAYLAND
106 if (con->sway_view->type == SWAY_VIEW_XWAYLAND) { 108 if (con->sway_view->type == SWAY_VIEW_XWAYLAND) {
107 struct wlr_xwayland *xwayland = 109 struct wlr_xwayland *xwayland =
108 seat->input->server->xwayland.wlr_xwayland; 110 seat->input->server->xwayland.wlr_xwayland;
109 wlr_xwayland_set_seat(xwayland, seat->wlr_seat); 111 wlr_xwayland_set_seat(xwayland, seat->wlr_seat);
110 } 112 }
113#endif
111 struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->wlr_seat); 114 struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->wlr_seat);
112 if (keyboard) { 115 if (keyboard) {
113 wlr_seat_keyboard_notify_enter(seat->wlr_seat, 116 wlr_seat_keyboard_notify_enter(seat->wlr_seat,
diff --git a/sway/meson.build b/sway/meson.build
index 30c848e2..649a3ac2 100644
--- a/sway/meson.build
+++ b/sway/meson.build
@@ -18,7 +18,6 @@ sway_sources = files(
18 'desktop/transaction.c', 18 'desktop/transaction.c',
19 'desktop/xdg_shell_v6.c', 19 'desktop/xdg_shell_v6.c',
20 'desktop/xdg_shell.c', 20 'desktop/xdg_shell.c',
21 'desktop/xwayland.c',
22 21
23 'input/input-manager.c', 22 'input/input-manager.c',
24 'input/seat.c', 23 'input/seat.c',
@@ -152,6 +151,10 @@ sway_sources = files(
152 'tree/output.c', 151 'tree/output.c',
153) 152)
154 153
154if get_option('enable-xwayland')
155 sway_sources += 'desktop/xwayland.c'
156endif
157
155sway_deps = [ 158sway_deps = [
156 cairo, 159 cairo,
157 gdk_pixbuf, 160 gdk_pixbuf,
diff --git a/sway/server.c b/sway/server.c
index 89dfbf8c..10ca9614 100644
--- a/sway/server.c
+++ b/sway/server.c
@@ -25,7 +25,10 @@
25#include "sway/input/input-manager.h" 25#include "sway/input/input-manager.h"
26#include "sway/server.h" 26#include "sway/server.h"
27#include "sway/tree/layout.h" 27#include "sway/tree/layout.h"
28#include "config.h"
29#ifdef HAVE_XWAYLAND
28#include "sway/xwayland.h" 30#include "sway/xwayland.h"
31#endif
29 32
30bool server_privileged_prepare(struct sway_server *server) { 33bool server_privileged_prepare(struct sway_server *server) {
31 wlr_log(WLR_DEBUG, "Preparing Wayland server initialization"); 34 wlr_log(WLR_DEBUG, "Preparing Wayland server initialization");
@@ -81,6 +84,7 @@ bool server_init(struct sway_server *server) {
81 server->xdg_shell_surface.notify = handle_xdg_shell_surface; 84 server->xdg_shell_surface.notify = handle_xdg_shell_surface;
82 85
83 // TODO make xwayland optional 86 // TODO make xwayland optional
87#ifdef HAVE_XWAYLAND
84 server->xwayland.wlr_xwayland = 88 server->xwayland.wlr_xwayland =
85 wlr_xwayland_create(server->wl_display, server->compositor, true); 89 wlr_xwayland_create(server->wl_display, server->compositor, true);
86 wl_signal_add(&server->xwayland.wlr_xwayland->events.new_surface, 90 wl_signal_add(&server->xwayland.wlr_xwayland->events.new_surface,
@@ -101,6 +105,7 @@ bool server_init(struct sway_server *server) {
101 image->width * 4, image->width, image->height, image->hotspot_x, 105 image->width * 4, image->width, image->height, image->hotspot_x,
102 image->hotspot_y); 106 image->hotspot_y);
103 } 107 }
108#endif
104 109
105 // TODO: Integration with sway borders 110 // TODO: Integration with sway borders
106 struct wlr_server_decoration_manager *deco_manager = 111 struct wlr_server_decoration_manager *deco_manager =
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 4f743c40..b56b4e87 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -527,10 +527,12 @@ static struct sway_container *container_at_view(struct sway_container *swayc,
527 double _sx, _sy; 527 double _sx, _sy;
528 struct wlr_surface *_surface = NULL; 528 struct wlr_surface *_surface = NULL;
529 switch (sview->type) { 529 switch (sview->type) {
530#ifdef HAVE_XWAYLAND
530 case SWAY_VIEW_XWAYLAND: 531 case SWAY_VIEW_XWAYLAND:
531 _surface = wlr_surface_surface_at(sview->surface, 532 _surface = wlr_surface_surface_at(sview->surface,
532 view_sx, view_sy, &_sx, &_sy); 533 view_sx, view_sy, &_sx, &_sy);
533 break; 534 break;
535#endif
534 case SWAY_VIEW_XDG_SHELL_V6: 536 case SWAY_VIEW_XDG_SHELL_V6:
535 _surface = wlr_xdg_surface_v6_surface_at( 537 _surface = wlr_xdg_surface_v6_surface_at(
536 sview->wlr_xdg_surface_v6, 538 sview->wlr_xdg_surface_v6,
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index a2be0ef3..2b3263f8 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -6,6 +6,7 @@
6#include <string.h> 6#include <string.h>
7#include <wlr/types/wlr_output.h> 7#include <wlr/types/wlr_output.h>
8#include <wlr/types/wlr_output_layout.h> 8#include <wlr/types/wlr_output_layout.h>
9#include "config.h"
9#include "sway/debug.h" 10#include "sway/debug.h"
10#include "sway/tree/arrange.h" 11#include "sway/tree/arrange.h"
11#include "sway/tree/container.h" 12#include "sway/tree/container.h"
@@ -39,7 +40,9 @@ void layout_init(void) {
39 root_container.sway_root = calloc(1, sizeof(*root_container.sway_root)); 40 root_container.sway_root = calloc(1, sizeof(*root_container.sway_root));
40 root_container.sway_root->output_layout = wlr_output_layout_create(); 41 root_container.sway_root->output_layout = wlr_output_layout_create();
41 wl_list_init(&root_container.sway_root->outputs); 42 wl_list_init(&root_container.sway_root->outputs);
43#ifdef HAVE_XWAYLAND
42 wl_list_init(&root_container.sway_root->xwayland_unmanaged); 44 wl_list_init(&root_container.sway_root->xwayland_unmanaged);
45#endif
43 wl_list_init(&root_container.sway_root->drag_icons); 46 wl_list_init(&root_container.sway_root->drag_icons);
44 wl_signal_init(&root_container.sway_root->events.new_container); 47 wl_signal_init(&root_container.sway_root->events.new_container);
45 root_container.sway_root->scratchpad = create_list(); 48 root_container.sway_root->scratchpad = create_list();
diff --git a/sway/tree/view.c b/sway/tree/view.c
index a55c8a29..beeb8144 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -3,7 +3,10 @@
3#include <wayland-server.h> 3#include <wayland-server.h>
4#include <wlr/render/wlr_renderer.h> 4#include <wlr/render/wlr_renderer.h>
5#include <wlr/types/wlr_output_layout.h> 5#include <wlr/types/wlr_output_layout.h>
6#include "config.h"
7#ifdef HAVE_XWAYLAND
6#include <wlr/xwayland.h> 8#include <wlr/xwayland.h>
9#endif
7#include "list.h" 10#include "list.h"
8#include "log.h" 11#include "log.h"
9#include "sway/criteria.h" 12#include "sway/criteria.h"
@@ -108,14 +111,14 @@ const char *view_get_instance(struct sway_view *view) {
108 } 111 }
109 return NULL; 112 return NULL;
110} 113}
111 114#ifdef HAVE_XWAYLAND
112uint32_t view_get_x11_window_id(struct sway_view *view) { 115uint32_t view_get_x11_window_id(struct sway_view *view) {
113 if (view->impl->get_int_prop) { 116 if (view->impl->get_int_prop) {
114 return view->impl->get_int_prop(view, VIEW_PROP_X11_WINDOW_ID); 117 return view->impl->get_int_prop(view, VIEW_PROP_X11_WINDOW_ID);
115 } 118 }
116 return 0; 119 return 0;
117} 120}
118 121#endif
119const char *view_get_window_role(struct sway_view *view) { 122const char *view_get_window_role(struct sway_view *view) {
120 if (view->impl->get_string_prop) { 123 if (view->impl->get_string_prop) {
121 return view->impl->get_string_prop(view, VIEW_PROP_WINDOW_ROLE); 124 return view->impl->get_string_prop(view, VIEW_PROP_WINDOW_ROLE);
@@ -136,8 +139,10 @@ const char *view_get_shell(struct sway_view *view) {
136 return "xdg_shell_v6"; 139 return "xdg_shell_v6";
137 case SWAY_VIEW_XDG_SHELL: 140 case SWAY_VIEW_XDG_SHELL:
138 return "xdg_shell"; 141 return "xdg_shell";
142#ifdef HAVE_XWAYLAND
139 case SWAY_VIEW_XWAYLAND: 143 case SWAY_VIEW_XWAYLAND:
140 return "xwayland"; 144 return "xwayland";
145#endif
141 } 146 }
142 return "unknown"; 147 return "unknown";
143} 148}
@@ -563,6 +568,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) {
563 } 568 }
564 569
565 pid_t pid; 570 pid_t pid;
571#ifdef HAVE_XWAYLAND
566 if (view->type == SWAY_VIEW_XWAYLAND) { 572 if (view->type == SWAY_VIEW_XWAYLAND) {
567 struct wlr_xwayland_surface *surf = 573 struct wlr_xwayland_surface *surf =
568 wlr_xwayland_surface_from_wlr_surface(wlr_surface); 574 wlr_xwayland_surface_from_wlr_surface(wlr_surface);
@@ -572,6 +578,11 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) {
572 wl_resource_get_client(wlr_surface->resource); 578 wl_resource_get_client(wlr_surface->resource);
573 wl_client_get_credentials(client, &pid, NULL, NULL); 579 wl_client_get_credentials(client, &pid, NULL, NULL);
574 } 580 }
581#else
582 struct wl_client *client =
583 wl_resource_get_client(wlr_surface->resource);
584 wl_client_get_credentials(client, &pid, NULL, NULL);
585#endif
575 586
576 struct sway_seat *seat = input_manager_current_seat(input_manager); 587 struct sway_seat *seat = input_manager_current_seat(input_manager);
577 struct sway_container *target_sibling = 588 struct sway_container *target_sibling =
@@ -825,11 +836,13 @@ struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) {
825 wlr_xdg_surface_v6_from_wlr_surface(wlr_surface); 836 wlr_xdg_surface_v6_from_wlr_surface(wlr_surface);
826 return view_from_wlr_xdg_surface_v6(xdg_surface_v6); 837 return view_from_wlr_xdg_surface_v6(xdg_surface_v6);
827 } 838 }
839#ifdef HAVE_XWAYLAND
828 if (wlr_surface_is_xwayland_surface(wlr_surface)) { 840 if (wlr_surface_is_xwayland_surface(wlr_surface)) {
829 struct wlr_xwayland_surface *xsurface = 841 struct wlr_xwayland_surface *xsurface =
830 wlr_xwayland_surface_from_wlr_surface(wlr_surface); 842 wlr_xwayland_surface_from_wlr_surface(wlr_surface);
831 return view_from_wlr_xwayland_surface(xsurface); 843 return view_from_wlr_xwayland_surface(xsurface);
832 } 844 }
845#endif
833 if (wlr_surface_is_subsurface(wlr_surface)) { 846 if (wlr_surface_is_subsurface(wlr_surface)) {
834 struct wlr_subsurface *subsurface = 847 struct wlr_subsurface *subsurface =
835 wlr_subsurface_from_wlr_surface(wlr_surface); 848 wlr_subsurface_from_wlr_surface(wlr_surface);