summaryrefslogtreecommitdiff
path: root/sway/desktop/xdg_shell_v6.c
diff options
context:
space:
mode:
authorDrew DeVault <[email protected]>2018-08-18 19:26:36 -0400
committerGitHub <[email protected]>2018-08-18 19:26:36 -0400
commitd0a24465d75cc7197ee253e1de9fa961071cd034 (patch)
tree916f9f40b9f587d3cd24a8d7b2185b5c7808cfa4 /sway/desktop/xdg_shell_v6.c
parent373f0254a8d28511897e19ada1487b9115fc2019 (diff)
parentce78f6770e9c950d5335bedfd123979428561ae1 (diff)
Merge pull request #2466 from RyanDwyer/geometry
Fix geometry
Diffstat (limited to 'sway/desktop/xdg_shell_v6.c')
-rw-r--r--sway/desktop/xdg_shell_v6.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index 5b3c7b2b..277c53a3 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -6,6 +6,7 @@
#include <wlr/types/wlr_xdg_shell_v6.h>
#include "log.h"
#include "sway/decoration.h"
+#include "sway/desktop.h"
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"
#include "sway/server.h"
@@ -106,7 +107,8 @@ static void get_constraints(struct sway_view *view, double *min_width,
*max_height = state->max_height > 0 ? state->max_height : DBL_MAX;
}
-static const char *get_string_prop(struct sway_view *view, enum sway_view_prop prop) {
+static const char *get_string_prop(struct sway_view *view,
+ enum sway_view_prop prop) {
if (xdg_shell_v6_view_from_view(view) == NULL) {
return NULL;
}
@@ -250,9 +252,26 @@ static void handle_commit(struct wl_listener *listener, void *data) {
if (!view->swayc) {
return;
}
+
if (view->swayc->instruction) {
+ wlr_xdg_surface_v6_get_geometry(xdg_surface_v6, &view->geometry);
transaction_notify_view_ready_by_serial(view,
xdg_surface_v6->configure_serial);
+ } else {
+ struct wlr_box new_geo;
+ wlr_xdg_surface_v6_get_geometry(xdg_surface_v6, &new_geo);
+
+ if ((new_geo.width != view->width || new_geo.height != view->height) &&
+ container_is_floating(view->swayc)) {
+ // A floating view has unexpectedly sent a new size
+ desktop_damage_view(view);
+ view_update_size(view, new_geo.width, new_geo.height);
+ memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
+ desktop_damage_view(view);
+ transaction_commit_dirty();
+ } else {
+ memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
+ }
}
view_damage_from(view);