fix: only update view position when needed
This commit is contained in:
parent
c50bc3864f
commit
7df1dec7f3
21
view.c
21
view.c
@ -418,7 +418,10 @@ void diyac_view_update_app_id(struct diyac_view *view)
|
|||||||
void diyac_view_sync_geo(struct diyac_view *view)
|
void diyac_view_sync_geo(struct diyac_view *view)
|
||||||
{
|
{
|
||||||
struct wlr_box size;
|
struct wlr_box size;
|
||||||
|
int current_x, current_y, next_x, next_y;
|
||||||
|
wlr_scene_node_coords(&view->scene_tree->node, ¤t_x, ¤t_y);
|
||||||
wlr_xdg_surface_get_geometry(view->xdg_surface, &size);
|
wlr_xdg_surface_get_geometry(view->xdg_surface, &size);
|
||||||
|
|
||||||
if (!view->state.fullscreen && !view->state.maximized)
|
if (!view->state.fullscreen && !view->state.maximized)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -445,16 +448,20 @@ void diyac_view_sync_geo(struct diyac_view *view)
|
|||||||
|
|
||||||
view->original.width = size.width;
|
view->original.width = size.width;
|
||||||
view->original.height = size.height;
|
view->original.height = size.height;
|
||||||
wlr_scene_node_set_position(&view->scene_tree->node, view->original.x, view->original.y);
|
next_x = view->original.x;
|
||||||
|
next_y = view->original.y;
|
||||||
view->pending_size = view->original;
|
view->pending_size = view->original;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(wlr_box_equal(&size, &view->pending_size))
|
|
||||||
{
|
next_x = view->pending_size.x;
|
||||||
return;
|
next_y = view->pending_size.y;
|
||||||
}
|
}
|
||||||
//wlr_log(WLR_ERROR, "update fullscreen position");
|
if(current_x != next_x || current_y != next_y)
|
||||||
wlr_scene_node_set_position(&view->scene_tree->node, view->pending_size.x, view->pending_size.y);
|
{
|
||||||
|
//wlr_log(WLR_INFO, "update fullscreen position [%d,%d] VS pending [%d,%d]",
|
||||||
|
// current_x, current_y, next_x, next_y);
|
||||||
|
wlr_scene_node_set_position(&view->scene_tree->node, next_x, next_y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user