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:
Diffstat (limited to 'source/blender/windowmanager/intern/wm_event_system.c')
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index c798b284c7b..de2c593043c 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 {
@@ -2616,16 +2617,25 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
/* exclude arrow keys, esc, etc from text input */
if(type==GHOST_kEventKeyUp) {
- if (event.ascii<32 && event.ascii > 0) {
- event.ascii= '\0';
- }
+ event.ascii= '\0';
/* ghost should do this already for key up */
if (event.utf8_buf[0]) {
- printf("%s: ghost on you're platform is misbehaving, utf8 events on key up!\n", __func__);
+ printf("%s: ghost on your platform is misbehaving, utf8 events on key up!\n", __func__);
}
event.utf8_buf[0]= '\0';
}
+ else if (event.ascii<32 && event.ascii > 0) {
+ event.ascii= '\0';
+ /* 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 */