reduce calls to win-title

rather than calling the script unconditionally per redraw, we now have
a `title_dirty` flag and keep track of when any of the relavent
information changes.

Co-authored-by: Arthur Williams <taaparthur@gmail.com>
Partially fixes: https://github.com/nsxiv/nsxiv/issues/258
This commit is contained in:
NRK
2022-06-01 14:59:16 +06:00
committed by N-R-K
parent 364c3d6f01
commit 810a9651a3
7 changed files with 16 additions and 6 deletions

View File

@ -546,7 +546,7 @@ static bool img_fit(img_t *img)
if (ABS(img->zoom - z) > 1.0/MAX(img->w, img->h)) {
img->zoom = z;
img->dirty = true;
img->dirty = title_dirty = true;
return true;
} else {
return false;
@ -677,8 +677,7 @@ bool img_zoom_to(img_t *img, float z)
img->y = y - (y - img->y) * z / img->zoom;
img->zoom = z;
img->scalemode = SCALE_ZOOM;
img->checkpan = true;
img->dirty = true;
img->dirty = img->checkpan = title_dirty = true;
return true;
} else {
return false;