2021-04-20 23:40:33 +04:00
|
|
|
/*
|
2021-05-09 13:30:38 +04:00
|
|
|
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
2021-04-20 23:40:33 +04:00
|
|
|
|
|
|
|
This software is provided 'as-is', without any express or implied
|
|
|
|
warranty. In no event will the authors be held liable for any damages
|
|
|
|
arising from the use of this software.
|
|
|
|
|
|
|
|
Permission is granted to anyone to use this software for any purpose,
|
|
|
|
including commercial applications, and to alter it and redistribute it
|
|
|
|
freely.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "testnative.h"
|
|
|
|
|
|
|
|
#ifdef TEST_NATIVE_OS2
|
|
|
|
|
2021-12-07 05:20:09 +04:00
|
|
|
#define WIN_CLIENT_CLASS "SDL Test"
|
2021-04-20 23:40:33 +04:00
|
|
|
|
|
|
|
static void *CreateWindowNative(int w, int h);
|
|
|
|
static void DestroyWindowNative(void *window);
|
|
|
|
|
|
|
|
NativeWindowFactory OS2WindowFactory = {
|
2021-12-07 05:20:09 +04:00
|
|
|
"DIVE",
|
|
|
|
CreateWindowNative,
|
|
|
|
DestroyWindowNative
|
2021-04-20 23:40:33 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
static void *CreateWindowNative(int w, int h)
|
|
|
|
{
|
2021-12-07 05:20:09 +04:00
|
|
|
HWND hwnd, hwndFrame;
|
|
|
|
ULONG ulFrameFlags = FCF_TASKLIST | FCF_DLGBORDER | FCF_TITLEBAR |
|
|
|
|
FCF_SYSMENU | FCF_SHELLPOSITION |
|
|
|
|
FCF_SIZEBORDER | FCF_MINBUTTON | FCF_MAXBUTTON;
|
|
|
|
|
|
|
|
WinRegisterClass(0, WIN_CLIENT_CLASS, WinDefWindowProc,
|
|
|
|
CS_SIZEREDRAW | CS_MOVENOTIFY,
|
|
|
|
sizeof(ULONG)); /* We should have minimum 4 bytes. */
|
|
|
|
|
|
|
|
hwndFrame = WinCreateStdWindow(HWND_DESKTOP, 0, &ulFrameFlags,
|
|
|
|
WIN_CLIENT_CLASS, "SDL Test", 0, 0, 1, &hwnd);
|
|
|
|
if (hwndFrame == NULLHANDLE) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
WinSetWindowPos(hwndFrame, HWND_TOP, 0, 0, w, h,
|
|
|
|
SWP_ZORDER | SWP_ACTIVATE | SWP_SIZE | SWP_SHOW);
|
|
|
|
|
|
|
|
return (void *)hwndFrame; /* We may return client or frame window
|
|
|
|
handle for SDL_CreateWindowFrom(). */
|
2021-04-20 23:40:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void DestroyWindowNative(void *window)
|
|
|
|
{
|
2021-12-07 05:20:09 +04:00
|
|
|
WinDestroyWindow((HWND) window);
|
2021-04-20 23:40:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* TEST_NATIVE_OS2 */
|