mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-21 02:01:38 +00:00
fb_sdl: drop spurious motion events without motion
Relative motion events with a motion vector of (0,0) should not exists. They cause jittery movements of nitpicker's pointer position. This patch filters out such events.
This commit is contained in:
parent
0bd73e440d
commit
23696760c3
@ -146,15 +146,21 @@ static Input::Event wait_for_sdl_event()
|
||||
|
||||
SDL_Event event;
|
||||
static int mx, my;
|
||||
static int ox, oy;
|
||||
|
||||
SDL_WaitEvent(&event);
|
||||
|
||||
/* query new mouse position */
|
||||
ox = mx; oy = my;
|
||||
if (event.type == SDL_MOUSEMOTION)
|
||||
if (event.type == SDL_MOUSEMOTION) {
|
||||
int ox = mx, oy = my;
|
||||
SDL_GetMouseState(&mx, &my);
|
||||
|
||||
/* drop superficial events */
|
||||
if (ox == mx && oy == my)
|
||||
return Event();
|
||||
|
||||
return Event(Event::MOTION, 0, mx, my, mx - ox, my - oy);
|
||||
}
|
||||
|
||||
/* determine keycode */
|
||||
long keycode = 0;
|
||||
switch (event.type) {
|
||||
@ -176,11 +182,8 @@ static Input::Event wait_for_sdl_event()
|
||||
}
|
||||
|
||||
/* determine event type */
|
||||
Event::Type type;
|
||||
Event::Type type = Event::INVALID;
|
||||
switch (event.type) {
|
||||
case SDL_MOUSEMOTION:
|
||||
type = Event::MOTION;
|
||||
break;
|
||||
|
||||
case SDL_KEYUP:
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
@ -208,7 +211,7 @@ static Input::Event wait_for_sdl_event()
|
||||
return Event();
|
||||
}
|
||||
|
||||
return Event(type, keycode, mx, my, mx - ox, my - oy);
|
||||
return Event(type, keycode, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user