Commit: 7aa91f5fbcb65ae57af2665b25335ff094dfd5bf
Author: Mike Erwin
Date: Thu Feb 26 18:40:09 2015 -0500
Branches: master
https://developer.blender.org/rB7aa91f5fbcb65ae57af2665b25335ff094dfd5bf
cleanup: ghost Win32 IME
Took out lots of redundant function calls (getters). Also wrapped more
code in WITH_INPUT_IME guards.
===================================================================
M intern/ghost/intern/GHOST_ImeWin32.cpp
M intern/ghost/intern/GHOST_ImeWin32.h
M intern/ghost/intern/GHOST_SystemWin32.cpp
M intern/ghost/intern/GHOST_SystemWin32.h
M intern/ghost/intern/GHOST_WindowWin32.cpp
===================================================================
diff --git a/intern/ghost/intern/GHOST_ImeWin32.cpp
b/intern/ghost/intern/GHOST_ImeWin32.cpp
index ef8eb98..af5a2ed 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 5b2d718..bfd9a49 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 30f8afd..650107e 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 2bb6311..3374b39 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 e033dae..efcb389 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 */
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs