summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2017-01-19 06:19:08 -0500
committerLibravatar GitHub <noreply@github.com>2017-01-19 06:19:08 -0500
commitb3c0aa3a9e7dfd8f70643bbfaf64c8af1f58a7fa (patch)
treef9fdbe92c9c9eccab7e21c5423154bac2215e00c
parentMerge pull request #1053 from Hummer12007/__focused__ (diff)
parentProperly place windows with xdg-positioner (diff)
downloadsway-b3c0aa3a9e7dfd8f70643bbfaf64c8af1f58a7fa.tar.gz
sway-b3c0aa3a9e7dfd8f70643bbfaf64c8af1f58a7fa.tar.zst
sway-b3c0aa3a9e7dfd8f70643bbfaf64c8af1f58a7fa.zip
Merge pull request #1055 from Hummer12007/positioner
Properly place windows with xdg-positioner
-rw-r--r--sway/handlers.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sway/handlers.c b/sway/handlers.c
index ad6c1c19..cd685118 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -331,6 +331,24 @@ static bool handle_view_created(wlc_handle handle) {
331 } 331 }
332 } 332 }
333 } 333 }
334
335 const struct wlc_geometry *anchor = wlc_view_positioner_get_anchor_rect(handle);
336 if (anchor) {
337 struct wlc_geometry geo = *wlc_view_get_geometry(handle);
338 struct wlc_size sr = *wlc_view_positioner_get_size(handle);
339 if (sr.w <= 0 || sr.h <= 0)
340 sr = geo.size;
341 geo.origin = anchor->origin;
342 geo.size = sr;
343 wlc_handle parent = wlc_view_get_parent(handle);
344 if (parent) {
345 const struct wlc_geometry *pg = wlc_view_get_geometry(parent);
346 geo.origin.x += pg->origin.x;
347 geo.origin.y += pg->origin.y;
348 }
349 wlc_view_set_geometry(handle, 0, &geo);
350 }
351
334 sway_log(L_DEBUG, "handle:%" PRIuPTR " type:%x state:%x parent:%" PRIuPTR " " 352 sway_log(L_DEBUG, "handle:%" PRIuPTR " type:%x state:%x parent:%" PRIuPTR " "
335 "mask:%d (x:%d y:%d w:%d h:%d) title:%s " 353 "mask:%d (x:%d y:%d w:%d h:%d) title:%s "
336 "class:%s appid:%s", 354 "class:%s appid:%s",