Skip to content

Commit

Permalink
Merge pull request #1075 from zandrmartin/floating-positioning
Browse files Browse the repository at this point in the history
use absolute view geometry to calculate position
  • Loading branch information
ddevault authored Feb 14, 2017
2 parents a018364 + c6f971d commit 76614ef
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions sway/container.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,23 +346,23 @@ swayc_t *new_floating_view(wlc_handle handle) {
view->sticky = false;

// Set the geometry of the floating view
struct wlc_geometry geometry;
wlc_view_get_visible_geometry(handle, &geometry);
const struct wlc_geometry *geometry = wlc_view_get_geometry(handle);

// 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;
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;
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;

view->width = geometry->size.w;
view->height = geometry->size.h;

view->desired_width = view->width;
view->desired_height = view->height;
Expand Down

0 comments on commit 76614ef

Please sign in to comment.