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 be0a281e8050b1bd51dfd575d6f9d3296c521b88 (commit) via 1f439d7f38b1ce547311f98f00727d482d33b3e8 (commit) via 71db1f001c26932cbcd61e28365e62d491f7f61e (commit) via f2de66cdd44a7250114d04992265239db3ecd3e3 (commit) via 31cd248d65bc525ab2f8587bf51fdf9cc39965ef (commit) from bcc7ec1a9edd6f0caf76bcce92eb0c4a827d99b1 (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/be0a281e8050b1bd51dfd575d6f9d3296c521...
commit be0a281e8050b1bd51dfd575d6f9d3296c521b88 Author: Cyril Hrubis metan@ucw.cz Date: Tue May 8 23:57:16 2012 +0200
spiv: Fix rounding error when centering image.
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index 42b40ba..06e507a 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -246,8 +246,8 @@ static void *image_loader(void *ptr) /* clean up the rest of the display */ GP_FillRectXYWH(context, 0, 0, cx, context->h, black_pixel); GP_FillRectXYWH(context, 0, 0, context->w, cy, black_pixel); - GP_FillRectXYWH(context, ret->w+cx, 0, cx, context->h, black_pixel); - GP_FillRectXYWH(context, 0, ret->h+cy, context->w, cy, black_pixel); + GP_FillRectXYWH(context, ret->w+cx, 0, context->w - ret->w - cx, context->h, black_pixel); + GP_FillRectXYWH(context, 0, ret->h+cy, context->w, context->h - ret->h - cy, black_pixel);
cpu_timer_stop(&sum_timer);
http://repo.or.cz/w/gfxprim.git/commit/1f439d7f38b1ce547311f98f00727d482d33b...
commit 1f439d7f38b1ce547311f98f00727d482d33b3e8 Author: Cyril Hrubis metan@ucw.cz Date: Tue May 8 23:46:04 2012 +0200
spiv: Make use of the SYS_RESIZE and SYS_QUIT events.
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index da4a97b..42b40ba 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -42,7 +42,6 @@ static GP_Pixel black_pixel; static GP_Pixel white_pixel;
static GP_Backend *backend = NULL; -static GP_Context *context = NULL;
/* image loader thread */ static int abort_flag = 0; @@ -53,6 +52,7 @@ static int resampling_method = GP_INTERP_LINEAR_LF_INT; static int image_loader_callback(GP_ProgressCallback *self) { static GP_Size size = 0; + GP_Context *c = backend->context;
if (abort_flag) return 1; @@ -65,8 +65,6 @@ static int image_loader_callback(GP_ProgressCallback *self) snprintf(buf, sizeof(buf), "%s ... %-3.1f%%", (const char*)self->priv, self->percentage);
- GP_Context *c = context; - int align = GP_ALIGN_CENTER|GP_VALIGN_ABOVE;
GP_TextClear(c, NULL, c->w/2, c->h - 4, align, @@ -126,7 +124,7 @@ static void *image_loader(void *ptr) GP_ProgressCallback callback = {.callback = image_loader_callback}; struct cpu_timer timer; struct cpu_timer sum_timer; - GP_Context *img; + GP_Context *img, *context = backend->context;
cpu_timer_start(&sum_timer, "sum");
@@ -331,6 +329,7 @@ static void init_backend(const char *backend_opts) int main(int argc, char *argv[]) { GP_InputDriverLinux *drv = NULL; + GP_Context *context = NULL; const char *input_dev = NULL; const char *backend_opts = "SDL"; int sleep_sec = -1; @@ -517,6 +516,18 @@ int main(int argc, char *argv[]) break; } break; + case GP_EV_SYS: + switch (ev.code) { + case GP_EV_SYS_RESIZE: + GP_BackendResize(backend, ev.val.sys.w, ev.val.sys.h); + show_image(¶ms); + break; + case GP_EV_SYS_QUIT: + GP_BackendExit(backend); + return 0; + break; + } + break; } } }
http://repo.or.cz/w/gfxprim.git/commit/71db1f001c26932cbcd61e28365e62d491f7f...
commit 71db1f001c26932cbcd61e28365e62d491f7f61e Author: Cyril Hrubis metan@ucw.cz Date: Tue May 8 23:45:38 2012 +0200
debug: Print debug level too.
diff --git a/include/core/GP_Debug.h b/include/core/GP_Debug.h index 2c935ee..235f001 100644 --- a/include/core/GP_Debug.h +++ b/include/core/GP_Debug.h @@ -45,12 +45,13 @@
#define GP_DEFAULT_DEBUG_LEVEL 0
-#define GP_DEBUG(level, ...) do { - if (level <= GP_GetDebugLevel()) { - fprintf(stderr, "%s:%s():%u: ", __FILE__, __FUNCTION__, __LINE__); - fprintf(stderr, __VA_ARGS__); - fputc('n', stderr); - } +#define GP_DEBUG(level, ...) do { + if (level <= GP_GetDebugLevel()) { + fprintf(stderr, "%u: %s:%s():%u: ", level, __FILE__, + __FUNCTION__, __LINE__); + fprintf(stderr, __VA_ARGS__); + fputc('n', stderr); + } } while (0)
void GP_SetDebugLevel(unsigned int level);
http://repo.or.cz/w/gfxprim.git/commit/f2de66cdd44a7250114d04992265239db3ecd...
commit f2de66cdd44a7250114d04992265239db3ecd3e3 Author: Cyril Hrubis metan@ucw.cz Date: Tue May 8 23:33:20 2012 +0200
input, backends: Add support for SYS_RESIZE and SYS_QUIT.
diff --git a/libs/backends/GP_BackendInit.c b/libs/backends/GP_BackendInit.c index 5f6a470..0f8e8d4 100644 --- a/libs/backends/GP_BackendInit.c +++ b/libs/backends/GP_BackendInit.c @@ -73,7 +73,7 @@ static GP_Backend *backend_sdl_init(char *params, const char *caption, return GP_BackendSDLInit(0, 0, 0, 0, caption); GP_Size w = 0, h = 0; - uint8_t flags = 0; + uint8_t flags = GP_SDL_RESIZABLE; char *s = params;
diff --git a/libs/backends/GP_X11.c b/libs/backends/GP_X11.c index f11cd6a..8f9b519 100644 --- a/libs/backends/GP_X11.c +++ b/libs/backends/GP_X11.c @@ -110,9 +110,10 @@ static void x11_poll(GP_Backend *self) ev.xexpose.x + ev.xexpose.width, ev.xexpose.y + ev.xexpose.height); break; - case MapNotify: - GP_DEBUG(1, "Shown"); - break; + case ConfigureNotify: + if (ev.xconfigure.width == (int)self->context->w && + ev.xconfigure.height == (int)self->context->h) + break; default: GP_InputDriverX11EventPut(&ev); break; @@ -130,9 +131,11 @@ static int x11_set_attributes(struct GP_Backend *self, XLockDisplay(x11->dpy); - if (caption != NULL) + if (caption != NULL) { + GP_DEBUG(3, "Setting window caption to '%s'", caption); XmbSetWMProperties(x11->dpy, x11->win, caption, caption, NULL, 0, NULL, NULL, NULL); + }
if (w != 0 || h != 0) { GP_Context *context; @@ -143,6 +146,8 @@ static int x11_set_attributes(struct GP_Backend *self, if (h == 0) h = self->context->h; + + GP_DEBUG(3, "Setting window size to %ux%u", w, h);
/* Create new X image */ img = XCreateImage(x11->dpy, x11->vis, 24, ZPixmap, 0, NULL, @@ -228,7 +233,7 @@ GP_Backend *GP_BackendX11Init(const char *display, int x, int y, }
/* Select events */ - XSelectInput(x11->dpy, x11->win, StructureNotifyMask | ExposureMask | + XSelectInput(x11->dpy, x11->win, ExposureMask | StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask); diff --git a/libs/input/GP_InputDriverSDL.c b/libs/input/GP_InputDriverSDL.c index 3b7ec01..b954127 100644 --- a/libs/input/GP_InputDriverSDL.c +++ b/libs/input/GP_InputDriverSDL.c @@ -132,8 +132,10 @@ void GP_InputDriverSDLEventPut(SDL_Event *ev) GP_EventPushKey(key, ev->key.state, NULL); break; case SDL_VIDEORESIZE: + GP_EventPushResize(ev->resize.w, ev->resize.h, NULL); break; case SDL_QUIT: + GP_EventPush(GP_EV_SYS, GP_EV_SYS_QUIT, 0, NULL); break; } } diff --git a/libs/input/GP_InputDriverX11.c b/libs/input/GP_InputDriverX11.c index 719ef3b..bab3b2a 100644 --- a/libs/input/GP_InputDriverX11.c +++ b/libs/input/GP_InputDriverX11.c @@ -90,6 +90,11 @@ void GP_InputDriverX11EventPut(XEvent *ev)
GP_EventPush(GP_EV_KEY, key, press, NULL); break; + case ConfigureNotify: + GP_EventPushResize(ev->xconfigure.width, + ev->xconfigure.height, NULL); + break; + break; case MotionNotify: GP_EventPushRelTo(ev->xmotion.x, ev->xmotion.y, NULL); break; @@ -108,6 +113,8 @@ void GP_InputDriverX11EventPut(XEvent *ev) GP_EventPushKey(key, press, NULL); break; + default: + GP_DEBUG(0, "Unhandled X11 event type %u", ev->type); } }
http://repo.or.cz/w/gfxprim.git/commit/31cd248d65bc525ab2f8587bf51fdf9cc3996...
commit 31cd248d65bc525ab2f8587bf51fdf9cc39965ef Author: Cyril Hrubis metan@ucw.cz Date: Tue May 8 23:32:39 2012 +0200
input: Prepare for SYS_RESIZE and SYS_QUIT events.
diff --git a/include/input/GP_Event.h b/include/input/GP_Event.h index e12d9ae..962c71c 100644 --- a/include/input/GP_Event.h +++ b/include/input/GP_Event.h @@ -45,7 +45,8 @@ enum GP_EventType { GP_EV_KEY = 1, /* key/button press event */ GP_EV_REL = 2, /* relative event */ GP_EV_ABS = 3, /* absolute event */ - GP_EV_MAX = 3, /* maximum, greater values are free */ + GP_EV_SYS = 4, /* system events window close, resize... */ + GP_EV_MAX = 4, /* maximum, greater values are free */ };
enum GP_EventKeyCode { @@ -220,6 +221,11 @@ enum GP_EventAbsCode { GP_EV_ABS_POS = 0, };
+enum GP_EventSysCode { + GP_EV_SYS_QUIT = 0, + GP_EV_SYS_RESIZE = 1, +}; + struct GP_EventPosRel { int32_t rx; int32_t ry; @@ -236,14 +242,20 @@ struct GP_EventKey { char ascii; };
+struct GP_EventSys { + uint32_t w, h; +}; + union GP_EventValue { /* generic one integer value */ int32_t val; /* key */ struct GP_EventKey key; - /* possition */ + /* position */ struct GP_EventPosRel rel; struct GP_EventPosAbs abs; + /* system event */ + struct GP_EventSys sys; };
typedef struct GP_Event { @@ -327,6 +339,11 @@ void GP_EventPushAbs(uint32_t x, uint32_t y, uint32_t pressure, void GP_EventPushKey(uint32_t key, uint8_t code, struct timeval *time);
/* + * Inject window resize event + */ +void GP_EventPushResize(uint32_t w, uint32_t h, struct timeval *time); + +/* * Inject common event. */ void GP_EventPush(uint16_t type, uint32_t code, int32_t value, diff --git a/libs/input/GP_Event.c b/libs/input/GP_Event.c index 161c0de..fe118ff 100644 --- a/libs/input/GP_Event.c +++ b/libs/input/GP_Event.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -163,6 +163,18 @@ static void dump_abs(struct GP_Event *ev) } }
+static void dump_sys(struct GP_Event *ev) +{ + switch (ev->code) { + case GP_EV_SYS_QUIT: + printf("Sys Quitn"); + break; + case GP_EV_SYS_RESIZE: + printf("Sys Resize %ux%un", ev->val.sys.w, ev->val.sys.h); + break; + } +} + void GP_EventDump(struct GP_Event *ev) { printf("Event (%u) ", (unsigned int)ev->time.tv_sec % 10000); @@ -177,6 +189,9 @@ void GP_EventDump(struct GP_Event *ev) case GP_EV_ABS: dump_abs(ev); break; + case GP_EV_SYS: + dump_sys(ev); + break; default: printf("Unknown %un", ev->type); } @@ -276,6 +291,21 @@ void GP_EventPushAbs(uint32_t x, uint32_t y, uint32_t pressure, event_put(&cur_state); }
+void GP_EventPushResize(uint32_t w, uint32_t h, struct timeval *time) +{ + /* event header */ + cur_state.type = GP_EV_SYS; + cur_state.code = GP_EV_SYS_RESIZE; + + cur_state.val.sys.w = w; + cur_state.val.sys.h = h; + + set_time(time); + + /* put it into queue */ + event_put(&cur_state); +} + static char keys_to_ascii[] = { 0x00, 0x1b, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0x08, 't', 'q', 'w', 'e', 'r',
-----------------------------------------------------------------------
Summary of changes: demos/spiv/spiv.c | 23 +++++++++++++++++------ include/core/GP_Debug.h | 13 +++++++------ include/input/GP_Event.h | 21 +++++++++++++++++++-- libs/backends/GP_BackendInit.c | 2 +- libs/backends/GP_X11.c | 15 ++++++++++----- libs/input/GP_Event.c | 32 +++++++++++++++++++++++++++++++- libs/input/GP_InputDriverSDL.c | 2 ++ libs/input/GP_InputDriverX11.c | 7 +++++++ 8 files changed, 94 insertions(+), 21 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.