Skip to content

Commit

Permalink
Properly place windows with xdg-positioner
Browse files Browse the repository at this point in the history
  • Loading branch information
Hummer12007 committed Jan 19, 2017
1 parent 2827886 commit 68507e5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions sway/handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,25 @@ static bool handle_view_created(wlc_handle handle) {
}
}
}

const struct wlc_geometry *anchor = wlc_view_positioner_get_anchor_rect(handle);
if (anchor) {
// TODO: test with hidpi
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",
Expand Down

0 comments on commit 68507e5

Please sign in to comment.