mirror of
https://github.com/swaywm/sway.git
synced 2024-11-11 04:54:14 +01:00
Merge pull request #1001 from alkino/master
Put floating views in center, fallback on top left
This commit is contained in:
commit
2b34ba99d4
@ -340,9 +340,18 @@ swayc_t *new_floating_view(wlc_handle handle) {
|
|||||||
struct wlc_geometry geometry;
|
struct wlc_geometry geometry;
|
||||||
wlc_view_get_visible_geometry(handle, &geometry);
|
wlc_view_get_visible_geometry(handle, &geometry);
|
||||||
|
|
||||||
// give it requested geometry, but place in center
|
// give it requested geometry, but place in center if possible
|
||||||
view->x = (swayc_active_workspace()->width - geometry.size.w) / 2;
|
// in top left otherwise
|
||||||
view->y = (swayc_active_workspace()->height- geometry.size.h) / 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;
|
||||||
|
} else {
|
||||||
|
view->y = 0;
|
||||||
|
}
|
||||||
view->width = geometry.size.w;
|
view->width = geometry.size.w;
|
||||||
view->height = geometry.size.h;
|
view->height = geometry.size.h;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user