aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-11-18 00:33:06 +0100
committerLibravatar emersion <contact@emersion.fr>2018-11-18 00:33:06 +0100
commitcad851805bea6b4777685df1c6adf8cb9fa71835 (patch)
tree145fcb048cc3df3d04a8b6afb90de68dd2dd80a9 /sway
parentMerge pull request #3142 from RyanDwyer/move-view-properties (diff)
downloadsway-cad851805bea6b4777685df1c6adf8cb9fa71835.tar.gz
sway-cad851805bea6b4777685df1c6adf8cb9fa71835.tar.zst
sway-cad851805bea6b4777685df1c6adf8cb9fa71835.zip
Use #if instead of #ifdef
Diffstat (limited to 'sway')
-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
12 files changed, 32 insertions, 32 deletions
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);