[Bf-blender-cvs] [7907014] input_method_editor: set up ime branch

Severin noreply at git.blender.org
Mon Nov 17 18:19:06 CET 2014


Commit: 7907014ed7da132fc88ec1b9dcb8b573ec9dd22a
Author: Severin
Date:   Mon Nov 17 18:18:11 2014 +0100
Branches: input_method_editor
https://developer.blender.org/rB7907014ed7da132fc88ec1b9dcb8b573ec9dd22a

set up ime branch

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

M	CMakeLists.txt
M	build_files/scons/config/win32-mingw-config.py
M	build_files/scons/config/win32-vc-config.py
M	build_files/scons/config/win64-mingw-config.py
M	build_files/scons/config/win64-vc-config.py
M	intern/ghost/CMakeLists.txt
M	intern/ghost/GHOST_C-api.h
M	intern/ghost/GHOST_IWindow.h
M	intern/ghost/GHOST_Types.h
M	intern/ghost/intern/GHOST_C-api.cpp
M	intern/ghost/intern/GHOST_SystemWin32.cpp
M	intern/ghost/intern/GHOST_SystemWin32.h
M	intern/ghost/intern/GHOST_Window.h
M	intern/ghost/intern/GHOST_WindowWin32.cpp
M	intern/ghost/intern/GHOST_WindowWin32.h
M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface.c
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_intern.h
M	source/blender/editors/interface/interface_widgets.c
M	source/blender/editors/screen/screen_edit.c
M	source/blender/editors/space_console/console_draw.c
M	source/blender/editors/space_console/console_ops.c
M	source/blender/editors/space_console/space_console.c
M	source/blender/editors/space_info/textview.c
M	source/blender/editors/space_info/textview.h
M	source/blender/editors/space_text/space_text.c
M	source/blender/editors/space_text/text_draw.c
M	source/blender/editors/space_text/text_format.h
M	source/blender/editors/space_text/text_ops.c
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesdna/DNA_windowmanager_types.h
M	source/blender/windowmanager/WM_api.h
M	source/blender/windowmanager/WM_types.h
M	source/blender/windowmanager/intern/wm_event_system.c
M	source/blender/windowmanager/intern/wm_window.c
M	source/blender/windowmanager/wm_event_types.h
M	source/blender/windowmanager/wm_window.h

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 924684c..37dadbe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1146,7 +1146,7 @@ elseif(WIN32)
 		set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
 		set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO")
 
-		list(APPEND PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid psapi)
+		list(APPEND PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid psapi imm32)
 
 		add_definitions(
 			-D_CRT_NONSTDC_NO_DEPRECATE
@@ -1502,7 +1502,7 @@ elseif(WIN32)
 			endif()
 		endif()
 		
-		list(APPEND PLATFORM_LINKLIBS -lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi)
+		list(APPEND PLATFORM_LINKLIBS -lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi -limm32)
 		set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
 
 		if(WITH_MINGW64)
diff --git a/build_files/scons/config/win32-mingw-config.py b/build_files/scons/config/win32-mingw-config.py
index 85aa72a..d67ee2f 100644
--- a/build_files/scons/config/win32-mingw-config.py
+++ b/build_files/scons/config/win32-mingw-config.py
@@ -196,7 +196,7 @@ C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wstrict-pro
 
 CC_WARN = [ '-Wall' ]
 
-LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi']
+LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi', '-limm32']
 
 PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152']
 
diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py
index 48a40cf..d903ded 100644
--- a/build_files/scons/config/win32-vc-config.py
+++ b/build_files/scons/config/win32-vc-config.py
@@ -235,7 +235,7 @@ C_WARN = []
 CC_WARN = []
 CXX_WARN = []
 
-LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi']
+LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi', 'imm32']
 
 PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/STACK:2097152','/INCREMENTAL:NO', '/LARGEADDRESSAWARE', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']
 
diff --git a/build_files/scons/config/win64-mingw-config.py b/build_files/scons/config/win64-mingw-config.py
index 92dcd6d..845dfb9 100644
--- a/build_files/scons/config/win64-mingw-config.py
+++ b/build_files/scons/config/win64-mingw-config.py
@@ -190,7 +190,7 @@ C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wstrict-pro
 
 CC_WARN = [ '-Wall' ]
 
-LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi', '-lpthread']
+LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi', '-lpthread', '-limm32']
 
 PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152']
 
diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py
index 285e9ac..b34b2b8 100644
--- a/build_files/scons/config/win64-vc-config.py
+++ b/build_files/scons/config/win64-vc-config.py
@@ -242,7 +242,7 @@ C_WARN = []
 CC_WARN = []
 CXX_WARN = []
 
-LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi']
+LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi', 'imm32']
 
 PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/STACK:2097152','/OPT:NOREF','/INCREMENTAL:NO', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']
 
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index 3ce269c..9d0b70f 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -264,12 +264,14 @@ 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)
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 7b47f05..b5d39ac 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -897,6 +897,38 @@ extern int GHOST_UseNativePixels(void);
  */
 extern float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle);
 
