mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +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),
|
mMouseLocked(false),
|
||||||
mShouldLockMouse(false),
|
mShouldLockMouse(false),
|
||||||
mSuppressReset(false),
|
mSuppressReset(false),
|
||||||
mMenuHandle(NULL)
|
mMenuHandle(NULL),
|
||||||
|
mClosing(false)
|
||||||
{
|
{
|
||||||
mCursorController = new PlatformCursorControllerSDL( this );
|
mCursorController = new PlatformCursorControllerSDL( this );
|
||||||
|
|
||||||
|
|
@ -583,8 +584,10 @@ void PlatformWindowSDL::_processSDLEvent(SDL_Event &evt)
|
||||||
|
|
||||||
case SDL_WINDOWEVENT:
|
case SDL_WINDOWEVENT:
|
||||||
{
|
{
|
||||||
switch( evt.window.event )
|
if (!mClosing)
|
||||||
{
|
{
|
||||||
|
switch (evt.window.event)
|
||||||
|
{
|
||||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||||
appEvent.trigger(getWindowId(), GainFocus);
|
appEvent.trigger(getWindowId(), GainFocus);
|
||||||
break;
|
break;
|
||||||
|
|
@ -595,15 +598,21 @@ void PlatformWindowSDL::_processSDLEvent(SDL_Event &evt)
|
||||||
case SDL_WINDOWEVENT_RESIZED:
|
case SDL_WINDOWEVENT_RESIZED:
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
SDL_GetWindowSize( mWindowHandle, &width, &height );
|
SDL_GetWindowSize(mWindowHandle, &width, &height);
|
||||||
mVideoMode.resolution.set( width, height );
|
mVideoMode.resolution.set(width, height);
|
||||||
getGFXTarget()->resetMode();
|
getGFXTarget()->resetMode();
|
||||||
resizeEvent.trigger(getWindowId(), width, height);
|
resizeEvent.trigger(getWindowId(), width, height);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SDL_WINDOWEVENT_CLOSE:
|
||||||
|
{
|
||||||
|
appEvent.trigger(getWindowId(), WindowClose);
|
||||||
|
mClosing = true;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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.
|
/// Menu associated with this window. This is a passive property of the window and is not required to be used at all.
|
||||||
void* mMenuHandle;
|
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);
|
void _processSDLEvent(SDL_Event &evt);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue