mirror of
https://github.com/swaywm/sway.git
synced 2024-11-14 06:24:20 +01:00
Merge pull request #2350 from ppascher/xwayland-optional
Added meson option to allow building sway without xwayland support
This commit is contained in:
commit
fc718f629a
@ -2,6 +2,7 @@
|
|||||||
#define _SWAY_CRITERIA_H
|
#define _SWAY_CRITERIA_H
|
||||||
|
|
||||||
#include <pcre.h>
|
#include <pcre.h>
|
||||||
|
#include "config.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "tree/view.h"
|
#include "tree/view.h"
|
||||||
|
|
||||||
@ -25,7 +26,9 @@ struct criteria {
|
|||||||
pcre *instance;
|
pcre *instance;
|
||||||
pcre *con_mark;
|
pcre *con_mark;
|
||||||
uint32_t con_id; // internal ID
|
uint32_t con_id; // internal ID
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
uint32_t id; // X11 window ID
|
uint32_t id; // X11 window ID
|
||||||
|
#endif
|
||||||
pcre *window_role;
|
pcre *window_role;
|
||||||
uint32_t window_type;
|
uint32_t window_type;
|
||||||
bool floating;
|
bool floating;
|
||||||
|
@ -12,7 +12,10 @@
|
|||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
// TODO WLR: make Xwayland optional
|
// TODO WLR: make Xwayland optional
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
#include "config.h"
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
#include "sway/xwayland.h"
|
#include "sway/xwayland.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
struct sway_server {
|
struct sway_server {
|
||||||
struct wl_display *wl_display;
|
struct wl_display *wl_display;
|
||||||
@ -39,11 +42,11 @@ 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
|
||||||
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;
|
||||||
|
#endif
|
||||||
bool debug_txn_timings;
|
bool debug_txn_timings;
|
||||||
|
|
||||||
list_t *transactions;
|
list_t *transactions;
|
||||||
@ -65,6 +68,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
|
||||||
void handle_xwayland_surface(struct wl_listener *listener, void *data);
|
void handle_xwayland_surface(struct wl_listener *listener, void *data);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <wlr/types/wlr_output_layout.h>
|
#include <wlr/types/wlr_output_layout.h>
|
||||||
#include <wlr/render/wlr_texture.h>
|
#include <wlr/render/wlr_texture.h>
|
||||||
#include "sway/tree/container.h"
|
#include "sway/tree/container.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
enum movement_direction {
|
enum movement_direction {
|
||||||
MOVE_LEFT,
|
MOVE_LEFT,
|
||||||
@ -27,8 +28,9 @@ 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
|
||||||
struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link
|
struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link
|
||||||
|
#endif
|
||||||
struct wl_list drag_icons; // sway_drag_icon::link
|
struct wl_list drag_icons; // sway_drag_icon::link
|
||||||
|
|
||||||
struct wlr_texture *debug_tree;
|
struct wlr_texture *debug_tree;
|
||||||
|
@ -3,7 +3,10 @@
|
|||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
#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"
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
#include <wlr/xwayland.h>
|
#include <wlr/xwayland.h>
|
||||||
|
#endif
|
||||||
#include "sway/input/input-manager.h"
|
#include "sway/input/input-manager.h"
|
||||||
#include "sway/input/seat.h"
|
#include "sway/input/seat.h"
|
||||||
|
|
||||||
@ -12,7 +15,9 @@ struct sway_container;
|
|||||||
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
|
||||||
SWAY_VIEW_XWAYLAND,
|
SWAY_VIEW_XWAYLAND,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
enum sway_view_prop {
|
enum sway_view_prop {
|
||||||
@ -22,7 +27,9 @@ 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
|
||||||
VIEW_PROP_X11_WINDOW_ID,
|
VIEW_PROP_X11_WINDOW_ID,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_view_impl {
|
struct sway_view_impl {
|
||||||
@ -90,7 +97,9 @@ 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
|
||||||
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
||||||
|
#endif
|
||||||
struct wlr_wl_shell_surface *wlr_wl_shell_surface;
|
struct wlr_wl_shell_surface *wlr_wl_shell_surface;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -133,7 +142,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
|
||||||
struct sway_xwayland_view {
|
struct sway_xwayland_view {
|
||||||
struct sway_view view;
|
struct sway_view view;
|
||||||
|
|
||||||
@ -165,7 +174,7 @@ struct sway_xwayland_unmanaged {
|
|||||||
struct wl_listener unmap;
|
struct wl_listener unmap;
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
struct sway_view_child;
|
struct sway_view_child;
|
||||||
|
|
||||||
struct sway_view_child_impl {
|
struct sway_view_child_impl {
|
||||||
@ -281,9 +290,10 @@ 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
|
||||||
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
|
||||||
struct sway_view *view_from_wlr_surface(struct wlr_surface *surface);
|
struct sway_view *view_from_wlr_surface(struct wlr_surface *surface);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,6 +48,12 @@ git = find_program('git', required: false)
|
|||||||
|
|
||||||
conf_data = configuration_data()
|
conf_data = configuration_data()
|
||||||
|
|
||||||
|
if get_option('enable-xwayland')
|
||||||
|
conf_data.set('HAVE_XWAYLAND', true)
|
||||||
|
else
|
||||||
|
conf_data.set('HAVE_XWAYLAND', false)
|
||||||
|
endif
|
||||||
|
|
||||||
if gdk_pixbuf.found()
|
if gdk_pixbuf.found()
|
||||||
conf_data.set('HAVE_GDK_PIXBUF', true)
|
conf_data.set('HAVE_GDK_PIXBUF', true)
|
||||||
endif
|
endif
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
option('sway_version', type : 'string', description: 'The version string reported in `sway --version`.')
|
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('default_wallpaper', type: 'boolean', value: true, description: 'Install the default wallpaper.')
|
||||||
option('zsh_completions', type: 'boolean', value: true, description: 'Install zsh shell completions.')
|
option('zsh_completions', type: 'boolean', value: true, description: 'Install zsh shell completions.')
|
||||||
|
option('enable-xwayland', type: 'boolean', value: true, description: 'Enable support for X11 applications')
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
|
#include "config.h"
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "sway/tree/arrange.h"
|
#include "sway/tree/arrange.h"
|
||||||
#include "sway/tree/layout.h"
|
#include "sway/tree/layout.h"
|
||||||
@ -14,10 +15,14 @@ static bool test_con_id(struct sway_container *container, void *con_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool test_id(struct sway_container *container, void *id) {
|
static bool test_id(struct sway_container *container, void *id) {
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
xcb_window_t *wid = id;
|
xcb_window_t *wid = id;
|
||||||
return (container->type == C_VIEW
|
return (container->type == C_VIEW
|
||||||
&& container->sway_view->type == SWAY_VIEW_XWAYLAND
|
&& container->sway_view->type == SWAY_VIEW_XWAYLAND
|
||||||
&& container->sway_view->wlr_xwayland_surface->window_id == *wid);
|
&& container->sway_view->wlr_xwayland_surface->window_id == *wid);
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool test_mark(struct sway_container *container, void *mark) {
|
static bool test_mark(struct sway_container *container, void *mark) {
|
||||||
@ -43,8 +48,10 @@ 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
|
||||||
xcb_window_t id = strtol(value, NULL, 0);
|
xcb_window_t id = strtol(value, NULL, 0);
|
||||||
other = container_find(&root_container, test_id, (void *)&id);
|
other = container_find(&root_container, test_id, (void *)&id);
|
||||||
|
#endif
|
||||||
} else if (strcasecmp(argv[2], "con_id") == 0) {
|
} else if (strcasecmp(argv[2], "con_id") == 0) {
|
||||||
size_t con_id = atoi(value);
|
size_t con_id = atoi(value);
|
||||||
other = container_find(&root_container, test_con_id, (void *)con_id);
|
other = container_find(&root_container, test_con_id, (void *)con_id);
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "stringop.h"
|
#include "stringop.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
bool criteria_is_empty(struct criteria *criteria) {
|
bool criteria_is_empty(struct criteria *criteria) {
|
||||||
return !criteria->title
|
return !criteria->title
|
||||||
@ -19,7 +20,9 @@ bool criteria_is_empty(struct criteria *criteria) {
|
|||||||
&& !criteria->instance
|
&& !criteria->instance
|
||||||
&& !criteria->con_mark
|
&& !criteria->con_mark
|
||||||
&& !criteria->con_id
|
&& !criteria->con_id
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
&& !criteria->id
|
&& !criteria->id
|
||||||
|
#endif
|
||||||
&& !criteria->window_role
|
&& !criteria->window_role
|
||||||
&& !criteria->window_type
|
&& !criteria->window_type
|
||||||
&& !criteria->floating
|
&& !criteria->floating
|
||||||
@ -127,12 +130,14 @@ static bool criteria_matches_view(struct criteria *criteria,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef 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) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (criteria->window_role) {
|
if (criteria->window_role) {
|
||||||
// TODO
|
// TODO
|
||||||
@ -265,7 +270,9 @@ enum criteria_token {
|
|||||||
T_CON_ID,
|
T_CON_ID,
|
||||||
T_CON_MARK,
|
T_CON_MARK,
|
||||||
T_FLOATING,
|
T_FLOATING,
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
T_ID,
|
T_ID,
|
||||||
|
#endif
|
||||||
T_INSTANCE,
|
T_INSTANCE,
|
||||||
T_SHELL,
|
T_SHELL,
|
||||||
T_TILING,
|
T_TILING,
|
||||||
@ -287,8 +294,10 @@ 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
|
||||||
} else if (strcmp(name, "id") == 0) {
|
} else if (strcmp(name, "id") == 0) {
|
||||||
return T_ID;
|
return T_ID;
|
||||||
|
#endif
|
||||||
} else if (strcmp(name, "instance") == 0) {
|
} else if (strcmp(name, "instance") == 0) {
|
||||||
return T_INSTANCE;
|
return T_INSTANCE;
|
||||||
} else if (strcmp(name, "shell") == 0) {
|
} else if (strcmp(name, "shell") == 0) {
|
||||||
@ -355,7 +364,9 @@ static char *get_focused_prop(enum criteria_token token) {
|
|||||||
case T_CON_ID: // These do not support __focused__
|
case T_CON_ID: // These do not support __focused__
|
||||||
case T_CON_MARK:
|
case T_CON_MARK:
|
||||||
case T_FLOATING:
|
case T_FLOATING:
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
case T_ID:
|
case T_ID:
|
||||||
|
#endif
|
||||||
case T_TILING:
|
case T_TILING:
|
||||||
case T_URGENT:
|
case T_URGENT:
|
||||||
case T_WINDOW_TYPE:
|
case T_WINDOW_TYPE:
|
||||||
@ -426,12 +437,14 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) {
|
|||||||
case T_WINDOW_TYPE:
|
case T_WINDOW_TYPE:
|
||||||
// TODO: This is a string but will be stored as an enum or integer
|
// TODO: This is a string but will be stored as an enum or integer
|
||||||
break;
|
break;
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
case T_ID:
|
case T_ID:
|
||||||
criteria->id = strtoul(effective_value, &endptr, 10);
|
criteria->id = strtoul(effective_value, &endptr, 10);
|
||||||
if (*endptr != 0) {
|
if (*endptr != 0) {
|
||||||
error = strdup("The value for 'id' should be numeric");
|
error = strdup("The value for 'id' should be numeric");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case T_FLOATING:
|
case T_FLOATING:
|
||||||
criteria->floating = true;
|
criteria->floating = true;
|
||||||
break;
|
break;
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include <wlr/types/wlr_surface.h>
|
#include <wlr/types/wlr_surface.h>
|
||||||
#include <wlr/util/region.h>
|
#include <wlr/util/region.h>
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "config.h"
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#include "sway/input/input-manager.h"
|
#include "sway/input/input-manager.h"
|
||||||
#include "sway/input/seat.h"
|
#include "sway/input/seat.h"
|
||||||
@ -128,7 +129,7 @@ void output_layer_for_each_surface(struct wl_list *layer_surfaces,
|
|||||||
user_data);
|
user_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
void output_unmanaged_for_each_surface(struct wl_list *unmanaged,
|
void output_unmanaged_for_each_surface(struct wl_list *unmanaged,
|
||||||
struct sway_output *output, struct root_geometry *geo,
|
struct sway_output *output, struct root_geometry *geo,
|
||||||
wlr_surface_iterator_func_t iterator, void *user_data) {
|
wlr_surface_iterator_func_t iterator, void *user_data) {
|
||||||
@ -143,7 +144,7 @@ void output_unmanaged_for_each_surface(struct wl_list *unmanaged,
|
|||||||
iterator, user_data);
|
iterator, user_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
void output_drag_icons_for_each_surface(struct wl_list *drag_icons,
|
void output_drag_icons_for_each_surface(struct wl_list *drag_icons,
|
||||||
struct sway_output *output, struct root_geometry *geo,
|
struct sway_output *output, struct root_geometry *geo,
|
||||||
wlr_surface_iterator_func_t iterator, void *user_data) {
|
wlr_surface_iterator_func_t iterator, void *user_data) {
|
||||||
@ -244,13 +245,13 @@ static void send_frame_done_layer(struct send_frame_done_data *data,
|
|||||||
output_layer_for_each_surface(layer_surfaces, &data->root_geo,
|
output_layer_for_each_surface(layer_surfaces, &data->root_geo,
|
||||||
send_frame_done_iterator, data);
|
send_frame_done_iterator, data);
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
static void send_frame_done_unmanaged(struct send_frame_done_data *data,
|
static void send_frame_done_unmanaged(struct send_frame_done_data *data,
|
||||||
struct wl_list *unmanaged) {
|
struct wl_list *unmanaged) {
|
||||||
output_unmanaged_for_each_surface(unmanaged, data->output, &data->root_geo,
|
output_unmanaged_for_each_surface(unmanaged, data->output, &data->root_geo,
|
||||||
send_frame_done_iterator, data);
|
send_frame_done_iterator, data);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
static void send_frame_done_drag_icons(struct send_frame_done_data *data,
|
static void send_frame_done_drag_icons(struct send_frame_done_data *data,
|
||||||
struct wl_list *drag_icons) {
|
struct wl_list *drag_icons) {
|
||||||
output_drag_icons_for_each_surface(drag_icons, data->output, &data->root_geo,
|
output_drag_icons_for_each_surface(drag_icons, data->output, &data->root_geo,
|
||||||
@ -291,11 +292,12 @@ static void send_frame_done(struct sway_output *output, struct timespec *when) {
|
|||||||
if (workspace->current.ws_fullscreen) {
|
if (workspace->current.ws_fullscreen) {
|
||||||
send_frame_done_container_iterator(
|
send_frame_done_container_iterator(
|
||||||
workspace->current.ws_fullscreen->swayc, &data);
|
workspace->current.ws_fullscreen->swayc, &data);
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
if (workspace->current.ws_fullscreen->type == SWAY_VIEW_XWAYLAND) {
|
if (workspace->current.ws_fullscreen->type == SWAY_VIEW_XWAYLAND) {
|
||||||
send_frame_done_unmanaged(&data,
|
send_frame_done_unmanaged(&data,
|
||||||
&root_container.sway_root->xwayland_unmanaged);
|
&root_container.sway_root->xwayland_unmanaged);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
send_frame_done_layer(&data,
|
send_frame_done_layer(&data,
|
||||||
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]);
|
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]);
|
||||||
@ -305,8 +307,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);
|
||||||
send_frame_done_container(&data, workspace->sway_workspace->floating);
|
send_frame_done_container(&data, workspace->sway_workspace->floating);
|
||||||
|
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
send_frame_done_unmanaged(&data,
|
send_frame_done_unmanaged(&data,
|
||||||
&root_container.sway_root->xwayland_unmanaged);
|
&root_container.sway_root->xwayland_unmanaged);
|
||||||
|
#endif
|
||||||
send_frame_done_layer(&data,
|
send_frame_done_layer(&data,
|
||||||
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
|
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include <wlr/types/wlr_surface.h>
|
#include <wlr/types/wlr_surface.h>
|
||||||
#include <wlr/util/region.h>
|
#include <wlr/util/region.h>
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "config.h"
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#include "sway/debug.h"
|
#include "sway/debug.h"
|
||||||
#include "sway/input/input-manager.h"
|
#include "sway/input/input-manager.h"
|
||||||
@ -132,7 +133,7 @@ static void render_layer(struct sway_output *output,
|
|||||||
output_layer_for_each_surface(layer_surfaces, &data.root_geo,
|
output_layer_for_each_surface(layer_surfaces, &data.root_geo,
|
||||||
render_surface_iterator, &data);
|
render_surface_iterator, &data);
|
||||||
}
|
}
|
||||||
|
#ifdef 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 = {
|
||||||
@ -143,7 +144,7 @@ static void render_unmanaged(struct sway_output *output,
|
|||||||
output_unmanaged_for_each_surface(unmanaged, output, &data.root_geo,
|
output_unmanaged_for_each_surface(unmanaged, output, &data.root_geo,
|
||||||
render_surface_iterator, &data);
|
render_surface_iterator, &data);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
static void render_drag_icons(struct sway_output *output,
|
static void render_drag_icons(struct sway_output *output,
|
||||||
pixman_region32_t *damage, struct wl_list *drag_icons) {
|
pixman_region32_t *damage, struct wl_list *drag_icons) {
|
||||||
struct render_data data = {
|
struct render_data data = {
|
||||||
@ -866,11 +867,12 @@ void output_render(struct sway_output *output, struct timespec *when,
|
|||||||
} else {
|
} else {
|
||||||
render_view_surfaces(fullscreen_view, output, damage, 1.0f);
|
render_view_surfaces(fullscreen_view, output, damage, 1.0f);
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
if (fullscreen_view->type == SWAY_VIEW_XWAYLAND) {
|
if (fullscreen_view->type == SWAY_VIEW_XWAYLAND) {
|
||||||
render_unmanaged(output, damage,
|
render_unmanaged(output, damage,
|
||||||
&root_container.sway_root->xwayland_unmanaged);
|
&root_container.sway_root->xwayland_unmanaged);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f};
|
float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f};
|
||||||
|
|
||||||
@ -888,9 +890,10 @@ void output_render(struct sway_output *output, struct timespec *when,
|
|||||||
|
|
||||||
render_container(output, damage, workspace, workspace->current.focused);
|
render_container(output, damage, workspace, workspace->current.focused);
|
||||||
render_floating(output, damage);
|
render_floating(output, damage);
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
render_unmanaged(output, damage,
|
render_unmanaged(output, damage,
|
||||||
&root_container.sway_root->xwayland_unmanaged);
|
&root_container.sway_root->xwayland_unmanaged);
|
||||||
|
#endif
|
||||||
render_layer(output, damage,
|
render_layer(output, damage,
|
||||||
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
|
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <wlr/types/wlr_idle.h>
|
#include <wlr/types/wlr_idle.h>
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "config.h"
|
||||||
#include "sway/desktop.h"
|
#include "sway/desktop.h"
|
||||||
#include "sway/desktop/transaction.h"
|
#include "sway/desktop/transaction.h"
|
||||||
#include "sway/input/cursor.h"
|
#include "sway/input/cursor.h"
|
||||||
@ -54,6 +55,7 @@ static struct sway_container *container_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
|
||||||
struct wl_list *unmanaged = &root_container.sway_root->xwayland_unmanaged;
|
struct wl_list *unmanaged = &root_container.sway_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) {
|
||||||
@ -69,7 +71,7 @@ static struct sway_container *container_at_coords(
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// find the output the cursor is on
|
// find the output the cursor is on
|
||||||
struct wlr_output_layout *output_layout =
|
struct wlr_output_layout *output_layout =
|
||||||
root_container.sway_root->output_layout;
|
root_container.sway_root->output_layout;
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <wlr/types/wlr_output_layout.h>
|
#include <wlr/types/wlr_output_layout.h>
|
||||||
#include <wlr/types/wlr_xcursor_manager.h>
|
#include <wlr/types/wlr_xcursor_manager.h>
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "config.h"
|
||||||
#include "sway/debug.h"
|
#include "sway/debug.h"
|
||||||
#include "sway/desktop.h"
|
#include "sway/desktop.h"
|
||||||
#include "sway/input/cursor.h"
|
#include "sway/input/cursor.h"
|
||||||
@ -103,11 +104,13 @@ static void seat_send_focus(struct sway_container *con,
|
|||||||
|
|
||||||
if (con->type == C_VIEW
|
if (con->type == C_VIEW
|
||||||
&& seat_is_input_allowed(seat, con->sway_view->surface)) {
|
&& seat_is_input_allowed(seat, con->sway_view->surface)) {
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
if (con->sway_view->type == SWAY_VIEW_XWAYLAND) {
|
if (con->sway_view->type == SWAY_VIEW_XWAYLAND) {
|
||||||
struct wlr_xwayland *xwayland =
|
struct wlr_xwayland *xwayland =
|
||||||
seat->input->server->xwayland.wlr_xwayland;
|
seat->input->server->xwayland.wlr_xwayland;
|
||||||
wlr_xwayland_set_seat(xwayland, seat->wlr_seat);
|
wlr_xwayland_set_seat(xwayland, seat->wlr_seat);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->wlr_seat);
|
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->wlr_seat);
|
||||||
if (keyboard) {
|
if (keyboard) {
|
||||||
wlr_seat_keyboard_notify_enter(seat->wlr_seat,
|
wlr_seat_keyboard_notify_enter(seat->wlr_seat,
|
||||||
|
@ -18,7 +18,6 @@ sway_sources = files(
|
|||||||
'desktop/transaction.c',
|
'desktop/transaction.c',
|
||||||
'desktop/xdg_shell_v6.c',
|
'desktop/xdg_shell_v6.c',
|
||||||
'desktop/xdg_shell.c',
|
'desktop/xdg_shell.c',
|
||||||
'desktop/xwayland.c',
|
|
||||||
|
|
||||||
'input/input-manager.c',
|
'input/input-manager.c',
|
||||||
'input/seat.c',
|
'input/seat.c',
|
||||||
@ -152,6 +151,10 @@ sway_sources = files(
|
|||||||
'tree/output.c',
|
'tree/output.c',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if get_option('enable-xwayland')
|
||||||
|
sway_sources += 'desktop/xwayland.c'
|
||||||
|
endif
|
||||||
|
|
||||||
sway_deps = [
|
sway_deps = [
|
||||||
cairo,
|
cairo,
|
||||||
gdk_pixbuf,
|
gdk_pixbuf,
|
||||||
|
@ -25,7 +25,10 @@
|
|||||||
#include "sway/input/input-manager.h"
|
#include "sway/input/input-manager.h"
|
||||||
#include "sway/server.h"
|
#include "sway/server.h"
|
||||||
#include "sway/tree/layout.h"
|
#include "sway/tree/layout.h"
|
||||||
|
#include "config.h"
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
#include "sway/xwayland.h"
|
#include "sway/xwayland.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
bool server_privileged_prepare(struct sway_server *server) {
|
bool server_privileged_prepare(struct sway_server *server) {
|
||||||
wlr_log(WLR_DEBUG, "Preparing Wayland server initialization");
|
wlr_log(WLR_DEBUG, "Preparing Wayland server initialization");
|
||||||
@ -81,6 +84,7 @@ bool server_init(struct sway_server *server) {
|
|||||||
server->xdg_shell_surface.notify = handle_xdg_shell_surface;
|
server->xdg_shell_surface.notify = handle_xdg_shell_surface;
|
||||||
|
|
||||||
// TODO make xwayland optional
|
// TODO make xwayland optional
|
||||||
|
#ifdef 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,
|
||||||
@ -101,6 +105,7 @@ bool server_init(struct sway_server *server) {
|
|||||||
image->width * 4, image->width, image->height, image->hotspot_x,
|
image->width * 4, image->width, image->height, image->hotspot_x,
|
||||||
image->hotspot_y);
|
image->hotspot_y);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// TODO: Integration with sway borders
|
// TODO: Integration with sway borders
|
||||||
struct wlr_server_decoration_manager *deco_manager =
|
struct wlr_server_decoration_manager *deco_manager =
|
||||||
|
@ -527,10 +527,12 @@ static struct sway_container *container_at_view(struct sway_container *swayc,
|
|||||||
double _sx, _sy;
|
double _sx, _sy;
|
||||||
struct wlr_surface *_surface = NULL;
|
struct wlr_surface *_surface = NULL;
|
||||||
switch (sview->type) {
|
switch (sview->type) {
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
case SWAY_VIEW_XWAYLAND:
|
case SWAY_VIEW_XWAYLAND:
|
||||||
_surface = wlr_surface_surface_at(sview->surface,
|
_surface = wlr_surface_surface_at(sview->surface,
|
||||||
view_sx, view_sy, &_sx, &_sy);
|
view_sx, view_sy, &_sx, &_sy);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case SWAY_VIEW_XDG_SHELL_V6:
|
case SWAY_VIEW_XDG_SHELL_V6:
|
||||||
_surface = wlr_xdg_surface_v6_surface_at(
|
_surface = wlr_xdg_surface_v6_surface_at(
|
||||||
sview->wlr_xdg_surface_v6,
|
sview->wlr_xdg_surface_v6,
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wlr/types/wlr_output.h>
|
#include <wlr/types/wlr_output.h>
|
||||||
#include <wlr/types/wlr_output_layout.h>
|
#include <wlr/types/wlr_output_layout.h>
|
||||||
|
#include "config.h"
|
||||||
#include "sway/debug.h"
|
#include "sway/debug.h"
|
||||||
#include "sway/tree/arrange.h"
|
#include "sway/tree/arrange.h"
|
||||||
#include "sway/tree/container.h"
|
#include "sway/tree/container.h"
|
||||||
@ -39,7 +40,9 @@ void layout_init(void) {
|
|||||||
root_container.sway_root = calloc(1, sizeof(*root_container.sway_root));
|
root_container.sway_root = calloc(1, sizeof(*root_container.sway_root));
|
||||||
root_container.sway_root->output_layout = wlr_output_layout_create();
|
root_container.sway_root->output_layout = wlr_output_layout_create();
|
||||||
wl_list_init(&root_container.sway_root->outputs);
|
wl_list_init(&root_container.sway_root->outputs);
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
wl_list_init(&root_container.sway_root->xwayland_unmanaged);
|
wl_list_init(&root_container.sway_root->xwayland_unmanaged);
|
||||||
|
#endif
|
||||||
wl_list_init(&root_container.sway_root->drag_icons);
|
wl_list_init(&root_container.sway_root->drag_icons);
|
||||||
wl_signal_init(&root_container.sway_root->events.new_container);
|
wl_signal_init(&root_container.sway_root->events.new_container);
|
||||||
root_container.sway_root->scratchpad = create_list();
|
root_container.sway_root->scratchpad = create_list();
|
||||||
|
@ -3,7 +3,10 @@
|
|||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
#include <wlr/types/wlr_output_layout.h>
|
#include <wlr/types/wlr_output_layout.h>
|
||||||
|
#include "config.h"
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
#include <wlr/xwayland.h>
|
#include <wlr/xwayland.h>
|
||||||
|
#endif
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "sway/criteria.h"
|
#include "sway/criteria.h"
|
||||||
@ -108,14 +111,14 @@ const char *view_get_instance(struct sway_view *view) {
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#ifdef 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);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
const char *view_get_window_role(struct sway_view *view) {
|
const char *view_get_window_role(struct sway_view *view) {
|
||||||
if (view->impl->get_string_prop) {
|
if (view->impl->get_string_prop) {
|
||||||
return view->impl->get_string_prop(view, VIEW_PROP_WINDOW_ROLE);
|
return view->impl->get_string_prop(view, VIEW_PROP_WINDOW_ROLE);
|
||||||
@ -136,8 +139,10 @@ 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
|
||||||
case SWAY_VIEW_XWAYLAND:
|
case SWAY_VIEW_XWAYLAND:
|
||||||
return "xwayland";
|
return "xwayland";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
@ -563,6 +568,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
#ifdef 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(wlr_surface);
|
wlr_xwayland_surface_from_wlr_surface(wlr_surface);
|
||||||
@ -572,6 +578,11 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) {
|
|||||||
wl_resource_get_client(wlr_surface->resource);
|
wl_resource_get_client(wlr_surface->resource);
|
||||||
wl_client_get_credentials(client, &pid, NULL, NULL);
|
wl_client_get_credentials(client, &pid, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
struct wl_client *client =
|
||||||
|
wl_resource_get_client(wlr_surface->resource);
|
||||||
|
wl_client_get_credentials(client, &pid, NULL, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
||||||
struct sway_container *target_sibling =
|
struct sway_container *target_sibling =
|
||||||
@ -825,11 +836,13 @@ 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 (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);
|
||||||
return view_from_wlr_xwayland_surface(xsurface);
|
return view_from_wlr_xwayland_surface(xsurface);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (wlr_surface_is_subsurface(wlr_surface)) {
|
if (wlr_surface_is_subsurface(wlr_surface)) {
|
||||||
struct wlr_subsurface *subsurface =
|
struct wlr_subsurface *subsurface =
|
||||||
wlr_subsurface_from_wlr_surface(wlr_surface);
|
wlr_subsurface_from_wlr_surface(wlr_surface);
|
||||||
|
Loading…
Reference in New Issue
Block a user