diff options
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.cpp | 6 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowWin32.cpp | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 2fdddda835d..455a166ece0 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -304,7 +304,6 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent) // Process all the events waiting for us while (::PeekMessage(&msg, 0, 0, 0, PM_REMOVE) != 0) { - ::TranslateMessage(&msg); ::DispatchMessage(&msg); anyProcessed = true; } @@ -819,6 +818,11 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, // Keyboard events, processed //////////////////////////////////////////////////////////////////////// case WM_INPUT: + // check WM_INPUT from input sink when ghost window is not in the foreground + if (wParam == RIM_INPUTSINK) { + if (GetFocus() != hwnd) // WM_INPUT message not for this window + return 0; + } //else wPAram == RIM_INPUT event = processKeyEvent(window, wParam, lParam); if (!event) { GHOST_PRINT("GHOST_SystemWin32::wndProc: key event ") diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index a89b2608bb4..aae1509fda1 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -307,6 +307,15 @@ GHOST_WindowWin32::GHOST_WindowWin32( } } + if (parentwindowhwnd != 0) { + RAWINPUTDEVICE device = {0}; + device.usUsagePage = 0x01; /* usUsagePage & usUsage for keyboard*/ + device.usUsage = 0x06; /* http://msdn.microsoft.com/en-us/windows/hardware/gg487473.aspx */ + device.dwFlags |= RIDEV_INPUTSINK; // makes WM_INPUT is visible for ghost when has parent window + device.hwndTarget = m_hWnd; + RegisterRawInputDevices(&device, 1, sizeof(device)); + } + m_wintab = ::LoadLibrary("Wintab32.dll"); if (m_wintab) { GHOST_WIN32_WTInfo fpWTInfo = ( GHOST_WIN32_WTInfo ) ::GetProcAddress( m_wintab, "WTInfoA" ); |