mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-23 18:39:48 +01:00
Center views on focused output
This commit is contained in:
parent
82a6598ca7
commit
74d31983b5
1 changed files with 6 additions and 2 deletions
|
@ -75,12 +75,16 @@ bool view_center(struct roots_view *view) {
|
|||
struct wlr_cursor *cursor = desktop->server->input->cursor;
|
||||
struct wlr_output *output = wlr_output_layout_output_at(desktop->layout,
|
||||
cursor->x, cursor->y);
|
||||
const struct wlr_output_layout_output *output_layout =
|
||||
wlr_output_layout_get(desktop->layout, output);
|
||||
if (!output) {
|
||||
return false;
|
||||
}
|
||||
|
||||
view->x = (double)(output->width - size.width) / 2;
|
||||
view->y = (double)(output->height - size.height) / 2;
|
||||
view->x = (double)(output->width - size.width) / 2
|
||||
+ output_layout->x;
|
||||
view->y = (double)(output->height - size.height) / 2
|
||||
+ output_layout->y;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue