croptool

Image cropping tool
git clone git://lumidify.org/croptool.git
Log | Files | Refs | README | LICENSE

commit fb401fb8b1cf5dc3a2f75e0eb678a7a76f6b550b
parent ea1456cb68fb8b0c8be0e6bca86e28c9d8fb4769
Author: lumidify <nobody@lumidify.org>
Date:   Fri,  1 Jan 2021 22:54:22 +0100

Fix manual redrawing

Diffstat:
Mcroptool.1 | 4+++-
Mcroptool.c | 9+++++++--
2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/croptool.1 b/croptool.1 @@ -23,7 +23,9 @@ was skipped, nothing is printed out for it. .It Fl m Enable manual window redrawing (i.e. disable automatic redrawing) when the window is resized. This may be useful on older machines that start accelerating global -warming when the image is redrawn constantly while resizing. +warming when the image is redrawn constantly while resizing. Note that this also +disables exposure events, so the window has to be manually redrawn when switching +back to it from another window. .It Fl r Disable automatic redrawing while the cropping box is being dragged or resized, for the same reason as diff --git a/croptool.c b/croptool.c @@ -1,3 +1,4 @@ +/* FIXME: show error if there are no loadable images */ /* * Copyright (c) 2021 lumidify <nobody[at]lumidify.org> * @@ -276,8 +277,9 @@ main(int argc, char **argv) { XNextEvent(state.dpy, &event); switch (event.type) { case Expose: - queue_update(event.xexpose.x, event.xexpose.y, - event.xexpose.width, event.xexpose.height); + if (RESIZE_REDRAW) + queue_update(event.xexpose.x, event.xexpose.y, + event.xexpose.width, event.xexpose.height); break; case ConfigureNotify: if (RESIZE_REDRAW) @@ -831,6 +833,9 @@ key_press(XEvent event) { case XK_space: XGetWindowAttributes(state.dpy, state.win, &attrs); resize_window(attrs.width, attrs.height); + /* queue update separately to it also redraws when + size didn't change */ + queue_update(0, 0, state.window_w, state.window_h); break; default: break;