mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-19 22:53:47 +00:00
Merge pull request #259 from Areloch/SecondaryWindowCloseFix
Captures secondary window close events
This commit is contained in:
commit
017f7fafa2
2 changed files with 17 additions and 5 deletions
|
|
@ -101,7 +101,8 @@ mPosition(0,0),
|
|||
mMouseLocked(false),
|
||||
mShouldLockMouse(false),
|
||||
mSuppressReset(false),
|
||||
mMenuHandle(NULL)
|
||||
mMenuHandle(NULL),
|
||||
mClosing(false)
|
||||
{
|
||||
mCursorController = new PlatformCursorControllerSDL( this );
|
||||
|
||||
|
|
@ -583,8 +584,10 @@ void PlatformWindowSDL::_processSDLEvent(SDL_Event &evt)
|
|||
|
||||
case SDL_WINDOWEVENT:
|
||||
{
|
||||
switch( evt.window.event )
|
||||
if (!mClosing)
|
||||
{
|
||||
switch (evt.window.event)
|
||||
{
|
||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||
appEvent.trigger(getWindowId(), GainFocus);
|
||||
break;
|
||||
|
|
@ -595,15 +598,21 @@ void PlatformWindowSDL::_processSDLEvent(SDL_Event &evt)
|
|||
case SDL_WINDOWEVENT_RESIZED:
|
||||
{
|
||||
int width, height;
|
||||
SDL_GetWindowSize( mWindowHandle, &width, &height );
|
||||
mVideoMode.resolution.set( width, height );
|
||||
SDL_GetWindowSize(mWindowHandle, &width, &height);
|
||||
mVideoMode.resolution.set(width, height);
|
||||
getGFXTarget()->resetMode();
|
||||
resizeEvent.trigger(getWindowId(), width, height);
|
||||
break;
|
||||
}
|
||||
case SDL_WINDOWEVENT_CLOSE:
|
||||
{
|
||||
appEvent.trigger(getWindowId(), WindowClose);
|
||||
mClosing = true;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -648,4 +657,4 @@ void PlatformWindowSDL::setKeyboardTranslation(const bool enabled)
|
|||
mOwningManager->updateSDLTextInputState(PlatformWindowManagerSDL::KeyboardInputState::TEXT_INPUT);
|
||||
else
|
||||
mOwningManager->updateSDLTextInputState(PlatformWindowManagerSDL::KeyboardInputState::RAW_INPUT);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,6 +87,9 @@ private:
|
|||
/// Menu associated with this window. This is a passive property of the window and is not required to be used at all.
|
||||
void* mMenuHandle;
|
||||
|
||||
/// Indicates if the window is being closed. This allows us to safely ignore other events like focus being gained or losed after cleanup has begun
|
||||
bool mClosing;
|
||||
|
||||
/// @}
|
||||
|
||||
void _processSDLEvent(SDL_Event &evt);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue