mirror of
https://github.com/labwc/labwc.git
synced 2025-11-03 09:01:51 -05:00
xdg: Just call view_center() now that it uses pending width/height
This commit is contained in:
parent
cf6eb29ef5
commit
a1b5e1939d
3 changed files with 2 additions and 18 deletions
|
|
@ -243,7 +243,7 @@ view_output(struct view *view)
|
|||
return output_from_wlr_output(view->server, wlr_output);
|
||||
}
|
||||
|
||||
bool
|
||||
static bool
|
||||
view_compute_centered_position(struct view *view, int w, int h, int *x, int *y)
|
||||
{
|
||||
struct output *output = view_output(view);
|
||||
|
|
|
|||
15
src/xdg.c
15
src/xdg.c
|
|
@ -284,20 +284,7 @@ position_xdg_toplevel_view(struct view *view)
|
|||
output_usable_area_from_cursor_coords(view->server);
|
||||
view->current.x = box.x;
|
||||
view->current.y = box.y;
|
||||
|
||||
/* Center the view without touching its w and h fields. This means we
|
||||
* can't simply set w/h and call view_center(). w and h fields should
|
||||
* only be modified at commit, or they will not be in sync with the
|
||||
* scene tree
|
||||
*/
|
||||
int w = xdg_surface->current.geometry.width;
|
||||
int h = xdg_surface->current.geometry.height;
|
||||
if (w && h) {
|
||||
int x, y;
|
||||
if (view_compute_centered_position(view, w, h, &x, &y)) {
|
||||
view_move(view, x, y);
|
||||
}
|
||||
}
|
||||
view_center(view);
|
||||
} else {
|
||||
/*
|
||||
* If child-toplevel-views, we center-align relative to their
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue