add GFX2_Get_Window_Handle() to get the win32 HWND

and use it
This commit is contained in:
Thomas Bernard
2018-06-25 10:23:19 +02:00
parent b6dec6d3f7
commit cb2d479867
7 changed files with 44 additions and 76 deletions

View File

@@ -45,11 +45,18 @@
#if defined(USE_SDL) || defined(USE_SDL2)
#include <SDL.h>
#include <SDL_image.h>
// There is no WM on the GP2X...
#if !defined(__GP2X__) && !defined(__WIZ__) && !defined(__CAANOO__) && !defined(GCWZERO)
#include <SDL_syswm.h>
#endif
#if defined(WIN32)
#include <windows.h>
#include <shlwapi.h>
#elif defined (__MINT__)
#include <mint/osbind.h>
#elif defined(__macosx__)
#import <CoreFoundation/CoreFoundation.h>
#import <sys/param.h>
#elif defined(__FreeBSD__)
#include <sys/param.h>
#endif
#include "const.h"
@@ -80,18 +87,6 @@
#include "win32screen.h"
#endif
#if defined(WIN32)
#include <windows.h>
#include <shlwapi.h>
#elif defined (__MINT__)
#include <mint/osbind.h>
#elif defined(__macosx__)
#import <CoreFoundation/CoreFoundation.h>
#import <sys/param.h>
#elif defined(__FreeBSD__)
#include <sys/param.h>
#endif
#if defined (WIN32) && (defined(USE_SDL) || defined(USE_SDL2))
// On Windows, SDL_putenv is not present in any compilable header.
@@ -859,11 +854,8 @@ int Init_program(int argc,char * argv[])
{
//RECT r;
#if defined(USE_SDL) || defined(USE_SDL2)
static SDL_SysWMinfo pInfo;
SDL_VERSION(&pInfo.version);
SDL_GetWMInfo(&pInfo);
//GetWindowRect(pInfo.window, &r);
SetWindowPos(pInfo.window, 0, Config.Window_pos_x, Config.Window_pos_y, 0, 0, SWP_NOSIZE);
//GetWindowRect(window, &r);
SetWindowPos(GFX2_Get_Window_Handle(), 0, Config.Window_pos_x, Config.Window_pos_y, 0, 0, SWP_NOSIZE);
#endif
}
}
@@ -1071,10 +1063,7 @@ void Program_shutdown(void)
#if defined(USE_SDL) || defined(USE_SDL2)
{
RECT r;
static SDL_SysWMinfo pInfo;
SDL_GetWMInfo(&pInfo);
GetWindowRect(pInfo.window, &r);
GetWindowRect(GFX2_Get_Window_Handle(), &r);
Config.Window_pos_x = r.left;
Config.Window_pos_y = r.top;