Преглед изворни кода

Use DefWindowProc for the initial SDL window proc

This makes sure that anything that hooks window creation to set up window proc hooks will call DefWindowProc instead of infinitely recursing when we set up our window proc afterwards.

Fixes https://github.com/libsdl-org/SDL/issues/10529
Sam Lantinga пре 8 месеци
родитељ
комит
6c4f2bd83d
1 измењених фајлова са 2 додато и 8 уклоњено
  1. 2 8
      src/video/windows/SDL_windowsevents.c

+ 2 - 8
src/video/windows/SDL_windowsevents.c

@@ -2729,18 +2729,12 @@ bool SDL_RegisterApp(const char *name, Uint32 style, void *hInst)
     SDL_Instance = hInst ? (HINSTANCE)hInst : GetModuleHandle(NULL);
     SDL_Instance = hInst ? (HINSTANCE)hInst : GetModuleHandle(NULL);
 
 
     // Register the application class
     // Register the application class
+    SDL_zero(wcex);
     wcex.cbSize = sizeof(WNDCLASSEX);
     wcex.cbSize = sizeof(WNDCLASSEX);
-    wcex.hCursor = NULL;
-    wcex.hIcon = NULL;
-    wcex.hIconSm = NULL;
-    wcex.lpszMenuName = NULL;
     wcex.lpszClassName = SDL_Appname;
     wcex.lpszClassName = SDL_Appname;
     wcex.style = SDL_Appstyle;
     wcex.style = SDL_Appstyle;
-    wcex.hbrBackground = NULL;
-    wcex.lpfnWndProc = WIN_WindowProc;
+    wcex.lpfnWndProc = DefWindowProc;
     wcex.hInstance = SDL_Instance;
     wcex.hInstance = SDL_Instance;
-    wcex.cbClsExtra = 0;
-    wcex.cbWndExtra = 0;
 
 
 #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
 #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
     hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON);
     hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON);