Commit: f086c5a1ea400cd4808955eb817e3bb9b513c548
Author: Severin
Date:   Tue Nov 18 01:44:12 2014 +0100
Branches: input_method_editor
https://developer.blender.org/rBf086c5a1ea400cd4808955eb817e3bb9b513c548

CMake: add WITH_INPUT_IME option + various fixes/cleanup

*note:* implementation of WITH_INPUT_IME is only halfway finished, you'll
get build errors if you disable it

===================================================================

M       CMakeLists.txt
M       intern/ghost/CMakeLists.txt
M       intern/ghost/GHOST_C-api.h
D       intern/ghost/GHOST_ImeWin32.h
M       intern/ghost/intern/GHOST_C-api.cpp
M       intern/ghost/intern/GHOST_ImeWin32.cpp
A       intern/ghost/intern/GHOST_ImeWin32.h
M       intern/ghost/intern/GHOST_SystemWin32.cpp
M       intern/ghost/intern/GHOST_Window.h
M       intern/ghost/intern/GHOST_WindowWin32.cpp
M       intern/ghost/intern/GHOST_WindowWin32.h
M       source/blender/windowmanager/intern/wm_window.c

===================================================================

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 37dadbe..45b0556 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -313,6 +313,9 @@ mark_as_advanced(WITH_LIBMV_SCHUR_SPECIALIZATIONS)
 option(WITH_FREESTYLE     "Enable Freestyle (advanced edges rendering)" ON)
 
 # Misc
+if (WIN32)
+       option(WITH_INPUT_IME "Enable Input Method Editor (IME)" ON)
+endif()
 option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and 
friends)" ${_init_INPUT_NDOF})
 option(WITH_RAYOPTIMIZATION    "Enable use of SIMD (SSE) optimizations for the 
raytracer" ON)
 option(WITH_OPENNL        "Enable use of Open Numerical Library" ON)
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index 9d0b70f..555d66d 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -264,14 +264,12 @@ elseif(WIN32)
                intern/GHOST_SystemWin32.cpp
                intern/GHOST_WindowWin32.cpp
                intern/GHOST_DropTargetWin32.cpp
-               intern/GHOST_ImeWin32.cpp
 
                intern/GHOST_DisplayManagerWin32.h
                intern/GHOST_DropTargetWin32.h
                intern/GHOST_SystemWin32.h
                intern/GHOST_WindowWin32.h
                intern/GHOST_TaskbarWin32.h
-               intern/GHOST_ImeWin32.h
        )
 
        if(NOT WITH_GL_EGL)
@@ -282,6 +280,14 @@ elseif(WIN32)
                )
        endif()
 
+       if(WITH_INPUT_IME)
+               add_definitions(-DWITH_INPUT_IME)
+               list(APPEND SRC
+                       intern/GHOST_ImeWin32.cpp
+                       intern/GHOST_ImeWin32.h
+               )
+       endif()
+       
        if(WITH_INPUT_NDOF)
                list(APPEND SRC
                        intern/GHOST_NDOFManagerWin32.cpp
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 702963c..56d30cb 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -909,7 +909,7 @@ extern float GHOST_GetNativePixelSize(GHOST_WindowHandle 
windowhandle);
  *     true:  Start a new composition
  *     false: Move the IME windows to the given position without finishing it.
  */
-extern void GHOST_EnableIME(GHOST_WindowHandle windowhandle,
+extern void GHOST_BeginIME(GHOST_WindowHandle windowhandle,
                             GHOST_TInt32 x,
                             GHOST_TInt32 y,
                             GHOST_TInt32 w,
@@ -920,7 +920,7 @@ extern void GHOST_EnableIME(GHOST_WindowHandle windowhandle,
  * events from being dispatched to the IME.
  * \param windowhandle The window handle of the caller
  */
-extern void GHOST_DisableIME(GHOST_WindowHandle windowhandle);
+extern void GHOST_EndIME(GHOST_WindowHandle windowhandle);
 
 #ifdef __cplusplus
 }
diff --git a/intern/ghost/intern/GHOST_C-api.cpp 
b/intern/ghost/intern/GHOST_C-api.cpp
index 19bde38..0158329 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -915,7 +915,9 @@ float GHOST_GetNativePixelSize(GHOST_WindowHandle 
windowhandle)
        return 1.0f;
 }
 
-void GHOST_EnableIME(GHOST_WindowHandle windowhandle,
+#ifdef WITH_INPUT_IME
+
+void GHOST_BeginIME(GHOST_WindowHandle windowhandle,
                      GHOST_TInt32 x,
                      GHOST_TInt32 y,
                      GHOST_TInt32 w,
@@ -926,8 +928,10 @@ void GHOST_EnableIME(GHOST_WindowHandle windowhandle,
        window->enableIME(x, y, w, h, complete);
 }
 
-void GHOST_DisableIME(GHOST_WindowHandle windowhandle)
+void GHOST_EndIME(GHOST_WindowHandle windowhandle)
 {
        GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
        window->disableIME();
 }
+
+#endif /* WITH_INPUT_IME */
diff --git a/intern/ghost/intern/GHOST_ImeWin32.cpp 
b/intern/ghost/intern/GHOST_ImeWin32.cpp
index f8945da..96dd36c 100644
--- a/intern/ghost/intern/GHOST_ImeWin32.cpp
+++ b/intern/ghost/intern/GHOST_ImeWin32.cpp
@@ -90,7 +90,10 @@ void GHOST_ImeWin32::CreateImeWindow(HWND window_handle)
                 system_caret_ = true;
             }
         }
-    }
+       }
+#ifdef WITH_INPUT_IME
+       printf("ime works\n");
+#endif
     /* Restore the positions of the IME windows. */
     UpdateImeWindow(window_handle);
 }
diff --git a/intern/ghost/GHOST_ImeWin32.h 
b/intern/ghost/intern/GHOST_ImeWin32.h
similarity index 100%
rename from intern/ghost/GHOST_ImeWin32.h
rename to intern/ghost/intern/GHOST_ImeWin32.h
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp 
b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 9fd2151..7359f87 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -787,12 +787,13 @@ GHOST_Event 
*GHOST_SystemWin32::processWindowEvent(GHOST_TEventType type, GHOST_
        return new GHOST_Event(system->getMilliSeconds(), type, window);
 }
 
-
+#ifdef WITH_INPUT_IME
 GHOST_Event *GHOST_SystemWin32::processImeEvent(GHOST_TEventType type, 
GHOST_IWindow *window, GHOST_TEventImeData *data)
 {
        GHOST_System *system = (GHOST_System *)getSystem();
        return new GHOST_EventIME(system->getMilliSeconds(), type, window, 
data);
 }
+#endif
 
 
 GHOST_TSuccess GHOST_SystemWin32::pushDragDropEvent(
@@ -918,7 +919,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT 
msg, WPARAM wParam,
                                case WM_INPUTLANGCHANGE:
                                {
                                        system->handleKeyboardChange();
+#ifdef WITH_INPUT_IME
                                        
window->getImeInput()->SetInputLanguage();
+#endif
                                        break;
                                }
                                
////////////////////////////////////////////////////////////////////////
@@ -956,6 +959,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT 
msg, WPARAM wParam,
                                        }
                                        break;
                                }
+#ifdef WITH_INPUT_IME
                                
////////////////////////////////////////////////////////////////////////
                                // IME events, processed, read more in 
GHOST_IME.h
                                
////////////////////////////////////////////////////////////////////////
@@ -995,6 +999,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT 
msg, WPARAM wParam,
                                        event = 
processImeEvent(GHOST_kEventImeCompositionEnd, window, 
&window->getImeInput()->eventImeData);
                                        break;
                                }
+#endif /* WITH_INPUT_IME */
                                
