[Bf-blender-cvs] [80496ab] input_method_editor: Minor cleanup
Severin
noreply at git.blender.org
Sun Nov 30 20:08:40 CET 2014
Commit: 80496abbf49a46f1e178ccb24d23403f94bea37b
Author: Severin
Date: Sun Nov 30 20:06:29 2014 +0100
Branches: input_method_editor
https://developer.blender.org/rB80496abbf49a46f1e178ccb24d23403f94bea37b
Minor cleanup
Adressing some of the inline comments from @sergey and @campbellbarton
===================================================================
M intern/ghost/intern/GHOST_ImeWin32.cpp
M source/blender/editors/interface/interface_handlers.c
M source/blender/editors/space_console/console_ops.c
M source/blender/editors/space_text/text_ops.c
M source/blender/windowmanager/WM_api.h
M source/blender/windowmanager/intern/wm_event_system.c
M source/blender/windowmanager/wm_event_types.h
===================================================================
diff --git a/intern/ghost/intern/GHOST_ImeWin32.cpp b/intern/ghost/intern/GHOST_ImeWin32.cpp
index 21e842a..ef8eb98 100644
--- a/intern/ghost/intern/GHOST_ImeWin32.cpp
+++ b/intern/ghost/intern/GHOST_ImeWin32.cpp
@@ -270,7 +270,7 @@ void GHOST_ImeWin32::GetCaret(HIMC imm_context, LPARAM lparam, ImeComposition *c
target_start = clauses[clause_size - 2];
target_end = clauses[clause_size - 1];
}
- else
+ else {
for (int i = 0; i < clause_size - 1; i++) {
if (clauses[i] == composition->cursor_position) {
target_start = clauses[i];
@@ -278,6 +278,7 @@ void GHOST_ImeWin32::GetCaret(HIMC imm_context, LPARAM lparam, ImeComposition *c
break;
}
}
+ }
}
else {
if (composition->cursor_position != -1) {
@@ -346,8 +347,6 @@ bool GHOST_ImeWin32::GetString(HIMC imm_context, WPARAM lparam, int type, ImeCom
int string_size = ::ImmGetCompositionStringW(imm_context, type, NULL, 0);
if (string_size > 0) {
int string_length = string_size / sizeof(wchar_t);
- /* wchar_t *string_data = WriteInto(&composition->ime_string, */
- /* string_length + 1); */
wchar_t *string_data = new wchar_t[string_length + 1];
string_data[string_length] = '\0';
if (string_data) {
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index e83dd02..0161211 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2634,10 +2634,10 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
bool changed = false, inbox = false, update = false;
wmWindow *win = CTX_wm_window(C);
- int is_composing = win->is_ime_composite;
wmImeData *ime_data = win->ime_data;
+ bool is_ime_composing = win->is_ime_composite;
/* most os using ctrl/oskey + space to switch ime, avoid added space */
- int is_switch_ime = WM_event_is_switch_ime(event);
+ bool is_ime_switch = WM_event_is_ime_switch(event);
switch (event->type) {
case MOUSEMOVE:
@@ -2716,7 +2716,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
}
}
- if (event->val == KM_PRESS && !is_composing) {
+ if (event->val == KM_PRESS && !is_ime_composing) {
switch (event->type) {
case VKEY:
case XKEY:
@@ -2834,7 +2834,7 @@ 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) &&
- !is_composing && !is_switch_ime)
+ !is_ime_composing && !is_ime_switch)
{
char ascii = event->ascii;
const char *utf8_buf = event->utf8_buf;
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index a322ffe..c0901d9 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -433,7 +433,7 @@ static int console_insert_invoke(bContext *C, wmOperator *op, const wmEvent *eve
return OPERATOR_PASS_THROUGH;
}
/* most IME shortcut for switch IME, fullwidth/halfwidth and so on */
- if (WM_event_is_switch_ime(event))
+ if (WM_event_is_ime_switch(event))
{
return OPERATOR_PASS_THROUGH;
}
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 5b5c55b..61eb8f6 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -2959,7 +2959,7 @@ static int text_insert_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_PASS_THROUGH;
}
/* most IME shortcut for switch IME, fullwidth/halfwidth and so on */
- if (WM_event_is_switch_ime(event))
+ if (WM_event_is_ime_switch(event))
{
return OPERATOR_PASS_THROUGH;
}
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 0038d8d..6f20b62 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -462,7 +462,7 @@ void WM_event_ndof_to_quat(const struct wmNDOFMotionData *ndof, float q[4
float WM_event_tablet_data(const struct wmEvent *event, int *pen_flip, float tilt[2]);
bool WM_event_is_tablet(const struct wmEvent *event);
-bool WM_event_is_switch_ime(const struct wmEvent *event);
+bool WM_event_is_ime_switch(const struct wmEvent *event);
#ifdef __cplusplus
}
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 1e1d05f..f9f1cdc 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -3504,9 +3504,11 @@ bool WM_event_is_tablet(const struct wmEvent *event)
return (event->tablet_data) ? true : false;
}
-bool WM_event_is_switch_ime(const struct wmEvent *event) {
+#ifdef WITH_INPUT_IME
+bool WM_event_is_ime_switch(const struct wmEvent *event) {
return event->val == KM_PRESS && event->type == SPACEKEY &&
(event->ctrl || event->oskey || event->shift || event->alt);
}
+#endif
/** \} */
diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
index 5b1abed..2301405 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -87,13 +87,10 @@ enum {
INBETWEEN_MOUSEMOVE = 0x0011,
/* IME event, GHOST_kEventImeCompositionStart in ghost */
-/* #define WM_IME_COMPOSITE_START 20 */
WM_IME_COMPOSITE_START = 0x0014,
/* IME event, GHOST_kEventImeComposition in ghost */
-/* #define WM_IME_COMPOSITE_EVENT 21 */
WM_IME_COMPOSITE_EVENT = 0x0015,
/* IME event, GHOST_kEventImeCompositionEnd in ghost */
-/* #define WM_IME_COMPOSITE_END 22 */
WM_IME_COMPOSITE_END = 0x0016,
/* *** Start of keyboard codes. *** */
More information about the Bf-blender-cvs
mailing list