From 05e4ac80ea6b5e037fff97407d13a1836e9a1dda Mon Sep 17 00:00:00 2001 From: Inori Date: Tue, 6 Aug 2019 21:17:25 -0400 Subject: [PATCH] Use windows native SetWindowPos for window resize --- src/fake-api.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/fake-api.cpp b/src/fake-api.cpp index 63618133..86e9b426 100644 --- a/src/fake-api.cpp +++ b/src/fake-api.cpp @@ -1,5 +1,6 @@ #ifdef __WIN32__ #include +#include #include @@ -81,9 +82,7 @@ MKXP_ScreenToClient(HWND hWnd, LPPOINT lpPoint) return true; } -// TODO: Try and get this, and the other hWnd stuff, -// to just run the real functions with the right window -// handle + BOOL __stdcall MKXP_SetWindowPos(HWND hWnd, HWND hWndInsertAfter, @@ -93,8 +92,14 @@ MKXP_SetWindowPos(HWND hWnd, int cy, UINT uFlags) { + // Setting window position still doesn't work with + // SetWindowPos, but it still needs to be called + // because Win32API.restoreScreen is picky about its + // metrics + SDL_SysWMinfo wm; + SDL_GetWindowWMInfo(shState->sdlWindow(), &wm); + SetWindowPos(wm.info.win.window, hWndInsertAfter, X, Y, cx, cy, uFlags); SDL_SetWindowPosition(shState->sdlWindow(), X, Y); - SDL_SetWindowSize(shState->sdlWindow(), cx-6, cy-29); return true; }