aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/background-image.c8
-rw-r--r--common/cairo.c6
-rw-r--r--include/cairo.h12
-rw-r--r--include/sway/criteria.h2
-rw-r--r--include/sway/output.h2
-rw-r--r--include/sway/server.h6
-rw-r--r--include/sway/tree/root.h2
-rw-r--r--include/sway/tree/view.h12
-rw-r--r--meson.build24
-rw-r--r--sway/commands/swap.c4
-rw-r--r--sway/criteria.c20
-rw-r--r--sway/desktop/output.c6
-rw-r--r--sway/desktop/render.c6
-rw-r--r--sway/desktop/transaction.c2
-rw-r--r--sway/input/cursor.c2
-rw-r--r--sway/input/seat.c2
-rw-r--r--sway/ipc-json.c2
-rw-r--r--sway/server.c6
-rw-r--r--sway/tree/container.c2
-rw-r--r--sway/tree/root.c2
-rw-r--r--sway/tree/view.c10
-rw-r--r--swayidle/main.c8
-rw-r--r--swayidle/meson.build24
23 files changed, 85 insertions, 85 deletions
diff --git a/common/background-image.c b/common/background-image.c
index 5ede55e3..72f39a79 100644
--- a/common/background-image.c
+++ b/common/background-image.c
@@ -24,7 +24,7 @@ enum background_mode parse_background_mode(const char *mode) {
24 24
25cairo_surface_t *load_background_image(const char *path) { 25cairo_surface_t *load_background_image(const char *path) {
26 cairo_surface_t *image; 26 cairo_surface_t *image;
27#ifdef HAVE_GDK_PIXBUF 27#if HAVE_GDK_PIXBUF
28 GError *err = NULL; 28 GError *err = NULL;
29 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(path, &err); 29 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(path, &err);
30 if (!pixbuf) { 30 if (!pixbuf) {
@@ -36,17 +36,17 @@ cairo_surface_t *load_background_image(const char *path) {
36 g_object_unref(pixbuf); 36 g_object_unref(pixbuf);
37#else 37#else
38 image = cairo_image_surface_create_from_png(path); 38 image = cairo_image_surface_create_from_png(path);
39#endif //HAVE_GDK_PIXBUF 39#endif // HAVE_GDK_PIXBUF
40 if (!image) { 40 if (!image) {
41 wlr_log(WLR_ERROR, "Failed to read background image."); 41 wlr_log(WLR_ERROR, "Failed to read background image.");
42 return NULL; 42 return NULL;
43 } 43 }
44 if (cairo_surface_status(image) != CAIRO_STATUS_SUCCESS) { 44 if (cairo_surface_status(image) != CAIRO_STATUS_SUCCESS) {
45 wlr_log(WLR_ERROR, "Failed to read background image: %s." 45 wlr_log(WLR_ERROR, "Failed to read background image: %s."
46#ifndef HAVE_GDK_PIXBUF 46#if !HAVE_GDK_PIXBUF
47 "\nSway was compiled without gdk_pixbuf support, so only" 47 "\nSway was compiled without gdk_pixbuf support, so only"
48 "\nPNG images can be loaded. This is the likely cause." 48 "\nPNG images can be loaded. This is the likely cause."
49#endif //HAVE_GDK_PIXBUF 49#endif // !HAVE_GDK_PIXBUF
50 , cairo_status_to_string(cairo_surface_status(image))); 50 , cairo_status_to_string(cairo_surface_status(image)));
51 return NULL; 51 return NULL;
52 } 52 }
diff --git a/common/cairo.c b/common/cairo.c
index e8231484..f2ad54c1 100644
--- a/common/cairo.c
+++ b/common/cairo.c
@@ -1,7 +1,7 @@
1#include <stdint.h> 1#include <stdint.h>
2#include <cairo/cairo.h> 2#include <cairo/cairo.h>
3#include "cairo.h" 3#include "cairo.h"
4#ifdef HAVE_GDK_PIXBUF 4#if HAVE_GDK_PIXBUF
5#include <gdk-pixbuf/gdk-pixbuf.h> 5#include <gdk-pixbuf/gdk-pixbuf.h>
6#endif 6#endif
7 7
@@ -46,7 +46,7 @@ cairo_surface_t *cairo_image_surface_scale(cairo_surface_t *image,
46 return new; 46 return new;
47} 47}
48 48
49#ifdef HAVE_GDK_PIXBUF 49#if HAVE_GDK_PIXBUF
50cairo_surface_t* gdk_cairo_image_surface_create_from_pixbuf(const GdkPixbuf *gdkbuf) { 50cairo_surface_t* gdk_cairo_image_surface_create_from_pixbuf(const GdkPixbuf *gdkbuf) {
51 int chan = gdk_pixbuf_get_n_channels(gdkbuf); 51 int chan = gdk_pixbuf_get_n_channels(gdkbuf);
52 if (chan < 3) { 52 if (chan < 3) {
@@ -140,4 +140,4 @@ cairo_surface_t* gdk_cairo_image_surface_create_from_pixbuf(const GdkPixbuf *gdk
140 cairo_surface_mark_dirty(cs); 140 cairo_surface_mark_dirty(cs);
141 return cs; 141 return cs;
142} 142}
143#endif //HAVE_GDK_PIXBUF 143#endif // HAVE_GDK_PIXBUF
diff --git a/include/cairo.h b/include/cairo.h
index 86530b60..f28c072f 100644
--- a/include/cairo.h
+++ b/include/cairo.h
@@ -1,8 +1,13 @@
1#ifndef _SWAY_CAIRO_H 1#ifndef _SWAY_CAIRO_H
2#define _SWAY_CAIRO_H 2#define _SWAY_CAIRO_H
3
4#include "config.h"
3#include <stdint.h> 5#include <stdint.h>
4#include <cairo/cairo.h> 6#include <cairo/cairo.h>
5#include <wlr/types/wlr_output.h> 7#include <wlr/types/wlr_output.h>
8#if HAVE_GDK_PIXBUF
9#include <gdk-pixbuf/gdk-pixbuf.h>
10#endif
6 11
7void cairo_set_source_u32(cairo_t *cairo, uint32_t color); 12void cairo_set_source_u32(cairo_t *cairo, uint32_t color);
8cairo_subpixel_order_t to_cairo_subpixel_order(enum wl_output_subpixel subpixel); 13cairo_subpixel_order_t to_cairo_subpixel_order(enum wl_output_subpixel subpixel);
@@ -10,12 +15,11 @@ cairo_subpixel_order_t to_cairo_subpixel_order(enum wl_output_subpixel subpixel)
10cairo_surface_t *cairo_image_surface_scale(cairo_surface_t *image, 15cairo_surface_t *cairo_image_surface_scale(cairo_surface_t *image,
11 int width, int height); 16 int width, int height);
12 17
13#include "config.h" 18#if HAVE_GDK_PIXBUF
14#ifdef HAVE_GDK_PIXBUF
15#include <gdk-pixbuf/gdk-pixbuf.h>
16 19
17cairo_surface_t* gdk_cairo_image_surface_create_from_pixbuf( 20cairo_surface_t* gdk_cairo_image_surface_create_from_pixbuf(
18 const GdkPixbuf *gdkbuf); 21 const GdkPixbuf *gdkbuf);
19#endif //WITH_GDK_PIXBUF 22
23#endif // HAVE_GDK_PIXBUF
20 24
21#endif 25#endif
diff --git a/include/sway/criteria.h b/include/sway/criteria.h
index 323ba01d..3eb583d5 100644
--- a/include/sway/criteria.h
+++ b/include/sway/criteria.h
@@ -25,7 +25,7 @@ struct criteria {
25 pcre *app_id; 25 pcre *app_id;
26 pcre *con_mark; 26 pcre *con_mark;
27 uint32_t con_id; // internal ID 27 uint32_t con_id; // internal ID
28#ifdef HAVE_XWAYLAND 28#if HAVE_XWAYLAND
29 pcre *class; 29 pcre *class;
30 uint32_t id; // X11 window ID 30 uint32_t id; // X11 window ID
31 pcre *instance; 31 pcre *instance;
diff --git a/include/sway/output.h b/include/sway/output.h
index 5efe1660..43c1ab96 100644
--- a/include/sway/output.h
+++ b/include/sway/output.h
@@ -119,7 +119,7 @@ void output_layer_for_each_surface(struct sway_output *output,
119 struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator, 119 struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator,
120 void *user_data); 120 void *user_data);
121 121
122#ifdef HAVE_XWAYLAND 122#if HAVE_XWAYLAND
123void output_unmanaged_for_each_surface(struct sway_output *output, 123void output_unmanaged_for_each_surface(struct sway_output *output,
124 struct wl_list *unmanaged, sway_surface_iterator_func_t iterator, 124 struct wl_list *unmanaged, sway_surface_iterator_func_t iterator,
125 void *user_data); 125 void *user_data);
diff --git a/include/sway/server.h b/include/sway/server.h
index 5fced224..a3233d66 100644
--- a/include/sway/server.h
+++ b/include/sway/server.h
@@ -14,7 +14,7 @@
14#include <wlr/types/wlr_xdg_shell.h> 14#include <wlr/types/wlr_xdg_shell.h>
15#include "config.h" 15#include "config.h"
16#include "list.h" 16#include "list.h"
17#ifdef HAVE_XWAYLAND 17#if HAVE_XWAYLAND
18#include "sway/xwayland.h" 18#include "sway/xwayland.h"
19#endif 19#endif
20 20
@@ -44,7 +44,7 @@ struct sway_server {
44 struct wlr_xdg_shell *xdg_shell; 44 struct wlr_xdg_shell *xdg_shell;
45 struct wl_listener xdg_shell_surface; 45 struct wl_listener xdg_shell_surface;
46 46
47#ifdef HAVE_XWAYLAND 47#if HAVE_XWAYLAND
48 struct sway_xwayland xwayland; 48 struct sway_xwayland xwayland;
49 struct wl_listener xwayland_surface; 49 struct wl_listener xwayland_surface;
50 struct wl_listener xwayland_ready; 50 struct wl_listener xwayland_ready;
@@ -80,7 +80,7 @@ void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data);
80void handle_layer_shell_surface(struct wl_listener *listener, void *data); 80void handle_layer_shell_surface(struct wl_listener *listener, void *data);
81void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data); 81void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data);
82void handle_xdg_shell_surface(struct wl_listener *listener, void *data); 82void handle_xdg_shell_surface(struct wl_listener *listener, void *data);
83#ifdef HAVE_XWAYLAND 83#if HAVE_XWAYLAND
84void handle_xwayland_surface(struct wl_listener *listener, void *data); 84void handle_xwayland_surface(struct wl_listener *listener, void *data);
85#endif 85#endif
86void handle_server_decoration(struct wl_listener *listener, void *data); 86void handle_server_decoration(struct wl_listener *listener, void *data);
diff --git a/include/sway/tree/root.h b/include/sway/tree/root.h
index a2d464f9..ceccc920 100644
--- a/include/sway/tree/root.h
+++ b/include/sway/tree/root.h
@@ -16,7 +16,7 @@ struct sway_root {
16 struct wlr_output_layout *output_layout; 16 struct wlr_output_layout *output_layout;
17 17
18 struct wl_listener output_layout_change; 18 struct wl_listener output_layout_change;
19#ifdef HAVE_XWAYLAND 19#if HAVE_XWAYLAND
20 struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link 20 struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link
21#endif 21#endif
22 struct wl_list drag_icons; // sway_drag_icon::link 22 struct wl_list drag_icons; // sway_drag_icon::link
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index 8f045c6a..4716c688 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -4,7 +4,7 @@
4#include <wlr/types/wlr_surface.h> 4#include <wlr/types/wlr_surface.h>
5#include <wlr/types/wlr_xdg_shell_v6.h> 5#include <wlr/types/wlr_xdg_shell_v6.h>
6#include "config.h" 6#include "config.h"
7#ifdef HAVE_XWAYLAND 7#if HAVE_XWAYLAND
8#include <wlr/xwayland.h> 8#include <wlr/xwayland.h>
9#endif 9#endif
10#include "sway/input/input-manager.h" 10#include "sway/input/input-manager.h"
@@ -16,7 +16,7 @@ struct sway_xdg_decoration;
16enum sway_view_type { 16enum sway_view_type {
17 SWAY_VIEW_XDG_SHELL_V6, 17 SWAY_VIEW_XDG_SHELL_V6,
18 SWAY_VIEW_XDG_SHELL, 18 SWAY_VIEW_XDG_SHELL,
19#ifdef HAVE_XWAYLAND 19#if HAVE_XWAYLAND
20 SWAY_VIEW_XWAYLAND, 20 SWAY_VIEW_XWAYLAND,
21#endif 21#endif
22}; 22};
@@ -28,7 +28,7 @@ enum sway_view_prop {
28 VIEW_PROP_INSTANCE, 28 VIEW_PROP_INSTANCE,
29 VIEW_PROP_WINDOW_TYPE, 29 VIEW_PROP_WINDOW_TYPE,
30 VIEW_PROP_WINDOW_ROLE, 30 VIEW_PROP_WINDOW_ROLE,
31#ifdef HAVE_XWAYLAND 31#if HAVE_XWAYLAND
32 VIEW_PROP_X11_WINDOW_ID, 32 VIEW_PROP_X11_WINDOW_ID,
33 VIEW_PROP_X11_PARENT_ID, 33 VIEW_PROP_X11_PARENT_ID,
34#endif 34#endif
@@ -100,7 +100,7 @@ struct sway_view {
100 union { 100 union {
101 struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6; 101 struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6;
102 struct wlr_xdg_surface *wlr_xdg_surface; 102 struct wlr_xdg_surface *wlr_xdg_surface;
103#ifdef HAVE_XWAYLAND 103#if HAVE_XWAYLAND
104 struct wlr_xwayland_surface *wlr_xwayland_surface; 104 struct wlr_xwayland_surface *wlr_xwayland_surface;
105#endif 105#endif
106 struct wlr_wl_shell_surface *wlr_wl_shell_surface; 106 struct wlr_wl_shell_surface *wlr_wl_shell_surface;
@@ -144,7 +144,7 @@ struct sway_xdg_shell_view {
144 struct wl_listener unmap; 144 struct wl_listener unmap;
145 struct wl_listener destroy; 145 struct wl_listener destroy;
146}; 146};
147#ifdef HAVE_XWAYLAND 147#if HAVE_XWAYLAND
148struct sway_xwayland_view { 148struct sway_xwayland_view {
149 struct sway_view view; 149 struct sway_view view;
150 150
@@ -323,7 +323,7 @@ struct sway_view *view_from_wlr_xdg_surface(
323 struct wlr_xdg_surface *xdg_surface); 323 struct wlr_xdg_surface *xdg_surface);
324struct sway_view *view_from_wlr_xdg_surface_v6( 324struct sway_view *view_from_wlr_xdg_surface_v6(
325 struct wlr_xdg_surface_v6 *xdg_surface_v6); 325 struct wlr_xdg_surface_v6 *xdg_surface_v6);
326#ifdef HAVE_XWAYLAND 326#if HAVE_XWAYLAND
327struct sway_view *view_from_wlr_xwayland_surface( 327struct sway_view *view_from_wlr_xwayland_surface(
328 struct wlr_xwayland_surface *xsurface); 328 struct wlr_xwayland_surface *xsurface);
329#endif 329#endif
diff --git a/meson.build b/meson.build
index 8327b763..bb60bc89 100644
--- a/meson.build
+++ b/meson.build
@@ -59,30 +59,18 @@ git = find_program('git', required: false)
59 59
60conf_data = configuration_data() 60conf_data = configuration_data()
61 61
62conf_data.set10('HAVE_XWAYLAND', get_option('enable-xwayland'))
62if get_option('enable-xwayland') 63if get_option('enable-xwayland')
63 conf_data.set('HAVE_XWAYLAND', true)
64 xcb = dependency('xcb') 64 xcb = dependency('xcb')
65else
66 conf_data.set('HAVE_XWAYLAND', false)
67endif
68
69if gdk_pixbuf.found()
70 conf_data.set('HAVE_GDK_PIXBUF', true)
71endif 65endif
72 66
73if systemd.found() 67conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found())
74 conf_data.set('SWAY_IDLE_HAS_SYSTEMD', true) 68conf_data.set10('HAVE_SYSTEMD', systemd.found())
75 swayidle_deps += systemd 69conf_data.set10('HAVE_ELOGIND', elogind.found())
76endif
77
78if elogind.found()
79 conf_data.set('SWAY_IDLE_HAS_ELOGIND', true)
80 swayidle_deps += elogind
81endif
82 70
83if not systemd.found() and not elogind.found() 71if not systemd.found() and not elogind.found()
84 warning('The sway binary must be setuid when compiled without (e)logind') 72 warning('The sway binary must be setuid when compiled without (e)logind')
85 warning('You must do this manually post-install: chmod a+s /path/to/sway') 73 warning('You must do this manually post-install: chmod a+s /path/to/sway')
86endif 74endif
87 75
88scdoc = find_program('scdoc', required: false) 76scdoc = find_program('scdoc', required: false)
diff --git a/sway/commands/swap.c b/sway/commands/swap.c
index de3f5c18..08860264 100644
--- a/sway/commands/swap.c
+++ b/sway/commands/swap.c
@@ -149,7 +149,7 @@ static bool test_con_id(struct sway_container *container, void *data) {
149 return container->node.id == *con_id; 149 return container->node.id == *con_id;
150} 150}
151 151
152#ifdef HAVE_XWAYLAND 152#if HAVE_XWAYLAND
153static bool test_id(struct sway_container *container, void *data) { 153static bool test_id(struct sway_container *container, void *data) {
154 xcb_window_t *wid = data; 154 xcb_window_t *wid = data;
155 return (container->view && container->view->type == SWAY_VIEW_XWAYLAND 155 return (container->view && container->view->type == SWAY_VIEW_XWAYLAND
@@ -184,7 +184,7 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
184 184
185 char *value = join_args(argv + 3, argc - 3); 185 char *value = join_args(argv + 3, argc - 3);
186 if (strcasecmp(argv[2], "id") == 0) { 186 if (strcasecmp(argv[2], "id") == 0) {
187#ifdef HAVE_XWAYLAND 187#if HAVE_XWAYLAND
188 xcb_window_t id = strtol(value, NULL, 0); 188 xcb_window_t id = strtol(value, NULL, 0);
189 other = root_find_container(test_id, &id); 189 other = root_find_container(test_id, &id);
190#endif 190#endif
diff --git a/sway/criteria.c b/sway/criteria.c
index 1d404333..3393852c 100644
--- a/sway/criteria.c
+++ b/sway/criteria.c
@@ -21,7 +21,7 @@ bool criteria_is_empty(struct criteria *criteria) {
21 && !criteria->app_id 21 && !criteria->app_id
22 && !criteria->con_mark 22 && !criteria->con_mark
23 && !criteria->con_id 23 && !criteria->con_id
24#ifdef HAVE_XWAYLAND 24#if HAVE_XWAYLAND
25 && !criteria->class 25 && !criteria->class
26 && !criteria->id 26 && !criteria->id
27 && !criteria->instance 27 && !criteria->instance
@@ -42,7 +42,7 @@ void criteria_destroy(struct criteria *criteria) {
42 pcre_free(criteria->shell); 42 pcre_free(criteria->shell);
43 pcre_free(criteria->app_id); 43 pcre_free(criteria->app_id);
44 pcre_free(criteria->con_mark); 44 pcre_free(criteria->con_mark);
45#ifdef HAVE_XWAYLAND 45#if HAVE_XWAYLAND
46 pcre_free(criteria->class); 46 pcre_free(criteria->class);
47 pcre_free(criteria->instance); 47 pcre_free(criteria->instance);
48 pcre_free(criteria->window_role); 48 pcre_free(criteria->window_role);
@@ -55,7 +55,7 @@ static int regex_cmp(const char *item, const pcre *regex) {
55 return pcre_exec(regex, NULL, item, strlen(item), 0, 0, NULL, 0); 55 return pcre_exec(regex, NULL, item, strlen(item), 0, 0, NULL, 0);
56} 56}
57 57
58#ifdef HAVE_XWAYLAND 58#if HAVE_XWAYLAND
59static bool view_has_window_type(struct sway_view *view, enum atom_name name) { 59static bool view_has_window_type(struct sway_view *view, enum atom_name name) {
60 if (view->type != SWAY_VIEW_XWAYLAND) { 60 if (view->type != SWAY_VIEW_XWAYLAND) {
61 return false; 61 return false;
@@ -140,7 +140,7 @@ static bool criteria_matches_view(struct criteria *criteria,
140 } 140 }
141 } 141 }
142 142
143#ifdef HAVE_XWAYLAND 143#if HAVE_XWAYLAND
144 if (criteria->id) { // X11 window ID 144 if (criteria->id) { // X11 window ID
145 uint32_t x11_window_id = view_get_x11_window_id(view); 145 uint32_t x11_window_id = view_get_x11_window_id(view);
146 if (!x11_window_id || x11_window_id != criteria->id) { 146 if (!x11_window_id || x11_window_id != criteria->id) {
@@ -276,7 +276,7 @@ static bool generate_regex(pcre **regex, char *value) {
276 return true; 276 return true;
277} 277}
278 278
279#ifdef HAVE_XWAYLAND 279#if HAVE_XWAYLAND
280static enum atom_name parse_window_type(const char *type) { 280static enum atom_name parse_window_type(const char *type) {
281 if (strcasecmp(type, "normal") == 0) { 281 if (strcasecmp(type, "normal") == 0) {
282 return NET_WM_WINDOW_TYPE_NORMAL; 282 return NET_WM_WINDOW_TYPE_NORMAL;
@@ -308,7 +308,7 @@ enum criteria_token {
308 T_CON_ID, 308 T_CON_ID,
309 T_CON_MARK, 309 T_CON_MARK,
310 T_FLOATING, 310 T_FLOATING,
311#ifdef HAVE_XWAYLAND 311#if HAVE_XWAYLAND
312 T_CLASS, 312 T_CLASS,
313 T_ID, 313 T_ID,
314 T_INSTANCE, 314 T_INSTANCE,
@@ -331,7 +331,7 @@ static enum criteria_token token_from_name(char *name) {
331 return T_CON_ID; 331 return T_CON_ID;
332 } else if (strcmp(name, "con_mark") == 0) { 332 } else if (strcmp(name, "con_mark") == 0) {
333 return T_CON_MARK; 333 return T_CON_MARK;
334#ifdef HAVE_XWAYLAND 334#if HAVE_XWAYLAND
335 } else if (strcmp(name, "class") == 0) { 335 } else if (strcmp(name, "class") == 0) {
336 return T_CLASS; 336 return T_CLASS;
337 } else if (strcmp(name, "id") == 0) { 337 } else if (strcmp(name, "id") == 0) {
@@ -402,7 +402,7 @@ static char *get_focused_prop(enum criteria_token token) {
402 snprintf(id_str, id_size, "%zu", id); 402 snprintf(id_str, id_size, "%zu", id);
403 value = id_str; 403 value = id_str;
404 break; 404 break;
405#ifdef HAVE_XWAYLAND 405#if HAVE_XWAYLAND
406 case T_CLASS: 406 case T_CLASS:
407 value = view_get_class(view); 407 value = view_get_class(view);
408 break; 408 break;
@@ -474,7 +474,7 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) {
474 case T_CON_MARK: 474 case T_CON_MARK:
475 generate_regex(&criteria->con_mark, effective_value); 475 generate_regex(&criteria->con_mark, effective_value);
476 break; 476 break;
477#ifdef HAVE_XWAYLAND 477#if HAVE_XWAYLAND
478 case T_CLASS: 478 case T_CLASS:
479 generate_regex(&criteria->class, effective_value); 479 generate_regex(&criteria->class, effective_value);
480 break; 480 break;
@@ -577,7 +577,7 @@ struct criteria *criteria_parse(char *raw, char **error_arg) {
577 ++head; 577 ++head;
578 578
579 struct criteria *criteria = calloc(1, sizeof(struct criteria)); 579 struct criteria *criteria = calloc(1, sizeof(struct criteria));
580#ifdef HAVE_XWAYLAND 580#if HAVE_XWAYLAND
581 criteria->window_type = ATOM_LAST; // default value 581 criteria->window_type = ATOM_LAST; // default value
582#endif 582#endif
583 char *name = NULL, *value = NULL; 583 char *name = NULL, *value = NULL;
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index e8112bd9..d649100f 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -204,7 +204,7 @@ void output_layer_for_each_surface(struct sway_output *output,
204 } 204 }
205} 205}
206 206
207#ifdef HAVE_XWAYLAND 207#if HAVE_XWAYLAND
208void output_unmanaged_for_each_surface(struct sway_output *output, 208void output_unmanaged_for_each_surface(struct sway_output *output,
209 struct wl_list *unmanaged, sway_surface_iterator_func_t iterator, 209 struct wl_list *unmanaged, sway_surface_iterator_func_t iterator,
210 void *user_data) { 210 void *user_data) {
@@ -274,7 +274,7 @@ static void output_for_each_surface(struct sway_output *output,
274 for_each_surface_container_iterator(floater, &data); 274 for_each_surface_container_iterator(floater, &data);
275 } 275 }
276 } 276 }
277#ifdef HAVE_XWAYLAND 277#if HAVE_XWAYLAND
278 output_unmanaged_for_each_surface(output, &root->xwayland_unmanaged, 278 output_unmanaged_for_each_surface(output, &root->xwayland_unmanaged,
279 iterator, user_data); 279 iterator, user_data);
280#endif 280#endif
@@ -289,7 +289,7 @@ static void output_for_each_surface(struct sway_output *output,
289 workspace_for_each_container(workspace, 289 workspace_for_each_container(workspace,
290 for_each_surface_container_iterator, &data); 290 for_each_surface_container_iterator, &data);
291 291
292#ifdef HAVE_XWAYLAND 292#if HAVE_XWAYLAND
293 output_unmanaged_for_each_surface(output, &root->xwayland_unmanaged, 293 output_unmanaged_for_each_surface(output, &root->xwayland_unmanaged,
294 iterator, user_data); 294 iterator, user_data);
295#endif 295#endif
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index 93e196bb..8d4a701b 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -140,7 +140,7 @@ static void render_layer(struct sway_output *output,
140 render_surface_iterator, &data); 140 render_surface_iterator, &data);
141} 141}
142 142
143#ifdef HAVE_XWAYLAND 143#if HAVE_XWAYLAND
144static void render_unmanaged(struct sway_output *output, 144static void render_unmanaged(struct sway_output *output,
145 pixman_region32_t *damage, struct wl_list *unmanaged) { 145 pixman_region32_t *damage, struct wl_list *unmanaged) {
146 struct render_data data = { 146 struct render_data data = {
@@ -966,7 +966,7 @@ void output_render(struct sway_output *output, struct timespec *when,
966 render_floating_container(output, damage, floater); 966 render_floating_container(output, damage, floater);
967 } 967 }
968 } 968 }
969#ifdef HAVE_XWAYLAND 969#if HAVE_XWAYLAND
970 render_unmanaged(output, damage, &root->xwayland_unmanaged); 970 render_unmanaged(output, damage, &root->xwayland_unmanaged);
971#endif 971#endif
972 } else { 972 } else {
@@ -986,7 +986,7 @@ void output_render(struct sway_output *output, struct timespec *when,
986 986
987 render_workspace(output, damage, workspace, workspace->current.focused); 987 render_workspace(output, damage, workspace, workspace->current.focused);
988 render_floating(output, damage); 988 render_floating(output, damage);
989#ifdef HAVE_XWAYLAND 989#if HAVE_XWAYLAND
990 render_unmanaged(output, damage, &root->xwayland_unmanaged); 990 render_unmanaged(output, damage, &root->xwayland_unmanaged);
991#endif 991#endif
992 render_layer(output, damage, 992 render_layer(output, damage,
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index 39cb641f..bf0038b4 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -380,7 +380,7 @@ static bool should_configure(struct sway_node *node,
380 } 380 }
381 struct sway_container_state *cstate = &node->sway_container->current; 381 struct sway_container_state *cstate = &node->sway_container->current;
382 struct sway_container_state *istate = &instruction->container_state; 382 struct sway_container_state *istate = &instruction->container_state;
383#ifdef HAVE_XWAYLAND 383#if HAVE_XWAYLAND
384 // Xwayland views are position-aware and need to be reconfigured 384 // Xwayland views are position-aware and need to be reconfigured
385 // when their position changes. 385 // when their position changes.
386 if (node->sway_container->view->type == SWAY_VIEW_XWAYLAND) { 386 if (node->sway_container->view->type == SWAY_VIEW_XWAYLAND) {
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index c81e9ab1..c6b7414c 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -63,7 +63,7 @@ static struct sway_node *node_at_coords(
63 struct sway_seat *seat, double lx, double ly, 63 struct sway_seat *seat, double lx, double ly,
64 struct wlr_surface **surface, double *sx, double *sy) { 64 struct wlr_surface **surface, double *sx, double *sy) {
65 // check for unmanaged views first 65 // check for unmanaged views first
66#ifdef HAVE_XWAYLAND 66#if HAVE_XWAYLAND
67 struct wl_list *unmanaged = &root->xwayland_unmanaged; 67 struct wl_list *unmanaged = &root->xwayland_unmanaged;
68 struct sway_xwayland_unmanaged *unmanaged_surface; 68 struct sway_xwayland_unmanaged *unmanaged_surface;
69 wl_list_for_each_reverse(unmanaged_surface, unmanaged, link) { 69 wl_list_for_each_reverse(unmanaged_surface, unmanaged, link) {
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 54fdf40b..663c5140 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -92,7 +92,7 @@ static void seat_send_focus(struct sway_node *node, struct sway_seat *seat) {
92 node->sway_container->view : NULL; 92 node->sway_container->view : NULL;
93 93
94 if (view && seat_is_input_allowed(seat, view->surface)) { 94 if (view && seat_is_input_allowed(seat, view->surface)) {
95#ifdef HAVE_XWAYLAND 95#if HAVE_XWAYLAND
96 if (view->type == SWAY_VIEW_XWAYLAND) { 96 if (view->type == SWAY_VIEW_XWAYLAND) {
97 struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland; 97 struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland;
98 wlr_xwayland_set_seat(xwayland, seat->wlr_seat); 98 wlr_xwayland_set_seat(xwayland, seat->wlr_seat);
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index 110b958a..e3450df1 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -266,7 +266,7 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object
266 struct wlr_box geometry = {0, 0, c->view->natural_width, c->view->natural_height}; 266 struct wlr_box geometry = {0, 0, c->view->natural_width, c->view->natural_height};
267 json_object_object_add(object, "geometry", ipc_json_create_rect(&geometry)); 267 json_object_object_add(object, "geometry", ipc_json_create_rect(&geometry));
268 268
269#ifdef HAVE_XWAYLAND 269#if HAVE_XWAYLAND
270 if (c->view->type == SWAY_VIEW_XWAYLAND) { 270 if (c->view->type == SWAY_VIEW_XWAYLAND) {
271 json_object_object_add(object, "window", 271 json_object_object_add(object, "window",
272 json_object_new_int(view_get_x11_window_id(c->view))); 272 json_object_new_int(view_get_x11_window_id(c->view)));
diff --git a/sway/server.c b/sway/server.c
index f06173d1..cd3fcdf6 100644
--- a/sway/server.c
+++ b/sway/server.c
@@ -26,7 +26,7 @@
26#include "sway/server.h" 26#include "sway/server.h"
27#include "sway/tree/root.h" 27#include "sway/tree/root.h"
28#include "config.h" 28#include "config.h"
29#ifdef HAVE_XWAYLAND 29#if HAVE_XWAYLAND
30#include "sway/xwayland.h" 30#include "sway/xwayland.h"
31#endif 31#endif
32 32
@@ -94,7 +94,7 @@ bool server_init(struct sway_server *server) {
94 setenv("XCURSOR_THEME", cursor_theme, 1); 94 setenv("XCURSOR_THEME", cursor_theme, 1);
95 } 95 }
96 96
97#ifdef HAVE_XWAYLAND 97#if HAVE_XWAYLAND
98 server->xwayland.wlr_xwayland = 98 server->xwayland.wlr_xwayland =
99 wlr_xwayland_create(server->wl_display, server->compositor, true); 99 wlr_xwayland_create(server->wl_display, server->compositor, true);
100 wl_signal_add(&server->xwayland.wlr_xwayland->events.new_surface, 100 wl_signal_add(&server->xwayland.wlr_xwayland->events.new_surface,
@@ -164,7 +164,7 @@ bool server_init(struct sway_server *server) {
164 164
165void server_fini(struct sway_server *server) { 165void server_fini(struct sway_server *server) {
166 // TODO: free sway-specific resources 166 // TODO: free sway-specific resources
167#ifdef HAVE_XWAYLAND 167#if HAVE_XWAYLAND
168 wlr_xwayland_destroy(server->xwayland.wlr_xwayland); 168 wlr_xwayland_destroy(server->xwayland.wlr_xwayland);
169#endif 169#endif
170 wl_display_destroy_clients(server->wl_display); 170 wl_display_destroy_clients(server->wl_display);
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 89d80e51..cf6f5b54 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -171,7 +171,7 @@ static struct sway_container *surface_at_view(struct sway_container *con, double
171 double _sx, _sy; 171 double _sx, _sy;
172 struct wlr_surface *_surface = NULL; 172 struct wlr_surface *_surface = NULL;
173 switch (view->type) { 173 switch (view->type) {
174#ifdef HAVE_XWAYLAND 174#if HAVE_XWAYLAND
175 case SWAY_VIEW_XWAYLAND: 175 case SWAY_VIEW_XWAYLAND:
176 _surface = wlr_surface_surface_at(view->surface, 176 _surface = wlr_surface_surface_at(view->surface,
177 view_sx, view_sy, &_sx, &_sy); 177 view_sx, view_sy, &_sx, &_sy);
diff --git a/sway/tree/root.c b/sway/tree/root.c
index 9bda7c28..544d666a 100644
--- a/sway/tree/root.c
+++ b/sway/tree/root.c
@@ -31,7 +31,7 @@ struct sway_root *root_create(void) {
31 node_init(&root->node, N_ROOT, root); 31 node_init(&root->node, N_ROOT, root);
32 root->output_layout = wlr_output_layout_create(); 32 root->output_layout = wlr_output_layout_create();
33 wl_list_init(&root->all_outputs); 33 wl_list_init(&root->all_outputs);
34#ifdef HAVE_XWAYLAND 34#if HAVE_XWAYLAND
35 wl_list_init(&root->xwayland_unmanaged); 35 wl_list_init(&root->xwayland_unmanaged);
36#endif 36#endif
37 wl_list_init(&root->drag_icons); 37 wl_list_init(&root->drag_icons);
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 18195467..d7110619 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -8,7 +8,7 @@
8#include <wlr/types/wlr_server_decoration.h> 8#include <wlr/types/wlr_server_decoration.h>
9#include <wlr/types/wlr_xdg_decoration_v1.h> 9#include <wlr/types/wlr_xdg_decoration_v1.h>
10#include "config.h" 10#include "config.h"
11#ifdef HAVE_XWAYLAND 11#if HAVE_XWAYLAND
12#include <wlr/xwayland.h> 12#include <wlr/xwayland.h>
13#endif 13#endif
14#include "list.h" 14#include "list.h"
@@ -101,7 +101,7 @@ const char *view_get_instance(struct sway_view *view) {
101 } 101 }
102 return NULL; 102 return NULL;
103} 103}
104#ifdef HAVE_XWAYLAND 104#if HAVE_XWAYLAND
105uint32_t view_get_x11_window_id(struct sway_view *view) { 105uint32_t view_get_x11_window_id(struct sway_view *view) {
106 if (view->impl->get_int_prop) { 106 if (view->impl->get_int_prop) {
107 return view->impl->get_int_prop(view, VIEW_PROP_X11_WINDOW_ID); 107 return view->impl->get_int_prop(view, VIEW_PROP_X11_WINDOW_ID);
@@ -136,7 +136,7 @@ const char *view_get_shell(struct sway_view *view) {
136 return "xdg_shell_v6"; 136 return "xdg_shell_v6";
137 case SWAY_VIEW_XDG_SHELL: 137 case SWAY_VIEW_XDG_SHELL:
138 return "xdg_shell"; 138 return "xdg_shell";
139#ifdef HAVE_XWAYLAND 139#if HAVE_XWAYLAND
140 case SWAY_VIEW_XWAYLAND: 140 case SWAY_VIEW_XWAYLAND:
141 return "xwayland"; 141 return "xwayland";
142#endif 142#endif
@@ -484,7 +484,7 @@ static struct sway_workspace *select_workspace(struct sway_view *view) {
484 484
485 // Check if there's a PID mapping 485 // Check if there's a PID mapping
486 pid_t pid; 486 pid_t pid;
487#ifdef HAVE_XWAYLAND 487#if HAVE_XWAYLAND
488 if (view->type == SWAY_VIEW_XWAYLAND) { 488 if (view->type == SWAY_VIEW_XWAYLAND) {
489 struct wlr_xwayland_surface *surf = 489 struct wlr_xwayland_surface *surf =
490 wlr_xwayland_surface_from_wlr_surface(view->surface); 490 wlr_xwayland_surface_from_wlr_surface(view->surface);
@@ -802,7 +802,7 @@ struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) {
802 wlr_xdg_surface_v6_from_wlr_surface(wlr_surface); 802 wlr_xdg_surface_v6_from_wlr_surface(wlr_surface);
803 return view_from_wlr_xdg_surface_v6(xdg_surface_v6); 803 return view_from_wlr_xdg_surface_v6(xdg_surface_v6);
804 } 804 }
805#ifdef HAVE_XWAYLAND 805#if HAVE_XWAYLAND
806 if (wlr_surface_is_xwayland_surface(wlr_surface)) { 806 if (wlr_surface_is_xwayland_surface(wlr_surface)) {
807 struct wlr_xwayland_surface *xsurface = 807 struct wlr_xwayland_surface *xsurface =
808 wlr_xwayland_surface_from_wlr_surface(wlr_surface); 808 wlr_xwayland_surface_from_wlr_surface(wlr_surface);
diff --git a/swayidle/main.c b/swayidle/main.c
index 7d0f23f4..2b185949 100644
--- a/swayidle/main.c
+++ b/swayidle/main.c
@@ -18,10 +18,10 @@
18#include "config.h" 18#include "config.h"
19#include "idle-client-protocol.h" 19#include "idle-client-protocol.h"
20#include "list.h" 20#include "list.h"
21#ifdef SWAY_IDLE_HAS_SYSTEMD 21#if HAVE_SYSTEMD
22#include <systemd/sd-bus.h> 22#include <systemd/sd-bus.h>
23#include <systemd/sd-login.h> 23#include <systemd/sd-login.h>
24#elif defined(SWAY_IDLE_HAS_ELOGIND) 24#elif HAVE_ELOGIND
25#include <elogind/sd-bus.h> 25#include <elogind/sd-bus.h>
26#include <elogind/sd-login.h> 26#include <elogind/sd-login.h>
27#endif 27#endif
@@ -66,7 +66,7 @@ static void cmd_exec(char *param) {
66 } 66 }
67} 67}
68 68
69#if defined(SWAY_IDLE_HAS_SYSTEMD) || defined(SWAY_IDLE_HAS_ELOGIND) 69#if HAVE_SYSTEMD || HAVE_ELOGIND
70static int lock_fd = -1; 70static int lock_fd = -1;
71static int ongoing_fd = -1; 71static int ongoing_fd = -1;
72static struct sd_bus *bus = NULL; 72static struct sd_bus *bus = NULL;
@@ -414,7 +414,7 @@ int main(int argc, char *argv[]) {
414 } 414 }
415 415
416 bool should_run = state.timeout_cmds->length > 0; 416 bool should_run = state.timeout_cmds->length > 0;
417#if defined(SWAY_IDLE_HAS_SYSTEMD) || defined(SWAY_IDLE_HAS_ELOGIND) 417#if HAVE_SYSTEMD || HAVE_ELOGIND
418 if (state.lock_cmd) { 418 if (state.lock_cmd) {
419 should_run = true; 419 should_run = true;
420 setup_sleep_listener(); 420 setup_sleep_listener();
diff --git a/swayidle/meson.build b/swayidle/meson.build
index 6c3ac119..79d2c5c4 100644
--- a/swayidle/meson.build
+++ b/swayidle/meson.build
@@ -1,18 +1,26 @@
1threads = dependency('threads') 1threads = dependency('threads')
2 2
3swayidle_deps = [
4 client_protos,
5 pixman,
6 wayland_client,
7 wayland_server,
8 wlroots,
9]
10
11if systemd.found()
12 swayidle_deps += systemd
13endif
14if elogind.found()
15 swayidle_deps += elogind
16endif
17
3executable( 18executable(
4 'swayidle', [ 19 'swayidle', [
5 'main.c', 20 'main.c',
6 ], 21 ],
7 include_directories: [sway_inc], 22 include_directories: [sway_inc],
8 dependencies: [ 23 dependencies: swayidle_deps,
9 client_protos,
10 pixman,
11 wayland_client,
12 wayland_server,
13 wlroots,
14 swayidle_deps,
15 ],
16 link_with: [lib_sway_common, lib_sway_client], 24 link_with: [lib_sway_common, lib_sway_client],
17 install_rpath : rpathdir, 25 install_rpath : rpathdir,
18 install: true 26 install: true