aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-11-18 00:33:06 +0100
committeremersion <contact@emersion.fr>2018-11-18 00:33:06 +0100
commitcad851805bea6b4777685df1c6adf8cb9fa71835 (patch)
tree145fcb048cc3df3d04a8b6afb90de68dd2dd80a9 /sway
parenteda3bfeed5097c71634332bfe998188b028abf02 (diff)
downloadsway-cad851805bea6b4777685df1c6adf8cb9fa71835.tar.xz
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) {
return container->node.id == *con_id;
}
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
static bool test_id(struct sway_container *container, void *data) {
xcb_window_t *wid = data;
return (container->view && container->view->type == SWAY_VIEW_XWAYLAND
@@ -184,7 +184,7 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
char *value = join_args(argv + 3, argc - 3);
if (strcasecmp(argv[2], "id") == 0) {
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
xcb_window_t id = strtol(value, NULL, 0);
other = root_find_container(test_id, &id);
#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) {
&& !criteria->app_id
&& !criteria->con_mark
&& !criteria->con_id
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
&& !criteria->class
&& !criteria->id
&& !criteria->instance
@@ -42,7 +42,7 @@ void criteria_destroy(struct criteria *criteria) {
pcre_free(criteria->shell);
pcre_free(criteria->app_id);
pcre_free(criteria->con_mark);
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
pcre_free(criteria->class);
pcre_free(criteria->instance);
pcre_free(criteria->window_role);
@@ -55,7 +55,7 @@ static int regex_cmp(const char *item, const pcre *regex) {
return pcre_exec(regex, NULL, item, strlen(item), 0, 0, NULL, 0);
}
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
static bool view_has_window_type(struct sway_view *view, enum atom_name name) {
if (view->type != SWAY_VIEW_XWAYLAND) {
return false;
@@ -140,7 +140,7 @@ static bool criteria_matches_view(struct criteria *criteria,
}
}
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
if (criteria->id) { // X11 window ID
uint32_t x11_window_id = view_get_x11_window_id(view);
if (!x11_window_id || x11_window_id != criteria->id) {
@@ -276,7 +276,7 @@ static bool generate_regex(pcre **regex, char *value) {
return true;
}
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
static enum atom_name parse_window_type(const char *type) {
if (strcasecmp(type, "normal") == 0) {
return NET_WM_WINDOW_TYPE_NORMAL;
@@ -308,7 +308,7 @@ enum criteria_token {
T_CON_ID,
T_CON_MARK,
T_FLOATING,
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
T_CLASS,
T_ID,
T_INSTANCE,
@@ -331,7 +331,7 @@ static enum criteria_token token_from_name(char *name) {
return T_CON_ID;
} else if (strcmp(name, "con_mark") == 0) {
return T_CON_MARK;
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
} else if (strcmp(name, "class") == 0) {
return T_CLASS;
} else if (strcmp(name, "id") == 0) {
@@ -402,7 +402,7 @@ static char *get_focused_prop(enum criteria_token token) {
snprintf(id_str, id_size, "%zu", id);
value = id_str;
break;
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
case T_CLASS:
value = view_get_class(view);
break;
@@ -474,7 +474,7 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) {
case T_CON_MARK:
generate_regex(&criteria->con_mark, effective_value);
break;
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
case T_CLASS:
generate_regex(&criteria->class, effective_value);
break;
@@ -577,7 +577,7 @@ struct criteria *criteria_parse(char *raw, char **error_arg) {
++head;
struct criteria *criteria = calloc(1, sizeof(struct criteria));
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
criteria->window_type = ATOM_LAST; // default value
#endif
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,
}
}
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
void output_unmanaged_for_each_surface(struct sway_output *output,
struct wl_list *unmanaged, sway_surface_iterator_func_t iterator,
void *user_data) {
@@ -274,7 +274,7 @@ static void output_for_each_surface(struct sway_output *output,
for_each_surface_container_iterator(floater, &data);
}
}
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
output_unmanaged_for_each_surface(output, &root->xwayland_unmanaged,
iterator, user_data);
#endif
@@ -289,7 +289,7 @@ static void output_for_each_surface(struct sway_output *output,
workspace_for_each_container(workspace,
for_each_surface_container_iterator, &data);
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
output_unmanaged_for_each_surface(output, &root->xwayland_unmanaged,
iterator, user_data);
#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,
render_surface_iterator, &data);
}
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
static void render_unmanaged(struct sway_output *output,
pixman_region32_t *damage, struct wl_list *unmanaged) {
struct render_data data = {
@@ -966,7 +966,7 @@ void output_render(struct sway_output *output, struct timespec *when,
render_floating_container(output, damage, floater);
}
}
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
render_unmanaged(output, damage, &root->xwayland_unmanaged);
#endif
} else {
@@ -986,7 +986,7 @@ void output_render(struct sway_output *output, struct timespec *when,
render_workspace(output, damage, workspace, workspace->current.focused);
render_floating(output, damage);
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
render_unmanaged(output, damage, &root->xwayland_unmanaged);
#endif
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,
}
struct sway_container_state *cstate = &node->sway_container->current;
struct sway_container_state *istate = &instruction->container_state;
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
// Xwayland views are position-aware and need to be reconfigured
// when their position changes.
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(
struct sway_seat *seat, double lx, double ly,
struct wlr_surface **surface, double *sx, double *sy) {
// check for unmanaged views first
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
struct wl_list *unmanaged = &root->xwayland_unmanaged;
struct sway_xwayland_unmanaged *unmanaged_surface;
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) {
node->sway_container->view : NULL;
if (view && seat_is_input_allowed(seat, view->surface)) {
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
if (view->type == SWAY_VIEW_XWAYLAND) {
struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland;
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
struct wlr_box geometry = {0, 0, c->view->natural_width, c->view->natural_height};
json_object_object_add(object, "geometry", ipc_json_create_rect(&geometry));
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
if (c->view->type == SWAY_VIEW_XWAYLAND) {
json_object_object_add(object, "window",
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 @@
#include "sway/server.h"
#include "sway/tree/root.h"
#include "config.h"
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
#include "sway/xwayland.h"
#endif
@@ -94,7 +94,7 @@ bool server_init(struct sway_server *server) {
setenv("XCURSOR_THEME", cursor_theme, 1);
}
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
server->xwayland.wlr_xwayland =
wlr_xwayland_create(server->wl_display, server->compositor, true);
wl_signal_add(&server->xwayland.wlr_xwayland->events.new_surface,
@@ -164,7 +164,7 @@ bool server_init(struct sway_server *server) {
void server_fini(struct sway_server *server) {
// TODO: free sway-specific resources
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
wlr_xwayland_destroy(server->xwayland.wlr_xwayland);
#endif
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
double _sx, _sy;
struct wlr_surface *_surface = NULL;
switch (view->type) {
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
case SWAY_VIEW_XWAYLAND:
_surface = wlr_surface_surface_at(view->surface,
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) {
node_init(&root->node, N_ROOT, root);
root->output_layout = wlr_output_layout_create();
wl_list_init(&root->all_outputs);
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
wl_list_init(&root->xwayland_unmanaged);
#endif
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 @@
#include <wlr/types/wlr_server_decoration.h>
#include <wlr/types/wlr_xdg_decoration_v1.h>
#include "config.h"
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
#include <wlr/xwayland.h>
#endif
#include "list.h"
@@ -101,7 +101,7 @@ const char *view_get_instance(struct sway_view *view) {
}
return NULL;
}
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
uint32_t view_get_x11_window_id(struct sway_view *view) {
if (view->impl->get_int_prop) {
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) {
return "xdg_shell_v6";
case SWAY_VIEW_XDG_SHELL:
return "xdg_shell";
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
case SWAY_VIEW_XWAYLAND:
return "xwayland";
#endif
@@ -484,7 +484,7 @@ static struct sway_workspace *select_workspace(struct sway_view *view) {
// Check if there's a PID mapping
pid_t pid;
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
if (view->type == SWAY_VIEW_XWAYLAND) {
struct wlr_xwayland_surface *surf =
wlr_xwayland_surface_from_wlr_surface(view->surface);
@@ -802,7 +802,7 @@ struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) {
wlr_xdg_surface_v6_from_wlr_surface(wlr_surface);
return view_from_wlr_xdg_surface_v6(xdg_surface_v6);
}
-#ifdef HAVE_XWAYLAND
+#if HAVE_XWAYLAND
if (wlr_surface_is_xwayland_surface(wlr_surface)) {
struct wlr_xwayland_surface *xsurface =
wlr_xwayland_surface_from_wlr_surface(wlr_surface);