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, generate has been updated via 64255c5b0947d3e9153a8e157b41c1ceb0de3a2b (commit) from 62a9833d1129677535724b6ec7c6f0e89a97abdd (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/64255c5b0947d3e9153a8e157b41c1ceb0de3...
commit 64255c5b0947d3e9153a8e157b41c1ceb0de3a2b Author: Cyril Hrubis metan@ucw.cz Date: Tue Aug 16 12:23:57 2011 +0200
Fixed bug in setting key bitmap.
diff --git a/include/input/GP_Event.h b/include/input/GP_Event.h index dff17af..126c0c2 100644 --- a/include/input/GP_Event.h +++ b/include/input/GP_Event.h @@ -334,13 +334,13 @@ static inline void GP_EventSetKey(struct GP_Event *ev, static inline int GP_EventGetKey(struct GP_Event *ev, uint32_t key) { - return !!(ev->keys_pressed[(key)/8] & ~(1<<((key)%8))); + return !!(ev->keys_pressed[(key)/8] & (1<<((key)%8))); }
static inline void GP_EventResetKey(struct GP_Event *ev, uint32_t key) { - ev->keys_pressed[(key)/8] |= 1<<((key)%8); + ev->keys_pressed[(key)/8] &= ~(1<<((key)%8)); }
#endif /* GP_EVENT_H */ diff --git a/libs/input/GP_Event.c b/libs/input/GP_Event.c index 5e87a04..e5beb2e 100644 --- a/libs/input/GP_Event.c +++ b/libs/input/GP_Event.c @@ -127,7 +127,7 @@ const char *GP_EventKeyName(enum GP_EventKeyValue key)
static void dump_rel(struct GP_Event *ev) { - printf("EVENT REL "); + printf("REL ");
switch (ev->code) { case GP_EV_REL_POS: @@ -146,13 +146,15 @@ static void dump_key(struct GP_Event *ev) if (ev->val.key.key < key_names_size) name = key_names[ev->val.key.key];
- printf("EVENT KEY %i (Key%s) %sn", + printf("KEY %i (Key%s) %sn", ev->val.key.key, name, ev->code ? "down" : "up");
}
void GP_EventDump(struct GP_Event *ev) { + printf("EVENT (%u) ", (unsigned int)ev->time.tv_sec % 10000); + switch (ev->type) { case GP_EV_KEY: dump_key(ev); diff --git a/libs/input/GP_InputDriverSDL.c b/libs/input/GP_InputDriverSDL.c index 3e7f5d1..967fdac 100644 --- a/libs/input/GP_InputDriverSDL.c +++ b/libs/input/GP_InputDriverSDL.c @@ -126,8 +126,6 @@ void GP_InputDriverSDLEventPut(SDL_Event *ev) return; } - printf("*** KEYSYM %u KEY %un", keysym, key); - GP_EventPushKey(key, ev->key.state, NULL); break; case SDL_VIDEORESIZE: diff --git a/tests/SDL/input.c b/tests/SDL/input.c index 7ff2dc5..509bc54 100644 --- a/tests/SDL/input.c +++ b/tests/SDL/input.c @@ -108,9 +108,32 @@ void event_loop(void) GP_EventGet(&ev); GP_EventDump(&ev);
- if (ev.type == GP_EV_KEY && - ev.val.key.key == GP_KEY_ESC) - exit(0); + switch (ev.type) { + case GP_EV_KEY: + switch (ev.val.key.key) { + case GP_KEY_ESC: + exit(0); + case GP_BTN_LEFT: + GP_PutPixel(&context, ev.cursor_x, + ev.cursor_y, red_pixel); + SDL_Flip(display); + break; + default: + break; + } + break; + case GP_EV_REL: + switch (ev.code) { + case GP_EV_REL_POS: + if (GP_EventGetKey(&ev, GP_BTN_LEFT)) { + GP_PutPixel(&context, ev.cursor_x, + ev.cursor_y, green_pixel); + SDL_Flip(display); + } + break; + } + break; + } } } }
-----------------------------------------------------------------------
Summary of changes: include/input/GP_Event.h | 4 ++-- libs/input/GP_Event.c | 6 ++++-- libs/input/GP_InputDriverSDL.c | 2 -- tests/SDL/input.c | 29 ++++++++++++++++++++++++++--- 4 files changed, 32 insertions(+), 9 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.