SDL  2.0
testnativeos2.c
Go to the documentation of this file.
1 /*
2  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
3 
4  This software is provided 'as-is', without any express or implied
5  warranty. In no event will the authors be held liable for any damages
6  arising from the use of this software.
7 
8  Permission is granted to anyone to use this software for any purpose,
9  including commercial applications, and to alter it and redistribute it
10  freely.
11 */
12 
13 #include "testnative.h"
14 
15 #ifdef TEST_NATIVE_OS2
16 
17 #define WIN_CLIENT_CLASS "SDL Test"
18 
19 static void *CreateWindowNative(int w, int h);
20 static void DestroyWindowNative(void *window);
21 
22 NativeWindowFactory OS2WindowFactory = {
23  "DIVE",
24  CreateWindowNative,
25  DestroyWindowNative
26 };
27 
28 static void *CreateWindowNative(int w, int h)
29 {
30  HWND hwnd;
31  HWND hwndFrame;
32  ULONG ulFrameFlags = FCF_TASKLIST | FCF_DLGBORDER | FCF_TITLEBAR |
33  FCF_SYSMENU | FCF_SHELLPOSITION |
34  FCF_SIZEBORDER | FCF_MINBUTTON | FCF_MAXBUTTON;
35 
36  WinRegisterClass( 0, WIN_CLIENT_CLASS, WinDefWindowProc,
37  CS_SIZEREDRAW | CS_MOVENOTIFY,
38  sizeof(ULONG) ); // We should have minimum 4 bytes.
39 
40  hwndFrame = WinCreateStdWindow( HWND_DESKTOP, 0, &ulFrameFlags,
41  WIN_CLIENT_CLASS, "SDL Test", 0, 0, 1, &hwnd );
42  if ( hwndFrame == NULLHANDLE )
43  {
44  return 0;
45  }
46 
47  WinSetWindowPos( hwndFrame, HWND_TOP, 0, 0, w, h,
48  SWP_ZORDER | SWP_ACTIVATE | SWP_SIZE | SWP_SHOW );
49 
50  return (void *)hwndFrame; // We may returns client or frame window handle
51  // for SDL_CreateWindowFrom().
52 }
53 
54 static void DestroyWindowNative(void *window)
55 {
56  WinDestroyWindow( (HWND)window );
57 }
58 
59 #endif /* TEST_NATIVE_OS2 */
GLfloat GLfloat GLfloat GLfloat h
GLubyte GLubyte GLubyte GLubyte w
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025