mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
don't set view->w and view->h when mapping xdg views
these should only be set on commit. doing so before then confuses code that expects these fields to be in sync with the scene tree, such as `handle_commit`. these were only being set so that `view_center` could read them to compute a centered position, so instead we can simply forward the values directly to `view_compute_centered_position` and `view_move`.
This commit is contained in:
parent
3dec9cf40c
commit
1b30edc778
3 changed files with 17 additions and 5 deletions
17
src/xdg.c
17
src/xdg.c
|
|
@ -285,10 +285,19 @@ position_xdg_toplevel_view(struct view *view)
|
|||
output_usable_area_from_cursor_coords(view->server);
|
||||
view->x = box.x;
|
||||
view->y = box.y;
|
||||
view->w = xdg_surface->current.geometry.width;
|
||||
view->h = xdg_surface->current.geometry.height;
|
||||
if (view->w && view->h) {
|
||||
view_center(view);
|
||||
|
||||
/* 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);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue