aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xdg_shell.c
diff options
context:
space:
mode:
authorLibravatar Kirill Primak <vyivel@posteo.net>2021-11-13 08:53:51 +0300
committerLibravatar Simon Ser <contact@emersion.fr>2022-02-03 21:01:28 +0100
commit30d27b5996f396b46e2d6dd60e826ff031472136 (patch)
tree2061db82d151f0a09d809fb7bbf33b301dbae843 /sway/desktop/xdg_shell.c
parentchore: chase wlr_output_layout_get_box() update (diff)
downloadsway-30d27b5996f396b46e2d6dd60e826ff031472136.tar.gz
sway-30d27b5996f396b46e2d6dd60e826ff031472136.tar.zst
sway-30d27b5996f396b46e2d6dd60e826ff031472136.zip
Chase wlroots xdg-shell refactor
Diffstat (limited to 'sway/desktop/xdg_shell.c')
-rw-r--r--sway/desktop/xdg_shell.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index 5fae8296..585e5ee8 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -148,7 +148,8 @@ static uint32_t configure(struct sway_view *view, double lx, double ly,
148 if (xdg_shell_view == NULL) { 148 if (xdg_shell_view == NULL) {
149 return 0; 149 return 0;
150 } 150 }
151 return wlr_xdg_toplevel_set_size(view->wlr_xdg_surface, width, height); 151 return wlr_xdg_toplevel_set_size(view->wlr_xdg_surface->toplevel,
152 width, height);
152} 153}
153 154
154static void set_activated(struct sway_view *view, bool activated) { 155static void set_activated(struct sway_view *view, bool activated) {
@@ -157,7 +158,7 @@ static void set_activated(struct sway_view *view, bool activated) {
157 } 158 }
158 struct wlr_xdg_surface *surface = view->wlr_xdg_surface; 159 struct wlr_xdg_surface *surface = view->wlr_xdg_surface;
159 if (surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) { 160 if (surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
160 wlr_xdg_toplevel_set_activated(surface, activated); 161 wlr_xdg_toplevel_set_activated(surface->toplevel, activated);
161 } 162 }
162} 163}
163 164
@@ -171,7 +172,7 @@ static void set_tiled(struct sway_view *view, bool tiled) {
171 edges = WLR_EDGE_LEFT | WLR_EDGE_RIGHT | WLR_EDGE_TOP | 172 edges = WLR_EDGE_LEFT | WLR_EDGE_RIGHT | WLR_EDGE_TOP |
172 WLR_EDGE_BOTTOM; 173 WLR_EDGE_BOTTOM;
173 } 174 }
174 wlr_xdg_toplevel_set_tiled(surface, edges); 175 wlr_xdg_toplevel_set_tiled(surface->toplevel, edges);
175} 176}
176 177
177static void set_fullscreen(struct sway_view *view, bool fullscreen) { 178static void set_fullscreen(struct sway_view *view, bool fullscreen) {
@@ -179,7 +180,7 @@ static void set_fullscreen(struct sway_view *view, bool fullscreen) {
179 return; 180 return;
180 } 181 }
181 struct wlr_xdg_surface *surface = view->wlr_xdg_surface; 182 struct wlr_xdg_surface *surface = view->wlr_xdg_surface;
182 wlr_xdg_toplevel_set_fullscreen(surface, fullscreen); 183 wlr_xdg_toplevel_set_fullscreen(surface->toplevel, fullscreen);
183} 184}
184 185
185static void set_resizing(struct sway_view *view, bool resizing) { 186static void set_resizing(struct sway_view *view, bool resizing) {
@@ -187,7 +188,7 @@ static void set_resizing(struct sway_view *view, bool resizing) {
187 return; 188 return;
188 } 189 }
189 struct wlr_xdg_surface *surface = view->wlr_xdg_surface; 190 struct wlr_xdg_surface *surface = view->wlr_xdg_surface;
190 wlr_xdg_toplevel_set_resizing(surface, resizing); 191 wlr_xdg_toplevel_set_resizing(surface->toplevel, resizing);
191} 192}
192 193
193static bool wants_floating(struct sway_view *view) { 194static bool wants_floating(struct sway_view *view) {
@@ -222,12 +223,12 @@ static bool is_transient_for(struct sway_view *child,
222 if (xdg_shell_view_from_view(child) == NULL) { 223 if (xdg_shell_view_from_view(child) == NULL) {
223 return false; 224 return false;
224 } 225 }
225 struct wlr_xdg_surface *surface = child->wlr_xdg_surface; 226 struct wlr_xdg_toplevel *toplevel = child->wlr_xdg_surface->toplevel;
226 while (surface && surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) { 227 while (toplevel) {
227 if (surface->toplevel->parent == ancestor->wlr_xdg_surface) { 228 if (toplevel->parent == ancestor->wlr_xdg_surface->toplevel) {
228 return true; 229 return true;
229 } 230 }
230 surface = surface->toplevel->parent; 231 toplevel = toplevel->parent;
231 } 232 }
232 return false; 233 return false;
233} 234}
@@ -239,14 +240,14 @@ static void _close(struct sway_view *view) {
239 struct wlr_xdg_surface *surface = view->wlr_xdg_surface; 240 struct wlr_xdg_surface *surface = view->wlr_xdg_surface;
240 if (surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL 241 if (surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL
241 && surface->toplevel) { 242 && surface->toplevel) {
242 wlr_xdg_toplevel_send_close(surface); 243 wlr_xdg_toplevel_send_close(surface->toplevel);
243 } 244 }
244} 245}
245 246
246static void close_popups(struct sway_view *view) { 247static void close_popups(struct sway_view *view) {
247 struct wlr_xdg_popup *popup, *tmp; 248 struct wlr_xdg_popup *popup, *tmp;
248 wl_list_for_each_safe(popup, tmp, &view->wlr_xdg_surface->popups, link) { 249 wl_list_for_each_safe(popup, tmp, &view->wlr_xdg_surface->popups, link) {
249 wlr_xdg_popup_destroy(popup->base); 250 wlr_xdg_popup_destroy(popup);
250 } 251 }
251} 252}
252 253
@@ -337,7 +338,6 @@ static void handle_new_popup(struct wl_listener *listener, void *data) {
337static void handle_request_fullscreen(struct wl_listener *listener, void *data) { 338static void handle_request_fullscreen(struct wl_listener *listener, void *data) {
338 struct sway_xdg_shell_view *xdg_shell_view = 339 struct sway_xdg_shell_view *xdg_shell_view =
339 wl_container_of(listener, xdg_shell_view, request_fullscreen); 340 wl_container_of(listener, xdg_shell_view, request_fullscreen);
340 struct wlr_xdg_toplevel_set_fullscreen_event *e = data;
341 struct wlr_xdg_surface *xdg_surface = 341 struct wlr_xdg_surface *xdg_surface =
342 xdg_shell_view->view.wlr_xdg_surface; 342 xdg_shell_view->view.wlr_xdg_surface;
343 struct sway_view *view = &xdg_shell_view->view; 343 struct sway_view *view = &xdg_shell_view->view;
@@ -352,8 +352,9 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
352 } 352 }
353 353
354 struct sway_container *container = view->container; 354 struct sway_container *container = view->container;
355 if (e->fullscreen && e->output && e->output->data) { 355 struct wlr_xdg_toplevel_requested *req = &xdg_surface->toplevel->requested;
356 struct sway_output *output = e->output->data; 356 if (req->fullscreen && req->fullscreen_output && req->fullscreen_output->data) {
357 struct sway_output *output = req->fullscreen_output->data;
357 struct sway_workspace *ws = output_get_active_workspace(output); 358 struct sway_workspace *ws = output_get_active_workspace(output);
358 if (ws && !container_is_scratchpad_hidden(container) && 359 if (ws && !container_is_scratchpad_hidden(container) &&
359 container->pending.workspace != ws) { 360 container->pending.workspace != ws) {
@@ -365,7 +366,7 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
365 } 366 }
366 } 367 }
367 368
368 container_set_fullscreen(container, e->fullscreen); 369 container_set_fullscreen(container, req->fullscreen);
369 370
370 arrange_root(); 371 arrange_root();
371 transaction_commit_dirty(); 372 transaction_commit_dirty();