Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-10-23 17:52:51 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-10-23 17:52:51 +0400
commite89107927bcc8297c74f9a8cb10562e6defc867c (patch)
tree7925d6bba50b803ab1ff5080e9b44b2e98a3059f /source/blender/windowmanager/intern/wm_event_system.c
parent66ef02aaa332039c2338bd4680aba34c748fb319 (diff)
- fix for error with utf8 textinput for buttons
- ensure input is valid utf8 from ghost and NULL then complain if its not. - added function to get utf8 size BLI_str_utf8_size()
Diffstat (limited to 'source/blender/windowmanager/intern/wm_event_system.c')
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 3e9bce651a8..09ec8bf84ba 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -454,11 +454,12 @@ void WM_event_print(wmEvent *event)
printf("wmEvent - type:%d/%s, val:%d/%s, "
"shift:%d, ctrl:%d, alt:%d, oskey:%d, keymodifier:%d, "
- "mouse:(%d,%d), ascii:'%c', utf8:'%.6s', "
+ "mouse:(%d,%d), ascii:'%c', utf8:'%.*s', "
"keymap_idname:%s, pointer:%p\n",
event->type, type_id, event->val, val_id,
event->shift, event->ctrl, event->alt, event->oskey, event->keymodifier,
- event->x, event->y, event->ascii, event->utf8_buf,
+ event->x, event->y, event->ascii,
+ BLI_str_utf8_size(event->utf8_buf), event->utf8_buf,
event->keymap_idname, (void *)event);
}
else {
@@ -2629,6 +2630,13 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
/* TODO. should this also zero utf8?, dont for now, campbell */
}
+ if (event.utf8_buf[0]) {
+ if (BLI_str_utf8_size(event.utf8_buf) == -1) {
+ printf("%s: ghost detected an invalid unicode character '%d'!\n", __func__, (int)(unsigned char)event.utf8_buf[0]);
+ event.utf8_buf[0]= '\0';
+ }
+ }
+
/* modifiers */
/* assigning both first and second is strange - campbell */
switch(event.type) {