[Bf-blender-cvs] [37a12d7] input_method_editor_partial_support: IME: clear 'win->ime_data' on file load, assert this is set correclty
Campbell Barton
noreply at git.blender.org
Sat Dec 6 12:59:37 CET 2014
Commit: 37a12d76a1ad7f04a7eb15ee654166b77dd9c5ad
Author: Campbell Barton
Date: Sat Dec 6 12:58:17 2014 +0100
Branches: input_method_editor_partial_support
https://developer.blender.org/rB37a12d76a1ad7f04a7eb15ee654166b77dd9c5ad
IME: clear 'win->ime_data' on file load, assert this is set correclty
also...
- use 'const' args for widget code.
- rename UI_text_draw_underline -> UI_draw_text_underline.
===================================================================
M source/blender/blenloader/intern/readfile.c
M source/blender/editors/include/UI_interface.h
M source/blender/editors/interface/interface_draw.c
M source/blender/editors/interface/interface_widgets.c
M source/blender/makesdna/DNA_windowmanager_types.h
M source/blender/windowmanager/intern/wm_event_system.c
M source/blender/windowmanager/intern/wm_window.c
===================================================================
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index ac903c7..237321d 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5677,6 +5677,7 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm)
win->eventstate = NULL;
win->curswin = NULL;
win->tweak = NULL;
+ win->ime_data = NULL;
BLI_listbase_clear(&win->queue);
BLI_listbase_clear(&win->handlers);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index a7bb570..2251f3f 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -313,7 +313,7 @@ void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx,
void UI_draw_roundbox_gl_mode(int mode, float minx, float miny, float maxx, float maxy, float rad);
void UI_draw_roundbox_shade_x(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown);
void UI_draw_roundbox_shade_y(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadeLeft, float shadeRight);
-void UI_text_draw_underline(int pos_x, int pos_y, int len, int height);
+void UI_draw_text_underline(int pos_x, int pos_y, int len, int height);
/* state for scrolldrawing */
#define UI_SCROLL_PRESSED (1 << 0)
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 3f134ce..bcd9b9a 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -395,7 +395,8 @@ void UI_draw_roundbox(float minx, float miny, float maxx, float maxy, float rad)
ui_draw_anti_roundbox(GL_POLYGON, minx, miny, maxx, maxy, rad, roundboxtype & UI_RB_ALPHA);
}
-void UI_text_draw_underline(int pos_x, int pos_y, int len, int height) {
+void UI_draw_text_underline(int pos_x, int pos_y, int len, int height)
+{
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_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 384fdca..d6c51b6 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1237,7 +1237,9 @@ static void ui_text_clip_right_label(uiFontStyle *fstyle, uiBut *but, const rcti
}
#ifdef WITH_INPUT_IME
-static void widget_draw_text_ime_underline(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, rcti *rect, wmIMEData *ime_data, char *drawstr)
+static void widget_draw_text_ime_underline(
+ uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, const rcti *rect,
+ const wmIMEData *ime_data, const char *drawstr)
{
int ofs_x, width;
int rect_x = BLI_rcti_size_x(rect);
@@ -1255,7 +1257,7 @@ static void widget_draw_text_ime_underline(uiFontStyle *fstyle, uiWidgetColors *
ime_data->composite_len + but->pos - but->ofs);
glColor4ubv((unsigned char *)wcol->text);
- UI_text_draw_underline(rect->xmin + ofs_x, rect->ymin + 6 * U.pixelsize, min_ii(width, rect_x - 2) - ofs_x, 1);
+ UI_draw_text_underline(rect->xmin + ofs_x, rect->ymin + 6 * U.pixelsize, min_ii(width, rect_x - 2) - ofs_x, 1);
/* draw the thick line */
if (sel_start != -1 && sel_end != -1) {
@@ -1272,11 +1274,11 @@ static void widget_draw_text_ime_underline(uiFontStyle *fstyle, uiWidgetColors *
width = BLF_width(fstyle->uifont_id, drawstr + but->ofs,
sel_end + sel_start - but->ofs);
- UI_text_draw_underline(rect->xmin + ofs_x, rect->ymin + 6 * U.pixelsize, min_ii(width, rect_x - 2) - ofs_x, 2);
+ UI_draw_text_underline(rect->xmin + ofs_x, rect->ymin + 6 * U.pixelsize, min_ii(width, rect_x - 2) - ofs_x, 2);
}
}
}
-#endif
+#endif /* WITH_INPUT_IME */
static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, rcti *rect)
{
@@ -1286,7 +1288,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
bool use_right_only = false;
#ifdef WITH_INPUT_IME
- wmIMEData *ime_data;
+ const wmIMEData *ime_data;
#endif
UI_fontstyle_set(fstyle);
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index ce4c3bc..a9cb32f 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -191,16 +191,16 @@ typedef struct wmWindow {
short last_pie_event; /* exception to the above rule for nested pies, store last pie event for operators
* that spawn a new pie right after destruction of last pie */
- /* Input Method Editor data - complex character input (esp. for asian character input)
- * Currently WIN32, runtime-only data */
- struct wmIMEData *ime_data;
-
struct wmEvent *eventstate; /* storage for event system */
struct wmSubWindow *curswin; /* internal for wm_subwindow.c only */
struct wmGesture *tweak; /* internal for wm_operators.c */
+ /* Input Method Editor data - complex character input (esp. for asian character input)
+ * Currently WIN32, runtime-only data */
+ struct wmIMEData *ime_data;
+
int drawmethod, drawfail; /* internal for wm_draw.c only */
void *drawdata; /* internal for wm_draw.c only */
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index a42f97b..3de34e7 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -3510,7 +3510,7 @@ bool WM_event_is_tablet(const struct wmEvent *event)
/* most os using ctrl/oskey + space to switch ime, avoid added space */
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);
+ (event->ctrl || event->oskey || event->shift || event->alt);
}
#endif
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 4e18e0b..0b33dbb 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1528,7 +1528,7 @@ bool WM_window_is_fullscreen(wmWindow *win)
#ifdef WITH_INPUT_IME
void wm_window_IME_begin(wmWindow *win, int x, int y, int w, int h, bool complete)
{
- BLI_assert(win);
+ BLI_assert(win && (win->ime_data == NULL));
GHOST_BeginIME(win->ghostwin, x, win->sizey - y, w, h, complete);
}
More information about the Bf-blender-cvs
mailing list