perf: skip frame repaint during resize grab, paint on release

wl_frame_paint is expensive (pixman blit per motion event).
Decorations content does not change during resize, only geometry.
Skip repaint while grab_type==2; repaint once on grab release.
This commit is contained in:
lkn 2026-06-24 19:28:30 +02:00
parent 12d49c6642
commit 1331103ce7
2 changed files with 10 additions and 0 deletions

View File

@ -575,6 +575,11 @@ void wl_frame_paint_button(WCoreWindow *button, WTexture *texture,
int
wl_frame_paint(struct WFrameWindow *fwin)
{
/* During live resize, skip expensive repaint — decorations content
* doesn't change, only geometry. Paint once on grab release. */
if (wl_state.grab_type == 2)
return 0;
struct wl_frame_buf *fb = frame_buf_find(fwin->core->window);
if (!fb || !fb->image)
return 0;

View File

@ -140,9 +140,14 @@ wl_grab_apply_motion(void)
void
wl_grab_end(void)
{
int was_resize = (wl_state.grab_type == 2);
wl_state.grab_type = 0;
wl_state.grab_view = NULL;
wl_set_cursor_image("left_ptr");
/* Repaint frame decorations deferred during resize */
if (was_resize && wl_state.scr && wl_state.scr->focused_window
&& wl_state.scr->focused_window->frame)
wm_backend->frame_paint(wl_state.scr->focused_window->frame);
}
void