[Bf-blender-cvs] [27a72d8] input_method_editor_partial_support: IME: New Branch For Text Button Support Only

Severin noreply at git.blender.org
Thu Dec 4 22:08:08 CET 2014


Commit: 27a72d822b4b784d99a9b624aa4674caf73547a6
Author: Severin
Date:   Thu Dec 4 22:01:07 2014 +0100
Branches: input_method_editor_partial_support
https://developer.blender.org/rB27a72d822b4b784d99a9b624aa4674caf73547a6

IME: New Branch For Text Button Support Only

This sets up the branch for IME support limited to text buttons only. Text
Editor, Info Editor and Console support has been removed in this commit,
as decision was made to only merge IME for text buttons in 2.73 (the rest
can follow up later).

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

M	source/blender/editors/screen/CMakeLists.txt
M	source/blender/editors/screen/screen_edit.c
M	source/blender/editors/space_console/CMakeLists.txt
M	source/blender/editors/space_console/console_draw.c
M	source/blender/editors/space_console/console_intern.h
M	source/blender/editors/space_console/console_ops.c
M	source/blender/editors/space_console/space_console.c
M	source/blender/editors/space_info/CMakeLists.txt
M	source/blender/editors/space_info/info_draw.c
M	source/blender/editors/space_info/info_intern.h
M	source/blender/editors/space_info/info_report.c
M	source/blender/editors/space_info/space_info.c
M	source/blender/editors/space_info/textview.c
M	source/blender/editors/space_info/textview.h
M	source/blender/editors/space_text/CMakeLists.txt
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_intern.h
M	source/blender/editors/space_text/text_ops.c

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

diff --git a/source/blender/editors/screen/CMakeLists.txt b/source/blender/editors/screen/CMakeLists.txt
index cce4f17..413d40b 100644
--- a/source/blender/editors/screen/CMakeLists.txt
+++ b/source/blender/editors/screen/CMakeLists.txt
@@ -52,12 +52,6 @@ if(WITH_INTERNATIONAL)
 	add_definitions(-DWITH_INTERNATIONAL)
 endif()
 