////////////////////////////////////////////////////////////////////////
                                // Keyboard events, ignored
                                
////////////////////////////////////////////////////////////////////////
diff --git a/intern/ghost/intern/GHOST_Window.h 
b/intern/ghost/intern/GHOST_Window.h
index 5dfe0b9..1a79285 100644
--- a/intern/ghost/intern/GHOST_Window.h
+++ b/intern/ghost/intern/GHOST_Window.h
@@ -295,6 +295,7 @@ public:
                return 1.0f;
        }
 
+#ifdef WITH_INPUT_IME
        virtual void enableIME(GHOST_TInt32 x,
                               GHOST_TInt32 y,
                               GHOST_TInt32 w,
@@ -308,6 +309,7 @@ public:
        {
                /* do nothing temporarily if not in windows */
        }
+#endif /* WITH_INPUT_IME */
 
 protected:
        /**
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp 
b/intern/ghost/intern/GHOST_WindowWin32.cpp
index ce9eb84..f8c49af 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -1051,6 +1051,7 @@ GHOST_TSuccess GHOST_WindowWin32::endProgressBar()
 }
 
 
+#ifdef WITH_INPUT_IME
 void GHOST_WindowWin32::enableIME(GHOST_TInt32 x, GHOST_TInt32 y, GHOST_TInt32 
w, GHOST_TInt32 h, int completed)
 {
        h = 20; /* text height */
@@ -1062,3 +1063,4 @@ void GHOST_WindowWin32::disableIME()
 {
        this->getImeInput()->DisableIME(this->getHWND());
 }
+#endif /* WITH_INPUT_IME */
diff --git a/intern/ghost/intern/GHOST_WindowWin32.h 
b/intern/ghost/intern/GHOST_WindowWin32.h
index 1cbb880..e05752b 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.h
+++ b/intern/ghost/intern/GHOST_WindowWin32.h
@@ -39,7 +39,9 @@
 
 #include "GHOST_Window.h"
 #include "GHOST_TaskbarWin32.h"
+#ifdef WITH_INPUT_IME
 #include "GHOST_ImeWin32.h"
+#endif
 
 #include <wintab.h>
 #define PACKETDATA  (PK_BUTTONS | PK_NORMAL_PRESSURE | PK_ORIENTATION | 
PK_CURSOR)
@@ -254,6 +256,7 @@ public:
        /** if the window currently resizing */
        bool m_inLiveResize;
 
+#ifdef WITH_INPUT_IME
        GHOST_ImeWin32 *getImeInput() {return &m_imeImput;}
 
        virtual void enableIME(GHOST_TInt32 x,
@@ -263,6 +266,7 @@ public:
                               int completed);
 
        virtual void disableIME();
+#endif /* WITH_INPUT_IME */
 
 private:
 
@@ -351,8 +355,10 @@ private:
        /** Hwnd to parent window */
        GHOST_TEmbedderWindowID m_parentWindowHwnd;
 
+#ifdef WITH_INPUT_IME
        /** Handle input method editors event */
        GHOST_ImeWin32 m_imeImput;
+#endif
 };
 
 #endif // __GHOST_WINDOWWIN32_H__
diff --git a/source/blender/windowmanager/intern/wm_window.c 
b/source/blender/windowmanager/intern/wm_window.c
index 6b923df..8a72e39 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1527,10 +1527,10 @@ bool WM_window_is_fullscreen(wmWindow *win)
 
 void wm_window_IME_enable(wmWindow *win, int x, int y, int w, int h, bool 
complete)
 {
-       GHOST_EnableIME(win->ghostwin, x, win->sizey - y, w, h, complete);
+       GHOST_BeginIME(win->ghostwin, x, win->sizey - y, w, h, complete);
 }
 
 void wm_window_IME_disable(wmWindow *win)
 {
-       GHOST_DisableIME(win->ghostwin);
+       GHOST_EndIME(win->ghostwin);
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to