Blame patches/sdl2/wchar.patch

213fe0
diff -ru SDL2-2.0.8.orig/src/video/windows/SDL_windowsevents.c SDL2-2.0.8/src/video/windows/SDL_windowsevents.c
213fe0
--- SDL2-2.0.8.orig/src/video/windows/SDL_windowsevents.c	2018-03-01 17:34:42.000000000 +0100
213fe0
+++ SDL2-2.0.8/src/video/windows/SDL_windowsevents.c	2020-10-05 13:11:43.595494306 +0200
213fe0
@@ -47,6 +47,10 @@
213fe0
 #include "wmmsg.h"
213fe0
 #endif
213fe0
 
213fe0
+#ifdef __midipix__
213fe0
+#define sdl_window_data (uint16_t[]){'S','D','L','_','W','i','n','d','o','w','D','a','t','a',0}
213fe0
+#endif
213fe0
+
213fe0
 /* For processing mouse WM_*BUTTON* and WM_MOUSEMOVE message-data from GetMessageExtraInfo() */
213fe0
 #define MOUSEEVENTF_FROMTOUCH 0xFF515700
213fe0
 
213fe0
@@ -384,7 +388,11 @@
213fe0
     }
213fe0
 
213fe0
     /* Get the window data for the window */
213fe0
+#ifdef __midipix__
213fe0
+    data = (SDL_WindowData *) GetProp(hwnd, sdl_window_data);
213fe0
+#else
213fe0
     data = (SDL_WindowData *) GetProp(hwnd, TEXT("SDL_WindowData"));
213fe0
+#endif
213fe0
     if (!data) {
213fe0
         return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
213fe0
     }
213fe0
diff -ru SDL2-2.0.8.orig/src/video/windows/SDL_windowswindow.c SDL2-2.0.8/src/video/windows/SDL_windowswindow.c
213fe0
--- SDL2-2.0.8.orig/src/video/windows/SDL_windowswindow.c	2018-03-01 17:34:42.000000000 +0100
213fe0
+++ SDL2-2.0.8/src/video/windows/SDL_windowswindow.c	2020-10-05 13:23:58.342720394 +0200
213fe0
@@ -45,10 +45,22 @@
213fe0
 #define SWP_NOCOPYBITS 0
213fe0
 #endif
213fe0
 
213fe0
+#ifdef __midipix__
213fe0
+#define sdl_helper_window_input_catcher (uint16_t[]){'S','D','L','H','e','l','p','e','r','W','i','n','d','o','w','I','n','p','u','t','C','a','t','c','h','e','r',0}
213fe0
+#define sdl_helper_window_name (uint16_t[]){'S','D','L','H','e','l','p','e','r','W','i','n','d','o','w','I','n','p','u','t','M','s','g','W','i','n','d','o','w',0}
213fe0
+#define sdl_window (uint16_t[]){'S','D','L','_','W','i','n','d','o','w','D','a','t','a',0}
213fe0
+#define sdl_empty (uint16_t[]){0}
213fe0
+#endif
213fe0
+
213fe0
 /* Fake window to help with DirectInput events. */
213fe0
 HWND SDL_HelperWindow = NULL;
213fe0
+#ifdef __midipix__
213fe0
+static WCHAR *SDL_HelperWindowClassName = sdl_helper_window_input_catcher;
213fe0
+static WCHAR *SDL_HelperWindowName = sdl_helper_window_name;
213fe0
+#else
213fe0
 static WCHAR *SDL_HelperWindowClassName = TEXT("SDLHelperWindowInputCatcher");
213fe0
 static WCHAR *SDL_HelperWindowName = TEXT("SDLHelperWindowInputMsgWindow");
213fe0
+#endif
213fe0
 static ATOM SDL_HelperWindowClass = 0;
213fe0
 
213fe0
 /* For borderless Windows, still want the following flags:
213fe0
@@ -183,7 +195,11 @@
213fe0
     window->driverdata = data;
213fe0
 
213fe0
     /* Associate the data with the window */
213fe0
+#ifdef __midipix__
213fe0
+    if (!SetProp(hwnd, sdl_window, data)) {
213fe0
+#else
213fe0
     if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) {
213fe0
+#endif
213fe0
         ReleaseDC(hwnd, data->hdc);
213fe0
         SDL_free(data);
213fe0
         return WIN_SetError("SetProp() failed");
213fe0
@@ -307,7 +323,11 @@
213fe0
     int w, h;
213fe0
 
213fe0
     if (window->flags & SDL_WINDOW_SKIP_TASKBAR) {
213fe0
+#ifdef __midipix__
213fe0
+        parent = CreateWindow(SDL_Appname, sdl_empty, STYLE_BASIC, 0, 0, 32, 32, NULL, NULL, SDL_Instance, NULL);
213fe0
+#else
213fe0
         parent = CreateWindow(SDL_Appname, TEXT(""), STYLE_BASIC, 0, 0, 32, 32, NULL, NULL, SDL_Instance, NULL);
213fe0
+#endif
213fe0
     }
213fe0
 
213fe0
     style |= GetWindowStyle(window);
213fe0
@@ -315,9 +335,13 @@
213fe0
     /* Figure out what the window area will be */
213fe0
     WIN_AdjustWindowRectWithStyle(window, style, FALSE, &x, &y, &w, &h, SDL_FALSE);
213fe0
 
213fe0
+#ifdef __midipix__
213fe0
+    hwnd = CreateWindow(SDL_Appname, sdl_empty, style, x, y, w, h, parent, NULL, SDL_Instance, NULL);
213fe0
+#else
213fe0
     hwnd =
213fe0
         CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, parent, NULL,
213fe0
                      SDL_Instance, NULL);
213fe0
+#endif
213fe0
     if (!hwnd) {
213fe0
         return WIN_SetError("Couldn't create window");
213fe0
     }
213fe0
@@ -741,7 +765,11 @@
213fe0
 
213fe0
     if (data) {
213fe0
         ReleaseDC(data->hwnd, data->hdc);
213fe0
+#ifdef __midipix__
213fe0
+        RemoveProp(data->hwnd, sdl_window);
213fe0
+#else
213fe0
         RemoveProp(data->hwnd, TEXT("SDL_WindowData"));
213fe0
+#endif
213fe0
         if (data->created) {
213fe0
             DestroyWindow(data->hwnd);
213fe0
             if (data->parent) {