aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xdg_shell_v6.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-18 15:10:06 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-18 15:10:06 +1000
commitb0a5f3a25f52bc1d48d771cb02820042006d8d9e (patch)
treee7a2e4c60e562589e3b9a54c6ce559a41dcf7534 /sway/desktop/xdg_shell_v6.c
parentSet current size when a floating xwayland view resizes (diff)
downloadsway-b0a5f3a25f52bc1d48d771cb02820042006d8d9e.tar.gz
sway-b0a5f3a25f52bc1d48d771cb02820042006d8d9e.tar.zst
sway-b0a5f3a25f52bc1d48d771cb02820042006d8d9e.zip
Store geometry in the view and handle any floating view resizing
Diffstat (limited to 'sway/desktop/xdg_shell_v6.c')
-rw-r--r--sway/desktop/xdg_shell_v6.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index bbc7456c..277c53a3 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -6,6 +6,7 @@
6#include <wlr/types/wlr_xdg_shell_v6.h> 6#include <wlr/types/wlr_xdg_shell_v6.h>
7#include "log.h" 7#include "log.h"
8#include "sway/decoration.h" 8#include "sway/decoration.h"
9#include "sway/desktop.h"
9#include "sway/input/input-manager.h" 10#include "sway/input/input-manager.h"
10#include "sway/input/seat.h" 11#include "sway/input/seat.h"
11#include "sway/server.h" 12#include "sway/server.h"
@@ -121,16 +122,6 @@ static const char *get_string_prop(struct sway_view *view,
121 } 122 }
122} 123}
123 124
124static void get_geometry(struct sway_view *view, struct wlr_box *box) {
125 struct sway_xdg_shell_v6_view *xdg_shell_v6_view =
126 xdg_shell_v6_view_from_view(view);
127 if (xdg_shell_v6_view == NULL) {
128 return;
129 }
130 struct wlr_xdg_surface_v6 *surface = view->wlr_xdg_surface_v6;
131 wlr_xdg_surface_v6_get_geometry(surface, box);
132}
133
134static uint32_t configure(struct sway_view *view, double lx, double ly, 125static uint32_t configure(struct sway_view *view, double lx, double ly,
135 int width, int height) { 126 int width, int height) {
136 struct sway_xdg_shell_v6_view *xdg_shell_v6_view = 127 struct sway_xdg_shell_v6_view *xdg_shell_v6_view =
@@ -239,7 +230,6 @@ static void destroy(struct sway_view *view) {
239static const struct sway_view_impl view_impl = { 230static const struct sway_view_impl view_impl = {
240 .get_constraints = get_constraints, 231 .get_constraints = get_constraints,
241 .get_string_prop = get_string_prop, 232 .get_string_prop = get_string_prop,
242 .get_geometry = get_geometry,
243 .configure = configure, 233 .configure = configure,
244 .set_activated = set_activated, 234 .set_activated = set_activated,
245 .set_tiled = set_tiled, 235 .set_tiled = set_tiled,
@@ -262,9 +252,26 @@ static void handle_commit(struct wl_listener *listener, void *data) {
262 if (!view->swayc) { 252 if (!view->swayc) {
263 return; 253 return;
264 } 254 }
255
265 if (view->swayc->instruction) { 256 if (view->swayc->instruction) {
257 wlr_xdg_surface_v6_get_geometry(xdg_surface_v6, &view->geometry);
266 transaction_notify_view_ready_by_serial(view, 258 transaction_notify_view_ready_by_serial(view,
267 xdg_surface_v6->configure_serial); 259 xdg_surface_v6->configure_serial);
260 } else {
261 struct wlr_box new_geo;
262 wlr_xdg_surface_v6_get_geometry(xdg_surface_v6, &new_geo);
263
264 if ((new_geo.width != view->width || new_geo.height != view->height) &&
265 container_is_floating(view->swayc)) {
266 // A floating view has unexpectedly sent a new size
267 desktop_damage_view(view);
268 view_update_size(view, new_geo.width, new_geo.height);
269 memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
270 desktop_damage_view(view);
271 transaction_commit_dirty();
272 } else {
273 memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
274 }
268 } 275 }
269 276
270 view_damage_from(view); 277 view_damage_from(view);