beh

X11 image viewer
git clone https://git.porkepik.fr/beh
Log | Files | Refs | README | LICENSE

commit b403ccd8deb3bafe584bf39eb288fe7077594c21
parent 5bb27b95c4671d2ffd2e5ea8bf97960f57e2bf8f
Author: Thomas Philippe <dev@porkepik.fr>
Date:   Sat,  4 Jul 2020 07:01:47 +0200

fix first image not displayed properly

Diffstat:
Mbeh.c | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/beh.c b/beh.c @@ -246,9 +246,9 @@ apply_image(Pixmap pixmap) XImage *ximg = XCreateImage(dpy, DefaultVisual(dpy, 0), 24, ZPixmap, 0, (char *)img.dpy_data, img.dpy_width, img.dpy_height, 8, 0); + XSetWindowBackgroundPixmap(dpy, app.win, pixmap); XPutImage(dpy, pixmap, DefaultGC(dpy, 0), ximg, img.src_x, img.src_y, img.dest_x, img.dest_y, img.dpy_width, img.dpy_height); - XSetWindowBackgroundPixmap(dpy, app.win, pixmap); XClearWindow(dpy, app.win); XFree(ximg); @@ -268,11 +268,13 @@ event_loop() memset(gotobuf, 0, 10); left_mouse_hold = imgid = 0; + set_zoom(NO_ZOOM); + pixmap = create_pixmap(); + apply_image(pixmap); + while (1) { XNextEvent(dpy, &ev); switch (ev.type) { - case Expose: - break; case ConfigureNotify: xce = ev.xconfigure; if (xce.width != app.width || @@ -292,7 +294,7 @@ event_loop() } else if (keysym >= XK_0 && keysym <= XK_9) { if (gotobuf[9] == '\0') { char tmp[2]; - printf("%lu\n", keysym - 48); + sprintf(tmp, "%lu", keysym - 48); strcat(gotobuf, tmp); } } else if (keysym == XK_g) {