Skip to content
Permalink
Browse files

Added SDL_SetWindowsMessageHook() to facilitate full IME support on W…

…indows
  • Loading branch information
slouken committed May 14, 2015
1 parent 094c4a1 commit 7de242e72cbe45b808097e20b7d30d1c71d6dcba

File 5 of 5 in 7de242e

@@ -24,6 +24,7 @@

#include "SDL_windowsvideo.h"
#include "SDL_windowsshape.h"
#include "SDL_system.h"
#include "SDL_syswm.h"
#include "SDL_timer.h"
#include "SDL_vkeys.h"
@@ -925,6 +926,14 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
}

/* A message hook called before TranslateMessage() */
static SDL_WindowsMessageHook g_WindowsMessageHook = NULL;

void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback)
{
g_WindowsMessageHook = callback;
}

void
WIN_PumpEvents(_THIS)
{
@@ -934,6 +943,10 @@ 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);
}

/* Always translate the message in case it's a non-SDL window (e.g. with Qt integration) */
TranslateMessage(&msg);
DispatchMessage(&msg);

0 comments on commit 7de242e

Please sign in to comment.