aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-05-26 20:37:04 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-06-01 23:14:58 +1000
commit3b1db30a5e5758ec099b79250681cbf4be5ae0e9 (patch)
tree5eb165beaf1de016aec2b2fe74c15c9034357ce8 /sway/desktop
parent4371c746e4d46c866ba4cdac2b3fba63a8de762e (diff)
Use surface size if xdg shell's geometry isn't set
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/xdg_shell.c13
-rw-r--r--sway/desktop/xdg_shell_v6.c13
2 files changed, 18 insertions, 8 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index ae6945c2..30990f67 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -182,13 +182,18 @@ static void handle_commit(struct wl_listener *listener, void *data) {
struct sway_xdg_shell_view *xdg_shell_view =
wl_container_of(listener, xdg_shell_view, commit);
struct sway_view *view = &xdg_shell_view->view;
- struct wlr_box *geometry = &view->wlr_xdg_surface->geometry;
+ int width = view->wlr_xdg_surface->geometry.width;
+ int height = view->wlr_xdg_surface->geometry.height;
+ if (!width && !height) {
+ width = view->wlr_xdg_surface->surface->current->width;
+ height = view->wlr_xdg_surface->surface->current->height;
+ }
if (!view->natural_width && !view->natural_height) {
- view->natural_width = geometry->width;
- view->natural_height = geometry->height;
+ view->natural_width = width;
+ view->natural_height = height;
}
if (view->swayc && container_is_floating(view->swayc)) {
- view_update_size(view, geometry->width, geometry->height);
+ view_update_size(view, width, height);
} else {
view_update_size(view, xdg_shell_view->pending_width,
xdg_shell_view->pending_height);
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index fc0abf56..7cba6e49 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -181,13 +181,18 @@ static void handle_commit(struct wl_listener *listener, void *data) {
struct sway_xdg_shell_v6_view *xdg_shell_v6_view =
wl_container_of(listener, xdg_shell_v6_view, commit);
struct sway_view *view = &xdg_shell_v6_view->view;
- struct wlr_box *geometry = &view->wlr_xdg_surface_v6->geometry;
+ int width = view->wlr_xdg_surface_v6->geometry.width;
+ int height = view->wlr_xdg_surface_v6->geometry.height;
+ if (!width && !height) {
+ width = view->wlr_xdg_surface_v6->surface->current->width;
+ height = view->wlr_xdg_surface_v6->surface->current->height;
+ }
if (!view->natural_width && !view->natural_height) {
- view->natural_width = geometry->width;
- view->natural_height = geometry->height;
+ view->natural_width = width;
+ view->natural_height = height;
}
if (view->swayc && container_is_floating(view->swayc)) {
- view_update_size(view, geometry->width, geometry->height);
+ view_update_size(view, width, height);
} else {
view_update_size(view, xdg_shell_v6_view->pending_width,
xdg_shell_v6_view->pending_height);