Adds handlers for sdl focus events.

This commit is contained in:
OTHGMars 2018-11-23 16:03:00 -05:00
parent 0b9ac45747
commit 299ecd9514

View file

@ -244,7 +244,7 @@ const char * PlatformWindowSDL::getCaption()
void PlatformWindowSDL::setFocus()
{
SDL_SetWindowGrab( mWindowHandle, SDL_TRUE );
SDL_SetWindowInputFocus(mWindowHandle);
}
void PlatformWindowSDL::setClientExtent( const Point2I newExtent )
@ -577,9 +577,7 @@ void PlatformWindowSDL::_processSDLEvent(SDL_Event &evt)
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
{
appEvent.trigger(getWindowId(), GainFocus);
_triggerMouseButtonNotify(evt);
break;
}
@ -587,6 +585,12 @@ void PlatformWindowSDL::_processSDLEvent(SDL_Event &evt)
{
switch( evt.window.event )
{
case SDL_WINDOWEVENT_FOCUS_GAINED:
appEvent.trigger(getWindowId(), GainFocus);
break;
case SDL_WINDOWEVENT_FOCUS_LOST:
appEvent.trigger(getWindowId(), LoseFocus);
break;
case SDL_WINDOWEVENT_MAXIMIZED:
case SDL_WINDOWEVENT_RESIZED:
{