-if(WIN32)
-	if(WITH_INPUT_IME)
-		add_definitions(-DWITH_INPUT_IME)
-	endif()
-endif()
-
 add_definitions(${GL_DEFINITIONS})
 
 blender_add_lib(bf_editor_screen "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index d1af93b..c179cfc 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -54,7 +54,6 @@
 
 #include "WM_api.h"
 #include "WM_types.h"
-#include "wm_window.h"
 
 #include "ED_object.h"
 #include "ED_screen.h"
@@ -1435,11 +1434,6 @@ void ED_screen_set_subwinactive(bContext *C, wmEvent *event)
 		else {
 			/* notifier invokes freeing the buttons... causing a bit too much redraws */
 			if (oldswin != scr->subwinactive) {
-#ifdef WITH_INPUT_IME
-				/* when cursor leaves a region, disable IME */
-				wm_window_IME_end(win);
-#endif
-
 				region_cursor_set(win, scr->subwinactive, true);
 
 				/* this used to be a notifier, but needs to be done immediate
diff --git a/source/blender/editors/space_console/CMakeLists.txt b/source/blender/editors/space_console/CMakeLists.txt
index 1353d94..ecfb1f0 100644
--- a/source/blender/editors/space_console/CMakeLists.txt
+++ b/source/blender/editors/space_console/CMakeLists.txt
@@ -47,12 +47,6 @@ if(WITH_PYTHON)
 	add_definitions(-DWITH_PYTHON)
 endif()
 
-if(WIN32)
-	if(WITH_INPUT_IME)
-		add_definitions(-DWITH_INPUT_IME)
-	endif()
-endif()
-
 add_definitions(${GL_DEFINITIONS})
 
 blender_add_lib(bf_editor_space_console "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index 5340b70..d206ce4 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -47,7 +47,6 @@
 
 #include "console_intern.h"
 
-#include "WM_types.h"
 
 #include "../space_info/textview.h"
 
@@ -162,7 +161,7 @@ static void console_cursor_wrap_offset(const char *str, int width, int *row, int
 	return;
 }
 
-static int console_textview_line_color(struct TextViewContext *tvc, wmImeData *ime_data, unsigned char fg[3], unsigned char UNUSED(bg[3]))
+static int console_textview_line_color(struct TextViewContext *tvc, unsigned char fg[3], unsigned char UNUSED(bg[3]))
 {
 	ConsoleLine *cl_iter = (ConsoleLine *)tvc->iter;
 
@@ -177,28 +176,9 @@ static int console_textview_line_color(struct TextViewContext *tvc, wmImeData *i
 
 		console_cursor_wrap_offset(sc->prompt, tvc->console_width, &offl, &offc, NULL);
 		console_cursor_wrap_offset(cl->line, tvc->console_width, &offl, &offc, cl->line + cl->cursor);
-
 		pen[0] = tvc->cwidth * offc;
 		pen[1] = -2 - tvc->lheight * offl;
 
-#ifdef WITH_INPUT_IME
-		/* consider the effect of composition string */
-		if (ime_data && ime_data->composite_len) {
-			char *end = NULL;
-			if (ime_data->cursor_position != -1)
-				end = ime_data->composite + ime_data->cursor_position;
-
-			console_cursor_wrap_offset(ime_data->composite, tvc->console_width, &offl, &offc, end);
-
-			/* cursor inside the composition string */
-			pen[0] = tvc->cwidth * offc;
-			pen[1] = -2 - tvc->lheight * offl;
-
-			if (end != NULL)
-				console_cursor_wrap_offset(end, tvc->console_width, &offl, &offc, NULL);
-		}
-#endif /* WITH_INPUT_IME */
-
 		console_cursor_wrap_offset(cl->line + cl->cursor, tvc->console_width, &offl, &offc, NULL);
 		pen[1] += tvc->lheight * offl;
 
@@ -210,16 +190,7 @@ static int console_textview_line_color(struct TextViewContext *tvc, wmImeData *i
 		        (xy[1] + pen[1]),
 		        (xy[0] + pen[0]) + 1,
 		        (xy[1] + pen[1] + tvc->lheight)
-				);
-
-#ifdef WITH_INPUT_IME
-		/* cursor following */
-		if (ime_data && ime_data->composite_len) {
-			ime_data->cursor_xy[0] = (xy[0] + pen[0]) + 1;
-			ime_data->cursor_xy[1] = (xy[1] + pen[1]) - 1;
-		}
-#endif
-
+		        );
 	}
 
 	console_line_color(fg, cl_iter->type);
@@ -232,8 +203,8 @@ static void console_textview_const_colors(TextViewContext *UNUSED(tvc), unsigned
 	UI_GetThemeColor4ubv(TH_CONSOLE_SELECT, bg_sel);
 }
 
-static int console_textview_main__internal(struct SpaceConsole *sc, ARegion *ar, wmImeData *ime_data,
-                                           int draw, int mval[2], void **mouse_pick, int *pos_pick)
+static int console_textview_main__internal(struct SpaceConsole *sc, ARegion *ar, int draw,
+                                           int mval[2], void **mouse_pick, int *pos_pick)
 {
 	ConsoleLine cl_dummy = {NULL};
 	int ret = 0;
@@ -261,33 +232,27 @@ static int console_textview_main__internal(struct SpaceConsole *sc, ARegion *ar,
 	tvc.ymax = v2d->cur.ymax;
 	tvc.winx = ar->winx - V2D_SCROLL_WIDTH;
 
-#ifdef WITH_INPUT_IME
-	if (!draw) {
-		ime_data = NULL;
-	}
-#endif
-
 	console_scrollback_prompt_begin(sc, &cl_dummy);
-	ret = textview_draw(&tvc, ime_data, draw, mval, mouse_pick, pos_pick);
+	ret = textview_draw(&tvc, draw, mval, mouse_pick, pos_pick);
 	console_scrollback_prompt_end(sc, &cl_dummy);
 
 	return ret;
 }
 
 
-void console_textview_main(struct SpaceConsole *sc, ARegion *ar, wmImeData *ime_data)
+void console_textview_main(struct SpaceConsole *sc, ARegion *ar)
 {
 	int mval[2] = {INT_MAX, INT_MAX};
-	console_textview_main__internal(sc, ar, ime_data, 1, mval, NULL, NULL);
+	console_textview_main__internal(sc, ar, 1,  mval, NULL, NULL);
 }
 
 int console_textview_height(struct SpaceConsole *sc, ARegion *ar)
 {
 	int mval[2] = {INT_MAX, INT_MAX};
-	return console_textview_main__internal(sc, ar, NULL, 0,  mval, NULL, NULL);
+	return console_textview_main__internal(sc, ar, 0,  mval, NULL, NULL);
 }
 
-int console_char_pick(struct SpaceConsole *sc, ARegion *ar, wmImeData *ime_data, const int mval[2])
+int console_char_pick(struct SpaceConsole *sc, ARegion *ar, const int mval[2])
 {
 	int pos_pick = 0;
 	void *mouse_pick = NULL;
@@ -296,6 +261,6 @@ int console_char_pick(struct SpaceConsole *sc, ARegion *ar, wmImeData *ime_data,
 	mval_clamp[0] = CLAMPIS(mval[0], CONSOLE_DRAW_MARGIN, ar->winx - CONSOLE_DRAW_MARGIN);
 	mval_clamp[1] = CLAMPIS(mval[1], CONSOLE_DRAW_MARGIN, ar->winy - CONSOLE_DRAW_MARGIN);
 
-	console_textview_main__internal(sc, ar, ime_data, 0, mval_clamp, &mouse_pick, &pos_pick);
+	console_textview_main__internal(sc, ar, 0, mval_clamp, &mouse_pick, &pos_pick);
 	return pos_pick;
 }
diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h
index dde6c58..00f1f8c2 100644
--- a/source/blender/editors/space_console/console_intern.h
+++ b/source/blender/editors/space_console/console_intern.h
@@ -35,9 +35,9 @@ struct ReportList;
 struct bContext;
 
 /* console_draw.c */
-void console_textview_main(struct SpaceConsole *sc, struct ARegion *ar, struct wmImeData *ime_data);
+void console_textview_main(struct SpaceConsole *sc, struct ARegion *ar);
 int console_textview_height(struct SpaceConsole *sc, struct ARegion *ar); /* needed to calculate the scrollbar */
-int console_char_pick(struct SpaceConsole *sc, struct ARegion *ar, struct wmImeData *ime_data, const int mval[2]);
+int console_char_pick(struct SpaceConsole *sc, struct ARegion *ar, const int mval[2]);
 
 void console_scrollback_prompt_begin(struct SpaceConsole *sc, ConsoleLine *cl_dummy);
 void console_scrollback_prompt_end(struct SpaceConsole *sc, ConsoleLine *cl_dummy);
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index b2e5b4d..2d5e5c6 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -394,37 +394,6 @@ static int console_insert_exec(bContext *C, wmOperator *op)
 	return OPERATOR_FINISHED;
 }
 
-static int console_insert_modal(bContext *C, wmOperator *op, const wmEvent *event)
-{
-#ifdef WITH_INPUT_IME
-	wmWindow *win = CTX_wm_window(C);
-	wmImeData *ime = win->ime_data;
-	ARegion *ar = CTX_wm_region(C);
-
-	if (event->type == WM_IME_COMPOSITE_EVENT) {
-		ED_area_tag_redraw(CTX_wm_area(C));
-		console_scroll_bottom(ar);
-	}
-
-	/* composition complete 
-	 * some Japanese IMEs return result without WM_IME_COMPOSITE_END event
-	 */
-	if (event->type == WM_IME_COMPOSITE_EVENT && ime->result_len) {
-		char *str = "";
-		if (ime->result) str = ime->result;
-		RNA_string_set(op->ptr, "text", str);
-		console_insert_exec(C, op);
-	}
-
-	if (event->type == WM_IME_COMPOSITE_END)
-		return OPERATOR_FINISHED;
-#else
-	(void)C; (void)op; (void)event;
-#endif /* WITH_INPUT_IME */
-
-	return OPERATOR_RUNNING_MODAL;
-}
-
 static int console_insert_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 {
 	// if (!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */
@@ -436,19 +405,6 @@ static int console_insert_invoke(bContext *C, wmOperator *op, const wmEvent *eve
 		if ((event->ctrl || event->oskey) && !event->utf8_buf[0]) {
 			return OPERATOR_PASS_THROUGH;
 		}
-		/* most IME shortcut for switch IME, fullwidth/halfwidth and so on */
-		if (WM_event_is_ime_switch(event))
-		{
-			return OPERATOR_PASS_THROUGH;
-		}
-		/* composition begin and enter modal */
-		else if (event->type == WM_IME_COMPOSITE_START) {
-			SpaceConsole *sc = CTX_wm_space_console(C);
-			WM_event_add_modal_handler(C, op);
-			/* clear seletion */
-			sc->sel_end = sc->sel_start;
-			return console_insert_modal(C, op, event);
-		} 
 		else {
 			char str[BLI_UTF8_MAX + 1];
 			size_t len;
@@ -480,7 +436,6 @@ void CONSOLE_OT_insert(wmOperatorType *ot)
 	/* api callbacks */
 	ot->exec = console_insert_exec;
 	ot->invoke = console_insert_invoke;
-	ot->modal = console_insert_modal;
 	ot->poll = ED_operator_console_active;
 
 	/* properties */
@@ -1062,10 +1017,10 @@ typedef struct SetConsoleCursor {
 } SetConsoleCursor;
 
 // TODO, cursor placement without selection
-static void console_cursor_set_to_pos(SpaceConsole *sc, ARegion

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list