From 7df1dec7f36ffd50be516f926cd6d21a947855d3 Mon Sep 17 00:00:00 2001 From: DanyLE Date: Sat, 13 Apr 2024 12:27:33 +0200 Subject: [PATCH] fix: only update view position when needed --- view.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/view.c b/view.c index 4e88f49..9129b24 100644 --- a/view.c +++ b/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) { 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); + 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.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; } else { - if(wlr_box_equal(&size, &view->pending_size)) - { - return; - } - //wlr_log(WLR_ERROR, "update fullscreen position"); - wlr_scene_node_set_position(&view->scene_tree->node, view->pending_size.x, view->pending_size.y); + + next_x = view->pending_size.x; + next_y = view->pending_size.y; + } + if(current_x != next_x || current_y != next_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); } }