aboutsummaryrefslogtreecommitdiffstats
path: root/image.c
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2022-06-01 10:59:16 +0200
committerN-R-K <nrk@disroot.org>2022-06-02 10:09:51 +0200
commit810a9651a362992383081619ca63122f41f1cd0a (patch)
treebea298b12676f642a4801a5d6385a781f918a639 /image.c
parent364c3d6f019a26e68f2bfb9594d6bc599a947be2 (diff)
downloadnsxiv-810a9651a362992383081619ca63122f41f1cd0a.tar.zst
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
Diffstat (limited to 'image.c')
-rw-r--r--image.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/image.c b/image.c
index 2904887..02e3957 100644
--- a/image.c
+++ b/image.c
@@ -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;