[Bf-blender-cvs] [2545e17] input_method_editor_partial_support: Cleanup: IME patch
Campbell Barton
noreply at git.blender.org
Sat Dec 6 12:46:11 CET 2014
Commit: 2545e1754b807b33e09c43f7abff943ec03c8174
Author: Campbell Barton
Date: Sat Dec 6 12:44:42 2014 +0100
Branches: input_method_editor_partial_support
https://developer.blender.org/rB2545e1754b807b33e09c43f7abff943ec03c8174
Cleanup: IME patch
- only link to IME when enabled.
- ifdef IME includes.
- minor changes to draw code.
===================================================================
M CMakeLists.txt
M intern/ghost/CMakeLists.txt
M intern/ghost/GHOST_C-api.h
M intern/ghost/GHOST_IWindow.h
M intern/ghost/intern/GHOST_C-api.cpp
M intern/ghost/intern/GHOST_WindowWin32.h
M source/blender/editors/include/UI_interface.h
M source/blender/editors/interface/interface_draw.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/makesdna/DNA_windowmanager_types.h
M source/blender/windowmanager/WM_api.h
M source/blender/windowmanager/intern/wm_window.c
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 93abf2b..45f2aaa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1152,7 +1152,11 @@ 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 imm32)
+ list(APPEND PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid psapi)
+
+ if(WITH_INPUT_IME)
+ list(APPEND PLATFORM_LINKLIBS imm32)
+ endif()
add_definitions(
-D_CRT_NONSTDC_NO_DEPRECATE
@@ -1508,7 +1512,12 @@ elseif(WIN32)
endif()
endif()
- list(APPEND PLATFORM_LINKLIBS -lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi -limm32)
+ list(APPEND PLATFORM_LINKLIBS -lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi)
+
+ if(WITH_INPUT_IME)
+ list(APPEND PLATFORM_LINKLIBS -limm32)
+ endif()
+
set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
if(WITH_MINGW64)
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index 8f30564..dc55a81 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -285,11 +285,11 @@ elseif(WIN32)
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 56d30cb..c0f2651 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -906,8 +906,8 @@ extern float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle);
* \param w Requested width of the rectangle
* \param h Requested height of the rectangle
* \param complete Whether or not to complete the ongoing composition
- * true: Start a new composition
- * false: Move the IME windows to the given position without finishing it.
+ * true: Start a new composition
+ * false: Move the IME windows to the given position without finishing it.
*/
extern void GHOST_BeginIME(GHOST_WindowHandle windowhandle,
GHOST_TInt32 x,
diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h
index 58d8172..3f8215d 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -340,14 +340,13 @@ public:
* \param w Requested width of the rectangle
* \param h Requested height of the rectangle
* \param complete Whether or not to complete the ongoing composition
- * true: Start a new composition
- * false: Move the IME windows to the given position without finishing it.
- */
- virtual void beginIME(GHOST_TInt32 x,
- GHOST_TInt32 y,
- GHOST_TInt32 w,
- GHOST_TInt32 h,
- int completed) = 0;
+ * true: Start a new composition
+ * false: Move the IME windows to the given position without finishing it.
+ */
+ virtual void beginIME(
+ 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
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index 71725c1..0da77ac 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -918,11 +918,9 @@ float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle)
#ifdef WITH_INPUT_IME
void GHOST_BeginIME(GHOST_WindowHandle windowhandle,
- GHOST_TInt32 x,
- GHOST_TInt32 y,
- GHOST_TInt32 w,
- GHOST_TInt32 h,
- int complete)
+ GHOST_TInt32 x, GHOST_TInt32 y,
+ GHOST_TInt32 w, GHOST_TInt32 h,
+ int complete)
{
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
window->beginIME(x, y, w, h, complete);
@@ -934,4 +932,4 @@ void GHOST_EndIME(GHOST_WindowHandle windowhandle)
window->endIME();
}
-#endif /* WITH_INPUT_IME */
+#endif /* WITH_INPUT_IME */
diff --git a/intern/ghost/intern/GHOST_WindowWin32.h b/intern/ghost/intern/GHOST_WindowWin32.h
index 91f18ad..c4575d0 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.h
+++ b/intern/ghost/intern/GHOST_WindowWin32.h
@@ -40,7 +40,7 @@
#include "GHOST_Window.h"
#include "GHOST_TaskbarWin32.h"
#ifdef WITH_INPUT_IME
-#include "GHOST_ImeWin32.h"
+# include "GHOST_ImeWin32.h"
#endif
#include <wintab.h>
@@ -259,11 +259,10 @@ public:
#ifdef WITH_INPUT_IME
GHOST_ImeWin32 *getImeInput() {return &m_imeImput;}
- virtual void beginIME(GHOST_TInt32 x,
- GHOST_TInt32 y,
- GHOST_TInt32 w,
- GHOST_TInt32 h,
- int completed);
+ virtual void beginIME(
+ GHOST_TInt32 x, GHOST_TInt32 y,
+ GHOST_TInt32 w, GHOST_TInt32 h,
+ int completed);
virtual void endIME();
#endif /* WITH_INPUT_IME */
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 2823ada..a7bb570 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -1010,6 +1010,4 @@ void UI_butstore_unregister(uiButStore *bs_handle, uiBut **but_p);
int UI_calc_float_precision(int prec, double value);
-/* Utility */
-void ui_region_to_window(const struct ARegion *ar, int *x, int *y);
#endif /* __UI_INTERFACE_H__ */
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index c145092..3f134ce 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -396,7 +396,7 @@ void UI_draw_roundbox(float minx, float miny, float maxx, float maxy, float rad)
}
void UI_text_draw_underline(int pos_x, int pos_y, int len, int height) {
- short ofs_y = 4 * U.pixelsize;
+ int ofs_y = 4 * U.pixelsize;
glRecti(pos_x, pos_y - ofs_y, pos_x + len, pos_y - ofs_y + (height * U.pixelsize));
}
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index fd5cc65..39f8ea1 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -86,7 +86,10 @@
#include "WM_api.h"
#include "WM_types.h"
-#include "wm_window.h"
+
+#ifdef WITH_INPUT_IME
+# include "wm_window.h"
+#endif
/* place the mouse at the scaled down location when un-grabbing */
#define USE_CONT_MOUSE_CORRECT
@@ -2634,9 +2637,13 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
int retval = WM_UI_HANDLER_CONTINUE;
bool changed = false, inbox = false, update = false;
+#ifdef WITH_INPUT_IME
wmWindow *win = CTX_wm_window(C);
wmIMEData *ime_data = win->ime_data;
bool is_ime_composing = ime_data && ime_data->is_ime_composing;
+#else
+ bool is_ime_composing = false;
+#endif
switch (event->type) {
case MOUSEMOVE:
@@ -2838,12 +2845,13 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
}
if ((event->ascii || event->utf8_buf[0]) &&
- (retval == WM_UI_HANDLER_CONTINUE)
+ (retval == WM_UI_HANDLER_CONTINUE)
#ifdef WITH_INPUT_IME
- && !is_ime_composing &&
- !WM_event_is_ime_switch(event)
+ &&
+ !is_ime_composing &&
+ !WM_event_is_ime_switch(event)
#endif
- )
+ )
{
char ascii = event->ascii;
const char *utf8_buf = event->utf8_buf;
@@ -2882,13 +2890,16 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
#ifdef WITH_INPUT_IME
if (event->type == WM_IME_COMPOSITE_START || event->type == WM_IME_COMPOSITE_EVENT) {
changed = true;
-
- if (event->type == WM_IME_COMPOSITE_START && but->selend > but->selsta)
+
+ if (event->type == WM_IME_COMPOSITE_START && but->selend > but->selsta) {
ui_textedit_delete_selection(but, data);
- if (event->type == WM_IME_COMPOSITE_EVENT && ime_data->result_len)
- ui_textedit_type_buf(but, data,
- ime_data->str_result,
- ime_data->result_len);
+ }
+ if (event->type == WM_IME_COMPOSITE_EVENT && ime_data->result_len) {
+ ui_textedit_type_buf(
+ but, data,
+ ime_data->str_result,
+ ime_data->result_len);
+ }
}
else if (event->type == WM_IME_COMPOSITE_END) {
changed = true;
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index e0f538b..fe8adba 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -433,6 +433,7 @@ extern void ui_block_to_window_rctf(const struct ARegion *ar, uiBlock *block, rc
extern void ui_window_to_block_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y);
extern void ui_window_to_block(const struct ARegion *ar, uiBlock *block, int *x, int *y);
extern void ui_window_to_region(const ARegion *ar, int *x, int *y);
+extern void ui_region_to_window(const struct ARegion *ar, int *x, int *y);
extern double ui_but_value_get(uiBut *but);
extern void ui_but_value_set(uiBut *but, double value);
@@ -627,8 +628,10 @@ void ui_panel_menu(struct bContext *C, ARegion *ar, Panel *pa);
uiBut *ui_but_find_old(uiBlock *block_old, const uiBut *but_new);
uiBut *ui_but_find_new(uiBlock *block_old, const uiBut *but_new);
+#ifdef WITH_INPUT_IME
void ui_but_ime_reposition(uiBut *but, int x, int y, int complete);
struct wmIMEData *ui_but_get_ime_data(uiBut *but);
+#endif
/* interface_widgets.c */
void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3);
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 84
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list