🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.7 KiB

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