mirror of
https://github.com/swaywm/sway.git
synced 2024-11-13 05:54:11 +01:00
use absolute view geometry to calculate position
This commit is contained in:
parent
a018364be3
commit
c6f971d108
@ -346,23 +346,23 @@ swayc_t *new_floating_view(wlc_handle handle) {
|
|||||||
view->sticky = false;
|
view->sticky = false;
|
||||||
|
|
||||||
// Set the geometry of the floating view
|
// Set the geometry of the floating view
|
||||||
struct wlc_geometry geometry;
|
const struct wlc_geometry *geometry = wlc_view_get_geometry(handle);
|
||||||
wlc_view_get_visible_geometry(handle, &geometry);
|
|
||||||
|
|
||||||
// give it requested geometry, but place in center if possible
|
// give it requested geometry, but place in center if possible
|
||||||
// in top left otherwise
|
// in top left otherwise
|
||||||
if (geometry.size.w != 0) {
|
if (geometry->size.w != 0) {
|
||||||
view->x = (swayc_active_workspace()->width - geometry.size.w) / 2;
|
view->x = (swayc_active_workspace()->width - geometry->size.w) / 2;
|
||||||
} else {
|
} else {
|
||||||
view->x = 0;
|
view->x = 0;
|
||||||
}
|
}
|
||||||
if (geometry.size.h != 0) {
|
if (geometry->size.h != 0) {
|
||||||
view->y = (swayc_active_workspace()->height - geometry.size.h) / 2;
|
view->y = (swayc_active_workspace()->height - geometry->size.h) / 2;
|
||||||
} else {
|
} else {
|
||||||
view->y = 0;
|
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_width = view->width;
|
||||||
view->desired_height = view->height;
|
view->desired_height = view->height;
|
||||||
|
Loading…
Reference in New Issue
Block a user