From b42680c57de1be7e8776c24a087402088becaad9 Mon Sep 17 00:00:00 2001 From: somewhatlurker <52014015+somewhatlurker@users.noreply.github.com> Date: Thu, 12 Sep 2019 04:07:44 +0000 Subject: [PATCH] render: make borderless mode behave more like a real window `WS_POPUP` is replaced with `WS_CLIPSIBLINGS | WS_CLIPCHILDREN` (same as freeglut uses for its native borderless mode) while `WS_POPUP` seems to often used as a style for borderless windows (at least from what I read online), it seems completely unnecessary :/ --- source-code/source/plugins/Render/dllmain.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source-code/source/plugins/Render/dllmain.cpp b/source-code/source/plugins/Render/dllmain.cpp index 0d348ff..6c43ff3 100644 --- a/source-code/source/plugins/Render/dllmain.cpp +++ b/source-code/source/plugins/Render/dllmain.cpp @@ -74,8 +74,8 @@ int hookedCreateWindow(const char* title, void(__cdecl* exit_function)(int)) HDC hDev = wglGetCurrentDC(); // get handle to current opengl device context HWND hWnd = WindowFromDC(hDev); // convert it to a window handle - SetWindowLongPtr(hWnd, GWL_STYLE, WS_POPUP + WS_VISIBLE); // set popup style (no border) - SetWindowPos(hWnd, HWND_TOP, wndX, wndY, nWidth, nHeight, 0); // adjust position to apply new style + SetWindowLongPtr(hWnd, GWL_STYLE, WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); // set no border (visible to ensure something is shown immediately) + SetWindowPos(hWnd, HWND_TOP, wndX, wndY, nWidth, nHeight, SWP_FRAMECHANGED); // adjust position to apply new style printf("[Render Manager] Borderless mode.\n"); } @@ -142,7 +142,7 @@ __int64 __fastcall limiterFuncLight(__int64 a1) nanoseconds timeDifference = (timeNow - sleepUntil); if (timeDifference > sleepWindow) // no need for abs because it doesn't matter if this is early { - printf("FPS LIMITER SLEEP TIME OUTSIDE ALLOWED WINDOW\n", timeDifference.count()); + printf("FPS LIMITER SLEEP TIME OUTSIDE ALLOWED WINDOW\n"); printf(" Target sleep until time: %lld, Actual time: %lld\n", sleepUntil.time_since_epoch().count(), timeNow.time_since_epoch().count()); printf(" (Difference: %lld, Window: %lld)\n", timeDifference.count(), sleepWindow.count()); }