diff --git a/include/boo/DeferredWindowEvents.hpp b/include/boo/DeferredWindowEvents.hpp index 289840f..b076d18 100644 --- a/include/boo/DeferredWindowEvents.hpp +++ b/include/boo/DeferredWindowEvents.hpp @@ -24,12 +24,13 @@ struct DeferredWindowEvents : public IWindowCallback bool m_hasResize = false; SWindowRect m_latestResize; - void resized(const SWindowRect& rect) + void resized(const SWindowRect& rect, bool sync) { std::unique_lock lk(m_mt); m_latestResize = rect; m_hasResize = true; - m_resizeCv.wait_for(lk, std::chrono::milliseconds(500)); + if (sync) + m_resizeCv.wait_for(lk, std::chrono::milliseconds(500)); } struct Command diff --git a/include/boo/IWindow.hpp b/include/boo/IWindow.hpp index 3403504..9ac5e8b 100644 --- a/include/boo/IWindow.hpp +++ b/include/boo/IWindow.hpp @@ -173,7 +173,7 @@ struct ITextInputCallback class IWindowCallback { public: - virtual void resized(const SWindowRect& rect) + virtual void resized(const SWindowRect& rect, bool sync) {(void)rect;} virtual void mouseDown(const SWindowCoord& coord, EMouseButton button, EModifierKey mods) {(void)coord;(void)button;(void)mods;} diff --git a/lib/mac/WindowCocoa.mm b/lib/mac/WindowCocoa.mm index 1230c61..a4671bc 100644 --- a/lib/mac/WindowCocoa.mm +++ b/lib/mac/WindowCocoa.mm @@ -8,8 +8,7 @@ #include "boo/IWindow.hpp" #include "boo/IGraphicsContext.hpp" #include "boo/audiodev/IAudioVoiceEngine.hpp" - -#include +#include "logvisor/logvisor.hpp" #if !__has_feature(objc_arc) #error ARC Required @@ -1146,7 +1145,7 @@ static boo::ESpecialKey translateKeycode(short code) boo::SWindowRect rect = {int(frame.origin.x), int(frame.origin.y), int(frame.size.width), int(frame.size.height)}; if (resp->booContext->m_callback) - resp->booContext->m_callback->resized(rect); + resp->booContext->m_callback->resized(rect, true); [super reshape]; } @@ -1224,7 +1223,7 @@ static boo::ESpecialKey translateKeycode(short code) boo::MetalContext::Window& w = m_ctx->m_windows[m_window]; std::unique_lock lk(w.m_resizeLock); if (resp->booContext->m_callback) - resp->booContext->m_callback->resized(rect); + resp->booContext->m_callback->resized(rect, false); w.m_size = CGSizeMake(rect.size[0], rect.size[1]); w.m_needsResize = YES; } diff --git a/lib/win/WindowWin32.cpp b/lib/win/WindowWin32.cpp index 4868399..c561133 100644 --- a/lib/win/WindowWin32.cpp +++ b/lib/win/WindowWin32.cpp @@ -934,6 +934,7 @@ class WindowWin32 : public IWindow IWindowCallback* m_callback = nullptr; EMouseCursor m_cursor = EMouseCursor::None; bool m_cursorWait = false; + bool m_openGL = false; static HCURSOR GetWin32Cursor(EMouseCursor cur) { switch (cur) @@ -971,6 +972,7 @@ public: { m_gfxCtx.reset(new GraphicsContextWin32GL(IGraphicsContext::EGraphicsAPI::OpenGL3_3, this, m_hwnd, b3dCtx, sampleCount)); + m_openGL = true; return; } #if BOO_HAS_VULKAN @@ -1289,7 +1291,7 @@ public: return; m_gfxCtx->m_3dCtx.resize(this, rect.size[0], rect.size[1]); if (m_callback) - m_callback->resized(rect); + m_callback->resized(rect, m_openGL); return; } case WM_MOVING: diff --git a/lib/x11/WindowXlib.cpp b/lib/x11/WindowXlib.cpp index 38c03c8..38c098c 100644 --- a/lib/x11/WindowXlib.cpp +++ b/lib/x11/WindowXlib.cpp @@ -911,6 +911,8 @@ class WindowXlib : public IWindow return X_CURSORS.m_pointer; } + bool m_openGL = false; + public: WindowXlib(const std::string& title, Display* display, void* xcbConn, @@ -936,6 +938,7 @@ public: i = 0; m_gfxCtx.reset(new GraphicsContextXlibGLX(IGraphicsContext::EGraphicsAPI::OpenGL3_3, this, display, defaultScreen, lastCtx, m_visualId, drawSamples)); + m_openGL = true; } /* Default screen */ @@ -1601,7 +1604,7 @@ public: { XUnlockDisplay(m_xDisp); m_gfxCtx->resized(m_wrect); - m_callback->resized(m_wrect); + m_callback->resized(m_wrect, m_openGL); XLockDisplay(m_xDisp); } return;