diff options
41 files changed, 132 insertions, 73 deletions
diff --git a/.builds/alpine.yml b/.builds/alpine.yml index 59df7737..055e5ffa 100644 --- a/.builds/alpine.yml +++ b/.builds/alpine.yml | |||
@@ -38,9 +38,14 @@ tasks: | |||
38 | cd sway | 38 | cd sway |
39 | ninja -C build | 39 | ninja -C build |
40 | - build-no-xwayland: | | 40 | - build-no-xwayland: | |
41 | cd sway | 41 | cd wlroots |
42 | meson configure build -Dxwayland=disabled | 42 | meson configure build -Dxwayland=disabled |
43 | ninja -C build | 43 | ninja -C build |
44 | sudo ninja -C build install | ||
45 | |||
46 | cd ../sway | ||
47 | meson configure build --clearcache | ||
48 | ninja -C build | ||
44 | - build-static: | | 49 | - build-static: | |
45 | cd sway | 50 | cd sway |
46 | mkdir subprojects | 51 | mkdir subprojects |
diff --git a/include/sway/criteria.h b/include/sway/criteria.h index 8da345ea..ae546821 100644 --- a/include/sway/criteria.h +++ b/include/sway/criteria.h | |||
@@ -7,6 +7,10 @@ | |||
7 | #include "list.h" | 7 | #include "list.h" |
8 | #include "tree/view.h" | 8 | #include "tree/view.h" |
9 | 9 | ||
10 | #if WLR_HAS_XWAYLAND | ||
11 | #include "sway/xwayland.h" | ||
12 | #endif | ||
13 | |||
10 | enum criteria_type { | 14 | enum criteria_type { |
11 | CT_COMMAND = 1 << 0, | 15 | CT_COMMAND = 1 << 0, |
12 | CT_ASSIGN_OUTPUT = 1 << 1, | 16 | CT_ASSIGN_OUTPUT = 1 << 1, |
@@ -36,7 +40,7 @@ struct criteria { | |||
36 | struct pattern *app_id; | 40 | struct pattern *app_id; |
37 | struct pattern *con_mark; | 41 | struct pattern *con_mark; |
38 | uint32_t con_id; // internal ID | 42 | uint32_t con_id; // internal ID |
39 | #if HAVE_XWAYLAND | 43 | #if WLR_HAS_XWAYLAND |
40 | struct pattern *class; | 44 | struct pattern *class; |
41 | uint32_t id; // X11 window ID | 45 | uint32_t id; // X11 window ID |
42 | struct pattern *instance; | 46 | struct pattern *instance; |
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h index 45c75199..b014e18f 100644 --- a/include/sway/input/input-manager.h +++ b/include/sway/input/input-manager.h | |||
@@ -5,10 +5,11 @@ | |||
5 | #include <wlr/types/wlr_virtual_keyboard_v1.h> | 5 | #include <wlr/types/wlr_virtual_keyboard_v1.h> |
6 | #include <wlr/types/wlr_virtual_pointer_v1.h> | 6 | #include <wlr/types/wlr_virtual_pointer_v1.h> |
7 | #include <wlr/types/wlr_transient_seat_v1.h> | 7 | #include <wlr/types/wlr_transient_seat_v1.h> |
8 | #include "sway/server.h" | ||
9 | #include "sway/config.h" | 8 | #include "sway/config.h" |
10 | #include "list.h" | 9 | #include "list.h" |
11 | 10 | ||
11 | struct sway_server; | ||
12 | |||
12 | struct sway_input_device { | 13 | struct sway_input_device { |
13 | char *identifier; | 14 | char *identifier; |
14 | struct wlr_input_device *wlr_device; | 15 | struct wlr_input_device *wlr_device; |
diff --git a/include/sway/server.h b/include/sway/server.h index c71851f6..3a63df34 100644 --- a/include/sway/server.h +++ b/include/sway/server.h | |||
@@ -5,7 +5,7 @@ | |||
5 | #include "config.h" | 5 | #include "config.h" |
6 | #include "list.h" | 6 | #include "list.h" |
7 | #include "sway/desktop/idle_inhibit_v1.h" | 7 | #include "sway/desktop/idle_inhibit_v1.h" |
8 | #if HAVE_XWAYLAND | 8 | #if WLR_HAS_XWAYLAND |
9 | #include "sway/xwayland.h" | 9 | #include "sway/xwayland.h" |
10 | #endif | 10 | #endif |
11 | 11 | ||
@@ -59,7 +59,7 @@ struct sway_server { | |||
59 | 59 | ||
60 | struct wlr_tablet_manager_v2 *tablet_v2; | 60 | struct wlr_tablet_manager_v2 *tablet_v2; |
61 | 61 | ||
62 | #if HAVE_XWAYLAND | 62 | #if WLR_HAS_XWAYLAND |
63 | struct sway_xwayland xwayland; | 63 | struct sway_xwayland xwayland; |
64 | struct wl_listener xwayland_surface; | 64 | struct wl_listener xwayland_surface; |
65 | struct wl_listener xwayland_ready; | 65 | struct wl_listener xwayland_ready; |
@@ -81,6 +81,8 @@ struct sway_server { | |||
81 | struct wlr_pointer_constraints_v1 *pointer_constraints; | 81 | struct wlr_pointer_constraints_v1 *pointer_constraints; |
82 | struct wl_listener pointer_constraint; | 82 | struct wl_listener pointer_constraint; |
83 | 83 | ||
84 | struct wlr_xdg_output_manager_v1 *xdg_output_manager_v1; | ||
85 | |||
84 | struct wlr_output_manager_v1 *output_manager_v1; | 86 | struct wlr_output_manager_v1 *output_manager_v1; |
85 | struct wl_listener output_manager_apply; | 87 | struct wl_listener output_manager_apply; |
86 | struct wl_listener output_manager_test; | 88 | struct wl_listener output_manager_test; |
@@ -165,7 +167,7 @@ void sway_session_lock_add_output(struct sway_session_lock *lock, | |||
165 | bool sway_session_lock_has_surface(struct sway_session_lock *lock, | 167 | bool sway_session_lock_has_surface(struct sway_session_lock *lock, |
166 | struct wlr_surface *surface); | 168 | struct wlr_surface *surface); |
167 | void handle_xdg_shell_toplevel(struct wl_listener *listener, void *data); | 169 | void handle_xdg_shell_toplevel(struct wl_listener *listener, void *data); |
168 | #if HAVE_XWAYLAND | 170 | #if WLR_HAS_XWAYLAND |
169 | void handle_xwayland_surface(struct wl_listener *listener, void *data); | 171 | void handle_xwayland_surface(struct wl_listener *listener, void *data); |
170 | #endif | 172 | #endif |
171 | void handle_server_decoration(struct wl_listener *listener, void *data); | 173 | void handle_server_decoration(struct wl_listener *listener, void *data); |
diff --git a/include/sway/tree/root.h b/include/sway/tree/root.h index 15df0f55..7de0abcd 100644 --- a/include/sway/tree/root.h +++ b/include/sway/tree/root.h | |||
@@ -2,12 +2,12 @@ | |||
2 | #define _SWAY_ROOT_H | 2 | #define _SWAY_ROOT_H |
3 | #include <wayland-server-core.h> | 3 | #include <wayland-server-core.h> |
4 | #include <wayland-util.h> | 4 | #include <wayland-util.h> |
5 | #include <wlr/config.h> | ||
5 | #include <wlr/types/wlr_output_layout.h> | 6 | #include <wlr/types/wlr_output_layout.h> |
6 | #include <wlr/types/wlr_scene.h> | 7 | #include <wlr/types/wlr_scene.h> |
7 | #include <wlr/render/wlr_texture.h> | 8 | #include <wlr/render/wlr_texture.h> |
8 | #include "sway/tree/container.h" | 9 | #include "sway/tree/container.h" |
9 | #include "sway/tree/node.h" | 10 | #include "sway/tree/node.h" |
10 | #include "config.h" | ||
11 | #include "list.h" | 11 | #include "list.h" |
12 | 12 | ||
13 | extern struct sway_root *root; | 13 | extern struct sway_root *root; |
@@ -47,7 +47,7 @@ struct sway_root { | |||
47 | struct wlr_scene_tree *shell_top; | 47 | struct wlr_scene_tree *shell_top; |
48 | struct wlr_scene_tree *fullscreen; | 48 | struct wlr_scene_tree *fullscreen; |
49 | struct wlr_scene_tree *fullscreen_global; | 49 | struct wlr_scene_tree *fullscreen_global; |
50 | #if HAVE_XWAYLAND | 50 | #if WLR_HAS_XWAYLAND |
51 | struct wlr_scene_tree *unmanaged; | 51 | struct wlr_scene_tree *unmanaged; |
52 | #endif | 52 | #endif |
53 | struct wlr_scene_tree *shell_overlay; | 53 | struct wlr_scene_tree *shell_overlay; |
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 7faacdcc..3ae8cf22 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -1,10 +1,11 @@ | |||
1 | #ifndef _SWAY_VIEW_H | 1 | #ifndef _SWAY_VIEW_H |
2 | #define _SWAY_VIEW_H | 2 | #define _SWAY_VIEW_H |
3 | #include <wayland-server-core.h> | 3 | #include <wayland-server-core.h> |
4 | #include <wlr/config.h> | ||
4 | #include <wlr/types/wlr_compositor.h> | 5 | #include <wlr/types/wlr_compositor.h> |
5 | #include <wlr/types/wlr_scene.h> | 6 | #include <wlr/types/wlr_scene.h> |
6 | #include "sway/config.h" | 7 | #include "sway/config.h" |
7 | #if HAVE_XWAYLAND | 8 | #if WLR_HAS_XWAYLAND |
8 | #include <wlr/xwayland.h> | 9 | #include <wlr/xwayland.h> |
9 | #endif | 10 | #endif |
10 | #include "sway/input/input-manager.h" | 11 | #include "sway/input/input-manager.h" |
@@ -15,7 +16,7 @@ struct sway_xdg_decoration; | |||
15 | 16 | ||
16 | enum sway_view_type { | 17 | enum sway_view_type { |
17 | SWAY_VIEW_XDG_SHELL, | 18 | SWAY_VIEW_XDG_SHELL, |
18 | #if HAVE_XWAYLAND | 19 | #if WLR_HAS_XWAYLAND |
19 | SWAY_VIEW_XWAYLAND, | 20 | SWAY_VIEW_XWAYLAND, |
20 | #endif | 21 | #endif |
21 | }; | 22 | }; |
@@ -27,7 +28,7 @@ enum sway_view_prop { | |||
27 | VIEW_PROP_INSTANCE, | 28 | VIEW_PROP_INSTANCE, |
28 | VIEW_PROP_WINDOW_TYPE, | 29 | VIEW_PROP_WINDOW_TYPE, |
29 | VIEW_PROP_WINDOW_ROLE, | 30 | VIEW_PROP_WINDOW_ROLE, |
30 | #if HAVE_XWAYLAND | 31 | #if WLR_HAS_XWAYLAND |
31 | VIEW_PROP_X11_WINDOW_ID, | 32 | VIEW_PROP_X11_WINDOW_ID, |
32 | VIEW_PROP_X11_PARENT_ID, | 33 | VIEW_PROP_X11_PARENT_ID, |
33 | #endif | 34 | #endif |
@@ -98,7 +99,7 @@ struct sway_view { | |||
98 | 99 | ||
99 | union { | 100 | union { |
100 | struct wlr_xdg_toplevel *wlr_xdg_toplevel; | 101 | struct wlr_xdg_toplevel *wlr_xdg_toplevel; |
101 | #if HAVE_XWAYLAND | 102 | #if WLR_HAS_XWAYLAND |
102 | struct wlr_xwayland_surface *wlr_xwayland_surface; | 103 | struct wlr_xwayland_surface *wlr_xwayland_surface; |
103 | #endif | 104 | #endif |
104 | }; | 105 | }; |
@@ -127,7 +128,7 @@ struct sway_xdg_shell_view { | |||
127 | struct wl_listener unmap; | 128 | struct wl_listener unmap; |
128 | struct wl_listener destroy; | 129 | struct wl_listener destroy; |
129 | }; | 130 | }; |
130 | #if HAVE_XWAYLAND | 131 | #if WLR_HAS_XWAYLAND |
131 | struct sway_xwayland_view { | 132 | struct sway_xwayland_view { |
132 | struct sway_view view; | 133 | struct sway_view view; |
133 | 134 | ||
@@ -293,7 +294,7 @@ void view_center_and_clip_surface(struct sway_view *view); | |||
293 | 294 | ||
294 | struct sway_view *view_from_wlr_xdg_surface( | 295 | struct sway_view *view_from_wlr_xdg_surface( |
295 | struct wlr_xdg_surface *xdg_surface); | 296 | struct wlr_xdg_surface *xdg_surface); |
296 | #if HAVE_XWAYLAND | 297 | #if WLR_HAS_XWAYLAND |
297 | struct sway_view *view_from_wlr_xwayland_surface( | 298 | struct sway_view *view_from_wlr_xwayland_surface( |
298 | struct wlr_xwayland_surface *xsurface); | 299 | struct wlr_xwayland_surface *xsurface); |
299 | #endif | 300 | #endif |
diff --git a/meson.build b/meson.build index 1043e4ba..eb66506a 100644 --- a/meson.build +++ b/meson.build | |||
@@ -45,7 +45,7 @@ subproject( | |||
45 | required: false, | 45 | required: false, |
46 | version: wlroots_version, | 46 | version: wlroots_version, |
47 | ) | 47 | ) |
48 | wlroots = dependency('wlroots', version: wlroots_version) | 48 | wlroots = dependency('wlroots-0.18', version: wlroots_version, fallback: 'wlroots') |
49 | wlroots_features = { | 49 | wlroots_features = { |
50 | 'xwayland': false, | 50 | 'xwayland': false, |
51 | 'libinput_backend': false, | 51 | 'libinput_backend': false, |
@@ -57,10 +57,6 @@ foreach name, _ : wlroots_features | |||
57 | wlroots_features += { name: have } | 57 | wlroots_features += { name: have } |
58 | endforeach | 58 | endforeach |
59 | 59 | ||
60 | if get_option('xwayland').enabled() and not wlroots_features['xwayland'] | ||
61 | error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support') | ||
62 | endif | ||
63 | |||
64 | null_dep = dependency('', required: false) | 60 | null_dep = dependency('', required: false) |
65 | 61 | ||
66 | jsonc = dependency('json-c', version: '>=0.13') | 62 | jsonc = dependency('json-c', version: '>=0.13') |
@@ -68,7 +64,7 @@ pcre2 = dependency('libpcre2-8') | |||
68 | wayland_server = dependency('wayland-server', version: '>=1.21.0') | 64 | wayland_server = dependency('wayland-server', version: '>=1.21.0') |
69 | wayland_client = dependency('wayland-client') | 65 | wayland_client = dependency('wayland-client') |
70 | wayland_cursor = dependency('wayland-cursor') | 66 | wayland_cursor = dependency('wayland-cursor') |
71 | wayland_protos = dependency('wayland-protocols', version: '>=1.24') | 67 | wayland_protos = dependency('wayland-protocols', version: '>=1.24', default_options: ['tests=false']) |
72 | xkbcommon = dependency('xkbcommon', version: '>=1.5.0') | 68 | xkbcommon = dependency('xkbcommon', version: '>=1.5.0') |
73 | cairo = dependency('cairo') | 69 | cairo = dependency('cairo') |
74 | pango = dependency('pango') | 70 | pango = dependency('pango') |
@@ -77,16 +73,14 @@ gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf')) | |||
77 | pixman = dependency('pixman-1') | 73 | pixman = dependency('pixman-1') |
78 | libevdev = dependency('libevdev') | 74 | libevdev = dependency('libevdev') |
79 | libinput = wlroots_features['libinput_backend'] ? dependency('libinput', version: '>=1.21.0') : null_dep | 75 | libinput = wlroots_features['libinput_backend'] ? dependency('libinput', version: '>=1.21.0') : null_dep |
80 | xcb = dependency('xcb', required: get_option('xwayland')) | 76 | xcb = wlroots_features['xwayland'] ? dependency('xcb') : null_dep |
81 | drm = dependency('libdrm') | 77 | drm = dependency('libdrm') |
82 | libudev = wlroots_features['libinput_backend'] ? dependency('libudev') : null_dep | 78 | libudev = wlroots_features['libinput_backend'] ? dependency('libudev') : null_dep |
83 | math = cc.find_library('m') | 79 | math = cc.find_library('m') |
84 | rt = cc.find_library('rt') | 80 | rt = cc.find_library('rt') |
85 | xcb_icccm = dependency('xcb-icccm', required: get_option('xwayland')) | 81 | xcb_icccm = wlroots_features['xwayland'] ? dependency('xcb-icccm') : null_dep |
86 | threads = dependency('threads') # for pthread_setschedparam | 82 | threads = dependency('threads') # for pthread_setschedparam |
87 | 83 | ||
88 | have_xwayland = xcb.found() and xcb_icccm.found() and wlroots_features['xwayland'] | ||
89 | |||
90 | if get_option('sd-bus-provider') == 'auto' | 84 | if get_option('sd-bus-provider') == 'auto' |
91 | if not get_option('tray').disabled() | 85 | if not get_option('tray').disabled() |
92 | assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto') | 86 | assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto') |
@@ -110,7 +104,6 @@ have_tray = (not get_option('tray').disabled()) and tray_deps_found | |||
110 | 104 | ||
111 | conf_data = configuration_data() | 105 | conf_data = configuration_data() |
112 | 106 | ||
113 | conf_data.set10('HAVE_XWAYLAND', have_xwayland) | ||
114 | conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found()) | 107 | conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found()) |
115 | conf_data.set10('HAVE_LIBSYSTEMD', sdbus.found() and sdbus.name() == 'libsystemd') | 108 | conf_data.set10('HAVE_LIBSYSTEMD', sdbus.found() and sdbus.name() == 'libsystemd') |
116 | conf_data.set10('HAVE_LIBELOGIND', sdbus.found() and sdbus.name() == 'libelogind') | 109 | conf_data.set10('HAVE_LIBELOGIND', sdbus.found() and sdbus.name() == 'libelogind') |
@@ -271,7 +264,6 @@ endif | |||
271 | subdir('completions') | 264 | subdir('completions') |
272 | 265 | ||
273 | summary({ | 266 | summary({ |
274 | 'xwayland': have_xwayland, | ||
275 | 'gdk-pixbuf': gdk_pixbuf.found(), | 267 | 'gdk-pixbuf': gdk_pixbuf.found(), |
276 | 'tray': have_tray, | 268 | 'tray': have_tray, |
277 | 'man-pages': scdoc.found(), | 269 | 'man-pages': scdoc.found(), |
diff --git a/meson_options.txt b/meson_options.txt index 8d0d6509..506ecc9a 100644 --- a/meson_options.txt +++ b/meson_options.txt | |||
@@ -4,7 +4,6 @@ option('bash-completions', type: 'boolean', value: true, description: 'Install b | |||
4 | option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.') | 4 | option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.') |
5 | option('swaybar', type: 'boolean', value: true, description: 'Enable support for swaybar') | 5 | option('swaybar', type: 'boolean', value: true, description: 'Enable support for swaybar') |
6 | option('swaynag', type: 'boolean', value: true, description: 'Enable support for swaynag') | 6 | option('swaynag', type: 'boolean', value: true, description: 'Enable support for swaynag') |
7 | option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications') | ||
8 | option('tray', type: 'feature', value: 'auto', description: 'Enable support for swaybar tray') | 7 | option('tray', type: 'feature', value: 'auto', description: 'Enable support for swaybar tray') |
9 | option('gdk-pixbuf', type: 'feature', value: 'auto', description: 'Enable support for more image formats in swaybar tray') | 8 | option('gdk-pixbuf', type: 'feature', value: 'auto', description: 'Enable support for more image formats in swaybar tray') |
10 | option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages') | 9 | option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages') |
diff --git a/sway/commands/input/events.c b/sway/commands/input/events.c index 08d99bf0..3cea026e 100644 --- a/sway/commands/input/events.c +++ b/sway/commands/input/events.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include "sway/config.h" | 5 | #include "sway/config.h" |
6 | #include "sway/commands.h" | 6 | #include "sway/commands.h" |
7 | #include "sway/input/input-manager.h" | 7 | #include "sway/input/input-manager.h" |
8 | #include "sway/server.h" | ||
8 | #include "log.h" | 9 | #include "log.h" |
9 | 10 | ||
10 | #if WLR_HAS_LIBINPUT_BACKEND | 11 | #if WLR_HAS_LIBINPUT_BACKEND |
diff --git a/sway/commands/input/xkb_switch_layout.c b/sway/commands/input/xkb_switch_layout.c index ecac8e6c..8d600fca 100644 --- a/sway/commands/input/xkb_switch_layout.c +++ b/sway/commands/input/xkb_switch_layout.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include "sway/config.h" | 3 | #include "sway/config.h" |
4 | #include "sway/commands.h" | 4 | #include "sway/commands.h" |
5 | #include "sway/input/input-manager.h" | 5 | #include "sway/input/input-manager.h" |
6 | #include "sway/server.h" | ||
6 | #include "log.h" | 7 | #include "log.h" |
7 | 8 | ||
8 | struct xkb_switch_layout_action { | 9 | struct xkb_switch_layout_action { |
diff --git a/sway/commands/move.c b/sway/commands/move.c index 8addf26e..ff656cfb 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include "sway/input/seat.h" | 11 | #include "sway/input/seat.h" |
12 | #include "sway/ipc-server.h" | 12 | #include "sway/ipc-server.h" |
13 | #include "sway/output.h" | 13 | #include "sway/output.h" |
14 | #include "sway/server.h" | ||
14 | #include "sway/tree/arrange.h" | 15 | #include "sway/tree/arrange.h" |
15 | #include "sway/tree/container.h" | 16 | #include "sway/tree/container.h" |
16 | #include "sway/tree/root.h" | 17 | #include "sway/tree/root.h" |
diff --git a/sway/commands/seat/cursor.c b/sway/commands/seat/cursor.c index df7c379d..434e6bbb 100644 --- a/sway/commands/seat/cursor.c +++ b/sway/commands/seat/cursor.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <wlr/types/wlr_pointer.h> | 5 | #include <wlr/types/wlr_pointer.h> |
6 | #include "sway/commands.h" | 6 | #include "sway/commands.h" |
7 | #include "sway/input/cursor.h" | 7 | #include "sway/input/cursor.h" |
8 | #include "sway/server.h" | ||
8 | 9 | ||
9 | static struct cmd_results *press_or_release(struct sway_cursor *cursor, | 10 | static struct cmd_results *press_or_release(struct sway_cursor *cursor, |
10 | char *action, char *button_str); | 11 | char *action, char *button_str); |
diff --git a/sway/commands/seat/pointer_constraint.c b/sway/commands/seat/pointer_constraint.c index 3890ebde..38f85bcd 100644 --- a/sway/commands/seat/pointer_constraint.c +++ b/sway/commands/seat/pointer_constraint.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include "sway/config.h" | 4 | #include "sway/config.h" |
5 | #include "sway/input/cursor.h" | 5 | #include "sway/input/cursor.h" |
6 | #include "sway/input/seat.h" | 6 | #include "sway/input/seat.h" |
7 | #include "sway/server.h" | ||
7 | 8 | ||
8 | enum operation { | 9 | enum operation { |
9 | OP_ENABLE, | 10 | OP_ENABLE, |
diff --git a/sway/commands/seat/shortcuts_inhibitor.c b/sway/commands/seat/shortcuts_inhibitor.c index 7c7f99cf..df68618d 100644 --- a/sway/commands/seat/shortcuts_inhibitor.c +++ b/sway/commands/seat/shortcuts_inhibitor.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include "sway/commands.h" | 2 | #include "sway/commands.h" |
3 | #include "sway/input/seat.h" | 3 | #include "sway/input/seat.h" |
4 | #include "sway/input/input-manager.h" | 4 | #include "sway/input/input-manager.h" |
5 | #include "sway/server.h" | ||
5 | #include "util.h" | 6 | #include "util.h" |
6 | 7 | ||
7 | static struct cmd_results *handle_action(struct seat_config *sc, | 8 | static struct cmd_results *handle_action(struct seat_config *sc, |
diff --git a/sway/commands/shortcuts_inhibitor.c b/sway/commands/shortcuts_inhibitor.c index ffa1a5c9..2dfd1b9f 100644 --- a/sway/commands/shortcuts_inhibitor.c +++ b/sway/commands/shortcuts_inhibitor.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include "sway/commands.h" | 3 | #include "sway/commands.h" |
4 | #include "sway/config.h" | 4 | #include "sway/config.h" |
5 | #include "sway/input/seat.h" | 5 | #include "sway/input/seat.h" |
6 | #include "sway/server.h" | ||
6 | #include "sway/tree/container.h" | 7 | #include "sway/tree/container.h" |
7 | #include "sway/tree/view.h" | 8 | #include "sway/tree/view.h" |
8 | 9 | ||
diff --git a/sway/commands/swap.c b/sway/commands/swap.c index e142eede..c0b0d0b9 100644 --- a/sway/commands/swap.c +++ b/sway/commands/swap.c | |||
@@ -18,7 +18,7 @@ static bool test_con_id(struct sway_container *container, void *data) { | |||
18 | return container->node.id == *con_id; | 18 | return container->node.id == *con_id; |
19 | } | 19 | } |
20 | 20 | ||
21 | #if HAVE_XWAYLAND | 21 | #if WLR_HAS_XWAYLAND |
22 | static bool test_id(struct sway_container *container, void *data) { | 22 | static bool test_id(struct sway_container *container, void *data) { |
23 | xcb_window_t *wid = data; | 23 | xcb_window_t *wid = data; |
24 | return (container->view && container->view->type == SWAY_VIEW_XWAYLAND | 24 | return (container->view && container->view->type == SWAY_VIEW_XWAYLAND |
@@ -53,7 +53,7 @@ struct cmd_results *cmd_swap(int argc, char **argv) { | |||
53 | 53 | ||
54 | char *value = join_args(argv + 3, argc - 3); | 54 | char *value = join_args(argv + 3, argc - 3); |
55 | if (strcasecmp(argv[2], "id") == 0) { | 55 | if (strcasecmp(argv[2], "id") == 0) { |
56 | #if HAVE_XWAYLAND | 56 | #if WLR_HAS_XWAYLAND |
57 | xcb_window_t id = strtol(value, NULL, 0); | 57 | xcb_window_t id = strtol(value, NULL, 0); |
58 | other = root_find_container(test_id, &id); | 58 | other = root_find_container(test_id, &id); |
59 | #endif | 59 | #endif |
diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c index a14ebb20..37a201b4 100644 --- a/sway/commands/workspace.c +++ b/sway/commands/workspace.c | |||
@@ -157,6 +157,10 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { | |||
157 | return cmd_results_new(CMD_FAILURE, | 157 | return cmd_results_new(CMD_FAILURE, |
158 | "Unable to allocate workspace output"); | 158 | "Unable to allocate workspace output"); |
159 | } | 159 | } |
160 | if (output_location + 1 < argc) { | ||
161 | list_free_items_and_destroy(wsc->outputs); | ||
162 | wsc->outputs = create_list(); | ||
163 | } | ||
160 | for (int i = output_location + 1; i < argc; ++i) { | 164 | for (int i = output_location + 1; i < argc; ++i) { |
161 | list_add(wsc->outputs, strdup(argv[i])); | 165 | list_add(wsc->outputs, strdup(argv[i])); |
162 | } | 166 | } |
diff --git a/sway/commands/xwayland.c b/sway/commands/xwayland.c index 584a8e3a..c0b175fc 100644 --- a/sway/commands/xwayland.c +++ b/sway/commands/xwayland.c | |||
@@ -10,7 +10,7 @@ struct cmd_results *cmd_xwayland(int argc, char **argv) { | |||
10 | return error; | 10 | return error; |
11 | } | 11 | } |
12 | 12 | ||
13 | #ifdef HAVE_XWAYLAND | 13 | #ifdef WLR_HAS_XWAYLAND |
14 | enum xwayland_mode xwayland; | 14 | enum xwayland_mode xwayland; |
15 | if (strcmp(argv[0], "force") == 0) { | 15 | if (strcmp(argv[0], "force") == 0) { |
16 | xwayland = XWAYLAND_MODE_IMMEDIATE; | 16 | xwayland = XWAYLAND_MODE_IMMEDIATE; |
diff --git a/sway/config.c b/sway/config.c index f9131e0f..5058efcc 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "sway/config.h" | 23 | #include "sway/config.h" |
24 | #include "sway/criteria.h" | 24 | #include "sway/criteria.h" |
25 | #include "sway/desktop/transaction.h" | 25 | #include "sway/desktop/transaction.h" |
26 | #include "sway/server.h" | ||
26 | #include "sway/swaynag.h" | 27 | #include "sway/swaynag.h" |
27 | #include "sway/tree/arrange.h" | 28 | #include "sway/tree/arrange.h" |
28 | #include "sway/tree/root.h" | 29 | #include "sway/tree/root.h" |
diff --git a/sway/config/bar.c b/sway/config/bar.c index 908b2865..ecefb61a 100644 --- a/sway/config/bar.c +++ b/sway/config/bar.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include "sway/config.h" | 12 | #include "sway/config.h" |
13 | #include "sway/input/keyboard.h" | 13 | #include "sway/input/keyboard.h" |
14 | #include "sway/output.h" | 14 | #include "sway/output.h" |
15 | #include "sway/server.h" | ||
15 | #include "config.h" | 16 | #include "config.h" |
16 | #include "list.h" | 17 | #include "list.h" |
17 | #include "log.h" | 18 | #include "log.h" |
diff --git a/sway/config/input.c b/sway/config/input.c index de3b21ed..613270df 100644 --- a/sway/config/input.c +++ b/sway/config/input.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <float.h> | 3 | #include <float.h> |
4 | #include "sway/config.h" | 4 | #include "sway/config.h" |
5 | #include "sway/input/keyboard.h" | 5 | #include "sway/input/keyboard.h" |
6 | #include "sway/server.h" | ||
6 | #include "log.h" | 7 | #include "log.h" |
7 | 8 | ||
8 | struct input_config *new_input_config(const char* identifier) { | 9 | struct input_config *new_input_config(const char* identifier) { |
diff --git a/sway/config/output.c b/sway/config/output.c index fb1956df..9a447388 100644 --- a/sway/config/output.c +++ b/sway/config/output.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include "sway/config.h" | 13 | #include "sway/config.h" |
14 | #include "sway/input/cursor.h" | 14 | #include "sway/input/cursor.h" |
15 | #include "sway/output.h" | 15 | #include "sway/output.h" |
16 | #include "sway/server.h" | ||
16 | #include "sway/tree/root.h" | 17 | #include "sway/tree/root.h" |
17 | #include "log.h" | 18 | #include "log.h" |
18 | #include "util.h" | 19 | #include "util.h" |
@@ -448,7 +449,7 @@ static void queue_output_config(struct output_config *oc, | |||
448 | #endif | 449 | #endif |
449 | } | 450 | } |
450 | if (wlr_output->transform != tr) { | 451 | if (wlr_output->transform != tr) { |
451 | sway_log(SWAY_DEBUG, "Set %s transform to %d", oc->name, tr); | 452 | sway_log(SWAY_DEBUG, "Set %s transform to %d", wlr_output->name, tr); |
452 | wlr_output_state_set_transform(pending, tr); | 453 | wlr_output_state_set_transform(pending, tr); |
453 | } | 454 | } |
454 | 455 | ||
diff --git a/sway/criteria.c b/sway/criteria.c index e16b4fa8..2b7290c0 100644 --- a/sway/criteria.c +++ b/sway/criteria.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include "sway/criteria.h" | 7 | #include "sway/criteria.h" |
8 | #include "sway/tree/container.h" | 8 | #include "sway/tree/container.h" |
9 | #include "sway/config.h" | 9 | #include "sway/config.h" |
10 | #include "sway/server.h" | ||
10 | #include "sway/tree/root.h" | 11 | #include "sway/tree/root.h" |
11 | #include "sway/tree/view.h" | 12 | #include "sway/tree/view.h" |
12 | #include "sway/tree/workspace.h" | 13 | #include "sway/tree/workspace.h" |
@@ -22,7 +23,7 @@ bool criteria_is_empty(struct criteria *criteria) { | |||
22 | && !criteria->app_id | 23 | && !criteria->app_id |
23 | && !criteria->con_mark | 24 | && !criteria->con_mark |
24 | && !criteria->con_id | 25 | && !criteria->con_id |
25 | #if HAVE_XWAYLAND | 26 | #if WLR_HAS_XWAYLAND |
26 | && !criteria->class | 27 | && !criteria->class |
27 | && !criteria->id | 28 | && !criteria->id |
28 | && !criteria->instance | 29 | && !criteria->instance |
@@ -90,7 +91,7 @@ void criteria_destroy(struct criteria *criteria) { | |||
90 | pattern_destroy(criteria->title); | 91 | pattern_destroy(criteria->title); |
91 | pattern_destroy(criteria->shell); | 92 | pattern_destroy(criteria->shell); |
92 | pattern_destroy(criteria->app_id); | 93 | pattern_destroy(criteria->app_id); |
93 | #if HAVE_XWAYLAND | 94 | #if WLR_HAS_XWAYLAND |
94 | pattern_destroy(criteria->class); | 95 | pattern_destroy(criteria->class); |
95 | pattern_destroy(criteria->instance); | 96 | pattern_destroy(criteria->instance); |
96 | pattern_destroy(criteria->window_role); | 97 | pattern_destroy(criteria->window_role); |
@@ -110,7 +111,7 @@ static int regex_cmp(const char *item, const pcre2_code *regex) { | |||
110 | return result; | 111 | return result; |
111 | } | 112 | } |
112 | 113 | ||
113 | #if HAVE_XWAYLAND | 114 | #if WLR_HAS_XWAYLAND |
114 | static bool view_has_window_type(struct sway_view *view, enum atom_name name) { | 115 | static bool view_has_window_type(struct sway_view *view, enum atom_name name) { |
115 | if (view->type != SWAY_VIEW_XWAYLAND) { | 116 | if (view->type != SWAY_VIEW_XWAYLAND) { |
116 | return false; | 117 | return false; |
@@ -251,7 +252,7 @@ static bool criteria_matches_view(struct criteria *criteria, | |||
251 | return false; | 252 | return false; |
252 | } | 253 | } |
253 | 254 | ||
254 | #if HAVE_XWAYLAND | 255 | #if WLR_HAS_XWAYLAND |
255 | if (criteria->id) { // X11 window ID | 256 | if (criteria->id) { // X11 window ID |
256 | uint32_t x11_window_id = view_get_x11_window_id(view); | 257 | uint32_t x11_window_id = view_get_x11_window_id(view); |
257 | if (!x11_window_id || x11_window_id != criteria->id) { | 258 | if (!x11_window_id || x11_window_id != criteria->id) { |
@@ -428,7 +429,7 @@ list_t *criteria_get_containers(struct criteria *criteria) { | |||
428 | return matches; | 429 | return matches; |
429 | } | 430 | } |
430 | 431 | ||
431 | #if HAVE_XWAYLAND | 432 | #if WLR_HAS_XWAYLAND |
432 | static enum atom_name parse_window_type(const char *type) { | 433 | static enum atom_name parse_window_type(const char *type) { |
433 | if (strcasecmp(type, "normal") == 0) { | 434 | if (strcasecmp(type, "normal") == 0) { |
434 | return NET_WM_WINDOW_TYPE_NORMAL; | 435 | return NET_WM_WINDOW_TYPE_NORMAL; |
@@ -461,7 +462,7 @@ enum criteria_token { | |||
461 | T_CON_ID, | 462 | T_CON_ID, |
462 | T_CON_MARK, | 463 | T_CON_MARK, |
463 | T_FLOATING, | 464 | T_FLOATING, |
464 | #if HAVE_XWAYLAND | 465 | #if WLR_HAS_XWAYLAND |
465 | T_CLASS, | 466 | T_CLASS, |
466 | T_ID, | 467 | T_ID, |
467 | T_INSTANCE, | 468 | T_INSTANCE, |
@@ -487,7 +488,7 @@ static enum criteria_token token_from_name(char *name) { | |||
487 | return T_CON_ID; | 488 | return T_CON_ID; |
488 | } else if (strcmp(name, "con_mark") == 0) { | 489 | } else if (strcmp(name, "con_mark") == 0) { |
489 | return T_CON_MARK; | 490 | return T_CON_MARK; |
490 | #if HAVE_XWAYLAND | 491 | #if WLR_HAS_XWAYLAND |
491 | } else if (strcmp(name, "class") == 0) { | 492 | } else if (strcmp(name, "class") == 0) { |
492 | return T_CLASS; | 493 | return T_CLASS; |
493 | } else if (strcmp(name, "id") == 0) { | 494 | } else if (strcmp(name, "id") == 0) { |
@@ -566,7 +567,7 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) { | |||
566 | case T_CON_MARK: | 567 | case T_CON_MARK: |
567 | pattern_create(&criteria->con_mark, value); | 568 | pattern_create(&criteria->con_mark, value); |
568 | break; | 569 | break; |
569 | #if HAVE_XWAYLAND | 570 | #if WLR_HAS_XWAYLAND |
570 | case T_CLASS: | 571 | case T_CLASS: |
571 | pattern_create(&criteria->class, value); | 572 | pattern_create(&criteria->class, value); |
572 | break; | 573 | break; |
@@ -674,7 +675,7 @@ struct criteria *criteria_parse(char *raw, char **error_arg) { | |||
674 | ++head; | 675 | ++head; |
675 | 676 | ||
676 | struct criteria *criteria = calloc(1, sizeof(struct criteria)); | 677 | struct criteria *criteria = calloc(1, sizeof(struct criteria)); |
677 | #if HAVE_XWAYLAND | 678 | #if WLR_HAS_XWAYLAND |
678 | criteria->window_type = ATOM_LAST; // default value | 679 | criteria->window_type = ATOM_LAST; // default value |
679 | #endif | 680 | #endif |
680 | char *name = NULL, *value = NULL; | 681 | char *name = NULL, *value = NULL; |
diff --git a/sway/desktop/launcher.c b/sway/desktop/launcher.c index 28043d19..2362e1ba 100644 --- a/sway/desktop/launcher.c +++ b/sway/desktop/launcher.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include "sway/input/seat.h" | 4 | #include "sway/input/seat.h" |
5 | #include "sway/output.h" | 5 | #include "sway/output.h" |
6 | #include "sway/desktop/launcher.h" | 6 | #include "sway/desktop/launcher.h" |
7 | #include "sway/server.h" | ||
7 | #include "sway/tree/node.h" | 8 | #include "sway/tree/node.h" |
8 | #include "sway/tree/container.h" | 9 | #include "sway/tree/container.h" |
9 | #include "sway/tree/workspace.h" | 10 | #include "sway/tree/workspace.h" |
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index 4b2584b6..6221b7b9 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <string.h> | 3 | #include <string.h> |
4 | #include <wayland-server-core.h> | 4 | #include <wayland-server-core.h> |
5 | #include <wlr/types/wlr_fractional_scale_v1.h> | ||
5 | #include <wlr/types/wlr_layer_shell_v1.h> | 6 | #include <wlr/types/wlr_layer_shell_v1.h> |
6 | #include <wlr/types/wlr_output.h> | 7 | #include <wlr/types/wlr_output.h> |
7 | #include <wlr/types/wlr_scene.h> | 8 | #include <wlr/types/wlr_scene.h> |
@@ -432,6 +433,12 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { | |||
432 | 433 | ||
433 | surface->output = output; | 434 | surface->output = output; |
434 | 435 | ||
436 | // now that the surface's output is known, we can advertise its scale | ||
437 | wlr_fractional_scale_v1_notify_scale(surface->layer_surface->surface, | ||
438 | layer_surface->output->scale); | ||
439 | wlr_surface_set_preferred_buffer_scale(surface->layer_surface->surface, | ||
440 | ceil(layer_surface->output->scale)); | ||
441 | |||
435 | surface->surface_commit.notify = handle_surface_commit; | 442 | surface->surface_commit.notify = handle_surface_commit; |
436 | wl_signal_add(&layer_surface->surface->events.commit, | 443 | wl_signal_add(&layer_surface->surface->events.commit, |
437 | &surface->surface_commit); | 444 | &surface->surface_commit); |
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 042141ab..d1898843 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include "sway/input/cursor.h" | 10 | #include "sway/input/cursor.h" |
11 | #include "sway/input/input-manager.h" | 11 | #include "sway/input/input-manager.h" |
12 | #include "sway/output.h" | 12 | #include "sway/output.h" |
13 | #include "sway/server.h" | ||
13 | #include "sway/tree/container.h" | 14 | #include "sway/tree/container.h" |
14 | #include "sway/tree/node.h" | 15 | #include "sway/tree/node.h" |
15 | #include "sway/tree/view.h" | 16 | #include "sway/tree/view.h" |
@@ -761,7 +762,7 @@ static bool should_configure(struct sway_node *node, | |||
761 | } | 762 | } |
762 | struct sway_container_state *cstate = &node->sway_container->current; | 763 | struct sway_container_state *cstate = &node->sway_container->current; |
763 | struct sway_container_state *istate = &instruction->container_state; | 764 | struct sway_container_state *istate = &instruction->container_state; |
764 | #if HAVE_XWAYLAND | 765 | #if WLR_HAS_XWAYLAND |
765 | // Xwayland views are position-aware and need to be reconfigured | 766 | // Xwayland views are position-aware and need to be reconfigured |
766 | // when their position changes. | 767 | // when their position changes. |
767 | if (node->sway_container->view->type == SWAY_VIEW_XWAYLAND) { | 768 | if (node->sway_container->view->type == SWAY_VIEW_XWAYLAND) { |
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 3d04826c..235951d4 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include "sway/layers.h" | 25 | #include "sway/layers.h" |
26 | #include "sway/output.h" | 26 | #include "sway/output.h" |
27 | #include "sway/scene_descriptor.h" | 27 | #include "sway/scene_descriptor.h" |
28 | #include "sway/server.h" | ||
28 | #include "sway/tree/container.h" | 29 | #include "sway/tree/container.h" |
29 | #include "sway/tree/root.h" | 30 | #include "sway/tree/root.h" |
30 | #include "sway/tree/view.h" | 31 | #include "sway/tree/view.h" |
@@ -107,7 +108,7 @@ struct sway_node *node_at_coords( | |||
107 | return NULL; | 108 | return NULL; |
108 | } | 109 | } |
109 | 110 | ||
110 | #if HAVE_XWAYLAND | 111 | #if WLR_HAS_XWAYLAND |
111 | if (scene_descriptor_try_get(current, SWAY_SCENE_DESC_XWAYLAND_UNMANAGED)) { | 112 | if (scene_descriptor_try_get(current, SWAY_SCENE_DESC_XWAYLAND_UNMANAGED)) { |
112 | return NULL; | 113 | return NULL; |
113 | } | 114 | } |
diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c index f74d0658..9ac21664 100644 --- a/sway/input/keyboard.c +++ b/sway/input/keyboard.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include "sway/input/seat.h" | 13 | #include "sway/input/seat.h" |
14 | #include "sway/input/cursor.h" | 14 | #include "sway/input/cursor.h" |
15 | #include "sway/ipc-server.h" | 15 | #include "sway/ipc-server.h" |
16 | #include "sway/server.h" | ||
16 | #include "log.h" | 17 | #include "log.h" |
17 | 18 | ||
18 | #if WLR_HAS_SESSION | 19 | #if WLR_HAS_SESSION |
diff --git a/sway/input/seat.c b/sway/input/seat.c index 0c5672bc..da4bb12a 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -190,7 +190,7 @@ static void seat_send_focus(struct sway_node *node, struct sway_seat *seat) { | |||
190 | node->sway_container->view : NULL; | 190 | node->sway_container->view : NULL; |
191 | 191 | ||
192 | if (view && seat_is_input_allowed(seat, view->surface)) { | 192 | if (view && seat_is_input_allowed(seat, view->surface)) { |
193 | #if HAVE_XWAYLAND | 193 | #if WLR_HAS_XWAYLAND |
194 | if (view->type == SWAY_VIEW_XWAYLAND) { | 194 | if (view->type == SWAY_VIEW_XWAYLAND) { |
195 | struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland; | 195 | struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland; |
196 | wlr_xwayland_set_seat(xwayland, seat->wlr_seat); | 196 | wlr_xwayland_set_seat(xwayland, seat->wlr_seat); |
@@ -1002,7 +1002,7 @@ void seat_configure_xcursor(struct sway_seat *seat) { | |||
1002 | setenv("XCURSOR_THEME", cursor_theme, 1); | 1002 | setenv("XCURSOR_THEME", cursor_theme, 1); |
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | #if HAVE_XWAYLAND | 1005 | #if WLR_HAS_XWAYLAND |
1006 | if (server.xwayland.wlr_xwayland && (!server.xwayland.xcursor_manager || | 1006 | if (server.xwayland.wlr_xwayland && (!server.xwayland.xcursor_manager || |
1007 | !xcursor_manager_is_named(server.xwayland.xcursor_manager, | 1007 | !xcursor_manager_is_named(server.xwayland.xcursor_manager, |
1008 | cursor_theme) || | 1008 | cursor_theme) || |
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c index 0c6f7c5e..f4a0f463 100644 --- a/sway/input/seatop_default.c +++ b/sway/input/seatop_default.c | |||
@@ -11,11 +11,12 @@ | |||
11 | #include "sway/input/tablet.h" | 11 | #include "sway/input/tablet.h" |
12 | #include "sway/layers.h" | 12 | #include "sway/layers.h" |
13 | #include "sway/output.h" | 13 | #include "sway/output.h" |
14 | #include "sway/server.h" | ||
14 | #include "sway/scene_descriptor.h" | 15 | #include "sway/scene_descriptor.h" |
15 | #include "sway/tree/view.h" | 16 | #include "sway/tree/view.h" |
16 | #include "sway/tree/workspace.h" | 17 | #include "sway/tree/workspace.h" |
17 | #include "log.h" | 18 | #include "log.h" |
18 | #if HAVE_XWAYLAND | 19 | #if WLR_HAS_XWAYLAND |
19 | #include "sway/xwayland.h" | 20 | #include "sway/xwayland.h" |
20 | #endif | 21 | #endif |
21 | 22 | ||
@@ -234,7 +235,7 @@ static void handle_tablet_tool_tip(struct sway_seat *seat, | |||
234 | node->sway_container : NULL; | 235 | node->sway_container : NULL; |
235 | 236 | ||
236 | struct wlr_layer_surface_v1 *layer; | 237 | struct wlr_layer_surface_v1 *layer; |
237 | #if HAVE_XWAYLAND | 238 | #if WLR_HAS_XWAYLAND |
238 | struct wlr_xwayland_surface *xsurface; | 239 | struct wlr_xwayland_surface *xsurface; |
239 | #endif | 240 | #endif |
240 | if ((layer = wlr_layer_surface_v1_try_from_wlr_surface(surface)) && | 241 | if ((layer = wlr_layer_surface_v1_try_from_wlr_surface(surface)) && |
@@ -268,7 +269,7 @@ static void handle_tablet_tool_tip(struct sway_seat *seat, | |||
268 | seat_set_focus_container(seat, cont); | 269 | seat_set_focus_container(seat, cont); |
269 | seatop_begin_down(seat, node->sway_container, sx, sy); | 270 | seatop_begin_down(seat, node->sway_container, sx, sy); |
270 | } | 271 | } |
271 | #if HAVE_XWAYLAND | 272 | #if WLR_HAS_XWAYLAND |
272 | // Handle tapping on an xwayland unmanaged view | 273 | // Handle tapping on an xwayland unmanaged view |
273 | else if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(surface)) && | 274 | else if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(surface)) && |
274 | xsurface->override_redirect && | 275 | xsurface->override_redirect && |
@@ -514,7 +515,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
514 | return; | 515 | return; |
515 | } | 516 | } |
516 | 517 | ||
517 | #if HAVE_XWAYLAND | 518 | #if WLR_HAS_XWAYLAND |
518 | // Handle clicking on xwayland unmanaged view | 519 | // Handle clicking on xwayland unmanaged view |
519 | struct wlr_xwayland_surface *xsurface; | 520 | struct wlr_xwayland_surface *xsurface; |
520 | if (surface && | 521 | if (surface && |
diff --git a/sway/input/switch.c b/sway/input/switch.c index 831f4dbf..6aab4ad0 100644 --- a/sway/input/switch.c +++ b/sway/input/switch.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include "sway/config.h" | 1 | #include "sway/config.h" |
2 | #include "sway/input/switch.h" | 2 | #include "sway/input/switch.h" |
3 | #include "sway/server.h" | ||
3 | #include "log.h" | 4 | #include "log.h" |
4 | 5 | ||
5 | struct sway_switch *sway_switch_create(struct sway_seat *seat, | 6 | struct sway_switch *sway_switch_create(struct sway_seat *seat, |
diff --git a/sway/input/tablet.c b/sway/input/tablet.c index 2863642a..ec1e4f68 100644 --- a/sway/input/tablet.c +++ b/sway/input/tablet.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include "sway/input/cursor.h" | 7 | #include "sway/input/cursor.h" |
8 | #include "sway/input/seat.h" | 8 | #include "sway/input/seat.h" |
9 | #include "sway/input/tablet.h" | 9 | #include "sway/input/tablet.h" |
10 | #include "sway/server.h" | ||
10 | 11 | ||
11 | #if WLR_HAS_LIBINPUT_BACKEND | 12 | #if WLR_HAS_LIBINPUT_BACKEND |
12 | #include <wlr/backend/libinput.h> | 13 | #include <wlr/backend/libinput.h> |
diff --git a/sway/input/text_input.c b/sway/input/text_input.c index c38a3bb2..580a9f54 100644 --- a/sway/input/text_input.c +++ b/sway/input/text_input.c | |||
@@ -9,6 +9,8 @@ | |||
9 | #include "sway/input/text_input.h" | 9 | #include "sway/input/text_input.h" |
10 | #include "sway/input/text_input_popup.h" | 10 | #include "sway/input/text_input_popup.h" |
11 | #include "sway/layers.h" | 11 | #include "sway/layers.h" |
12 | #include "sway/server.h" | ||
13 | |||
12 | static void input_popup_update(struct sway_input_popup *popup); | 14 | static void input_popup_update(struct sway_input_popup *popup); |
13 | 15 | ||
14 | static struct sway_text_input *relay_get_focusable_text_input( | 16 | static struct sway_text_input *relay_get_focusable_text_input( |
@@ -66,11 +68,13 @@ static void handle_im_keyboard_grab_destroy(struct wl_listener *listener, void * | |||
66 | struct sway_input_method_relay *relay = wl_container_of(listener, relay, | 68 | struct sway_input_method_relay *relay = wl_container_of(listener, relay, |
67 | input_method_keyboard_grab_destroy); | 69 | input_method_keyboard_grab_destroy); |
68 | struct wlr_input_method_keyboard_grab_v2 *keyboard_grab = data; | 70 | struct wlr_input_method_keyboard_grab_v2 *keyboard_grab = data; |
71 | struct wlr_seat *wlr_seat = keyboard_grab->input_method->seat; | ||
69 | wl_list_remove(&relay->input_method_keyboard_grab_destroy.link); | 72 | wl_list_remove(&relay->input_method_keyboard_grab_destroy.link); |
70 | 73 | ||
71 | if (keyboard_grab->keyboard) { | 74 | if (keyboard_grab->keyboard) { |
72 | // send modifier state to original client | 75 | // send modifier state to original client |
73 | wlr_seat_keyboard_notify_modifiers(keyboard_grab->input_method->seat, | 76 | wlr_seat_set_keyboard(wlr_seat, keyboard_grab->keyboard); |
77 | wlr_seat_keyboard_notify_modifiers(wlr_seat, | ||
74 | &keyboard_grab->keyboard->modifiers); | 78 | &keyboard_grab->keyboard->modifiers); |
75 | } | 79 | } |
76 | } | 80 | } |
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 81ca3483..1ee39124 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include "log.h" | 11 | #include "log.h" |
12 | #include "sway/config.h" | 12 | #include "sway/config.h" |
13 | #include "sway/ipc-json.h" | 13 | #include "sway/ipc-json.h" |
14 | #include "sway/server.h" | ||
14 | #include "sway/tree/container.h" | 15 | #include "sway/tree/container.h" |
15 | #include "sway/tree/view.h" | 16 | #include "sway/tree/view.h" |
16 | #include "sway/tree/workspace.h" | 17 | #include "sway/tree/workspace.h" |
@@ -154,7 +155,7 @@ static json_object *ipc_json_output_mode_description( | |||
154 | return mode_object; | 155 | return mode_object; |
155 | } | 156 | } |
156 | 157 | ||
157 | #if HAVE_XWAYLAND | 158 | #if WLR_HAS_XWAYLAND |
158 | static const char *ipc_json_xwindow_type_description(struct sway_view *view) { | 159 | static const char *ipc_json_xwindow_type_description(struct sway_view *view) { |
159 | struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface; | 160 | struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface; |
160 | struct sway_xwayland *xwayland = &server.xwayland; | 161 | struct sway_xwayland *xwayland = &server.xwayland; |
@@ -633,7 +634,7 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object | |||
633 | json_object_new_string(ipc_json_content_type_description(content_type))); | 634 | json_object_new_string(ipc_json_content_type_description(content_type))); |
634 | } | 635 | } |
635 | 636 | ||
636 | #if HAVE_XWAYLAND | 637 | #if WLR_HAS_XWAYLAND |
637 | if (c->view->type == SWAY_VIEW_XWAYLAND) { | 638 | if (c->view->type == SWAY_VIEW_XWAYLAND) { |
638 | json_object_object_add(object, "window", | 639 | json_object_object_add(object, "window", |
639 | json_object_new_int(view_get_x11_window_id(c->view))); | 640 | json_object_new_int(view_get_x11_window_id(c->view))); |
diff --git a/sway/meson.build b/sway/meson.build index d937e425..47b51d0c 100644 --- a/sway/meson.build +++ b/sway/meson.build | |||
@@ -231,7 +231,7 @@ sway_deps = [ | |||
231 | xcb_icccm, | 231 | xcb_icccm, |
232 | ] | 232 | ] |
233 | 233 | ||
234 | if have_xwayland | 234 | if wlroots_features['xwayland'] |
235 | sway_sources += 'desktop/xwayland.c' | 235 | sway_sources += 'desktop/xwayland.c' |
236 | endif | 236 | endif |
237 | 237 | ||
diff --git a/sway/server.c b/sway/server.c index 180d3a6b..edbc1a4b 100644 --- a/sway/server.c +++ b/sway/server.c | |||
@@ -56,7 +56,7 @@ | |||
56 | #include "sway/input/cursor.h" | 56 | #include "sway/input/cursor.h" |
57 | #include "sway/tree/root.h" | 57 | #include "sway/tree/root.h" |
58 | 58 | ||
59 | #if HAVE_XWAYLAND | 59 | #if WLR_HAS_XWAYLAND |
60 | #include <wlr/xwayland/shell.h> | 60 | #include <wlr/xwayland/shell.h> |
61 | #include "sway/xwayland.h" | 61 | #include "sway/xwayland.h" |
62 | #endif | 62 | #endif |
@@ -113,12 +113,13 @@ static bool is_privileged(const struct wl_global *global) { | |||
113 | global == server.input->keyboard_shortcuts_inhibit->global || | 113 | global == server.input->keyboard_shortcuts_inhibit->global || |
114 | global == server.input->virtual_keyboard->global || | 114 | global == server.input->virtual_keyboard->global || |
115 | global == server.input->virtual_pointer->global || | 115 | global == server.input->virtual_pointer->global || |
116 | global == server.input->transient_seat_manager->global; | 116 | global == server.input->transient_seat_manager->global || |
117 | global == server.xdg_output_manager_v1->global; | ||
117 | } | 118 | } |
118 | 119 | ||
119 | static bool filter_global(const struct wl_client *client, | 120 | static bool filter_global(const struct wl_client *client, |
120 | const struct wl_global *global, void *data) { | 121 | const struct wl_global *global, void *data) { |
121 | #if HAVE_XWAYLAND | 122 | #if WLR_HAS_XWAYLAND |
122 | struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland; | 123 | struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland; |
123 | if (xwayland && global == xwayland->shell_v1->global) { | 124 | if (xwayland && global == xwayland->shell_v1->global) { |
124 | return xwayland->server != NULL && client == xwayland->server->client; | 125 | return xwayland->server != NULL && client == xwayland->server->client; |
@@ -275,7 +276,8 @@ bool server_init(struct sway_server *server) { | |||
275 | wl_signal_add(&root->output_layout->events.change, | 276 | wl_signal_add(&root->output_layout->events.change, |
276 | &server->output_layout_change); | 277 | &server->output_layout_change); |
277 | 278 | ||
278 | wlr_xdg_output_manager_v1_create(server->wl_display, root->output_layout); | 279 | server->xdg_output_manager_v1 = |
280 | wlr_xdg_output_manager_v1_create(server->wl_display, root->output_layout); | ||
279 | 281 | ||
280 | server->idle_notifier_v1 = wlr_idle_notifier_v1_create(server->wl_display); | 282 | server->idle_notifier_v1 = wlr_idle_notifier_v1_create(server->wl_display); |
281 | sway_idle_inhibit_manager_v1_init(); | 283 | sway_idle_inhibit_manager_v1_init(); |
@@ -437,7 +439,7 @@ bool server_init(struct sway_server *server) { | |||
437 | 439 | ||
438 | void server_fini(struct sway_server *server) { | 440 | void server_fini(struct sway_server *server) { |
439 | // TODO: free sway-specific resources | 441 | // TODO: free sway-specific resources |
440 | #if HAVE_XWAYLAND | 442 | #if WLR_HAS_XWAYLAND |
441 | wlr_xwayland_destroy(server->xwayland.wlr_xwayland); | 443 | wlr_xwayland_destroy(server->xwayland.wlr_xwayland); |
442 | #endif | 444 | #endif |
443 | wl_display_destroy_clients(server->wl_display); | 445 | wl_display_destroy_clients(server->wl_display); |
@@ -447,7 +449,7 @@ void server_fini(struct sway_server *server) { | |||
447 | } | 449 | } |
448 | 450 | ||
449 | bool server_start(struct sway_server *server) { | 451 | bool server_start(struct sway_server *server) { |
450 | #if HAVE_XWAYLAND | 452 | #if WLR_HAS_XWAYLAND |
451 | if (config->xwayland != XWAYLAND_MODE_DISABLED) { | 453 | if (config->xwayland != XWAYLAND_MODE_DISABLED) { |
452 | sway_log(SWAY_DEBUG, "Initializing Xwayland (lazy=%d)", | 454 | sway_log(SWAY_DEBUG, "Initializing Xwayland (lazy=%d)", |
453 | config->xwayland == XWAYLAND_MODE_LAZY); | 455 | config->xwayland == XWAYLAND_MODE_LAZY); |
diff --git a/sway/sway_text_node.c b/sway/sway_text_node.c index 5eba53ba..4b7ee999 100644 --- a/sway/sway_text_node.c +++ b/sway/sway_text_node.c | |||
@@ -58,7 +58,7 @@ struct text_buffer { | |||
58 | 58 | ||
59 | static int get_text_width(struct sway_text_node *props) { | 59 | static int get_text_width(struct sway_text_node *props) { |
60 | int width = props->width; | 60 | int width = props->width; |
61 | if (props->max_width) { | 61 | if (props->max_width >= 0) { |
62 | width = MIN(width, props->max_width); | 62 | width = MIN(width, props->max_width); |
63 | } | 63 | } |
64 | return MAX(width, 0); | 64 | return MAX(width, 0); |
@@ -81,6 +81,11 @@ static void render_backing_buffer(struct text_buffer *buffer) { | |||
81 | return; | 81 | return; |
82 | } | 82 | } |
83 | 83 | ||
84 | if (buffer->props.max_width == 0) { | ||
85 | wlr_scene_buffer_set_buffer(buffer->buffer_node, NULL); | ||
86 | return; | ||
87 | } | ||
88 | |||
84 | float scale = buffer->scale; | 89 | float scale = buffer->scale; |
85 | int width = ceil(buffer->props.width * scale); | 90 | int width = ceil(buffer->props.width * scale); |
86 | int height = ceil(buffer->props.height * scale); | 91 | int height = ceil(buffer->props.height * scale); |
@@ -236,6 +241,7 @@ struct sway_text_node *sway_text_node_create(struct wlr_scene_tree *parent, | |||
236 | 241 | ||
237 | buffer->buffer_node = node; | 242 | buffer->buffer_node = node; |
238 | buffer->props.node = &node->node; | 243 | buffer->props.node = &node->node; |
244 | buffer->props.max_width = -1; | ||
239 | buffer->text = strdup(text); | 245 | buffer->text = strdup(text); |
240 | if (!buffer->text) { | 246 | if (!buffer->text) { |
241 | free(buffer); | 247 | free(buffer); |
diff --git a/sway/tree/container.c b/sway/tree/container.c index 9224b4fb..80ef34fe 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -352,6 +352,8 @@ void container_arrange_title_bar(struct sway_container *con) { | |||
352 | 352 | ||
353 | int alloc_width = MIN((int)node->width, | 353 | int alloc_width = MIN((int)node->width, |
354 | width - h_padding - config->titlebar_h_padding); | 354 | width - h_padding - config->titlebar_h_padding); |
355 | alloc_width = MAX(alloc_width, 0); | ||
356 | |||
355 | sway_text_node_set_max_width(node, alloc_width); | 357 | sway_text_node_set_max_width(node, alloc_width); |
356 | wlr_scene_node_set_position(node->node, | 358 | wlr_scene_node_set_position(node->node, |
357 | h_padding, (height - node->height) >> 1); | 359 | h_padding, (height - node->height) >> 1); |
@@ -376,6 +378,8 @@ void container_arrange_title_bar(struct sway_container *con) { | |||
376 | 378 | ||
377 | int alloc_width = MIN((int) node->width, | 379 | int alloc_width = MIN((int) node->width, |
378 | width - h_padding - config->titlebar_h_padding); | 380 | width - h_padding - config->titlebar_h_padding); |
381 | alloc_width = MAX(alloc_width, 0); | ||
382 | |||
379 | sway_text_node_set_max_width(node, alloc_width); | 383 | sway_text_node_set_max_width(node, alloc_width); |
380 | wlr_scene_node_set_position(node->node, | 384 | wlr_scene_node_set_position(node->node, |
381 | h_padding, (height - node->height) >> 1); | 385 | h_padding, (height - node->height) >> 1); |
diff --git a/sway/tree/root.c b/sway/tree/root.c index ae3c3cb2..20fcfa59 100644 --- a/sway/tree/root.c +++ b/sway/tree/root.c | |||
@@ -53,7 +53,7 @@ struct sway_root *root_create(struct wl_display *wl_display) { | |||
53 | root->layers.shell_top = alloc_scene_tree(root->layer_tree, &failed); | 53 | root->layers.shell_top = alloc_scene_tree(root->layer_tree, &failed); |
54 | root->layers.fullscreen = alloc_scene_tree(root->layer_tree, &failed); | 54 | root->layers.fullscreen = alloc_scene_tree(root->layer_tree, &failed); |
55 | root->layers.fullscreen_global = alloc_scene_tree(root->layer_tree, &failed); | 55 | root->layers.fullscreen_global = alloc_scene_tree(root->layer_tree, &failed); |
56 | #if HAVE_XWAYLAND | 56 | #if WLR_HAS_XWAYLAND |
57 | root->layers.unmanaged = alloc_scene_tree(root->layer_tree, &failed); | 57 | root->layers.unmanaged = alloc_scene_tree(root->layer_tree, &failed); |
58 | #endif | 58 | #endif |
59 | root->layers.shell_overlay = alloc_scene_tree(root->layer_tree, &failed); | 59 | root->layers.shell_overlay = alloc_scene_tree(root->layer_tree, &failed); |
diff --git a/sway/tree/view.c b/sway/tree/view.c index 35b4b73f..1c1c8ee8 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <strings.h> | 2 | #include <strings.h> |
3 | #include <wayland-server-core.h> | 3 | #include <wayland-server-core.h> |
4 | #include <wlr/config.h> | ||
4 | #include <wlr/render/wlr_renderer.h> | 5 | #include <wlr/render/wlr_renderer.h> |
5 | #include <wlr/types/wlr_buffer.h> | 6 | #include <wlr/types/wlr_buffer.h> |
6 | #include <wlr/types/wlr_ext_foreign_toplevel_list_v1.h> | 7 | #include <wlr/types/wlr_ext_foreign_toplevel_list_v1.h> |
@@ -9,8 +10,7 @@ | |||
9 | #include <wlr/types/wlr_server_decoration.h> | 10 | #include <wlr/types/wlr_server_decoration.h> |
10 | #include <wlr/types/wlr_subcompositor.h> | 11 | #include <wlr/types/wlr_subcompositor.h> |
11 | #include <wlr/types/wlr_xdg_decoration_v1.h> | 12 | #include <wlr/types/wlr_xdg_decoration_v1.h> |
12 | #include "config.h" | 13 | #if WLR_HAS_XWAYLAND |
13 | #if HAVE_XWAYLAND | ||
14 | #include <wlr/xwayland.h> | 14 | #include <wlr/xwayland.h> |
15 | #endif | 15 | #endif |
16 | #include "list.h" | 16 | #include "list.h" |
@@ -126,7 +126,7 @@ const char *view_get_instance(struct sway_view *view) { | |||
126 | } | 126 | } |
127 | return NULL; | 127 | return NULL; |
128 | } | 128 | } |
129 | #if HAVE_XWAYLAND | 129 | #if WLR_HAS_XWAYLAND |
130 | uint32_t view_get_x11_window_id(struct sway_view *view) { | 130 | uint32_t view_get_x11_window_id(struct sway_view *view) { |
131 | if (view->impl->get_int_prop) { | 131 | if (view->impl->get_int_prop) { |
132 | return view->impl->get_int_prop(view, VIEW_PROP_X11_WINDOW_ID); | 132 | return view->impl->get_int_prop(view, VIEW_PROP_X11_WINDOW_ID); |
@@ -159,7 +159,7 @@ const char *view_get_shell(struct sway_view *view) { | |||
159 | switch(view->type) { | 159 | switch(view->type) { |
160 | case SWAY_VIEW_XDG_SHELL: | 160 | case SWAY_VIEW_XDG_SHELL: |
161 | return "xdg_shell"; | 161 | return "xdg_shell"; |
162 | #if HAVE_XWAYLAND | 162 | #if WLR_HAS_XWAYLAND |
163 | case SWAY_VIEW_XWAYLAND: | 163 | case SWAY_VIEW_XWAYLAND: |
164 | return "xwayland"; | 164 | return "xwayland"; |
165 | #endif | 165 | #endif |
@@ -499,7 +499,7 @@ void view_execute_criteria(struct sway_view *view) { | |||
499 | static void view_populate_pid(struct sway_view *view) { | 499 | static void view_populate_pid(struct sway_view *view) { |
500 | pid_t pid; | 500 | pid_t pid; |
501 | switch (view->type) { | 501 | switch (view->type) { |
502 | #if HAVE_XWAYLAND | 502 | #if WLR_HAS_XWAYLAND |
503 | case SWAY_VIEW_XWAYLAND:; | 503 | case SWAY_VIEW_XWAYLAND:; |
504 | struct wlr_xwayland_surface *surf = | 504 | struct wlr_xwayland_surface *surf = |
505 | wlr_xwayland_surface_try_from_wlr_surface(view->surface); | 505 | wlr_xwayland_surface_try_from_wlr_surface(view->surface); |
@@ -838,7 +838,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, | |||
838 | 838 | ||
839 | bool set_focus = should_focus(view); | 839 | bool set_focus = should_focus(view); |
840 | 840 | ||
841 | #if HAVE_XWAYLAND | 841 | #if WLR_HAS_XWAYLAND |
842 | struct wlr_xwayland_surface *xsurface; | 842 | struct wlr_xwayland_surface *xsurface; |
843 | if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(wlr_surface))) { | 843 | if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(wlr_surface))) { |
844 | set_focus &= wlr_xwayland_icccm_input_model(xsurface) != | 844 | set_focus &= wlr_xwayland_icccm_input_model(xsurface) != |
@@ -927,11 +927,14 @@ void view_update_size(struct sway_view *view) { | |||
927 | void view_center_and_clip_surface(struct sway_view *view) { | 927 | void view_center_and_clip_surface(struct sway_view *view) { |
928 | struct sway_container *con = view->container; | 928 | struct sway_container *con = view->container; |
929 | 929 | ||
930 | bool clip_to_geometry = true; | ||
931 | |||
930 | if (container_is_floating(con)) { | 932 | if (container_is_floating(con)) { |
931 | // We always center the current coordinates rather than the next, as the | 933 | // We always center the current coordinates rather than the next, as the |
932 | // geometry immediately affects the currently active rendering. | 934 | // geometry immediately affects the currently active rendering. |
933 | int x = (int) fmax(0, (con->current.content_width - view->geometry.width) / 2); | 935 | int x = (int) fmax(0, (con->current.content_width - view->geometry.width) / 2); |
934 | int y = (int) fmax(0, (con->current.content_height - view->geometry.height) / 2); | 936 | int y = (int) fmax(0, (con->current.content_height - view->geometry.height) / 2); |
937 | clip_to_geometry = !view->using_csd; | ||
935 | 938 | ||
936 | wlr_scene_node_set_position(&view->content_tree->node, x, y); | 939 | wlr_scene_node_set_position(&view->content_tree->node, x, y); |
937 | } else { | 940 | } else { |
@@ -940,12 +943,16 @@ void view_center_and_clip_surface(struct sway_view *view) { | |||
940 | 943 | ||
941 | // only make sure to clip the content if there is content to clip | 944 | // only make sure to clip the content if there is content to clip |
942 | if (!wl_list_empty(&con->view->content_tree->children)) { | 945 | if (!wl_list_empty(&con->view->content_tree->children)) { |
943 | wlr_scene_subsurface_tree_set_clip(&con->view->content_tree->node, &(struct wlr_box){ | 946 | struct wlr_box clip = {0}; |
944 | .x = con->view->geometry.x, | 947 | if (clip_to_geometry) { |
945 | .y = con->view->geometry.y, | 948 | clip = (struct wlr_box){ |
946 | .width = con->current.content_width, | 949 | .x = con->view->geometry.x, |
947 | .height = con->current.content_height, | 950 | .y = con->view->geometry.y, |
948 | }); | 951 | .width = con->current.content_width, |
952 | .height = con->current.content_height, | ||
953 | }; | ||
954 | } | ||
955 | wlr_scene_subsurface_tree_set_clip(&con->view->content_tree->node, &clip); | ||
949 | } | 956 | } |
950 | } | 957 | } |
951 | 958 | ||
@@ -954,7 +961,7 @@ struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) { | |||
954 | if ((xdg_surface = wlr_xdg_surface_try_from_wlr_surface(wlr_surface))) { | 961 | if ((xdg_surface = wlr_xdg_surface_try_from_wlr_surface(wlr_surface))) { |
955 | return view_from_wlr_xdg_surface(xdg_surface); | 962 | return view_from_wlr_xdg_surface(xdg_surface); |
956 | } | 963 | } |
957 | #if HAVE_XWAYLAND | 964 | #if WLR_HAS_XWAYLAND |
958 | struct wlr_xwayland_surface *xsurface; | 965 | struct wlr_xwayland_surface *xsurface; |
959 | if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(wlr_surface))) { | 966 | if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(wlr_surface))) { |
960 | return view_from_wlr_xwayland_surface(xsurface); | 967 | return view_from_wlr_xwayland_surface(xsurface); |
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index a68dc927..52e48ad5 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include "sway/input/seat.h" | 10 | #include "sway/input/seat.h" |
11 | #include "sway/ipc-server.h" | 11 | #include "sway/ipc-server.h" |
12 | #include "sway/output.h" | 12 | #include "sway/output.h" |
13 | #include "sway/server.h" | ||
13 | #include "sway/tree/arrange.h" | 14 | #include "sway/tree/arrange.h" |
14 | #include "sway/tree/container.h" | 15 | #include "sway/tree/container.h" |
15 | #include "sway/tree/node.h" | 16 | #include "sway/tree/node.h" |