Fixed events for windows that have had their window proc hooked at creation time
This commit is contained in:
@@ -2496,11 +2496,6 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK WIN_DefWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
|
||||||
return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
int WIN_WaitEventTimeout(SDL_VideoDevice *_this, Sint64 timeoutNS)
|
int WIN_WaitEventTimeout(SDL_VideoDevice *_this, Sint64 timeoutNS)
|
||||||
{
|
{
|
||||||
if (g_WindowsEnableMessageLoop) {
|
if (g_WindowsEnableMessageLoop) {
|
||||||
@@ -2804,7 +2799,7 @@ bool SDL_RegisterApp(const char *name, Uint32 style, void *hInst)
|
|||||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||||
wcex.lpszClassName = SDL_Appname;
|
wcex.lpszClassName = SDL_Appname;
|
||||||
wcex.style = SDL_Appstyle;
|
wcex.style = SDL_Appstyle;
|
||||||
wcex.lpfnWndProc = WIN_DefWindowProc;
|
wcex.lpfnWndProc = WIN_WindowProc;
|
||||||
wcex.hInstance = SDL_Instance;
|
wcex.hInstance = SDL_Instance;
|
||||||
|
|
||||||
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
|
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ extern HINSTANCE SDL_Instance;
|
|||||||
|
|
||||||
extern LRESULT CALLBACK WIN_KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam);
|
extern LRESULT CALLBACK WIN_KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam);
|
||||||
extern LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
extern LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
extern LRESULT CALLBACK WIN_DefWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
|
||||||
extern void WIN_PollRawInput(SDL_VideoDevice *_this, Uint64 poll_start);
|
extern void WIN_PollRawInput(SDL_VideoDevice *_this, Uint64 poll_start);
|
||||||
extern void WIN_CheckKeyboardAndMouseHotplug(SDL_VideoDevice *_this, bool initial_check);
|
extern void WIN_CheckKeyboardAndMouseHotplug(SDL_VideoDevice *_this, bool initial_check);
|
||||||
extern void WIN_PumpEvents(SDL_VideoDevice *_this);
|
extern void WIN_PumpEvents(SDL_VideoDevice *_this);
|
||||||
|
|||||||
@@ -425,19 +425,22 @@ static bool SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, HWND hwn
|
|||||||
window->internal = data;
|
window->internal = data;
|
||||||
|
|
||||||
// Set up the window proc function
|
// Set up the window proc function
|
||||||
|
if (window->flags & SDL_WINDOW_EXTERNAL) {
|
||||||
#ifdef GWLP_WNDPROC
|
#ifdef GWLP_WNDPROC
|
||||||
data->wndproc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_WNDPROC);
|
data->wndproc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_WNDPROC);
|
||||||
if (data->wndproc == WIN_DefWindowProc) {
|
if (data->wndproc != WIN_WindowProc) {
|
||||||
data->wndproc = NULL;
|
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)WIN_WindowProc);
|
||||||
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)WIN_WindowProc);
|
}
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
data->wndproc = (WNDPROC)GetWindowLong(hwnd, GWL_WNDPROC);
|
data->wndproc = (WNDPROC)GetWindowLong(hwnd, GWL_WNDPROC);
|
||||||
if (data->wndproc == WIN_DefWindowProc) {
|
if (data->wndproc != WIN_WindowProc) {
|
||||||
data->wndproc = NULL;
|
SetWindowLong(hwnd, GWL_WNDPROC, (LONG_PTR)WIN_WindowProc);
|
||||||
SetWindowLong(hwnd, GWL_WNDPROC, (LONG_PTR)WIN_WindowProc);
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
} else {
|
||||||
|
// We set up our window proc function at window creation.
|
||||||
|
// If someone has set hooks to modify it, leave it alone.
|
||||||
|
}
|
||||||
|
|
||||||
// Fill in the SDL window with the window state
|
// Fill in the SDL window with the window state
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user