This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via f5c3fdd85dc385b05af7f41ede836a6074fb4c3c (commit) via b237bf3df004656f0668fbcf5c507b95a6e94504 (commit) via 66a5907055cd5fe7831d88f633dfff20be27a5bf (commit) via e26ee6f9de0c0ba897df7f61de6b92622c874a8f (commit) from 46fc9fc756d28ff45e30d962eb98fb1b8d80586c (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/f5c3fdd85dc385b05af7f41ede836a6074fb4...
commit f5c3fdd85dc385b05af7f41ede836a6074fb4c3c Author: Cyril Hrubis metan@ucw.cz Date: Sun Jun 10 22:56:36 2012 +0200
spiv: Make the original image cache larger.
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index c0e918d..72d8595 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -487,8 +487,8 @@ static void init_caches(struct loader_params *params) if (resized_size > 100 * 1024 * 1024) resized_size = 100 * 1024 * 1024;
- if (orig_size > 20 * 1024 * 1024) - orig_size = 20 * 1024 * 1024; + if (orig_size > 40 * 1024 * 1024) + orig_size = 40 * 1024 * 1024;
GP_DEBUG(1, "Cache sizes original = %u, resized = %u", orig_size, resized_size);
http://repo.or.cz/w/gfxprim.git/commit/b237bf3df004656f0668fbcf5c507b95a6e94...
commit b237bf3df004656f0668fbcf5c507b95a6e94504 Author: Cyril Hrubis metan@ucw.cz Date: Sun Jun 10 22:51:30 2012 +0200
spiv: Fix progress callback.
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index 531dfc8..c0e918d 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -140,9 +140,6 @@ GP_Context *load_image(struct loader_params *params, int elevate)
/* Image not cached, load it */ if (img == NULL) { - show_progress = params->show_progress || params->show_progress_once; - params->show_progress_once = 0; - fprintf(stderr, "Loading '%s'n", params->img_path);
cpu_timer_start(&timer, "Loading"); @@ -244,6 +241,9 @@ static void *image_loader(void *ptr) GP_ProgressCallback callback = {.callback = image_loader_callback};
cpu_timer_start(&sum_timer, "sum"); + + show_progress = params->show_progress || params->show_progress_once; + params->show_progress_once = 0;
/* Figure out rotation */ GP_Size w, h;
http://repo.or.cz/w/gfxprim.git/commit/66a5907055cd5fe7831d88f633dfff20be27a...
commit 66a5907055cd5fe7831d88f633dfff20be27a5bf Author: Cyril Hrubis metan@ucw.cz Date: Sun Jun 10 12:44:42 2012 +0200
spiv: PgUp and PgDown to scrolls by 10 images.
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index cec4ab6..531dfc8 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -594,7 +594,7 @@ int main(int argc, char *argv[])
while (GP_EventGet(&ev)) {
- GP_EventDump(&ev); + // GP_EventDump(&ev); switch (ev.type) { case GP_EV_KEY: @@ -629,6 +629,24 @@ int main(int argc, char *argv[]) GP_BackendExit(backend); return 0; break; + case GP_KEY_PAGE_UP: + argn+=10; + //TODO + if (argn >= argc) + argn = argf; + + params.show_progress_once = 1; + show_image(¶ms, argv[argn]); + break; + case GP_KEY_PAGE_DOWN: + argn-=10; + //TODO + if (argn < argf) + argn = argc - 1 ; + + params.show_progress_once = 1; + show_image(¶ms, argv[argn]); + break; case GP_KEY_RIGHT: case GP_KEY_UP: case GP_KEY_SPACE:
http://repo.or.cz/w/gfxprim.git/commit/e26ee6f9de0c0ba897df7f61de6b92622c874...
commit e26ee6f9de0c0ba897df7f61de6b92622c874a8f Author: Cyril Hrubis metan@ucw.cz Date: Sun Jun 10 12:43:31 2012 +0200
backends: Add Wait method.
diff --git a/include/backends/GP_Backend.h b/include/backends/GP_Backend.h index b28917e..159892d 100644 --- a/include/backends/GP_Backend.h +++ b/include/backends/GP_Backend.h @@ -105,14 +105,23 @@ typedef struct GP_Backend { int fd;
/* - * Some of the backends doesn't expose file descriptor - * (for example SDL is broken that way). + * Non-blocking event loop. * - * In that case the fd_list is NULL and this function - * is non NULL. + * The events are filled into the event queue see GP_Input.h. */ void (*Poll)(struct GP_Backend *self);
+ /* + * Blocking event loop. Blocks until events are ready. + * + * Note that events received by a backend are not necessarily + * translated to input events. So input queue may be empty + * after Wait has returned. + * + * The events are filled into the event queue see GP_Input.h. + */ + void (*Wait)(struct GP_Backend *self); + /* Backed private data */ char priv[]; } GP_Backend; @@ -151,6 +160,14 @@ static inline void GP_BackendPoll(GP_Backend *backend) }
/* + * Waits for backend events. + */ +static inline void GP_BackendWait(GP_Backend *backend) +{ + backend->Wait(backend); +} + +/* * Sets backend caption, if supported. * * When setting caption is not possible/implemented non zero is returned. diff --git a/libs/backends/GP_BackendVirtual.c b/libs/backends/GP_BackendVirtual.c index b28c3cb..89598f7 100644 --- a/libs/backends/GP_BackendVirtual.c +++ b/libs/backends/GP_BackendVirtual.c @@ -60,9 +60,9 @@ static void virt_update_rect(GP_Backend *self, GP_Coord x0, GP_Coord y0, virt->backend->UpdateRect(virt->backend, x0, y0, x1, y1); }
-static int virt_set_attributes(struct GP_Backend *self, - uint32_t w, uint32_t h, - const char *caption) +static int virt_set_attrs(struct GP_Backend *self, + uint32_t w, uint32_t h, + const char *caption) { struct virt_priv *virt = GP_BACKEND_PRIV(self); int ret; @@ -86,6 +86,13 @@ static void virt_poll(GP_Backend *self) virt->backend->Poll(virt->backend); }
+static void virt_wait(GP_Backend *self) +{ + struct virt_priv *virt = GP_BACKEND_PRIV(self); + + virt->backend->Wait(virt->backend); +} + static void virt_exit(GP_Backend *self) { struct virt_priv *virt = GP_BACKEND_PRIV(self); @@ -130,12 +137,9 @@ GP_Backend *GP_BackendVirtualInit(GP_Backend *backend, self->Flip = virt_flip; self->UpdateRect = virt_update_rect; self->Exit = virt_exit; - - if (backend->Poll) - self->Poll = virt_poll; - - if (backend->SetAttributes) - self->SetAttributes = virt_set_attributes; + self->Poll = backend->Poll ? virt_poll : NULL; + self->Wait = backend->Wait ? virt_wait : NULL; + self->SetAttributes = backend->SetAttributes ? virt_set_attrs : NULL;
return self;
diff --git a/libs/backends/GP_LinuxFB.c b/libs/backends/GP_LinuxFB.c index a374cbe..6d69ce4 100644 --- a/libs/backends/GP_LinuxFB.c +++ b/libs/backends/GP_LinuxFB.c @@ -29,6 +29,7 @@ #include <errno.h> #include <termios.h> #include <unistd.h> +#include <poll.h>
#include <linux/fb.h> #include <linux/kd.h> @@ -188,6 +189,18 @@ static void fb_poll(GP_Backend *self) GP_InputDriverKBDEventPut(buf[i]); }
+static void fb_wait(GP_Backend *self) +{ + struct fb_priv *fb = GP_BACKEND_PRIV(self); + + struct pollfd fd = {.fd = fb->con_fd, .events = POLLIN, .revents = 0}; + + if (poll(&fd, 1, -1) > 0) + fb_poll(self); + else + GP_WARN("poll(): %s", strerror(errno)); +} + static void fb_exit(GP_Backend *self) { struct fb_priv *fb = GP_BACKEND_PRIV(self); @@ -312,6 +325,7 @@ GP_Backend *GP_BackendLinuxFBInit(const char *path, int flag) backend->Exit = fb_exit; backend->SetAttributes = NULL; backend->Poll = flag ? fb_poll : NULL; + backend->Wait = flag ? fb_wait : NULL; backend->fd = fb->con_fd;
return backend; diff --git a/libs/backends/GP_SDL.c b/libs/backends/GP_SDL.c index 5705eec..d487dd6 100644 --- a/libs/backends/GP_SDL.c +++ b/libs/backends/GP_SDL.c @@ -82,6 +82,21 @@ static void sdl_poll(struct GP_Backend *self __attribute__((unused))) SDL_mutexV(mutex); }
+static void sdl_wait(struct GP_Backend *self __attribute__((unused))) +{ + SDL_Event ev; + + SDL_mutexP(mutex); + + SDL_WaitEvent(&ev); + GP_InputDriverSDLEventPut(&ev); + + while (SDL_PollEvent(&ev)) + GP_InputDriverSDLEventPut(&ev); + + SDL_mutexV(mutex); +} + int context_from_surface(GP_Context *context, SDL_Surface *surf) { /* sanity checks on the SDL surface */ @@ -145,6 +160,7 @@ static struct GP_Backend backend = { .Exit = sdl_exit, .fd = -1, .Poll = sdl_poll, + .Wait = sdl_wait, };
static void sdl_exit(struct GP_Backend *self __attribute__((unused))) diff --git a/libs/backends/GP_X11.c b/libs/backends/GP_X11.c index 8b12562..d95e2de 100644 --- a/libs/backends/GP_X11.c +++ b/libs/backends/GP_X11.c @@ -105,6 +105,34 @@ static void x11_flip(GP_Backend *self) XUnlockDisplay(x11->dpy); }
+static void x11_ev(GP_Backend *self, XEvent *ev) +{ + struct x11_priv *x11 = GP_BACKEND_PRIV(self); + + switch (ev->type) { + case Expose: + GP_DEBUG(4, "Expose %ix%i-%ix%i %i", + ev->xexpose.x, ev->xexpose.y, + ev->xexpose.width, ev->xexpose.height, + ev->xexpose.count); + + if (x11->resized_flag) + break; + + x11_update_rect(self, ev->xexpose.x, ev->xexpose.y, + ev->xexpose.x + ev->xexpose.width - 1, + ev->xexpose.y + ev->xexpose.height - 1); + break; + case ConfigureNotify: + if (ev->xconfigure.width == (int)self->context->w && + ev->xconfigure.height == (int)self->context->h) + break; + default: + GP_InputDriverX11EventPut(ev); + break; + } +} + static void x11_poll(GP_Backend *self) { struct x11_priv *x11 = GP_BACKEND_PRIV(self); @@ -114,34 +142,25 @@ static void x11_poll(GP_Backend *self) while (XPending(x11->dpy)) { XNextEvent(x11->dpy, &ev); - - switch (ev.type) { - case Expose: - GP_DEBUG(4, "Expose %ix%i-%ix%i %i", - ev.xexpose.x, ev.xexpose.y, - ev.xexpose.width, ev.xexpose.height, - ev.xexpose.count); - - if (x11->resized_flag) - break; - - x11_update_rect(self, ev.xexpose.x, ev.xexpose.y, - ev.xexpose.x + ev.xexpose.width - 1, - ev.xexpose.y + ev.xexpose.height - 1); - break; - case ConfigureNotify: - if (ev.xconfigure.width == (int)self->context->w && - ev.xconfigure.height == (int)self->context->h) - break; - default: - GP_InputDriverX11EventPut(&ev); - break; - } + x11_ev(self, &ev); } XUnlockDisplay(x11->dpy); }
+static void x11_wait(GP_Backend *self) +{ + struct x11_priv *x11 = GP_BACKEND_PRIV(self); + XEvent ev; + + XLockDisplay(x11->dpy); + + XNextEvent(x11->dpy, &ev); + x11_ev(self, &ev); + + XUnlockDisplay(x11->dpy); +} + static int x11_set_attributes(struct GP_Backend *self, uint32_t w, uint32_t h, const char *caption) @@ -495,6 +514,7 @@ GP_Backend *GP_BackendX11Init(const char *display, int x, int y, backend->UpdateRect = x11_update_rect; backend->Exit = x11_exit; backend->Poll = x11_poll; + backend->Wait = x11_wait; backend->SetAttributes = x11_set_attributes; backend->fd = XConnectionNumber(x11->dpy);
-----------------------------------------------------------------------
Summary of changes: demos/spiv/spiv.c | 30 +++++++++++++--- include/backends/GP_Backend.h | 25 ++++++++++++-- libs/backends/GP_BackendVirtual.c | 22 +++++++----- libs/backends/GP_LinuxFB.c | 14 ++++++++ libs/backends/GP_SDL.c | 16 +++++++++ libs/backends/GP_X11.c | 66 ++++++++++++++++++++++++------------- 6 files changed, 131 insertions(+), 42 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.