aboutsummaryrefslogtreecommitdiff
path: root/sway/handlers.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-01-19 06:19:08 -0500
committerGitHub <noreply@github.com>2017-01-19 06:19:08 -0500
commitb3c0aa3a9e7dfd8f70643bbfaf64c8af1f58a7fa (patch)
treef9fdbe92c9c9eccab7e21c5423154bac2215e00c /sway/handlers.c
parent7cc6f288d9cdb85eead948f78237848b2d479004 (diff)
parent7520607b8d9c8b7e348190887ab3b2bf351b54ce (diff)
Merge pull request #1055 from Hummer12007/positioner
Properly place windows with xdg-positioner
Diffstat (limited to 'sway/handlers.c')
-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) {
}
}
}
+
+ const struct wlc_geometry *anchor = wlc_view_positioner_get_anchor_rect(handle);
+ if (anchor) {
+ struct wlc_geometry geo = *wlc_view_get_geometry(handle);
+ struct wlc_size sr = *wlc_view_positioner_get_size(handle);
+ if (sr.w <= 0 || sr.h <= 0)
+ sr = geo.size;
+ geo.origin = anchor->origin;
+ geo.size = sr;
+ wlc_handle parent = wlc_view_get_parent(handle);
+ if (parent) {
+ const struct wlc_geometry *pg = wlc_view_get_geometry(parent);
+ geo.origin.x += pg->origin.x;
+ geo.origin.y += pg->origin.y;
+ }
+ wlc_view_set_geometry(handle, 0, &geo);
+ }
+
sway_log(L_DEBUG, "handle:%" PRIuPTR " type:%x state:%x parent:%" PRIuPTR " "
"mask:%d (x:%d y:%d w:%d h:%d) title:%s "
"class:%s appid:%s",