diff options
author | Patrice Mandin <patmandin@gmail.com> | 2012-10-12 18:37:59 +0200 |
---|---|---|
committer | Patrice Mandin <patmandin@gmail.com> | 2012-10-12 18:37:59 +0200 |
commit | 43277da46642fc3f06e289957bd20fcb33c6727d (patch) | |
tree | ecb32b8817b4d7f47f806388781915d256dbe021 | |
parent | 01b0914e1bbce4d48f657dee1cdeea7adf27db41 (diff) | |
download | sdl-43277da46642fc3f06e289957bd20fcb33c6727d.tar.gz |
gem: Handle relative mouse motion earlier
-rw-r--r-- | src/video/gem/SDL_gemevents.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/src/video/gem/SDL_gemevents.c b/src/video/gem/SDL_gemevents.c index d802ea186..ff54f38f0 100644 --- a/src/video/gem/SDL_gemevents.c +++ b/src/video/gem/SDL_gemevents.c @@ -316,6 +316,16 @@ static void do_mouse_motion(_THIS, short mx, short my) return; } + /* Relative mouse motion ? */ + if (GEM_mouse_relative) { + if (GEM_usedevmouse) { + SDL_AtariDevMouse_PostMouseEvents(this, SDL_FALSE); + } else { + SDL_AtariXbios_PostMouseEvents(this, SDL_FALSE); + } + return; + } + /* Retrieve window coords, and generate mouse events accordingly */ x2 = y2 = 0; w2 = VDI_w; @@ -324,30 +334,21 @@ static void do_mouse_motion(_THIS, short mx, short my) wind_get (GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2); } - /* Mouse motion ? */ - if (GEM_mouse_relative) { - if (GEM_usedevmouse) { - SDL_AtariDevMouse_PostMouseEvents(this, SDL_FALSE); - } else { - SDL_AtariXbios_PostMouseEvents(this, SDL_FALSE); - } - } else { - if ((prevmousex!=mx) || (prevmousey!=my)) { - int posx, posy; - - /* Give mouse position relative to window position */ - posx = mx - x2; - if (posx<0) posx = 0; - if (posx>w2) posx = w2-1; - posy = my - y2; - if (posy<0) posy = 0; - if (posy>h2) posy = h2-1; - - SDL_PrivateMouseMotion(0, 0, posx, posy); - } - prevmousex = mx; - prevmousey = my; + if ((prevmousex!=mx) || (prevmousey!=my)) { + int posx, posy; + + /* Give mouse position relative to window position */ + posx = mx - x2; + if (posx<0) posx = 0; + if (posx>w2) posx = w2-1; + posy = my - y2; + if (posy<0) posy = 0; + if (posy>h2) posy = h2-1; + + SDL_PrivateMouseMotion(0, 0, posx, posy); } + prevmousex = mx; + prevmousey = my; } static void do_mouse_buttons(_THIS, short mb) |