Utility/Window: Window now automatically close on quit event
Former-commit-id: 727311111afc6108dc1d2140ea1b4de46158160a [formerly 2d54d14f17deb75d949c63bd1f84b697fd7338ba] [formerly 5567a99268b022010d70c18d28e16d09dde8dd65 [formerly 6db94dce7ebfa5110d0279868ebda4728e20cc95]] Former-commit-id: 864263f18501629c2f5bc50453a41d5a24e8cf2a [formerly f065aa1bebdc2bc3b3eb455f90381b3e990530c2] Former-commit-id: f21791c84c9f024db8e12a6985b22e07d01a0a27
This commit is contained in:
@@ -16,6 +16,7 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_THREADED_WINDOW
|
||||
m_waitForEvent(false),
|
||||
#endif
|
||||
m_closeOnQuit(true),
|
||||
m_eventPolling(false)
|
||||
{
|
||||
}
|
||||
@@ -44,10 +45,11 @@ namespace Nz
|
||||
m_eventCondition(std::move(window.m_eventCondition)),
|
||||
m_eventMutex(std::move(window.m_eventMutex)),
|
||||
m_eventConditionMutex(std::move(window.m_eventConditionMutex)),
|
||||
m_eventPolling(window.m_eventPolling),
|
||||
m_waitForEvent(window.m_waitForEvent),
|
||||
#endif
|
||||
m_closed(window.m_closed),
|
||||
m_closeOnQuit(window.m_closeOnQuit),
|
||||
m_eventPolling(window.m_eventPolling),
|
||||
m_ownsWindow(window.m_ownsWindow)
|
||||
{
|
||||
window.m_impl = nullptr;
|
||||
@@ -63,6 +65,11 @@ namespace Nz
|
||||
m_closed = true; // The window will be closed at the next non-const IsOpen() call
|
||||
}
|
||||
|
||||
inline void Window::EnableCloseOnQuit(bool closeOnQuit)
|
||||
{
|
||||
m_closeOnQuit = closeOnQuit;
|
||||
}
|
||||
|
||||
inline void Window::EnableEventPolling(bool enable)
|
||||
{
|
||||
m_eventPolling = enable;
|
||||
@@ -116,6 +123,9 @@ namespace Nz
|
||||
if (event.type == WindowEventType_Resized)
|
||||
OnWindowResized();
|
||||
|
||||
if (event.type == WindowEventType_Quit && m_closeOnQuit)
|
||||
Close();
|
||||
|
||||
#if NAZARA_UTILITY_THREADED_WINDOW
|
||||
m_eventMutex.Unlock();
|
||||
|
||||
@@ -137,6 +147,7 @@ namespace Nz
|
||||
Destroy();
|
||||
|
||||
m_closed = window.m_closed;
|
||||
m_closeOnQuit = window.m_closeOnQuit;
|
||||
m_eventPolling = window.m_eventPolling;
|
||||
m_impl = window.m_impl;
|
||||
m_events = std::move(window.m_events);
|
||||
|
||||
Reference in New Issue
Block a user