diff options
Diffstat (limited to 'source/blender/windowmanager/intern/wm_event_query.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_query.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_query.c b/source/blender/windowmanager/intern/wm_event_query.c index b732bc91569..a1d94c33f27 100644 --- a/source/blender/windowmanager/intern/wm_event_query.c +++ b/source/blender/windowmanager/intern/wm_event_query.c @@ -112,7 +112,7 @@ void WM_event_print(const wmEvent *event) "wmEvent type:%d/%s, val:%d/%s, " "prev_type:%d/%s, prev_val:%d/%s, " "modifier=%s, keymodifier:%d, flag:%s, " - "mouse:(%d,%d), ascii:'%c', utf8:'%.*s', pointer:%p", + "mouse:(%d,%d), utf8:'%.*s', pointer:%p", event->type, type_id, event->val, @@ -126,7 +126,6 @@ void WM_event_print(const wmEvent *event) flag_id, event->xy[0], event->xy[1], - event->ascii, BLI_str_utf8_size(event->utf8_buf), event->utf8_buf, (const void *)event); @@ -254,16 +253,6 @@ bool WM_event_is_modal_drag_exit(const wmEvent *event, return 0; } -bool WM_event_is_last_mousemove(const wmEvent *event) -{ - while ((event = event->next)) { - if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) { - return false; - } - } - return true; -} - bool WM_event_is_mouse_drag(const wmEvent *event) { return (ISMOUSE_BUTTON(event->type) && (event->val == KM_CLICK_DRAG)); @@ -357,8 +346,8 @@ bool WM_cursor_test_motion_and_update(const int mval[2]) int WM_event_drag_threshold(const struct wmEvent *event) { int drag_threshold; - if (ISMOUSE(event->prev_press_type)) { - BLI_assert(event->prev_press_type != MOUSEMOVE); + BLI_assert(event->prev_press_type != MOUSEMOVE); + if (ISMOUSE_BUTTON(event->prev_press_type)) { /* Using the previous type is important is we want to check the last pressed/released button, * The `event->type` would include #MOUSEMOVE which is always the case when dragging * and does not help us know which threshold to use. */ @@ -411,6 +400,20 @@ void WM_event_drag_start_xy(const wmEvent *event, int r_xy[2]) /** \} */ /* -------------------------------------------------------------------- */ +/** \name Event Text Queries + * \{ */ + +char WM_event_utf8_to_ascii(const struct wmEvent *event) +{ + if (BLI_str_utf8_size(event->utf8_buf) == 1) { + return event->utf8_buf[0]; + } + return '\0'; +} + +/** \} */ + +/* -------------------------------------------------------------------- */ /** \name Event Preference Mapping * \{ */ |