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 d4b06d880a619f82d52e6de8dafddd36f84b76ac (commit) from ccb2bc826483c0465f6671654e4c45259a029b04 (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/d4b06d880a619f82d52e6de8dafddd36f84b7...
commit d4b06d880a619f82d52e6de8dafddd36f84b76ac Author: Cyril Hrubis metan@ucw.cz Date: Sun Jan 20 21:06:57 2013 +0100
input: X11: Ignore out-of-window relative events.
diff --git a/include/input/GP_InputDriverX11.h b/include/input/GP_InputDriverX11.h index 117a3e0..87d4030 100644 --- a/include/input/GP_InputDriverX11.h +++ b/include/input/GP_InputDriverX11.h @@ -34,6 +34,6 @@ /* * Converts X11 event to GFXprim event and puts it into the queue. */ -void GP_InputDriverX11EventPut(XEvent *ev); +void GP_InputDriverX11EventPut(XEvent *ev, int w, int h);
#endif /* GP_INPUT_DRIVER_X11_H */ diff --git a/libs/backends/GP_X11.c b/libs/backends/GP_X11.c index 63d8162..9d5a3e1 100644 --- a/libs/backends/GP_X11.c +++ b/libs/backends/GP_X11.c @@ -181,7 +181,8 @@ static void x11_ev(GP_Backend *self, XEvent *ev) /* Window has been resized, set flag. */ x11->resized_flag = 1; default: - GP_InputDriverX11EventPut(ev); + //TODO: More accurate window w and h? + GP_InputDriverX11EventPut(ev, x11->context.w, x11->context.h); break; } } diff --git a/libs/input/GP_Event.c b/libs/input/GP_Event.c index efd82c9..13c400b 100644 --- a/libs/input/GP_Event.c +++ b/libs/input/GP_Event.c @@ -135,7 +135,9 @@ static void dump_rel(struct GP_Event *ev)
switch (ev->code) { case GP_EV_REL_POS: - printf("Position %u %un", ev->cursor_x, ev->cursor_y); + printf("Position %u %u dx=%i dy=%in", + ev->cursor_x, ev->cursor_y, + ev->val.rel.rx, ev->val.rel.ry); break; case GP_EV_REL_WHEEL: printf("Wheel %in", ev->val.val); @@ -237,6 +239,11 @@ static uint32_t clip_rel(uint32_t val, uint32_t max, int32_t rel)
void GP_EventPushRelTo(uint32_t x, uint32_t y, struct timeval *time) { + if (x > screen_w || y > screen_h) { + GP_WARN("x > screen_w or y > screen_h, forgot to set screen size?"); + return; + } + int32_t rx = x - cur_state.cursor_x; int32_t ry = y - cur_state.cursor_y;
diff --git a/libs/input/GP_InputDriverX11.c b/libs/input/GP_InputDriverX11.c index cbfb0c9..a63896c 100644 --- a/libs/input/GP_InputDriverX11.c +++ b/libs/input/GP_InputDriverX11.c @@ -63,7 +63,7 @@ static uint16_t keycode_table[] = {
static const uint16_t keycode_table_size = sizeof(keycode_table)/2;
-void GP_InputDriverX11EventPut(XEvent *ev) +void GP_InputDriverX11EventPut(XEvent *ev, int w, int h) { int key = 0, keycode, press = 0;
@@ -106,6 +106,11 @@ void GP_InputDriverX11EventPut(XEvent *ev) break; break; case MotionNotify: + /* Ignore all pointer events that are out of the window */ + if (ev->xmotion.x < 0 || ev->xmotion.y < 0 || + ev->xmotion.x > w || ev->xmotion.y > h) + return; + GP_EventPushRelTo(ev->xmotion.x, ev->xmotion.y, NULL); break; case KeyPress:
-----------------------------------------------------------------------
Summary of changes: include/input/GP_InputDriverX11.h | 2 +- libs/backends/GP_X11.c | 3 ++- libs/input/GP_Event.c | 9 ++++++++- libs/input/GP_InputDriverX11.c | 7 ++++++- 4 files changed, 17 insertions(+), 4 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.