diff options
-rw-r--r-- | include/sway/server.h | 5 | ||||
-rw-r--r-- | include/sway/tree/view.h | 30 | ||||
-rw-r--r-- | protocols/meson.build | 1 | ||||
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 508 | ||||
-rw-r--r-- | sway/meson.build | 1 | ||||
-rw-r--r-- | sway/server.c | 5 | ||||
-rw-r--r-- | sway/tree/container.c | 20 | ||||
-rw-r--r-- | sway/tree/view.c | 7 |
8 files changed, 0 insertions, 577 deletions
diff --git a/include/sway/server.h b/include/sway/server.h index 7cbca4f2..a43cbf72 100644 --- a/include/sway/server.h +++ b/include/sway/server.h | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <wlr/types/wlr_presentation_time.h> | 12 | #include <wlr/types/wlr_presentation_time.h> |
13 | #include <wlr/types/wlr_relative_pointer_v1.h> | 13 | #include <wlr/types/wlr_relative_pointer_v1.h> |
14 | #include <wlr/types/wlr_server_decoration.h> | 14 | #include <wlr/types/wlr_server_decoration.h> |
15 | #include <wlr/types/wlr_xdg_shell_v6.h> | ||
16 | #include <wlr/types/wlr_xdg_shell.h> | 15 | #include <wlr/types/wlr_xdg_shell.h> |
17 | #include "config.h" | 16 | #include "config.h" |
18 | #include "list.h" | 17 | #include "list.h" |
@@ -42,9 +41,6 @@ struct sway_server { | |||
42 | struct wlr_layer_shell_v1 *layer_shell; | 41 | struct wlr_layer_shell_v1 *layer_shell; |
43 | struct wl_listener layer_shell_surface; | 42 | struct wl_listener layer_shell_surface; |
44 | 43 | ||
45 | struct wlr_xdg_shell_v6 *xdg_shell_v6; | ||
46 | struct wl_listener xdg_shell_v6_surface; | ||
47 | |||
48 | struct wlr_xdg_shell *xdg_shell; | 44 | struct wlr_xdg_shell *xdg_shell; |
49 | struct wl_listener xdg_shell_surface; | 45 | struct wl_listener xdg_shell_surface; |
50 | 46 | ||
@@ -105,7 +101,6 @@ void handle_new_output(struct wl_listener *listener, void *data); | |||
105 | 101 | ||
106 | void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data); | 102 | void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data); |
107 | void handle_layer_shell_surface(struct wl_listener *listener, void *data); | 103 | void handle_layer_shell_surface(struct wl_listener *listener, void *data); |
108 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data); | ||
109 | void handle_xdg_shell_surface(struct wl_listener *listener, void *data); | 104 | void handle_xdg_shell_surface(struct wl_listener *listener, void *data); |
110 | #if HAVE_XWAYLAND | 105 | #if HAVE_XWAYLAND |
111 | void handle_xwayland_surface(struct wl_listener *listener, void *data); | 106 | void handle_xwayland_surface(struct wl_listener *listener, void *data); |
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index d9f5b8f2..44cd4a7b 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -2,7 +2,6 @@ | |||
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/types/wlr_surface.h> | 4 | #include <wlr/types/wlr_surface.h> |
5 | #include <wlr/types/wlr_xdg_shell_v6.h> | ||
6 | #include "config.h" | 5 | #include "config.h" |
7 | #if HAVE_XWAYLAND | 6 | #if HAVE_XWAYLAND |
8 | #include <wlr/xwayland.h> | 7 | #include <wlr/xwayland.h> |
@@ -14,7 +13,6 @@ struct sway_container; | |||
14 | struct sway_xdg_decoration; | 13 | struct sway_xdg_decoration; |
15 | 14 | ||
16 | enum sway_view_type { | 15 | enum sway_view_type { |
17 | SWAY_VIEW_XDG_SHELL_V6, | ||
18 | SWAY_VIEW_XDG_SHELL, | 16 | SWAY_VIEW_XDG_SHELL, |
19 | #if HAVE_XWAYLAND | 17 | #if HAVE_XWAYLAND |
20 | SWAY_VIEW_XWAYLAND, | 18 | SWAY_VIEW_XWAYLAND, |
@@ -98,7 +96,6 @@ struct sway_view { | |||
98 | list_t *executed_criteria; // struct criteria * | 96 | list_t *executed_criteria; // struct criteria * |
99 | 97 | ||
100 | union { | 98 | union { |
101 | struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6; | ||
102 | struct wlr_xdg_surface *wlr_xdg_surface; | 99 | struct wlr_xdg_surface *wlr_xdg_surface; |
103 | #if HAVE_XWAYLAND | 100 | #if HAVE_XWAYLAND |
104 | struct wlr_xwayland_surface *wlr_xwayland_surface; | 101 | struct wlr_xwayland_surface *wlr_xwayland_surface; |
@@ -113,22 +110,6 @@ struct sway_view { | |||
113 | struct wl_listener surface_new_subsurface; | 110 | struct wl_listener surface_new_subsurface; |
114 | }; | 111 | }; |
115 | 112 | ||
116 | struct sway_xdg_shell_v6_view { | ||
117 | struct sway_view view; | ||
118 | |||
119 | struct wl_listener commit; | ||
120 | struct wl_listener request_move; | ||
121 | struct wl_listener request_resize; | ||
122 | struct wl_listener request_maximize; | ||
123 | struct wl_listener request_fullscreen; | ||
124 | struct wl_listener set_title; | ||
125 | struct wl_listener set_app_id; | ||
126 | struct wl_listener new_popup; | ||
127 | struct wl_listener map; | ||
128 | struct wl_listener unmap; | ||
129 | struct wl_listener destroy; | ||
130 | }; | ||
131 | |||
132 | struct sway_xdg_shell_view { | 113 | struct sway_xdg_shell_view { |
133 | struct sway_view view; | 114 | struct sway_view view; |
134 | 115 | ||
@@ -214,15 +195,6 @@ struct sway_subsurface { | |||
214 | struct wl_listener destroy; | 195 | struct wl_listener destroy; |
215 | }; | 196 | }; |
216 | 197 | ||
217 | struct sway_xdg_popup_v6 { | ||
218 | struct sway_view_child child; | ||
219 | |||
220 | struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6; | ||
221 | |||
222 | struct wl_listener new_popup; | ||
223 | struct wl_listener destroy; | ||
224 | }; | ||
225 | |||
226 | struct sway_xdg_popup { | 198 | struct sway_xdg_popup { |
227 | struct sway_view_child child; | 199 | struct sway_view_child child; |
228 | 200 | ||
@@ -332,8 +304,6 @@ void view_child_destroy(struct sway_view_child *child); | |||
332 | 304 | ||
333 | struct sway_view *view_from_wlr_xdg_surface( | 305 | struct sway_view *view_from_wlr_xdg_surface( |
334 | struct wlr_xdg_surface *xdg_surface); | 306 | struct wlr_xdg_surface *xdg_surface); |
335 | struct sway_view *view_from_wlr_xdg_surface_v6( | ||
336 | struct wlr_xdg_surface_v6 *xdg_surface_v6); | ||
337 | #if HAVE_XWAYLAND | 307 | #if HAVE_XWAYLAND |
338 | struct sway_view *view_from_wlr_xwayland_surface( | 308 | struct sway_view *view_from_wlr_xwayland_surface( |
339 | struct wlr_xwayland_surface *xsurface); | 309 | struct wlr_xwayland_surface *xsurface); |
diff --git a/protocols/meson.build b/protocols/meson.build index 2a6cea09..4ba6f723 100644 --- a/protocols/meson.build +++ b/protocols/meson.build | |||
@@ -12,7 +12,6 @@ endif | |||
12 | 12 | ||
13 | protocols = [ | 13 | protocols = [ |
14 | [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], | 14 | [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], |
15 | [wl_protocol_dir, 'unstable/xdg-shell/xdg-shell-unstable-v6.xml'], | ||
16 | [wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'], | 15 | [wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'], |
17 | [wl_protocol_dir, 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml'], | 16 | [wl_protocol_dir, 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml'], |
18 | ['wlr-layer-shell-unstable-v1.xml'], | 17 | ['wlr-layer-shell-unstable-v1.xml'], |
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c deleted file mode 100644 index 0c6ab7dc..00000000 --- a/sway/desktop/xdg_shell_v6.c +++ /dev/null | |||
@@ -1,508 +0,0 @@ | |||
1 | #define _POSIX_C_SOURCE 199309L | ||
2 | #include <float.h> | ||
3 | #include <stdbool.h> | ||
4 | #include <stdlib.h> | ||
5 | #include <wayland-server-core.h> | ||
6 | #include <wlr/types/wlr_xdg_shell_v6.h> | ||
7 | #include "log.h" | ||
8 | #include "sway/decoration.h" | ||
9 | #include "sway/desktop.h" | ||
10 | #include "sway/desktop/transaction.h" | ||
11 | #include "sway/input/cursor.h" | ||
12 | #include "sway/input/input-manager.h" | ||
13 | #include "sway/input/seat.h" | ||
14 | #include "sway/output.h" | ||
15 | #include "sway/tree/arrange.h" | ||
16 | #include "sway/tree/container.h" | ||
17 | #include "sway/tree/view.h" | ||
18 | #include "sway/tree/workspace.h" | ||
19 | |||
20 | static const struct sway_view_child_impl popup_impl; | ||
21 | |||
22 | static void popup_get_root_coords(struct sway_view_child *child, | ||
23 | int *root_sx, int *root_sy) { | ||
24 | struct sway_xdg_popup_v6 *popup = (struct sway_xdg_popup_v6 *)child; | ||
25 | struct wlr_xdg_surface_v6 *surface = popup->wlr_xdg_surface_v6; | ||
26 | |||
27 | int x_offset = -child->view->geometry.x - surface->geometry.x; | ||
28 | int y_offset = -child->view->geometry.y - surface->geometry.y; | ||
29 | |||
30 | wlr_xdg_popup_v6_get_toplevel_coords(surface->popup, | ||
31 | x_offset + surface->popup->geometry.x, | ||
32 | y_offset + surface->popup->geometry.y, | ||
33 | root_sx, root_sy); | ||
34 | } | ||
35 | |||
36 | static void popup_destroy(struct sway_view_child *child) { | ||
37 | if (!sway_assert(child->impl == &popup_impl, | ||
38 | "Expected an xdg_shell_v6 popup")) { | ||
39 | return; | ||
40 | } | ||
41 | struct sway_xdg_popup_v6 *popup = (struct sway_xdg_popup_v6 *)child; | ||
42 | wl_list_remove(&popup->new_popup.link); | ||
43 | wl_list_remove(&popup->destroy.link); | ||
44 | free(popup); | ||
45 | } | ||
46 | |||
47 | static const struct sway_view_child_impl popup_impl = { | ||
48 | .get_root_coords = popup_get_root_coords, | ||
49 | .destroy = popup_destroy, | ||
50 | }; | ||
51 | |||
52 | static struct sway_xdg_popup_v6 *popup_create( | ||
53 | struct wlr_xdg_popup_v6 *wlr_popup, struct sway_view *view); | ||
54 | |||
55 | static void popup_handle_new_popup(struct wl_listener *listener, void *data) { | ||
56 | struct sway_xdg_popup_v6 *popup = | ||
57 | wl_container_of(listener, popup, new_popup); | ||
58 | struct wlr_xdg_popup_v6 *wlr_popup = data; | ||
59 | popup_create(wlr_popup, popup->child.view); | ||
60 | } | ||
61 | |||
62 | static void popup_handle_destroy(struct wl_listener *listener, void *data) { | ||
63 | struct sway_xdg_popup_v6 *popup = wl_container_of(listener, popup, destroy); | ||
64 | view_child_destroy(&popup->child); | ||
65 | } | ||
66 | |||
67 | static void popup_unconstrain(struct sway_xdg_popup_v6 *popup) { | ||
68 | struct sway_view *view = popup->child.view; | ||
69 | struct wlr_xdg_popup_v6 *wlr_popup = popup->wlr_xdg_surface_v6->popup; | ||
70 | |||
71 | struct sway_output *output = view->container->workspace->output; | ||
72 | |||
73 | // the output box expressed in the coordinate system of the toplevel parent | ||
74 | // of the popup | ||
75 | struct wlr_box output_toplevel_sx_box = { | ||
76 | .x = output->lx - view->container->content_x, | ||
77 | .y = output->ly - view->container->content_y, | ||
78 | .width = output->width, | ||
79 | .height = output->height, | ||
80 | }; | ||
81 | |||
82 | wlr_xdg_popup_v6_unconstrain_from_box(wlr_popup, &output_toplevel_sx_box); | ||
83 | } | ||
84 | |||
85 | static struct sway_xdg_popup_v6 *popup_create( | ||
86 | struct wlr_xdg_popup_v6 *wlr_popup, struct sway_view *view) { | ||
87 | struct wlr_xdg_surface_v6 *xdg_surface = wlr_popup->base; | ||
88 | |||
89 | struct sway_xdg_popup_v6 *popup = | ||
90 | calloc(1, sizeof(struct sway_xdg_popup_v6)); | ||
91 | if (popup == NULL) { | ||
92 | return NULL; | ||
93 | } | ||
94 | view_child_init(&popup->child, &popup_impl, view, xdg_surface->surface); | ||
95 | popup->wlr_xdg_surface_v6 = xdg_surface; | ||
96 | |||
97 | wl_signal_add(&xdg_surface->events.new_popup, &popup->new_popup); | ||
98 | popup->new_popup.notify = popup_handle_new_popup; | ||
99 | wl_signal_add(&xdg_surface->events.destroy, &popup->destroy); | ||
100 | popup->destroy.notify = popup_handle_destroy; | ||
101 | |||
102 | wl_signal_add(&xdg_surface->events.map, &popup->child.surface_map); | ||
103 | wl_signal_add(&xdg_surface->events.unmap, &popup->child.surface_unmap); | ||
104 | |||
105 | popup_unconstrain(popup); | ||
106 | |||
107 | return popup; | ||
108 | } | ||
109 | |||
110 | |||
111 | static struct sway_xdg_shell_v6_view *xdg_shell_v6_view_from_view( | ||
112 | struct sway_view *view) { | ||
113 | if (!sway_assert(view->type == SWAY_VIEW_XDG_SHELL_V6, | ||
114 | "Expected xdg_shell_v6 view")) { | ||
115 | return NULL; | ||
116 | } | ||
117 | return (struct sway_xdg_shell_v6_view *)view; | ||
118 | } | ||
119 | |||
120 | static void get_constraints(struct sway_view *view, double *min_width, | ||
121 | double *max_width, double *min_height, double *max_height) { | ||
122 | struct wlr_xdg_toplevel_v6_state *state = | ||
123 | &view->wlr_xdg_surface_v6->toplevel->current; | ||
124 | *min_width = state->min_width > 0 ? state->min_width : DBL_MIN; | ||
125 | *max_width = state->max_width > 0 ? state->max_width : DBL_MAX; | ||
126 | *min_height = state->min_height > 0 ? state->min_height : DBL_MIN; | ||
127 | *max_height = state->max_height > 0 ? state->max_height : DBL_MAX; | ||
128 | } | ||
129 | |||
130 | static const char *get_string_prop(struct sway_view *view, | ||
131 | enum sway_view_prop prop) { | ||
132 | if (xdg_shell_v6_view_from_view(view) == NULL) { | ||
133 | return NULL; | ||
134 | } | ||
135 | switch (prop) { | ||
136 | case VIEW_PROP_TITLE: | ||
137 | return view->wlr_xdg_surface_v6->toplevel->title; | ||
138 | case VIEW_PROP_APP_ID: | ||
139 | return view->wlr_xdg_surface_v6->toplevel->app_id; | ||
140 | default: | ||
141 | return NULL; | ||
142 | } | ||
143 | } | ||
144 | |||
145 | static uint32_t configure(struct sway_view *view, double lx, double ly, | ||
146 | int width, int height) { | ||
147 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | ||
148 | xdg_shell_v6_view_from_view(view); | ||
149 | if (xdg_shell_v6_view == NULL) { | ||
150 | return 0; | ||
151 | } | ||
152 | return wlr_xdg_toplevel_v6_set_size( | ||
153 | view->wlr_xdg_surface_v6, width, height); | ||
154 | } | ||
155 | |||
156 | static void set_activated(struct sway_view *view, bool activated) { | ||
157 | if (xdg_shell_v6_view_from_view(view) == NULL) { | ||
158 | return; | ||
159 | } | ||
160 | struct wlr_xdg_surface_v6 *surface = view->wlr_xdg_surface_v6; | ||
161 | if (surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) { | ||
162 | wlr_xdg_toplevel_v6_set_activated(surface, activated); | ||
163 | } | ||
164 | } | ||
165 | |||
166 | static void set_tiled(struct sway_view *view, bool tiled) { | ||
167 | if (xdg_shell_v6_view_from_view(view) == NULL) { | ||
168 | return; | ||
169 | } | ||
170 | struct wlr_xdg_surface_v6 *surface = view->wlr_xdg_surface_v6; | ||
171 | wlr_xdg_toplevel_v6_set_maximized(surface, tiled); | ||
172 | } | ||
173 | |||
174 | static void set_fullscreen(struct sway_view *view, bool fullscreen) { | ||
175 | if (xdg_shell_v6_view_from_view(view) == NULL) { | ||
176 | return; | ||
177 | } | ||
178 | struct wlr_xdg_surface_v6 *surface = view->wlr_xdg_surface_v6; | ||
179 | wlr_xdg_toplevel_v6_set_fullscreen(surface, fullscreen); | ||
180 | } | ||
181 | |||
182 | static bool wants_floating(struct sway_view *view) { | ||
183 | struct wlr_xdg_toplevel_v6 *toplevel = | ||
184 | view->wlr_xdg_surface_v6->toplevel; | ||
185 | struct wlr_xdg_toplevel_v6_state *state = &toplevel->current; | ||
186 | return (state->min_width != 0 && state->min_height != 0 | ||
187 | && (state->min_width == state->max_width | ||
188 | || state->min_height == state->max_height)) | ||
189 | || toplevel->parent; | ||
190 | } | ||
191 | |||
192 | static void for_each_surface(struct sway_view *view, | ||
193 | wlr_surface_iterator_func_t iterator, void *user_data) { | ||
194 | if (xdg_shell_v6_view_from_view(view) == NULL) { | ||
195 | return; | ||
196 | } | ||
197 | wlr_xdg_surface_v6_for_each_surface(view->wlr_xdg_surface_v6, iterator, | ||
198 | user_data); | ||
199 | } | ||
200 | |||
201 | static void for_each_popup(struct sway_view *view, | ||
202 | wlr_surface_iterator_func_t iterator, void *user_data) { | ||
203 | if (xdg_shell_v6_view_from_view(view) == NULL) { | ||
204 | return; | ||
205 | } | ||
206 | wlr_xdg_surface_v6_for_each_popup(view->wlr_xdg_surface_v6, iterator, | ||
207 | user_data); | ||
208 | } | ||
209 | |||
210 | static bool is_transient_for(struct sway_view *child, | ||
211 | struct sway_view *ancestor) { | ||
212 | if (xdg_shell_v6_view_from_view(child) == NULL) { | ||
213 | return false; | ||
214 | } | ||
215 | struct wlr_xdg_surface_v6 *surface = child->wlr_xdg_surface_v6; | ||
216 | while (surface && surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) { | ||
217 | if (surface->toplevel->parent == ancestor->wlr_xdg_surface_v6) { | ||
218 | return true; | ||
219 | } | ||
220 | surface = surface->toplevel->parent; | ||
221 | } | ||
222 | return false; | ||
223 | } | ||
224 | |||
225 | static void _close(struct sway_view *view) { | ||
226 | if (xdg_shell_v6_view_from_view(view) == NULL) { | ||
227 | return; | ||
228 | } | ||
229 | struct wlr_xdg_surface_v6 *surface = view->wlr_xdg_surface_v6; | ||
230 | if (surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) { | ||
231 | wlr_xdg_surface_v6_send_close(surface); | ||
232 | } | ||
233 | } | ||
234 | |||
235 | static void close_popups_iterator(struct wlr_surface *surface, | ||
236 | int sx, int sy, void *data) { | ||
237 | struct wlr_xdg_surface_v6 *xdg_surface_v6 = | ||
238 | wlr_xdg_surface_v6_from_wlr_surface(surface); | ||
239 | wlr_xdg_surface_v6_send_close(xdg_surface_v6); | ||
240 | } | ||
241 | |||
242 | static void close_popups(struct sway_view *view) { | ||
243 | wlr_xdg_surface_v6_for_each_popup(view->wlr_xdg_surface_v6, | ||
244 | close_popups_iterator, NULL); | ||
245 | } | ||
246 | |||
247 | static void destroy(struct sway_view *view) { | ||
248 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | ||
249 | xdg_shell_v6_view_from_view(view); | ||
250 | if (xdg_shell_v6_view == NULL) { | ||
251 | return; | ||
252 | } | ||
253 | free(xdg_shell_v6_view); | ||
254 | } | ||
255 | |||
256 | static const struct sway_view_impl view_impl = { | ||
257 | .get_constraints = get_constraints, | ||
258 | .get_string_prop = get_string_prop, | ||
259 | .configure = configure, | ||
260 | .set_activated = set_activated, | ||
261 | .set_tiled = set_tiled, | ||
262 | .set_fullscreen = set_fullscreen, | ||
263 | .wants_floating = wants_floating, | ||
264 | .for_each_surface = for_each_surface, | ||
265 | .for_each_popup = for_each_popup, | ||
266 | .is_transient_for = is_transient_for, | ||
267 | .close = _close, | ||
268 | .close_popups = close_popups, | ||
269 | .destroy = destroy, | ||
270 | }; | ||
271 | |||
272 | static void handle_commit(struct wl_listener *listener, void *data) { | ||
273 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | ||
274 | wl_container_of(listener, xdg_shell_v6_view, commit); | ||
275 | struct sway_view *view = &xdg_shell_v6_view->view; | ||
276 | struct wlr_xdg_surface_v6 *xdg_surface_v6 = view->wlr_xdg_surface_v6; | ||
277 | |||
278 | if (view->container->node.instruction) { | ||
279 | wlr_xdg_surface_v6_get_geometry(xdg_surface_v6, &view->geometry); | ||
280 | transaction_notify_view_ready_by_serial(view, | ||
281 | xdg_surface_v6->configure_serial); | ||
282 | } else { | ||
283 | struct wlr_box new_geo; | ||
284 | wlr_xdg_surface_v6_get_geometry(xdg_surface_v6, &new_geo); | ||
285 | struct sway_container *con = view->container; | ||
286 | |||
287 | if ((new_geo.width != con->surface_width || | ||
288 | new_geo.height != con->surface_height)) { | ||
289 | // The view has unexpectedly sent a new size | ||
290 | desktop_damage_view(view); | ||
291 | view_update_size(view, new_geo.width, new_geo.height); | ||
292 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | ||
293 | desktop_damage_view(view); | ||
294 | transaction_commit_dirty(); | ||
295 | } else { | ||
296 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | ||
297 | } | ||
298 | } | ||
299 | |||
300 | view_damage_from(view); | ||
301 | } | ||
302 | |||
303 | static void handle_set_title(struct wl_listener *listener, void *data) { | ||
304 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | ||
305 | wl_container_of(listener, xdg_shell_v6_view, set_title); | ||
306 | struct sway_view *view = &xdg_shell_v6_view->view; | ||
307 | view_update_title(view, false); | ||
308 | view_execute_criteria(view); | ||
309 | } | ||
310 | |||
311 | static void handle_set_app_id(struct wl_listener *listener, void *data) { | ||
312 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | ||
313 | wl_container_of(listener, xdg_shell_v6_view, set_app_id); | ||
314 | struct sway_view *view = &xdg_shell_v6_view->view; | ||
315 | view_execute_criteria(view); | ||
316 | } | ||
317 | |||
318 | static void handle_new_popup(struct wl_listener *listener, void *data) { | ||
319 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | ||
320 | wl_container_of(listener, xdg_shell_v6_view, new_popup); | ||
321 | struct wlr_xdg_popup_v6 *wlr_popup = data; | ||
322 | popup_create(wlr_popup, &xdg_shell_v6_view->view); | ||
323 | } | ||
324 | |||
325 | static void handle_request_fullscreen(struct wl_listener *listener, void *data) { | ||
326 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | ||
327 | wl_container_of(listener, xdg_shell_v6_view, request_fullscreen); | ||
328 | struct wlr_xdg_toplevel_v6_set_fullscreen_event *e = data; | ||
329 | struct wlr_xdg_surface_v6 *xdg_surface = | ||
330 | xdg_shell_v6_view->view.wlr_xdg_surface_v6; | ||
331 | struct sway_view *view = &xdg_shell_v6_view->view; | ||
332 | |||
333 | if (!sway_assert(xdg_surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL, | ||
334 | "xdg_shell_v6 requested fullscreen of surface with role %i", | ||
335 | xdg_surface->role)) { | ||
336 | return; | ||
337 | } | ||
338 | if (!xdg_surface->mapped) { | ||
339 | return; | ||
340 | } | ||
341 | |||
342 | if (e->fullscreen && e->output && e->output->data) { | ||
343 | struct sway_output *output = e->output->data; | ||
344 | struct sway_workspace *ws = output_get_active_workspace(output); | ||
345 | if (ws && !container_is_scratchpad_hidden(view->container)) { | ||
346 | if (container_is_floating(view->container)) { | ||
347 | workspace_add_floating(ws, view->container); | ||
348 | } else { | ||
349 | workspace_add_tiling(ws, view->container); | ||
350 | } | ||
351 | } | ||
352 | } | ||
353 | |||
354 | container_set_fullscreen(view->container, e->fullscreen); | ||
355 | |||
356 | arrange_root(); | ||
357 | transaction_commit_dirty(); | ||
358 | } | ||
359 | |||
360 | static void handle_request_move(struct wl_listener *listener, void *data) { | ||
361 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | ||
362 | wl_container_of(listener, xdg_shell_v6_view, request_move); | ||
363 | struct sway_view *view = &xdg_shell_v6_view->view; | ||
364 | if (!container_is_floating(view->container)) { | ||
365 | return; | ||
366 | } | ||
367 | struct wlr_xdg_toplevel_v6_move_event *e = data; | ||
368 | struct sway_seat *seat = e->seat->seat->data; | ||
369 | if (e->serial == seat->last_button_serial) { | ||
370 | seatop_begin_move_floating(seat, view->container); | ||
371 | } | ||
372 | } | ||
373 | |||
374 | static void handle_request_resize(struct wl_listener *listener, void *data) { | ||
375 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | ||
376 | wl_container_of(listener, xdg_shell_v6_view, request_resize); | ||
377 | struct sway_view *view = &xdg_shell_v6_view->view; | ||
378 | if (!container_is_floating(view->container)) { | ||
379 | return; | ||
380 | } | ||
381 | struct wlr_xdg_toplevel_v6_resize_event *e = data; | ||
382 | struct sway_seat *seat = e->seat->seat->data; | ||
383 | if (e->serial == seat->last_button_serial) { | ||
384 | seatop_begin_resize_floating(seat, view->container, e->edges); | ||
385 | } | ||
386 | } | ||
387 | |||
388 | static void handle_unmap(struct wl_listener *listener, void *data) { | ||
389 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | ||
390 | wl_container_of(listener, xdg_shell_v6_view, unmap); | ||
391 | struct sway_view *view = &xdg_shell_v6_view->view; | ||
392 | |||
393 | if (!sway_assert(view->surface, "Cannot unmap unmapped view")) { | ||
394 | return; | ||
395 | } | ||
396 | |||
397 | view_unmap(view); | ||
398 | |||
399 | wl_list_remove(&xdg_shell_v6_view->commit.link); | ||
400 | wl_list_remove(&xdg_shell_v6_view->new_popup.link); | ||
401 | wl_list_remove(&xdg_shell_v6_view->request_fullscreen.link); | ||
402 | wl_list_remove(&xdg_shell_v6_view->request_move.link); | ||
403 | wl_list_remove(&xdg_shell_v6_view->request_resize.link); | ||
404 | wl_list_remove(&xdg_shell_v6_view->set_title.link); | ||
405 | wl_list_remove(&xdg_shell_v6_view->set_app_id.link); | ||
406 | } | ||
407 | |||
408 | static void handle_map(struct wl_listener *listener, void *data) { | ||
409 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | ||
410 | wl_container_of(listener, xdg_shell_v6_view, map); | ||
411 | struct sway_view *view = &xdg_shell_v6_view->view; | ||
412 | struct wlr_xdg_surface_v6 *xdg_surface = view->wlr_xdg_surface_v6; | ||
413 | |||
414 | view->natural_width = view->wlr_xdg_surface_v6->geometry.width; | ||
415 | view->natural_height = view->wlr_xdg_surface_v6->geometry.height; | ||
416 | if (!view->natural_width && !view->natural_height) { | ||
417 | view->natural_width = view->wlr_xdg_surface_v6->surface->current.width; | ||
418 | view->natural_height = view->wlr_xdg_surface_v6->surface->current.height; | ||
419 | } | ||
420 | struct sway_server_decoration *deco = | ||
421 | decoration_from_surface(xdg_surface->surface); | ||
422 | bool csd = !deco || deco->wlr_server_decoration->mode | ||
423 | == WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT; | ||
424 | |||
425 | view_map(view, view->wlr_xdg_surface_v6->surface, | ||
426 | xdg_surface->toplevel->client_pending.fullscreen, | ||
427 | xdg_surface->toplevel->client_pending.fullscreen_output, | ||
428 | csd); | ||
429 | |||
430 | transaction_commit_dirty(); | ||
431 | |||
432 | xdg_shell_v6_view->commit.notify = handle_commit; | ||
433 | wl_signal_add(&xdg_surface->surface->events.commit, | ||
434 | &xdg_shell_v6_view->commit); | ||
435 | |||
436 | xdg_shell_v6_view->new_popup.notify = handle_new_popup; | ||
437 | wl_signal_add(&xdg_surface->events.new_popup, | ||
438 | &xdg_shell_v6_view->new_popup); | ||
439 | |||
440 | xdg_shell_v6_view->request_fullscreen.notify = handle_request_fullscreen; | ||
441 | wl_signal_add(&xdg_surface->toplevel->events.request_fullscreen, | ||
442 | &xdg_shell_v6_view->request_fullscreen); | ||
443 | |||
444 | xdg_shell_v6_view->request_move.notify = handle_request_move; | ||
445 | wl_signal_add(&xdg_surface->toplevel->events.request_move, | ||
446 | &xdg_shell_v6_view->request_move); | ||
447 | |||
448 | xdg_shell_v6_view->request_resize.notify = handle_request_resize; | ||
449 | wl_signal_add(&xdg_surface->toplevel->events.request_resize, | ||
450 | &xdg_shell_v6_view->request_resize); | ||
451 | |||
452 | xdg_shell_v6_view->set_title.notify = handle_set_title; | ||
453 | wl_signal_add(&xdg_surface->toplevel->events.set_title, | ||
454 | &xdg_shell_v6_view->set_title); | ||
455 | |||
456 | xdg_shell_v6_view->set_app_id.notify = handle_set_app_id; | ||
457 | wl_signal_add(&xdg_surface->toplevel->events.set_app_id, | ||
458 | &xdg_shell_v6_view->set_app_id); | ||
459 | } | ||
460 | |||
461 | static void handle_destroy(struct wl_listener *listener, void *data) { | ||
462 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | ||
463 | wl_container_of(listener, xdg_shell_v6_view, destroy); | ||
464 | struct sway_view *view = &xdg_shell_v6_view->view; | ||
465 | wl_list_remove(&xdg_shell_v6_view->destroy.link); | ||
466 | wl_list_remove(&xdg_shell_v6_view->map.link); | ||
467 | wl_list_remove(&xdg_shell_v6_view->unmap.link); | ||
468 | view->wlr_xdg_surface_v6 = NULL; | ||
469 | view_begin_destroy(view); | ||
470 | } | ||
471 | |||
472 | struct sway_view *view_from_wlr_xdg_surface_v6( | ||
473 | struct wlr_xdg_surface_v6 *xdg_surface_v6) { | ||
474 | return xdg_surface_v6->data; | ||
475 | } | ||
476 | |||
477 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { | ||
478 | struct wlr_xdg_surface_v6 *xdg_surface = data; | ||
479 | |||
480 | if (xdg_surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP) { | ||
481 | sway_log(SWAY_DEBUG, "New xdg_shell_v6 popup"); | ||
482 | return; | ||
483 | } | ||
484 | |||
485 | sway_log(SWAY_DEBUG, "New xdg_shell_v6 toplevel title='%s' app_id='%s'", | ||
486 | xdg_surface->toplevel->title, xdg_surface->toplevel->app_id); | ||
487 | wlr_xdg_surface_v6_ping(xdg_surface); | ||
488 | |||
489 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | ||
490 | calloc(1, sizeof(struct sway_xdg_shell_v6_view)); | ||
491 | if (!sway_assert(xdg_shell_v6_view, "Failed to allocate view")) { | ||
492 | return; | ||
493 | } | ||
494 | |||
495 | view_init(&xdg_shell_v6_view->view, SWAY_VIEW_XDG_SHELL_V6, &view_impl); | ||
496 | xdg_shell_v6_view->view.wlr_xdg_surface_v6 = xdg_surface; | ||
497 | |||
498 | xdg_shell_v6_view->map.notify = handle_map; | ||
499 | wl_signal_add(&xdg_surface->events.map, &xdg_shell_v6_view->map); | ||
500 | |||
501 | xdg_shell_v6_view->unmap.notify = handle_unmap; | ||
502 | wl_signal_add(&xdg_surface->events.unmap, &xdg_shell_v6_view->unmap); | ||
503 | |||
504 | xdg_shell_v6_view->destroy.notify = handle_destroy; | ||
505 | wl_signal_add(&xdg_surface->events.destroy, &xdg_shell_v6_view->destroy); | ||
506 | |||
507 | xdg_surface->data = xdg_shell_v6_view; | ||
508 | } | ||
diff --git a/sway/meson.build b/sway/meson.build index 157e3996..4783c58f 100644 --- a/sway/meson.build +++ b/sway/meson.build | |||
@@ -17,7 +17,6 @@ sway_sources = files( | |||
17 | 'desktop/output.c', | 17 | 'desktop/output.c', |
18 | 'desktop/render.c', | 18 | 'desktop/render.c', |
19 | 'desktop/transaction.c', | 19 | 'desktop/transaction.c', |
20 | 'desktop/xdg_shell_v6.c', | ||
21 | 'desktop/xdg_shell.c', | 20 | 'desktop/xdg_shell.c', |
22 | 21 | ||
23 | 'input/input-manager.c', | 22 | 'input/input-manager.c', |
diff --git a/sway/server.c b/sway/server.c index 784237d4..6fe2a919 100644 --- a/sway/server.c +++ b/sway/server.c | |||
@@ -81,11 +81,6 @@ bool server_init(struct sway_server *server) { | |||
81 | &server->layer_shell_surface); | 81 | &server->layer_shell_surface); |
82 | server->layer_shell_surface.notify = handle_layer_shell_surface; | 82 | server->layer_shell_surface.notify = handle_layer_shell_surface; |
83 | 83 | ||
84 | server->xdg_shell_v6 = wlr_xdg_shell_v6_create(server->wl_display); | ||
85 | wl_signal_add(&server->xdg_shell_v6->events.new_surface, | ||
86 | &server->xdg_shell_v6_surface); | ||
87 | server->xdg_shell_v6_surface.notify = handle_xdg_shell_v6_surface; | ||
88 | |||
89 | server->xdg_shell = wlr_xdg_shell_create(server->wl_display); | 84 | server->xdg_shell = wlr_xdg_shell_create(server->wl_display); |
90 | wl_signal_add(&server->xdg_shell->events.new_surface, | 85 | wl_signal_add(&server->xdg_shell->events.new_surface, |
91 | &server->xdg_shell_surface); | 86 | &server->xdg_shell_surface); |
diff --git a/sway/tree/container.c b/sway/tree/container.c index 7068e166..6620921f 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -6,8 +6,6 @@ | |||
6 | #include <strings.h> | 6 | #include <strings.h> |
7 | #include <wayland-server-core.h> | 7 | #include <wayland-server-core.h> |
8 | #include <wlr/types/wlr_output_layout.h> | 8 | #include <wlr/types/wlr_output_layout.h> |
9 | #include <wlr/types/wlr_xdg_shell_v6.h> | ||
10 | #include <wlr/types/wlr_xdg_shell.h> | ||
11 | #include "cairo.h" | 9 | #include "cairo.h" |
12 | #include "pango.h" | 10 | #include "pango.h" |
13 | #include "sway/config.h" | 11 | #include "sway/config.h" |
@@ -187,11 +185,6 @@ static struct sway_container *surface_at_view(struct sway_container *con, double | |||
187 | view_sx, view_sy, &_sx, &_sy); | 185 | view_sx, view_sy, &_sx, &_sy); |
188 | break; | 186 | break; |
189 | #endif | 187 | #endif |
190 | case SWAY_VIEW_XDG_SHELL_V6: | ||
191 | _surface = wlr_xdg_surface_v6_surface_at( | ||
192 | view->wlr_xdg_surface_v6, | ||
193 | view_sx, view_sy, &_sx, &_sy); | ||
194 | break; | ||
195 | case SWAY_VIEW_XDG_SHELL: | 188 | case SWAY_VIEW_XDG_SHELL: |
196 | _surface = wlr_xdg_surface_surface_at( | 189 | _surface = wlr_xdg_surface_surface_at( |
197 | view->wlr_xdg_surface, | 190 | view->wlr_xdg_surface, |
@@ -358,19 +351,6 @@ static bool surface_is_popup(struct wlr_surface *surface) { | |||
358 | return false; | 351 | return false; |
359 | } | 352 | } |
360 | 353 | ||
361 | if (wlr_surface_is_xdg_surface_v6(surface)) { | ||
362 | struct wlr_xdg_surface_v6 *xdg_surface_v6 = | ||
363 | wlr_xdg_surface_v6_from_wlr_surface(surface); | ||
364 | while (xdg_surface_v6 && | ||
365 | xdg_surface_v6->role != WLR_XDG_SURFACE_V6_ROLE_NONE) { | ||
366 | if (xdg_surface_v6->role == WLR_XDG_SURFACE_V6_ROLE_POPUP) { | ||
367 | return true; | ||
368 | } | ||
369 | xdg_surface_v6 = xdg_surface_v6->toplevel->parent; | ||
370 | } | ||
371 | return false; | ||
372 | } | ||
373 | |||
374 | return false; | 354 | return false; |
375 | } | 355 | } |
376 | 356 | ||
diff --git a/sway/tree/view.c b/sway/tree/view.c index 0f35d970..1d9cbec7 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -132,8 +132,6 @@ uint32_t view_get_window_type(struct sway_view *view) { | |||
132 | 132 | ||
133 | const char *view_get_shell(struct sway_view *view) { | 133 | const char *view_get_shell(struct sway_view *view) { |
134 | switch(view->type) { | 134 | switch(view->type) { |
135 | case SWAY_VIEW_XDG_SHELL_V6: | ||
136 | return "xdg_shell_v6"; | ||
137 | case SWAY_VIEW_XDG_SHELL: | 135 | case SWAY_VIEW_XDG_SHELL: |
138 | return "xdg_shell"; | 136 | return "xdg_shell"; |
139 | #if HAVE_XWAYLAND | 137 | #if HAVE_XWAYLAND |
@@ -933,11 +931,6 @@ struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) { | |||
933 | wlr_xdg_surface_from_wlr_surface(wlr_surface); | 931 | wlr_xdg_surface_from_wlr_surface(wlr_surface); |
934 | return view_from_wlr_xdg_surface(xdg_surface); | 932 | return view_from_wlr_xdg_surface(xdg_surface); |
935 | } | 933 | } |
936 | if (wlr_surface_is_xdg_surface_v6(wlr_surface)) { | ||
937 | struct wlr_xdg_surface_v6 *xdg_surface_v6 = | ||
938 | wlr_xdg_surface_v6_from_wlr_surface(wlr_surface); | ||
939 | return view_from_wlr_xdg_surface_v6(xdg_surface_v6); | ||
940 | } | ||
941 | #if HAVE_XWAYLAND | 934 | #if HAVE_XWAYLAND |
942 | if (wlr_surface_is_xwayland_surface(wlr_surface)) { | 935 | if (wlr_surface_is_xwayland_surface(wlr_surface)) { |
943 | struct wlr_xwayland_surface *xsurface = | 936 | struct wlr_xwayland_surface *xsurface = |