mirror of
https://github.com/encounter/SDL.git
synced 2025-12-08 13:15:10 +00:00
Added a userdata parameter to SDL_SetWindowsMessageHook()
This commit is contained in:
@@ -625,5 +625,5 @@ SDL_DYNAPI_PROC(Uint32,SDL_GetQueuedAudioSize,(SDL_AudioDeviceID a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_ClearQueuedAudio,(SDL_AudioDeviceID a),(a),)
|
||||
SDL_DYNAPI_PROC(SDL_Window*,SDL_GetGrabbedWindow,(void),(),return)
|
||||
#ifdef __WIN32__
|
||||
SDL_DYNAPI_PROC(void,SDL_SetWindowsMessageHook,(SDL_WindowsMessageHook a),(a),)
|
||||
SDL_DYNAPI_PROC(void,SDL_SetWindowsMessageHook,(SDL_WindowsMessageHook a, void *b),(a,b),)
|
||||
#endif
|
||||
|
||||
@@ -928,10 +928,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
/* A message hook called before TranslateMessage() */
|
||||
static SDL_WindowsMessageHook g_WindowsMessageHook = NULL;
|
||||
static void *g_WindowsMessageHookData = NULL;
|
||||
|
||||
void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback)
|
||||
void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata)
|
||||
{
|
||||
g_WindowsMessageHook = callback;
|
||||
g_WindowsMessageHookData = userdata;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -944,7 +946,7 @@ WIN_PumpEvents(_THIS)
|
||||
if (g_WindowsEnableMessageLoop) {
|
||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||
if (g_WindowsMessageHook) {
|
||||
g_WindowsMessageHook(msg.hwnd, msg.message, msg.wParam, msg.lParam);
|
||||
g_WindowsMessageHook(g_WindowsMessageHookData, msg.hwnd, msg.message, msg.wParam, msg.lParam);
|
||||
}
|
||||
|
||||
/* Always translate the message in case it's a non-SDL window (e.g. with Qt integration) */
|
||||
|
||||
Reference in New Issue
Block a user