+/**
+ * Enable the IME attached to the given window, i.e. allows user-input
+ * events to be dispatched to the IME.
+ * \param window_handle
+ *     Represents the window handle of the caller.
+ * \param x requested x-coordinate of the rectangle
+ * \param y requested y-coordinate of the rectangle
+ * \param w requested width of the rectangle
+ * \param h requested height of the rectangle
+ * \param complete
+ *     Represents whether or not to complete the ongoing composition.
+ *     + true
+ *       After finishing the ongoing composition and close its IME windows,
+ *       start another composition and display its IME windows to the given
+ *       position.
+ *     + false
+ *       Just move the IME windows of the ongoing composition to the given
+ *       position without finishing it.
+ */
+extern void GHOST_EnableIME(GHOST_WindowHandle windowhandle,
+							GHOST_TInt32 x,
+							GHOST_TInt32 y,
+							GHOST_TInt32 w,
+							GHOST_TInt32 h,
+							int complete);
+/**
+ * Disable the IME attached to the given window, i.e. prohibits any user-input
+ * events from being dispatched to the IME.
+ * \param window_handle
+ *     Represents the window handle of the caller.
+ */
+extern void GHOST_DisableIME(GHOST_WindowHandle windowhandle);
 
 #ifdef __cplusplus
 }
diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h
index 71dc193..376fee7 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -331,6 +331,34 @@ public:
 
 	virtual float getNativePixelSize(void) = 0;
 
+	/**
+	* Enable the IME attached to the given window, i.e. allows user-input
+	* events to be dispatched to the IME.
+	* \param x requested x-coordinate of the rectangle
+	* \param y requested y-coordinate of the rectangle
+	* \param w requested width of the rectangle
+	* \param h requested height of the rectangle
+	* \param complete
+	*     Represents whether or not to complete the ongoing composition.
+	*     + true
+	*       After finishing the ongoing composition and close its IME windows,
+	*       start another composition and display its IME windows to the given
+	*       position.
+	*     + false
+	*       Just move the IME windows of the ongoing composition to the given
+	*       position without finishing it.
+	*/
+	virtual void enableIME(GHOST_TInt32 x,
+						   GHOST_TInt32 y,
+						   GHOST_TInt32 w,
+						   GHOST_TInt32 h,
+						   int completed) = 0;
+
+	/**
+	* Disable the IME attached to the given window, i.e. prohibits any user-input
+	* events from being dispatched to the IME.
+	*/
+	virtual void disableIME() = 0;
 	
 #ifdef WITH_CXX_GUARDEDALLOC
 	MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_IWindow")
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index 7333ba0..d89379b 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -190,6 +190,10 @@ typedef enum {
 
 	GHOST_kEventTimer,
 
+	GHOST_kEventImeCompositionStart,
+	GHOST_kEventImeComposition,
+	GHOST_kEventImeCompositionEnd,
+
 	GHOST_kNumEventTypes
 } GHOST_TEventType;
 
@@ -436,6 +440,16 @@ typedef struct {
 	GHOST_TEventDataPtr data;
 } GHOST_TEventDragnDropData;
 
+/** same with wmImeData */
+typedef struct {
+	GHOST_TUserDataPtr result_len, composite_len; /** size_t */
+	GHOST_TUserDataPtr result, composite; /** char * utf8 encoding */
+	int cursor_position; /* Represents the cursor position in the IME composition. */
+	int target_start; /* Represents the position of the beginning of the selection */
+	int target_end; /* Represents the position of the end of the selection */
+	GHOST_TUserDataPtr tmp; /* custom temporal data */
+} GHOST_TEventImeData;
+
 typedef struct {
 	int count;
 	GHOST_TUns8 **strings;
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index 5a2e638..3592645 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -915,3 +915,19 @@ float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle)
 	return 1.0f;
 }
 
+void GHOST_EnableIME(GHOST_WindowHandle windowhandle,
+					 GHOST_TInt32 x,
+					 GHOST_TInt32 y,
+					 GHOST_TInt32 w,
+					 GHOST_TInt32 h,
+					 int complete)
+{
+	GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
+	window->enableIME(x, y, w, h, complete);
+}
+
+void GHOST_DisableIME(GHOST_WindowHandle windowhandle)
+{
+	GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
+	window->disableIME();
+}
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 0767ad5..6321fa8 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -787,6 +787,15 @@ GHOST_Event *GHOST_SystemWin32::processWindowEvent(GHOST_TEventType type, GHOST_
 	return new GHOST_Event(system->getMilliSeconds(), type, window);
 }
 
+GHOST_Event *GHOST_SystemWin32::processImeEvent(
+		GHOST_TEventType type, 
+		GHOST_IWindow *window, 
+		GHOST_TEventImeData *data)
+{
+	GHOST_System *system = (GHOST_System *)getSyste

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list