mirror of
https://github.com/swaywm/sway.git
synced 2025-11-17 06:59:48 -05:00
Use #if instead of #ifdef
This commit is contained in:
parent
eda3bfeed5
commit
cad851805b
23 changed files with 85 additions and 85 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)));
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue