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,25 +514,25 @@ 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)
{
// check if it's a wiimote pointer pretending to be a mouse
if (ev.motion.state & SDL_BUTTON_X2MASK)
{
// the absolute values are used to draw the crosshair
mouseabsx = ev.motion.x;
mouseabsy = ev.motion.y;
// hack: reduce the scale of the "relative" motions
// to make it act more like a real mouse
ev.motion.xrel /= 16;
ev.motion.yrel /= 12;
}
// the absolute values are used to draw the crosshair
mouseabsx = ev.motion.x;
mouseabsy = ev.motion.y;
// hack: reduce the scale of the "relative" motions
// to make it act more like a real mouse
ev.motion.xrel /= 16;
ev.motion.yrel /= 12;
}
#endif
default: // OSD_Printf("Got event (%d)\n", ev.type); break;