style fixes, exclude sway/desctop/xwayland.c when enable_xwayland: false
This commit is contained in:
parent
24ad1c3983
commit
2bf893248a
|
@ -25,9 +25,9 @@ struct criteria {
|
|||
pcre *instance;
|
||||
pcre *con_mark;
|
||||
uint32_t con_id; // internal ID
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
uint32_t id; // X11 window ID
|
||||
#endif
|
||||
#endif
|
||||
pcre *window_role;
|
||||
uint32_t window_type;
|
||||
bool floating;
|
||||
|
|
|
@ -41,11 +41,11 @@ struct sway_server {
|
|||
|
||||
struct wlr_xdg_shell *xdg_shell;
|
||||
struct wl_listener xdg_shell_surface;
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
struct sway_xwayland xwayland;
|
||||
struct wl_listener xwayland_surface;
|
||||
struct wl_listener xwayland_ready;
|
||||
#endif
|
||||
#endif
|
||||
bool debug_txn_timings;
|
||||
|
||||
list_t *transactions;
|
||||
|
|
|
@ -27,9 +27,9 @@ struct sway_root {
|
|||
struct wlr_output_layout *output_layout;
|
||||
|
||||
struct wl_listener output_layout_change;
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link
|
||||
#endif
|
||||
#endif
|
||||
struct wl_list drag_icons; // sway_drag_icon::link
|
||||
|
||||
struct wlr_texture *debug_tree;
|
||||
|
|
|
@ -14,9 +14,9 @@ struct sway_container;
|
|||
enum sway_view_type {
|
||||
SWAY_VIEW_XDG_SHELL_V6,
|
||||
SWAY_VIEW_XDG_SHELL,
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
SWAY_VIEW_XWAYLAND,
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
enum sway_view_prop {
|
||||
|
@ -26,9 +26,9 @@ enum sway_view_prop {
|
|||
VIEW_PROP_INSTANCE,
|
||||
VIEW_PROP_WINDOW_TYPE,
|
||||
VIEW_PROP_WINDOW_ROLE,
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
VIEW_PROP_X11_WINDOW_ID,
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
struct sway_view_impl {
|
||||
|
@ -96,9 +96,9 @@ struct sway_view {
|
|||
union {
|
||||
struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6;
|
||||
struct wlr_xdg_surface *wlr_xdg_surface;
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
||||
#endif
|
||||
#endif
|
||||
struct wlr_wl_shell_surface *wlr_wl_shell_surface;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
option('sway_version', type : 'string', description: 'The version string reported in `sway --version`.')
|
||||
option('default_wallpaper', type: 'boolean', value: true, description: 'Install the default wallpaper.')
|
||||
option('zsh_completions', type: 'boolean', value: true, description: 'Install zsh shell completions.')
|
||||
option('enable-xwayland', type: 'boolean', value: false, description: 'Enable support X11 applications')
|
||||
option('enable-xwayland', type: 'boolean', value: true, description: 'Enable support for X11 applications')
|
||||
|
|
|
@ -14,14 +14,14 @@ static bool test_con_id(struct sway_container *container, void *con_id) {
|
|||
}
|
||||
|
||||
static bool test_id(struct sway_container *container, void *id) {
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
xcb_window_t *wid = id;
|
||||
return (container->type == C_VIEW
|
||||
&& container->sway_view->type == SWAY_VIEW_XWAYLAND
|
||||
&& container->sway_view->wlr_xwayland_surface->window_id == *wid);
|
||||
#else
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool test_mark(struct sway_container *container, void *mark) {
|
||||
|
@ -47,10 +47,10 @@ 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
|
||||
#ifdef HAVE_XWAYLAND
|
||||
xcb_window_t id = strtol(value, NULL, 0);
|
||||
other = container_find(&root_container, test_id, (void *)&id);
|
||||
#endif
|
||||
#endif
|
||||
} else if (strcasecmp(argv[2], "con_id") == 0) {
|
||||
size_t con_id = atoi(value);
|
||||
other = container_find(&root_container, test_con_id, (void *)con_id);
|
||||
|
|
|
@ -291,12 +291,12 @@ static void send_frame_done(struct sway_output *output, struct timespec *when) {
|
|||
if (workspace->current.ws_fullscreen) {
|
||||
send_frame_done_container_iterator(
|
||||
workspace->current.ws_fullscreen->swayc, &data);
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
if (workspace->current.ws_fullscreen->type == SWAY_VIEW_XWAYLAND) {
|
||||
send_frame_done_unmanaged(&data,
|
||||
&root_container.sway_root->xwayland_unmanaged);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
} else {
|
||||
send_frame_done_layer(&data,
|
||||
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]);
|
||||
|
@ -306,10 +306,10 @@ static void send_frame_done(struct sway_output *output, struct timespec *when) {
|
|||
send_frame_done_container(&data, workspace);
|
||||
send_frame_done_container(&data, workspace->sway_workspace->floating);
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
send_frame_done_unmanaged(&data,
|
||||
&root_container.sway_root->xwayland_unmanaged);
|
||||
#endif
|
||||
#endif
|
||||
send_frame_done_layer(&data,
|
||||
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
|
||||
}
|
||||
|
|
|
@ -866,12 +866,12 @@ void output_render(struct sway_output *output, struct timespec *when,
|
|||
} else {
|
||||
render_view_surfaces(fullscreen_view, output, damage, 1.0f);
|
||||
}
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
if (fullscreen_view->type == SWAY_VIEW_XWAYLAND) {
|
||||
render_unmanaged(output, damage,
|
||||
&root_container.sway_root->xwayland_unmanaged);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
} else {
|
||||
float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f};
|
||||
|
||||
|
@ -889,10 +889,10 @@ void output_render(struct sway_output *output, struct timespec *when,
|
|||
|
||||
render_container(output, damage, workspace, workspace->current.focused);
|
||||
render_floating(output, damage);
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
render_unmanaged(output, damage,
|
||||
&root_container.sway_root->xwayland_unmanaged);
|
||||
#endif
|
||||
#endif
|
||||
render_layer(output, damage,
|
||||
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#define _POSIX_C_SOURCE 199309L
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <wayland-server.h>
|
||||
|
@ -592,4 +591,3 @@ void handle_xwayland_ready(struct wl_listener *listener, void *data) {
|
|||
|
||||
xcb_disconnect(xcb_conn);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -54,7 +54,7 @@ static struct sway_container *container_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
|
||||
#ifdef HAVE_XWAYLAND
|
||||
struct wl_list *unmanaged = &root_container.sway_root->xwayland_unmanaged;
|
||||
struct sway_xwayland_unmanaged *unmanaged_surface;
|
||||
wl_list_for_each_reverse(unmanaged_surface, unmanaged, link) {
|
||||
|
@ -70,7 +70,7 @@ static struct sway_container *container_at_coords(
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
// find the output the cursor is on
|
||||
struct wlr_output_layout *output_layout =
|
||||
root_container.sway_root->output_layout;
|
||||
|
|
|
@ -103,13 +103,13 @@ static void seat_send_focus(struct sway_container *con,
|
|||
|
||||
if (con->type == C_VIEW
|
||||
&& seat_is_input_allowed(seat, con->sway_view->surface)) {
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
if (con->sway_view->type == SWAY_VIEW_XWAYLAND) {
|
||||
struct wlr_xwayland *xwayland =
|
||||
seat->input->server->xwayland.wlr_xwayland;
|
||||
wlr_xwayland_set_seat(xwayland, seat->wlr_seat);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->wlr_seat);
|
||||
if (keyboard) {
|
||||
wlr_seat_keyboard_notify_enter(seat->wlr_seat,
|
||||
|
|
|
@ -18,7 +18,6 @@ sway_sources = files(
|
|||
'desktop/transaction.c',
|
||||
'desktop/xdg_shell_v6.c',
|
||||
'desktop/xdg_shell.c',
|
||||
'desktop/xwayland.c',
|
||||
|
||||
'input/input-manager.c',
|
||||
'input/seat.c',
|
||||
|
@ -152,6 +151,10 @@ sway_sources = files(
|
|||
'tree/output.c',
|
||||
)
|
||||
|
||||
if get_option('enable-xwayland')
|
||||
sway_sources += 'desktop/xwayland.c'
|
||||
endif
|
||||
|
||||
sway_deps = [
|
||||
cairo,
|
||||
gdk_pixbuf,
|
||||
|
|
|
@ -83,7 +83,7 @@ bool server_init(struct sway_server *server) {
|
|||
server->xdg_shell_surface.notify = handle_xdg_shell_surface;
|
||||
|
||||
// TODO make xwayland optional
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#ifdef 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,
|
||||
|
@ -104,7 +104,7 @@ bool server_init(struct sway_server *server) {
|
|||
image->width * 4, image->width, image->height, image->hotspot_x,
|
||||
image->hotspot_y);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// TODO: Integration with sway borders
|
||||
struct wlr_server_decoration_manager *deco_manager =
|
||||
|
|
|
@ -527,12 +527,12 @@ static struct sway_container *container_at_view(struct sway_container *swayc,
|
|||
double _sx, _sy;
|
||||
struct wlr_surface *_surface = NULL;
|
||||
switch (sview->type) {
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
case SWAY_VIEW_XWAYLAND:
|
||||
_surface = wlr_surface_surface_at(sview->surface,
|
||||
view_sx, view_sy, &_sx, &_sy);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
case SWAY_VIEW_XDG_SHELL_V6:
|
||||
_surface = wlr_xdg_surface_v6_surface_at(
|
||||
sview->wlr_xdg_surface_v6,
|
||||
|
|
|
@ -39,9 +39,9 @@ void layout_init(void) {
|
|||
root_container.sway_root = calloc(1, sizeof(*root_container.sway_root));
|
||||
root_container.sway_root->output_layout = wlr_output_layout_create();
|
||||
wl_list_init(&root_container.sway_root->outputs);
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
wl_list_init(&root_container.sway_root->xwayland_unmanaged);
|
||||
#endif
|
||||
#endif
|
||||
wl_list_init(&root_container.sway_root->drag_icons);
|
||||
wl_signal_init(&root_container.sway_root->events.new_container);
|
||||
root_container.sway_root->scratchpad = create_list();
|
||||
|
|
|
@ -138,10 +138,10 @@ const char *view_get_shell(struct sway_view *view) {
|
|||
return "xdg_shell_v6";
|
||||
case SWAY_VIEW_XDG_SHELL:
|
||||
return "xdg_shell";
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
case SWAY_VIEW_XWAYLAND:
|
||||
return "xwayland";
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
@ -567,7 +567,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) {
|
|||
}
|
||||
|
||||
pid_t pid;
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
if (view->type == SWAY_VIEW_XWAYLAND) {
|
||||
struct wlr_xwayland_surface *surf =
|
||||
wlr_xwayland_surface_from_wlr_surface(wlr_surface);
|
||||
|
@ -577,11 +577,11 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) {
|
|||
wl_resource_get_client(wlr_surface->resource);
|
||||
wl_client_get_credentials(client, &pid, NULL, NULL);
|
||||
}
|
||||
#else
|
||||
#else
|
||||
struct wl_client *client =
|
||||
wl_resource_get_client(wlr_surface->resource);
|
||||
wl_client_get_credentials(client, &pid, NULL, NULL);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
||||
struct sway_container *target_sibling =
|
||||
|
@ -835,13 +835,13 @@ 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
|
||||
#ifdef HAVE_XWAYLAND
|
||||
if (wlr_surface_is_xwayland_surface(wlr_surface)) {
|
||||
struct wlr_xwayland_surface *xsurface =
|
||||
wlr_xwayland_surface_from_wlr_surface(wlr_surface);
|
||||
return view_from_wlr_xwayland_surface(xsurface);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if (wlr_surface_is_subsurface(wlr_surface)) {
|
||||
struct wlr_subsurface *subsurface =
|
||||
wlr_subsurface_from_wlr_surface(wlr_surface);
|
||||
|
|
Loading…
Reference in a new issue