diff options
author | Mike Erwin <significant.bit@gmail.com> | 2015-02-27 02:40:09 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2015-02-27 02:40:34 +0300 |
commit | 7aa91f5fbcb65ae57af2665b25335ff094dfd5bf (patch) | |
tree | f7c51742cc0286cec110a824da2278736e7700e2 /intern/ghost | |
parent | 87dc01e690d12b1cf50aa274c59d584e355f3c86 (diff) |
cleanup: ghost Win32 IME
Took out lots of redundant function calls (getters). Also wrapped more
code in WITH_INPUT_IME guards.
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/intern/GHOST_ImeWin32.cpp | 3 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_ImeWin32.h | 6 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.cpp | 30 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.h | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowWin32.cpp | 4 |
5 files changed, 29 insertions, 16 deletions
diff --git a/intern/ghost/intern/GHOST_ImeWin32.cpp b/intern/ghost/intern/GHOST_ImeWin32.cpp index ef8eb9827ff..af5a2ed7097 100644 --- a/intern/ghost/intern/GHOST_ImeWin32.cpp +++ b/intern/ghost/intern/GHOST_ImeWin32.cpp @@ -30,6 +30,7 @@ * \ingroup GHOST */ +#ifdef WITH_INPUT_IME #include "GHOST_C-api.h" #include "GHOST_ImeWin32.h" @@ -515,3 +516,5 @@ void GHOST_ImeWin32::UpdateInfo(HWND window_handle) eventImeData.target_end = -1; } } + +#endif // WITH_INPUT_IME diff --git a/intern/ghost/intern/GHOST_ImeWin32.h b/intern/ghost/intern/GHOST_ImeWin32.h index 5b2d71875e8..bfd9a49d785 100644 --- a/intern/ghost/intern/GHOST_ImeWin32.h +++ b/intern/ghost/intern/GHOST_ImeWin32.h @@ -32,6 +32,9 @@ #ifndef __GHOST_IME_H__ #define __GHOST_IME_H__ +#ifdef WITH_INPUT_IME + +#define WIN32_LEAN_AND_MEAN #include <windows.h> #include <string> @@ -398,4 +401,5 @@ private: bool is_first, is_enable; }; -#endif * __GHOST_IME_H__ +#endif // WITH_INPUT_IME +#endif // __GHOST_IME_H__ diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 30f8afd72b2..650107ed181 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -970,47 +970,51 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, //////////////////////////////////////////////////////////////////////// case WM_IME_SETCONTEXT: { - window->getImeInput()->SetInputLanguage(); - window->getImeInput()->CreateImeWindow(window->getHWND()); - window->getImeInput()->CleanupComposition(window->getHWND()); - window->getImeInput()->CheckFirst(window->getHWND()); + GHOST_ImeWin32 *ime = window->getImeInput(); + ime->SetInputLanguage(); + ime->CreateImeWindow(hwnd); + ime->CleanupComposition(hwnd); + ime->CheckFirst(hwnd); break; } case WM_IME_STARTCOMPOSITION: { + GHOST_ImeWin32 *ime = window->getImeInput(); eventHandled = true; /* remove input event before start comp event, avoid redundant input */ eventManager->removeTypeEvents(GHOST_kEventKeyDown, window); - window->getImeInput()->CreateImeWindow(window->getHWND()); - window->getImeInput()->ResetComposition(window->getHWND()); + ime->CreateImeWindow(hwnd); + ime->ResetComposition(hwnd); event = processImeEvent( GHOST_kEventImeCompositionStart, window, - &window->getImeInput()->eventImeData); + &ime->eventImeData); break; } case WM_IME_COMPOSITION: { + GHOST_ImeWin32 *ime = window->getImeInput(); eventHandled = true; - window->getImeInput()->UpdateImeWindow(window->getHWND()); - window->getImeInput()->UpdateInfo(window->getHWND()); + ime->UpdateImeWindow(hwnd); + ime->UpdateInfo(hwnd); event = processImeEvent( GHOST_kEventImeComposition, window, - &window->getImeInput()->eventImeData); + &ime->eventImeData); break; } case WM_IME_ENDCOMPOSITION: { + GHOST_ImeWin32 *ime = window->getImeInput(); eventHandled = true; /* remove input event after end comp event, avoid redundant input */ eventManager->removeTypeEvents(GHOST_kEventKeyDown, window); - window->getImeInput()->ResetComposition(window->getHWND()); - window->getImeInput()->DestroyImeWindow(window->getHWND()); + ime->ResetComposition(hwnd); + ime->DestroyImeWindow(hwnd); event = processImeEvent( GHOST_kEventImeCompositionEnd, window, - &window->getImeInput()->eventImeData); + &ime->eventImeData); break; } #endif /* WITH_INPUT_IME */ diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h index 2bb631103c7..3374b3999b4 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.h +++ b/intern/ghost/intern/GHOST_SystemWin32.h @@ -305,6 +305,7 @@ protected: */ static GHOST_Event *processWindowEvent(GHOST_TEventType type, GHOST_IWindow *window); +#ifdef WITH_INPUT_IME /** * Creates a IME event. * \param type The type of event to create. @@ -313,6 +314,7 @@ protected: * \return The event created. */ static GHOST_Event *processImeEvent(GHOST_TEventType type, GHOST_IWindow *window, GHOST_TEventImeData *data); +#endif // WITH_INPUT_IME /** * Handles minimum window size. diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index e033daeb221..efcb389363d 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -1060,12 +1060,12 @@ GHOST_TSuccess GHOST_WindowWin32::endProgressBar() #ifdef WITH_INPUT_IME void GHOST_WindowWin32::beginIME(GHOST_TInt32 x, GHOST_TInt32 y, GHOST_TInt32 w, GHOST_TInt32 h, int completed) { - this->getImeInput()->BeginIME(this->getHWND(), GHOST_Rect(x, y - h , x, y), (bool)completed); + m_imeImput.BeginIME(m_hWnd, GHOST_Rect(x, y - h, x, y), (bool)completed); } void GHOST_WindowWin32::endIME() { - this->getImeInput()->EndIME(this->getHWND()); + m_imeImput.EndIME(m_hWnd); } #endif /* WITH_INPUT_IME */ |