Use #if instead of #ifdef
This commit is contained in:
parent
eda3bfeed5
commit
cad851805b
|
@ -24,7 +24,7 @@ enum background_mode parse_background_mode(const char *mode) {
|
||||||
|
|
||||||
cairo_surface_t *load_background_image(const char *path) {
|
cairo_surface_t *load_background_image(const char *path) {
|
||||||
cairo_surface_t *image;
|
cairo_surface_t *image;
|
||||||
#ifdef HAVE_GDK_PIXBUF
|
#if HAVE_GDK_PIXBUF
|
||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(path, &err);
|
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(path, &err);
|
||||||
if (!pixbuf) {
|
if (!pixbuf) {
|
||||||
|
@ -43,10 +43,10 @@ cairo_surface_t *load_background_image(const char *path) {
|
||||||
}
|
}
|
||||||
if (cairo_surface_status(image) != CAIRO_STATUS_SUCCESS) {
|
if (cairo_surface_status(image) != CAIRO_STATUS_SUCCESS) {
|
||||||
wlr_log(WLR_ERROR, "Failed to read background image: %s."
|
wlr_log(WLR_ERROR, "Failed to read background image: %s."
|
||||||
#ifndef HAVE_GDK_PIXBUF
|
#if !HAVE_GDK_PIXBUF
|
||||||
"\nSway was compiled without gdk_pixbuf support, so only"
|
"\nSway was compiled without gdk_pixbuf support, so only"
|
||||||
"\nPNG images can be loaded. This is the likely cause."
|
"\nPNG images can be loaded. This is the likely cause."
|
||||||
#endif //HAVE_GDK_PIXBUF
|
#endif // !HAVE_GDK_PIXBUF
|
||||||
, cairo_status_to_string(cairo_surface_status(image)));
|
, cairo_status_to_string(cairo_surface_status(image)));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <cairo/cairo.h>
|
#include <cairo/cairo.h>
|
||||||
#include "cairo.h"
|
#include "cairo.h"
|
||||||
#ifdef HAVE_GDK_PIXBUF
|
#if HAVE_GDK_PIXBUF
|
||||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ cairo_surface_t *cairo_image_surface_scale(cairo_surface_t *image,
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GDK_PIXBUF
|
#if HAVE_GDK_PIXBUF
|
||||||
cairo_surface_t* gdk_cairo_image_surface_create_from_pixbuf(const GdkPixbuf *gdkbuf) {
|
cairo_surface_t* gdk_cairo_image_surface_create_from_pixbuf(const GdkPixbuf *gdkbuf) {
|
||||||
int chan = gdk_pixbuf_get_n_channels(gdkbuf);
|
int chan = gdk_pixbuf_get_n_channels(gdkbuf);
|
||||||
if (chan < 3) {
|
if (chan < 3) {
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
#ifndef _SWAY_CAIRO_H
|
#ifndef _SWAY_CAIRO_H
|
||||||
#define _SWAY_CAIRO_H
|
#define _SWAY_CAIRO_H
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <cairo/cairo.h>
|
#include <cairo/cairo.h>
|
||||||
#include <wlr/types/wlr_output.h>
|
#include <wlr/types/wlr_output.h>
|
||||||
|
#if HAVE_GDK_PIXBUF
|
||||||
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
void cairo_set_source_u32(cairo_t *cairo, uint32_t color);
|
void cairo_set_source_u32(cairo_t *cairo, uint32_t color);
|
||||||
cairo_subpixel_order_t to_cairo_subpixel_order(enum wl_output_subpixel subpixel);
|
cairo_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)
|
||||||
cairo_surface_t *cairo_image_surface_scale(cairo_surface_t *image,
|
cairo_surface_t *cairo_image_surface_scale(cairo_surface_t *image,
|
||||||
int width, int height);
|
int width, int height);
|
||||||
|
|
||||||
#include "config.h"
|
#if HAVE_GDK_PIXBUF
|
||||||
#ifdef HAVE_GDK_PIXBUF
|
|
||||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
|
||||||
|
|
||||||
cairo_surface_t* gdk_cairo_image_surface_create_from_pixbuf(
|
cairo_surface_t* gdk_cairo_image_surface_create_from_pixbuf(
|
||||||
const GdkPixbuf *gdkbuf);
|
const GdkPixbuf *gdkbuf);
|
||||||
#endif //WITH_GDK_PIXBUF
|
|
||||||
|
#endif // HAVE_GDK_PIXBUF
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -25,7 +25,7 @@ struct criteria {
|
||||||
pcre *app_id;
|
pcre *app_id;
|
||||||
pcre *con_mark;
|
pcre *con_mark;
|
||||||
uint32_t con_id; // internal ID
|
uint32_t con_id; // internal ID
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
pcre *class;
|
pcre *class;
|
||||||
uint32_t id; // X11 window ID
|
uint32_t id; // X11 window ID
|
||||||
pcre *instance;
|
pcre *instance;
|
||||||
|
|
|
@ -119,7 +119,7 @@ void output_layer_for_each_surface(struct sway_output *output,
|
||||||
struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator,
|
struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
void output_unmanaged_for_each_surface(struct sway_output *output,
|
void output_unmanaged_for_each_surface(struct sway_output *output,
|
||||||
struct wl_list *unmanaged, sway_surface_iterator_func_t iterator,
|
struct wl_list *unmanaged, sway_surface_iterator_func_t iterator,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include <wlr/types/wlr_xdg_shell.h>
|
#include <wlr/types/wlr_xdg_shell.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
#include "sway/xwayland.h"
|
#include "sway/xwayland.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ struct sway_server {
|
||||||
struct wlr_xdg_shell *xdg_shell;
|
struct wlr_xdg_shell *xdg_shell;
|
||||||
struct wl_listener xdg_shell_surface;
|
struct wl_listener xdg_shell_surface;
|
||||||
|
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
struct sway_xwayland xwayland;
|
struct sway_xwayland xwayland;
|
||||||
struct wl_listener xwayland_surface;
|
struct wl_listener xwayland_surface;
|
||||||
struct wl_listener xwayland_ready;
|
struct wl_listener xwayland_ready;
|
||||||
|
@ -80,7 +80,7 @@ void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data);
|
||||||
void handle_layer_shell_surface(struct wl_listener *listener, void *data);
|
void handle_layer_shell_surface(struct wl_listener *listener, void *data);
|
||||||
void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data);
|
void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data);
|
||||||
void handle_xdg_shell_surface(struct wl_listener *listener, void *data);
|
void handle_xdg_shell_surface(struct wl_listener *listener, void *data);
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
void handle_xwayland_surface(struct wl_listener *listener, void *data);
|
void handle_xwayland_surface(struct wl_listener *listener, void *data);
|
||||||
#endif
|
#endif
|
||||||
void handle_server_decoration(struct wl_listener *listener, void *data);
|
void handle_server_decoration(struct wl_listener *listener, void *data);
|
||||||
|
|
|
@ -16,7 +16,7 @@ struct sway_root {
|
||||||
struct wlr_output_layout *output_layout;
|
struct wlr_output_layout *output_layout;
|
||||||
|
|
||||||
struct wl_listener output_layout_change;
|
struct wl_listener output_layout_change;
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link
|
struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link
|
||||||
#endif
|
#endif
|
||||||
struct wl_list drag_icons; // sway_drag_icon::link
|
struct wl_list drag_icons; // sway_drag_icon::link
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <wlr/types/wlr_surface.h>
|
#include <wlr/types/wlr_surface.h>
|
||||||
#include <wlr/types/wlr_xdg_shell_v6.h>
|
#include <wlr/types/wlr_xdg_shell_v6.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
#include <wlr/xwayland.h>
|
#include <wlr/xwayland.h>
|
||||||
#endif
|
#endif
|
||||||
#include "sway/input/input-manager.h"
|
#include "sway/input/input-manager.h"
|
||||||
|
@ -16,7 +16,7 @@ struct sway_xdg_decoration;
|
||||||
enum sway_view_type {
|
enum sway_view_type {
|
||||||
SWAY_VIEW_XDG_SHELL_V6,
|
SWAY_VIEW_XDG_SHELL_V6,
|
||||||
SWAY_VIEW_XDG_SHELL,
|
SWAY_VIEW_XDG_SHELL,
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
SWAY_VIEW_XWAYLAND,
|
SWAY_VIEW_XWAYLAND,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -28,7 +28,7 @@ enum sway_view_prop {
|
||||||
VIEW_PROP_INSTANCE,
|
VIEW_PROP_INSTANCE,
|
||||||
VIEW_PROP_WINDOW_TYPE,
|
VIEW_PROP_WINDOW_TYPE,
|
||||||
VIEW_PROP_WINDOW_ROLE,
|
VIEW_PROP_WINDOW_ROLE,
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
VIEW_PROP_X11_WINDOW_ID,
|
VIEW_PROP_X11_WINDOW_ID,
|
||||||
VIEW_PROP_X11_PARENT_ID,
|
VIEW_PROP_X11_PARENT_ID,
|
||||||
#endif
|
#endif
|
||||||
|
@ -100,7 +100,7 @@ struct sway_view {
|
||||||
union {
|
union {
|
||||||
struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6;
|
struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6;
|
||||||
struct wlr_xdg_surface *wlr_xdg_surface;
|
struct wlr_xdg_surface *wlr_xdg_surface;
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
||||||
#endif
|
#endif
|
||||||
struct wlr_wl_shell_surface *wlr_wl_shell_surface;
|
struct wlr_wl_shell_surface *wlr_wl_shell_surface;
|
||||||
|
@ -144,7 +144,7 @@ struct sway_xdg_shell_view {
|
||||||
struct wl_listener unmap;
|
struct wl_listener unmap;
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
};
|
};
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
struct sway_xwayland_view {
|
struct sway_xwayland_view {
|
||||||
struct sway_view view;
|
struct sway_view view;
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ struct sway_view *view_from_wlr_xdg_surface(
|
||||||
struct wlr_xdg_surface *xdg_surface);
|
struct wlr_xdg_surface *xdg_surface);
|
||||||
struct sway_view *view_from_wlr_xdg_surface_v6(
|
struct sway_view *view_from_wlr_xdg_surface_v6(
|
||||||
struct wlr_xdg_surface_v6 *xdg_surface_v6);
|
struct wlr_xdg_surface_v6 *xdg_surface_v6);
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
struct sway_view *view_from_wlr_xwayland_surface(
|
struct sway_view *view_from_wlr_xwayland_surface(
|
||||||
struct wlr_xwayland_surface *xsurface);
|
struct wlr_xwayland_surface *xsurface);
|
||||||
#endif
|
#endif
|
||||||
|
|
20
meson.build
20
meson.build
|
@ -59,26 +59,14 @@ git = find_program('git', required: false)
|
||||||
|
|
||||||
conf_data = configuration_data()
|
conf_data = configuration_data()
|
||||||
|
|
||||||
|
conf_data.set10('HAVE_XWAYLAND', get_option('enable-xwayland'))
|
||||||
if get_option('enable-xwayland')
|
if get_option('enable-xwayland')
|
||||||
conf_data.set('HAVE_XWAYLAND', true)
|
|
||||||
xcb = dependency('xcb')
|
xcb = dependency('xcb')
|
||||||
else
|
|
||||||
conf_data.set('HAVE_XWAYLAND', false)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if gdk_pixbuf.found()
|
conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found())
|
||||||
conf_data.set('HAVE_GDK_PIXBUF', true)
|
conf_data.set10('HAVE_SYSTEMD', systemd.found())
|
||||||
endif
|
conf_data.set10('HAVE_ELOGIND', elogind.found())
|
||||||
|
|
||||||
if systemd.found()
|
|
||||||
conf_data.set('SWAY_IDLE_HAS_SYSTEMD', true)
|
|
||||||
swayidle_deps += systemd
|
|
||||||
endif
|
|
||||||
|
|
||||||
if elogind.found()
|
|
||||||
conf_data.set('SWAY_IDLE_HAS_ELOGIND', true)
|
|
||||||
swayidle_deps += elogind
|
|
||||||
endif
|
|
||||||
|
|
||||||
if not systemd.found() and not elogind.found()
|
if not systemd.found() and not elogind.found()
|
||||||
warning('The sway binary must be setuid when compiled without (e)logind')
|
warning('The sway binary must be setuid when compiled without (e)logind')
|
||||||
|
|
|
@ -149,7 +149,7 @@ static bool test_con_id(struct sway_container *container, void *data) {
|
||||||
return container->node.id == *con_id;
|
return container->node.id == *con_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
static bool test_id(struct sway_container *container, void *data) {
|
static bool test_id(struct sway_container *container, void *data) {
|
||||||
xcb_window_t *wid = data;
|
xcb_window_t *wid = data;
|
||||||
return (container->view && container->view->type == SWAY_VIEW_XWAYLAND
|
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);
|
char *value = join_args(argv + 3, argc - 3);
|
||||||
if (strcasecmp(argv[2], "id") == 0) {
|
if (strcasecmp(argv[2], "id") == 0) {
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
xcb_window_t id = strtol(value, NULL, 0);
|
xcb_window_t id = strtol(value, NULL, 0);
|
||||||
other = root_find_container(test_id, &id);
|
other = root_find_container(test_id, &id);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -21,7 +21,7 @@ bool criteria_is_empty(struct criteria *criteria) {
|
||||||
&& !criteria->app_id
|
&& !criteria->app_id
|
||||||
&& !criteria->con_mark
|
&& !criteria->con_mark
|
||||||
&& !criteria->con_id
|
&& !criteria->con_id
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
&& !criteria->class
|
&& !criteria->class
|
||||||
&& !criteria->id
|
&& !criteria->id
|
||||||
&& !criteria->instance
|
&& !criteria->instance
|
||||||
|
@ -42,7 +42,7 @@ void criteria_destroy(struct criteria *criteria) {
|
||||||
pcre_free(criteria->shell);
|
pcre_free(criteria->shell);
|
||||||
pcre_free(criteria->app_id);
|
pcre_free(criteria->app_id);
|
||||||
pcre_free(criteria->con_mark);
|
pcre_free(criteria->con_mark);
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
pcre_free(criteria->class);
|
pcre_free(criteria->class);
|
||||||
pcre_free(criteria->instance);
|
pcre_free(criteria->instance);
|
||||||
pcre_free(criteria->window_role);
|
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);
|
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) {
|
static bool view_has_window_type(struct sway_view *view, enum atom_name name) {
|
||||||
if (view->type != SWAY_VIEW_XWAYLAND) {
|
if (view->type != SWAY_VIEW_XWAYLAND) {
|
||||||
return false;
|
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
|
if (criteria->id) { // X11 window ID
|
||||||
uint32_t x11_window_id = view_get_x11_window_id(view);
|
uint32_t x11_window_id = view_get_x11_window_id(view);
|
||||||
if (!x11_window_id || x11_window_id != criteria->id) {
|
if (!x11_window_id || x11_window_id != criteria->id) {
|
||||||
|
@ -276,7 +276,7 @@ static bool generate_regex(pcre **regex, char *value) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
static enum atom_name parse_window_type(const char *type) {
|
static enum atom_name parse_window_type(const char *type) {
|
||||||
if (strcasecmp(type, "normal") == 0) {
|
if (strcasecmp(type, "normal") == 0) {
|
||||||
return NET_WM_WINDOW_TYPE_NORMAL;
|
return NET_WM_WINDOW_TYPE_NORMAL;
|
||||||
|
@ -308,7 +308,7 @@ enum criteria_token {
|
||||||
T_CON_ID,
|
T_CON_ID,
|
||||||
T_CON_MARK,
|
T_CON_MARK,
|
||||||
T_FLOATING,
|
T_FLOATING,
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
T_CLASS,
|
T_CLASS,
|
||||||
T_ID,
|
T_ID,
|
||||||
T_INSTANCE,
|
T_INSTANCE,
|
||||||
|
@ -331,7 +331,7 @@ static enum criteria_token token_from_name(char *name) {
|
||||||
return T_CON_ID;
|
return T_CON_ID;
|
||||||
} else if (strcmp(name, "con_mark") == 0) {
|
} else if (strcmp(name, "con_mark") == 0) {
|
||||||
return T_CON_MARK;
|
return T_CON_MARK;
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
} else if (strcmp(name, "class") == 0) {
|
} else if (strcmp(name, "class") == 0) {
|
||||||
return T_CLASS;
|
return T_CLASS;
|
||||||
} else if (strcmp(name, "id") == 0) {
|
} 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);
|
snprintf(id_str, id_size, "%zu", id);
|
||||||
value = id_str;
|
value = id_str;
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
case T_CLASS:
|
case T_CLASS:
|
||||||
value = view_get_class(view);
|
value = view_get_class(view);
|
||||||
break;
|
break;
|
||||||
|
@ -474,7 +474,7 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) {
|
||||||
case T_CON_MARK:
|
case T_CON_MARK:
|
||||||
generate_regex(&criteria->con_mark, effective_value);
|
generate_regex(&criteria->con_mark, effective_value);
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
case T_CLASS:
|
case T_CLASS:
|
||||||
generate_regex(&criteria->class, effective_value);
|
generate_regex(&criteria->class, effective_value);
|
||||||
break;
|
break;
|
||||||
|
@ -577,7 +577,7 @@ struct criteria *criteria_parse(char *raw, char **error_arg) {
|
||||||
++head;
|
++head;
|
||||||
|
|
||||||
struct criteria *criteria = calloc(1, sizeof(struct criteria));
|
struct criteria *criteria = calloc(1, sizeof(struct criteria));
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
criteria->window_type = ATOM_LAST; // default value
|
criteria->window_type = ATOM_LAST; // default value
|
||||||
#endif
|
#endif
|
||||||
char *name = NULL, *value = NULL;
|
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,
|
void output_unmanaged_for_each_surface(struct sway_output *output,
|
||||||
struct wl_list *unmanaged, sway_surface_iterator_func_t iterator,
|
struct wl_list *unmanaged, sway_surface_iterator_func_t iterator,
|
||||||
void *user_data) {
|
void *user_data) {
|
||||||
|
@ -274,7 +274,7 @@ static void output_for_each_surface(struct sway_output *output,
|
||||||
for_each_surface_container_iterator(floater, &data);
|
for_each_surface_container_iterator(floater, &data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
output_unmanaged_for_each_surface(output, &root->xwayland_unmanaged,
|
output_unmanaged_for_each_surface(output, &root->xwayland_unmanaged,
|
||||||
iterator, user_data);
|
iterator, user_data);
|
||||||
#endif
|
#endif
|
||||||
|
@ -289,7 +289,7 @@ static void output_for_each_surface(struct sway_output *output,
|
||||||
workspace_for_each_container(workspace,
|
workspace_for_each_container(workspace,
|
||||||
for_each_surface_container_iterator, &data);
|
for_each_surface_container_iterator, &data);
|
||||||
|
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
output_unmanaged_for_each_surface(output, &root->xwayland_unmanaged,
|
output_unmanaged_for_each_surface(output, &root->xwayland_unmanaged,
|
||||||
iterator, user_data);
|
iterator, user_data);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -140,7 +140,7 @@ static void render_layer(struct sway_output *output,
|
||||||
render_surface_iterator, &data);
|
render_surface_iterator, &data);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
static void render_unmanaged(struct sway_output *output,
|
static void render_unmanaged(struct sway_output *output,
|
||||||
pixman_region32_t *damage, struct wl_list *unmanaged) {
|
pixman_region32_t *damage, struct wl_list *unmanaged) {
|
||||||
struct render_data data = {
|
struct render_data data = {
|
||||||
|
@ -966,7 +966,7 @@ void output_render(struct sway_output *output, struct timespec *when,
|
||||||
render_floating_container(output, damage, floater);
|
render_floating_container(output, damage, floater);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
render_unmanaged(output, damage, &root->xwayland_unmanaged);
|
render_unmanaged(output, damage, &root->xwayland_unmanaged);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
@ -986,7 +986,7 @@ void output_render(struct sway_output *output, struct timespec *when,
|
||||||
|
|
||||||
render_workspace(output, damage, workspace, workspace->current.focused);
|
render_workspace(output, damage, workspace, workspace->current.focused);
|
||||||
render_floating(output, damage);
|
render_floating(output, damage);
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
render_unmanaged(output, damage, &root->xwayland_unmanaged);
|
render_unmanaged(output, damage, &root->xwayland_unmanaged);
|
||||||
#endif
|
#endif
|
||||||
render_layer(output, damage,
|
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 *cstate = &node->sway_container->current;
|
||||||
struct sway_container_state *istate = &instruction->container_state;
|
struct sway_container_state *istate = &instruction->container_state;
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
// Xwayland views are position-aware and need to be reconfigured
|
// Xwayland views are position-aware and need to be reconfigured
|
||||||
// when their position changes.
|
// when their position changes.
|
||||||
if (node->sway_container->view->type == SWAY_VIEW_XWAYLAND) {
|
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 sway_seat *seat, double lx, double ly,
|
||||||
struct wlr_surface **surface, double *sx, double *sy) {
|
struct wlr_surface **surface, double *sx, double *sy) {
|
||||||
// check for unmanaged views first
|
// check for unmanaged views first
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
struct wl_list *unmanaged = &root->xwayland_unmanaged;
|
struct wl_list *unmanaged = &root->xwayland_unmanaged;
|
||||||
struct sway_xwayland_unmanaged *unmanaged_surface;
|
struct sway_xwayland_unmanaged *unmanaged_surface;
|
||||||
wl_list_for_each_reverse(unmanaged_surface, unmanaged, link) {
|
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;
|
node->sway_container->view : NULL;
|
||||||
|
|
||||||
if (view && seat_is_input_allowed(seat, view->surface)) {
|
if (view && seat_is_input_allowed(seat, view->surface)) {
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
if (view->type == SWAY_VIEW_XWAYLAND) {
|
if (view->type == SWAY_VIEW_XWAYLAND) {
|
||||||
struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland;
|
struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland;
|
||||||
wlr_xwayland_set_seat(xwayland, seat->wlr_seat);
|
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};
|
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));
|
json_object_object_add(object, "geometry", ipc_json_create_rect(&geometry));
|
||||||
|
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
if (c->view->type == SWAY_VIEW_XWAYLAND) {
|
if (c->view->type == SWAY_VIEW_XWAYLAND) {
|
||||||
json_object_object_add(object, "window",
|
json_object_object_add(object, "window",
|
||||||
json_object_new_int(view_get_x11_window_id(c->view)));
|
json_object_new_int(view_get_x11_window_id(c->view)));
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "sway/server.h"
|
#include "sway/server.h"
|
||||||
#include "sway/tree/root.h"
|
#include "sway/tree/root.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
#include "sway/xwayland.h"
|
#include "sway/xwayland.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ bool server_init(struct sway_server *server) {
|
||||||
setenv("XCURSOR_THEME", cursor_theme, 1);
|
setenv("XCURSOR_THEME", cursor_theme, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
server->xwayland.wlr_xwayland =
|
server->xwayland.wlr_xwayland =
|
||||||
wlr_xwayland_create(server->wl_display, server->compositor, true);
|
wlr_xwayland_create(server->wl_display, server->compositor, true);
|
||||||
wl_signal_add(&server->xwayland.wlr_xwayland->events.new_surface,
|
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) {
|
void server_fini(struct sway_server *server) {
|
||||||
// TODO: free sway-specific resources
|
// TODO: free sway-specific resources
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
wlr_xwayland_destroy(server->xwayland.wlr_xwayland);
|
wlr_xwayland_destroy(server->xwayland.wlr_xwayland);
|
||||||
#endif
|
#endif
|
||||||
wl_display_destroy_clients(server->wl_display);
|
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;
|
double _sx, _sy;
|
||||||
struct wlr_surface *_surface = NULL;
|
struct wlr_surface *_surface = NULL;
|
||||||
switch (view->type) {
|
switch (view->type) {
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
case SWAY_VIEW_XWAYLAND:
|
case SWAY_VIEW_XWAYLAND:
|
||||||
_surface = wlr_surface_surface_at(view->surface,
|
_surface = wlr_surface_surface_at(view->surface,
|
||||||
view_sx, view_sy, &_sx, &_sy);
|
view_sx, view_sy, &_sx, &_sy);
|
||||||
|
|
|
@ -31,7 +31,7 @@ struct sway_root *root_create(void) {
|
||||||
node_init(&root->node, N_ROOT, root);
|
node_init(&root->node, N_ROOT, root);
|
||||||
root->output_layout = wlr_output_layout_create();
|
root->output_layout = wlr_output_layout_create();
|
||||||
wl_list_init(&root->all_outputs);
|
wl_list_init(&root->all_outputs);
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
wl_list_init(&root->xwayland_unmanaged);
|
wl_list_init(&root->xwayland_unmanaged);
|
||||||
#endif
|
#endif
|
||||||
wl_list_init(&root->drag_icons);
|
wl_list_init(&root->drag_icons);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include <wlr/types/wlr_server_decoration.h>
|
#include <wlr/types/wlr_server_decoration.h>
|
||||||
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
#include <wlr/xwayland.h>
|
#include <wlr/xwayland.h>
|
||||||
#endif
|
#endif
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
@ -101,7 +101,7 @@ const char *view_get_instance(struct sway_view *view) {
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
uint32_t view_get_x11_window_id(struct sway_view *view) {
|
uint32_t view_get_x11_window_id(struct sway_view *view) {
|
||||||
if (view->impl->get_int_prop) {
|
if (view->impl->get_int_prop) {
|
||||||
return view->impl->get_int_prop(view, VIEW_PROP_X11_WINDOW_ID);
|
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";
|
return "xdg_shell_v6";
|
||||||
case SWAY_VIEW_XDG_SHELL:
|
case SWAY_VIEW_XDG_SHELL:
|
||||||
return "xdg_shell";
|
return "xdg_shell";
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
case SWAY_VIEW_XWAYLAND:
|
case SWAY_VIEW_XWAYLAND:
|
||||||
return "xwayland";
|
return "xwayland";
|
||||||
#endif
|
#endif
|
||||||
|
@ -484,7 +484,7 @@ static struct sway_workspace *select_workspace(struct sway_view *view) {
|
||||||
|
|
||||||
// Check if there's a PID mapping
|
// Check if there's a PID mapping
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
if (view->type == SWAY_VIEW_XWAYLAND) {
|
if (view->type == SWAY_VIEW_XWAYLAND) {
|
||||||
struct wlr_xwayland_surface *surf =
|
struct wlr_xwayland_surface *surf =
|
||||||
wlr_xwayland_surface_from_wlr_surface(view->surface);
|
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);
|
wlr_xdg_surface_v6_from_wlr_surface(wlr_surface);
|
||||||
return view_from_wlr_xdg_surface_v6(xdg_surface_v6);
|
return view_from_wlr_xdg_surface_v6(xdg_surface_v6);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
if (wlr_surface_is_xwayland_surface(wlr_surface)) {
|
if (wlr_surface_is_xwayland_surface(wlr_surface)) {
|
||||||
struct wlr_xwayland_surface *xsurface =
|
struct wlr_xwayland_surface *xsurface =
|
||||||
wlr_xwayland_surface_from_wlr_surface(wlr_surface);
|
wlr_xwayland_surface_from_wlr_surface(wlr_surface);
|
||||||
|
|
|
@ -18,10 +18,10 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "idle-client-protocol.h"
|
#include "idle-client-protocol.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#ifdef SWAY_IDLE_HAS_SYSTEMD
|
#if HAVE_SYSTEMD
|
||||||
#include <systemd/sd-bus.h>
|
#include <systemd/sd-bus.h>
|
||||||
#include <systemd/sd-login.h>
|
#include <systemd/sd-login.h>
|
||||||
#elif defined(SWAY_IDLE_HAS_ELOGIND)
|
#elif HAVE_ELOGIND
|
||||||
#include <elogind/sd-bus.h>
|
#include <elogind/sd-bus.h>
|
||||||
#include <elogind/sd-login.h>
|
#include <elogind/sd-login.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -66,7 +66,7 @@ static void cmd_exec(char *param) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SWAY_IDLE_HAS_SYSTEMD) || defined(SWAY_IDLE_HAS_ELOGIND)
|
#if HAVE_SYSTEMD || HAVE_ELOGIND
|
||||||
static int lock_fd = -1;
|
static int lock_fd = -1;
|
||||||
static int ongoing_fd = -1;
|
static int ongoing_fd = -1;
|
||||||
static struct sd_bus *bus = NULL;
|
static struct sd_bus *bus = NULL;
|
||||||
|
@ -414,7 +414,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool should_run = state.timeout_cmds->length > 0;
|
bool should_run = state.timeout_cmds->length > 0;
|
||||||
#if defined(SWAY_IDLE_HAS_SYSTEMD) || defined(SWAY_IDLE_HAS_ELOGIND)
|
#if HAVE_SYSTEMD || HAVE_ELOGIND
|
||||||
if (state.lock_cmd) {
|
if (state.lock_cmd) {
|
||||||
should_run = true;
|
should_run = true;
|
||||||
setup_sleep_listener();
|
setup_sleep_listener();
|
||||||
|
|
|
@ -1,18 +1,26 @@
|
||||||
threads = dependency('threads')
|
threads = dependency('threads')
|
||||||
|
|
||||||
|
swayidle_deps = [
|
||||||
|
client_protos,
|
||||||
|
pixman,
|
||||||
|
wayland_client,
|
||||||
|
wayland_server,
|
||||||
|
wlroots,
|
||||||
|
]
|
||||||
|
|
||||||
|
if systemd.found()
|
||||||
|
swayidle_deps += systemd
|
||||||
|
endif
|
||||||
|
if elogind.found()
|
||||||
|
swayidle_deps += elogind
|
||||||
|
endif
|
||||||
|
|
||||||
executable(
|
executable(
|
||||||
'swayidle', [
|
'swayidle', [
|
||||||
'main.c',
|
'main.c',
|
||||||
],
|
],
|
||||||
include_directories: [sway_inc],
|
include_directories: [sway_inc],
|
||||||
dependencies: [
|
dependencies: swayidle_deps,
|
||||||
client_protos,
|
|
||||||
pixman,
|
|
||||||
wayland_client,
|
|
||||||
wayland_server,
|
|
||||||
wlroots,
|
|
||||||
swayidle_deps,
|
|
||||||
],
|
|
||||||
link_with: [lib_sway_common, lib_sway_client],
|
link_with: [lib_sway_common, lib_sway_client],
|
||||||
install_rpath : rpathdir,
|
install_rpath : rpathdir,
|
||||||
install: true
|
install: true
|
||||||
|
|
Loading…
Reference in a new issue