Fixups to sync WIP SDL refactor up with r4738. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4753 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2014-11-22 12:34:46 +00:00
parent d73f7f113d
commit 52236d79a2
2 changed files with 22 additions and 14 deletions

View file

@ -1691,6 +1691,10 @@ int32_t handleevents_sdlcommon(SDL_Event *ev)
switch (ev->type)
{
case SDL_MOUSEMOTION:
#ifndef GEKKO
mouseabsx = ev->motion.x;
mouseabsy = ev->motion.y;
#endif
// SDL <VER> doesn't handle relative mouse movement correctly yet as the cursor still clips to the
// screen edges
// so, we call SDL_WarpMouse() to center the cursor and ignore the resulting motion event that occurs
@ -1706,8 +1710,6 @@ int32_t handleevents_sdlcommon(SDL_Event *ev)
#endif
}
}
if (ev.active.state & SDL_APPMOUSEFOCUS)
mouseinwindow = ev.active.gain;
break;
case SDL_MOUSEBUTTONDOWN:
@ -1947,6 +1949,12 @@ int32_t handleevents_pollsdl(void)
windowy = ev.window.data2;
}
break;
case SDL_WINDOWEVENT_ENTER:
mouseinwindow = 1;
break;
case SDL_WINDOWEVENT_LEAVE:
mouseinwindow = 0;
break;
}
break;

View file

@ -514,14 +514,15 @@ int32_t handleevents_pollsdl(void)
grabmouse_low(!!appactive);
#endif
rv = -1;
if (ev.active.state & SDL_APPMOUSEFOCUS)
mouseinwindow = ev.active.gain;
}
break;
// SDL_MOUSEMOTION needs to fall through to default... this is just GEKKO processing!
case SDL_MOUSEMOTION:
#ifdef GEKKO
if (appactive && mousegrab)
{
// check if it's a wiimote pointer pretending to be a mouse
if (ev.motion.state & SDL_BUTTON_X2MASK)
{
@ -533,7 +534,6 @@ int32_t handleevents_pollsdl(void)
ev.motion.xrel /= 16;
ev.motion.yrel /= 12;
}
}
#endif
default: // OSD_Printf("Got event (%d)\n", ev.type); break;
rv = handleevents_sdlcommon(&ev);