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 2cc8f1085bcceb34939008770bf988597a1d0d5f (commit) from d2feca863b6d28d6b7a494ce16621c434d53aa41 (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/2cc8f1085bcceb34939008770bf988597a1d0...
commit 2cc8f1085bcceb34939008770bf988597a1d0d5f Author: Cyril Hrubis metan@ucw.cz Date: Tue Jul 31 19:02:36 2012 +0200
input: Map mouse wheel in X11 and SDL.
diff --git a/include/input/GP_Event.h b/include/input/GP_Event.h index 962c71c..71eef60 100644 --- a/include/input/GP_Event.h +++ b/include/input/GP_Event.h @@ -214,7 +214,7 @@ enum GP_EventKeyValue {
enum GP_EventRelCode { GP_EV_REL_POS = 0, - GP_EV_REL_WHEEL = 1, + GP_EV_REL_WHEEL = 8, };
enum GP_EventAbsCode { diff --git a/libs/input/GP_InputDriverSDL.c b/libs/input/GP_InputDriverSDL.c index b954127..207cfca 100644 --- a/libs/input/GP_InputDriverSDL.c +++ b/libs/input/GP_InputDriverSDL.c @@ -24,6 +24,8 @@
#ifdef HAVE_LIBSDL
+#include "core/GP_Debug.h" + #include "GP_Event.h" #include "GP_InputDriverSDL.h"
@@ -108,7 +110,18 @@ void GP_InputDriverSDLEventPut(SDL_Event *ev) case 3: key = GP_BTN_RIGHT; break; + /* Mouse wheel */ + case 4: + if (ev->type == SDL_MOUSEBUTTONDOWN) + GP_EventPush(GP_EV_REL, GP_EV_REL_WHEEL, 1, NULL); + return; + case 5: + if (ev->type == SDL_MOUSEBUTTONDOWN) + GP_EventPush(GP_EV_REL, GP_EV_REL_WHEEL, -1, NULL); + return; default: + GP_DEBUG(0, "Unmapped SDL Mouse button %02x", + ev->button.button); return; }
diff --git a/libs/input/GP_InputDriverX11.c b/libs/input/GP_InputDriverX11.c index 3de0734..656c232 100644 --- a/libs/input/GP_InputDriverX11.c +++ b/libs/input/GP_InputDriverX11.c @@ -81,6 +81,15 @@ void GP_InputDriverX11EventPut(XEvent *ev) case 3: key = GP_BTN_RIGHT; break; + /* Mouse wheel */ + case 4: + if (press) + GP_EventPush(GP_EV_REL, GP_EV_REL_WHEEL, 1, NULL); + return; + case 5: + if (press) + GP_EventPush(GP_EV_REL, GP_EV_REL_WHEEL, -1, NULL); + return; }
if (key == 0) {
-----------------------------------------------------------------------
Summary of changes: include/input/GP_Event.h | 2 +- libs/input/GP_InputDriverSDL.c | 13 +++++++++++++ libs/input/GP_InputDriverX11.c | 9 +++++++++ 3 files changed, 23 insertions(+), 1 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.