diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-12-18 15:09:30 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-18 15:09:30 -0500 |
commit | 2b34ba99d42e935d0390e66dd36b7182fa9f5464 (patch) | |
tree | 3c2a1d3c8c6f625d53ea4e9b65f4f4aa4bbe3c10 /sway | |
parent | 1172566d4e298aa6c3555a0d606af4ff31d0db48 (diff) | |
parent | 0f0bbbff4dae750a0e6f5770c67224bdf3b1bf46 (diff) |
Merge pull request #1001 from alkino/master
Put floating views in center, fallback on top left
Diffstat (limited to 'sway')
-rw-r--r-- | sway/container.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sway/container.c b/sway/container.c index d9677cdb..e557f450 100644 --- a/sway/container.c +++ b/sway/container.c @@ -340,9 +340,18 @@ swayc_t *new_floating_view(wlc_handle handle) { struct wlc_geometry geometry; wlc_view_get_visible_geometry(handle, &geometry); - // give it requested geometry, but place in center - view->x = (swayc_active_workspace()->width - geometry.size.w) / 2; - view->y = (swayc_active_workspace()->height- geometry.size.h) / 2; + // give it requested geometry, but place in center if possible + // in top left otherwise + if (geometry.size.w != 0) { + view->x = (swayc_active_workspace()->width - geometry.size.w) / 2; + } else { + view->x = 0; + } + if (geometry.size.h != 0) { + view->y = (swayc_active_workspace()->height - geometry.size.h) / 2; + } else { + view->y = 0; + } view->width = geometry.size.w; view->height = geometry.size.h; |