summaryrefslogtreecommitdiffhomepage
path: root/patches/sdl2/wchar.patch
blob: 8513c88e0e949ab7ad8e8dfa646119282137b216 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
diff -ru SDL2-2.0.12.orig/src/video/windows/SDL_windowsmessagebox.c SDL2-2.0.12/src/video/windows/SDL_windowsmessagebox.c
--- SDL2-2.0.12.orig/src/video/windows/SDL_windowsmessagebox.c  2020-03-11 02:36:18.000000000 +0100
+++ SDL2-2.0.12/src/video/windows/SDL_windowsmessagebox.c       2020-10-07 14:04:09.877146877 +0200
@@ -803,7 +803,7 @@
     }

     /* If we cannot load comctl32.dll use the old messagebox! */
-    hComctl32 = LoadLibrary(TEXT("Comctl32.dll"));
+    hComctl32 = LoadLibrary((uint16_t[]){'C','o','m','c','t','l','3','2','.','d','l','l',0});
     if (hComctl32 == NULL) {
         return WIN_ShowOldMessageBox(messageboxdata, buttonid);
     }
diff -ru SDL2-2.0.12.orig/src/video/windows/SDL_windowsevents.c SDL2-2.0.12/src/video/windows/SDL_windowsevents.c
--- SDL2-2.0.12.orig/src/video/windows/SDL_windowsevents.c      2020-03-11 02:36:18.000000000 +0100
+++ SDL2-2.0.12/src/video/windows/SDL_windowsevents.c   2020-10-07 14:00:09.021392356 +0200
@@ -416,7 +416,7 @@
     }

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