src/video/windows/SDL_windowsevents.c
changeset 9599 223fbcc6a327
parent 9597 345bc53b52b8
child 9619 b94b6d0bff0f
equal deleted inserted replaced
9598:5f50522bf2e1 9599:223fbcc6a327
   926     }
   926     }
   927 }
   927 }
   928 
   928 
   929 /* A message hook called before TranslateMessage() */
   929 /* A message hook called before TranslateMessage() */
   930 static SDL_WindowsMessageHook g_WindowsMessageHook = NULL;
   930 static SDL_WindowsMessageHook g_WindowsMessageHook = NULL;
   931 
   931 static void *g_WindowsMessageHookData = NULL;
   932 void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback)
   932 
       
   933 void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata)
   933 {
   934 {
   934     g_WindowsMessageHook = callback;
   935     g_WindowsMessageHook = callback;
       
   936     g_WindowsMessageHookData = userdata;
   935 }
   937 }
   936 
   938 
   937 void
   939 void
   938 WIN_PumpEvents(_THIS)
   940 WIN_PumpEvents(_THIS)
   939 {
   941 {
   942     DWORD start_ticks = GetTickCount();
   944     DWORD start_ticks = GetTickCount();
   943 
   945 
   944     if (g_WindowsEnableMessageLoop) {
   946     if (g_WindowsEnableMessageLoop) {
   945         while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
   947         while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
   946             if (g_WindowsMessageHook) {
   948             if (g_WindowsMessageHook) {
   947                 g_WindowsMessageHook(msg.hwnd, msg.message, msg.wParam, msg.lParam);
   949                 g_WindowsMessageHook(g_WindowsMessageHookData, msg.hwnd, msg.message, msg.wParam, msg.lParam);
   948             }
   950             }
   949 
   951 
   950             /* Always translate the message in case it's a non-SDL window (e.g. with Qt integration) */
   952             /* Always translate the message in case it's a non-SDL window (e.g. with Qt integration) */
   951             TranslateMessage(&msg);
   953             TranslateMessage(&msg);
   952             DispatchMessage(&msg);
   954             DispatchMessage(&msg);