diff options
author | Ray Molenkamp <github@lazydodo.com> | 2020-03-18 19:38:37 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2020-03-18 19:38:37 +0300 |
commit | b88ca3e6d113d161dd119bf1cec959c73b797af7 (patch) | |
tree | 6a8b73ca95f8a21742cba1e764d1e24cc5ae8db5 /source/blender/windowmanager | |
parent | 9e382dd2a3d8569201a3e5c1a8478166c77e9029 (diff) |
Cleanup: Resolve HKEY conflict
Both the MS headers and blender headers define the HKEY
which gives all kind of inclusion order issues.
This diff renames all *KEY constants to EVT_*KEY to resolve
this conflict.
Reviewed By: brecht , dfelinto
Differential Revision: http://developer.blender.org/D7164
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c | 29 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_cursors.c | 8 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_query.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 188 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_gesture_ops.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_keymap.c | 40 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operator_utils.c | 14 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 12 | ||||
-rw-r--r-- | source/blender/windowmanager/wm_event_types.h | 257 |
9 files changed, 276 insertions, 276 deletions
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c index f2cd847fe75..066aae9071c 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c @@ -675,21 +675,24 @@ wmKeyMap *wm_gizmogroup_tweak_modal_keymap(wmKeyConfig *kc) keymap = WM_modalkeymap_add(kc, name, modal_items); /* items for modal map */ - WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_CANCEL); + WM_modalkeymap_add_item(keymap, EVT_ESCKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_CANCEL); WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_CANCEL); - WM_modalkeymap_add_item(keymap, RETKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_CONFIRM); - WM_modalkeymap_add_item(keymap, PADENTER, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_CONFIRM); - - WM_modalkeymap_add_item(keymap, RIGHTSHIFTKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_PRECISION_ON); - WM_modalkeymap_add_item(keymap, RIGHTSHIFTKEY, KM_RELEASE, KM_ANY, 0, TWEAK_MODAL_PRECISION_OFF); - WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_PRECISION_ON); - WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_RELEASE, KM_ANY, 0, TWEAK_MODAL_PRECISION_OFF); - - WM_modalkeymap_add_item(keymap, RIGHTCTRLKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_SNAP_ON); - WM_modalkeymap_add_item(keymap, RIGHTCTRLKEY, KM_RELEASE, KM_ANY, 0, TWEAK_MODAL_SNAP_OFF); - WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_SNAP_ON); - WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, TWEAK_MODAL_SNAP_OFF); + WM_modalkeymap_add_item(keymap, EVT_RETKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_CONFIRM); + WM_modalkeymap_add_item(keymap, EVT_PADENTER, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_CONFIRM); + + WM_modalkeymap_add_item( + keymap, EVT_RIGHTSHIFTKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_PRECISION_ON); + WM_modalkeymap_add_item( + keymap, EVT_RIGHTSHIFTKEY, KM_RELEASE, KM_ANY, 0, TWEAK_MODAL_PRECISION_OFF); + WM_modalkeymap_add_item(keymap, EVT_LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_PRECISION_ON); + WM_modalkeymap_add_item( + keymap, EVT_LEFTSHIFTKEY, KM_RELEASE, KM_ANY, 0, TWEAK_MODAL_PRECISION_OFF); + + WM_modalkeymap_add_item(keymap, EVT_RIGHTCTRLKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_SNAP_ON); + WM_modalkeymap_add_item(keymap, EVT_RIGHTCTRLKEY, KM_RELEASE, KM_ANY, 0, TWEAK_MODAL_SNAP_OFF); + WM_modalkeymap_add_item(keymap, EVT_LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_SNAP_ON); + WM_modalkeymap_add_item(keymap, EVT_LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, TWEAK_MODAL_SNAP_OFF); WM_modalkeymap_assign(keymap, "GIZMOGROUP_OT_gizmo_tweak"); diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index f69bc822f44..06a6a9d039a 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -311,19 +311,19 @@ bool wm_cursor_arrow_move(wmWindow *win, const wmEvent *event) /* Must move at least this much to avoid rounding in WM_cursor_warp. */ float fac = GHOST_GetNativePixelSize(win->ghostwin); - if (event->type == UPARROWKEY) { + if (event->type == EVT_UPARROWKEY) { wm_cursor_warp_relative(win, 0, fac); return 1; } - else if (event->type == DOWNARROWKEY) { + else if (event->type == EVT_DOWNARROWKEY) { wm_cursor_warp_relative(win, 0, -fac); return 1; } - else if (event->type == LEFTARROWKEY) { + else if (event->type == EVT_LEFTARROWKEY) { wm_cursor_warp_relative(win, -fac, 0); return 1; } - else if (event->type == RIGHTARROWKEY) { + else if (event->type == EVT_RIGHTARROWKEY) { wm_cursor_warp_relative(win, fac, 0); return 1; } diff --git a/source/blender/windowmanager/intern/wm_event_query.c b/source/blender/windowmanager/intern/wm_event_query.c index f1a03efa49b..eaddbb25034 100644 --- a/source/blender/windowmanager/intern/wm_event_query.c +++ b/source/blender/windowmanager/intern/wm_event_query.c @@ -420,7 +420,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 && + return event->val == KM_PRESS && event->type == EVT_SPACEKEY && (event->ctrl || event->oskey || event->shift || event->alt); } #endif diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index c7556ec7516..c14ae57d4a3 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1824,25 +1824,25 @@ static bool wm_eventmatch(const wmEvent *winevent, const wmKeyMapItem *kmi) * Account for rare case of when these keys are used as the 'type' not as modifiers. */ if (kmi->shift != KM_ANY) { if ((winevent->shift != kmi->shift) && !(winevent->shift & kmi->shift) && - !ELEM(winevent->type, LEFTSHIFTKEY, RIGHTSHIFTKEY)) { + !ELEM(winevent->type, EVT_LEFTSHIFTKEY, EVT_RIGHTSHIFTKEY)) { return false; } } if (kmi->ctrl != KM_ANY) { if (winevent->ctrl != kmi->ctrl && !(winevent->ctrl & kmi->ctrl) && - !ELEM(winevent->type, LEFTCTRLKEY, RIGHTCTRLKEY)) { + !ELEM(winevent->type, EVT_LEFTCTRLKEY, EVT_RIGHTCTRLKEY)) { return false; } } if (kmi->alt != KM_ANY) { if (winevent->alt != kmi->alt && !(winevent->alt & kmi->alt) && - !ELEM(winevent->type, LEFTALTKEY, RIGHTALTKEY)) { + !ELEM(winevent->type, EVT_LEFTALTKEY, EVT_RIGHTALTKEY)) { return false; } } if (kmi->oskey != KM_ANY) { if (winevent->oskey != kmi->oskey && !(winevent->oskey & kmi->oskey) && - (winevent->type != OSKEY)) { + (winevent->type != EVT_OSKEY)) { return false; } } @@ -3059,7 +3059,7 @@ static void wm_event_drag_and_drop_test(wmWindowManager *wm, wmWindow *win, wmEv if (event->type == MOUSEMOVE || ISKEYMODIFIER(event->type)) { screen->do_draw_drag = true; } - else if (event->type == ESCKEY) { + else if (event->type == EVT_ESCKEY) { WM_drag_free_list(&wm->drags); screen->do_draw_drag = true; @@ -3910,139 +3910,139 @@ void WM_event_add_mousemove(wmWindow *win) static int convert_key(GHOST_TKey key) { if (key >= GHOST_kKeyA && key <= GHOST_kKeyZ) { - return (AKEY + ((int)key - GHOST_kKeyA)); + return (EVT_AKEY + ((int)key - GHOST_kKeyA)); } else if (key >= GHOST_kKey0 && key <= GHOST_kKey9) { - return (ZEROKEY + ((int)key - GHOST_kKey0)); + return (EVT_ZEROKEY + ((int)key - GHOST_kKey0)); } else if (key >= GHOST_kKeyNumpad0 && key <= GHOST_kKeyNumpad9) { - return (PAD0 + ((int)key - GHOST_kKeyNumpad0)); + return (EVT_PAD0 + ((int)key - GHOST_kKeyNumpad0)); } else if (key >= GHOST_kKeyF1 && key <= GHOST_kKeyF24) { - return (F1KEY + ((int)key - GHOST_kKeyF1)); + return (EVT_F1KEY + ((int)key - GHOST_kKeyF1)); } else { switch (key) { case GHOST_kKeyBackSpace: - return BACKSPACEKEY; + return EVT_BACKSPACEKEY; case GHOST_kKeyTab: - return TABKEY; + return EVT_TABKEY; case GHOST_kKeyLinefeed: - return LINEFEEDKEY; + return EVT_LINEFEEDKEY; case GHOST_kKeyClear: return 0; case GHOST_kKeyEnter: - return RETKEY; + return EVT_RETKEY; case GHOST_kKeyEsc: - return ESCKEY; + return EVT_ESCKEY; case GHOST_kKeySpace: - return SPACEKEY; + return EVT_SPACEKEY; case GHOST_kKeyQuote: - return QUOTEKEY; + return EVT_QUOTEKEY; case GHOST_kKeyComma: - return COMMAKEY; + return EVT_COMMAKEY; case GHOST_kKeyMinus: - return MINUSKEY; + return EVT_MINUSKEY; case GHOST_kKeyPlus: - return PLUSKEY; + return EVT_PLUSKEY; case GHOST_kKeyPeriod: - return PERIODKEY; + return EVT_PERIODKEY; case GHOST_kKeySlash: - return SLASHKEY; + return EVT_SLASHKEY; case GHOST_kKeySemicolon: - return SEMICOLONKEY; + return EVT_SEMICOLONKEY; case GHOST_kKeyEqual: - return EQUALKEY; + return EVT_EQUALKEY; case GHOST_kKeyLeftBracket: - return LEFTBRACKETKEY; + return EVT_LEFTBRACKETKEY; case GHOST_kKeyRightBracket: - return RIGHTBRACKETKEY; + return EVT_RIGHTBRACKETKEY; case GHOST_kKeyBackslash: - return BACKSLASHKEY; + return EVT_BACKSLASHKEY; case GHOST_kKeyAccentGrave: - return ACCENTGRAVEKEY; + return EVT_ACCENTGRAVEKEY; case GHOST_kKeyLeftShift: - return LEFTSHIFTKEY; + return EVT_LEFTSHIFTKEY; case GHOST_kKeyRightShift: - return RIGHTSHIFTKEY; + return EVT_RIGHTSHIFTKEY; case GHOST_kKeyLeftControl: - return LEFTCTRLKEY; + return EVT_LEFTCTRLKEY; case GHOST_kKeyRightControl: - return RIGHTCTRLKEY; + return EVT_RIGHTCTRLKEY; case GHOST_kKeyOS: - return OSKEY; + return EVT_OSKEY; case GHOST_kKeyLeftAlt: - return LEFTALTKEY; + return EVT_LEFTALTKEY; case GHOST_kKeyRightAlt: - return RIGHTALTKEY; + return EVT_RIGHTALTKEY; case GHOST_kKeyApp: - return APPKEY; + return EVT_APPKEY; case GHOST_kKeyCapsLock: - return CAPSLOCKKEY; + return EVT_CAPSLOCKKEY; case GHOST_kKeyNumLock: return 0; case GHOST_kKeyScrollLock: return 0; case GHOST_kKeyLeftArrow: - return LEFTARROWKEY; + return EVT_LEFTARROWKEY; case GHOST_kKeyRightArrow: - return RIGHTARROWKEY; + return EVT_RIGHTARROWKEY; case GHOST_kKeyUpArrow: - return UPARROWKEY; + return EVT_UPARROWKEY; case GHOST_kKeyDownArrow: - return DOWNARROWKEY; + return EVT_DOWNARROWKEY; case GHOST_kKeyPrintScreen: return 0; case GHOST_kKeyPause: - return PAUSEKEY; + return EVT_PAUSEKEY; case GHOST_kKeyInsert: - return INSERTKEY; + return EVT_INSERTKEY; case GHOST_kKeyDelete: - return DELKEY; + return EVT_DELKEY; case GHOST_kKeyHome: - return HOMEKEY; + return EVT_HOMEKEY; case GHOST_kKeyEnd: - return ENDKEY; + return EVT_ENDKEY; case GHOST_kKeyUpPage: - return PAGEUPKEY; + return EVT_PAGEUPKEY; case GHOST_kKeyDownPage: - return PAGEDOWNKEY; + return EVT_PAGEDOWNKEY; case GHOST_kKeyNumpadPeriod: - return PADPERIOD; + return EVT_PADPERIOD; case GHOST_kKeyNumpadEnter: - return PADENTER; + return EVT_PADENTER; case GHOST_kKeyNumpadPlus: - return PADPLUSKEY; + return EVT_PADPLUSKEY; case GHOST_kKeyNumpadMinus: - return PADMINUS; + return EVT_PADMINUS; case GHOST_kKeyNumpadAsterisk: - return PADASTERKEY; + return EVT_PADASTERKEY; case GHOST_kKeyNumpadSlash: - return PADSLASHKEY; + return EVT_PADSLASHKEY; case GHOST_kKeyGrLess: - return GRLESSKEY; + return EVT_GRLESSKEY; case GHOST_kKeyMediaPlay: - return MEDIAPLAY; + return EVT_MEDIAPLAY; case GHOST_kKeyMediaStop: - return MEDIASTOP; + return EVT_MEDIASTOP; case GHOST_kKeyMediaFirst: - return MEDIAFIRST; + return EVT_MEDIAFIRST; case GHOST_kKeyMediaLast: - return MEDIALAST; + return EVT_MEDIALAST; default: - return UNKNOWNKEY; /* GHOST_kKeyUnknown */ + return EVT_UNKNOWNKEY; /* GHOST_kKeyUnknown */ } } } @@ -4095,44 +4095,44 @@ static void wm_eventemulation(wmEvent *event, bool test_only) /* numpad emulation */ if (U.flag & USER_NONUMPAD) { switch (event->type) { - case ZEROKEY: - event->type = PAD0; + case EVT_ZEROKEY: + event->type = EVT_PAD0; break; - case ONEKEY: - event->type = PAD1; + case EVT_ONEKEY: + event->type = EVT_PAD1; break; - case TWOKEY: - event->type = PAD2; + case EVT_TWOKEY: + event->type = EVT_PAD2; break; - case THREEKEY: - event->type = PAD3; + case EVT_THREEKEY: + event->type = EVT_PAD3; break; - case FOURKEY: - event->type = PAD4; + case EVT_FOURKEY: + event->type = EVT_PAD4; break; - case FIVEKEY: - event->type = PAD5; + case EVT_FIVEKEY: + event->type = EVT_PAD5; break; - case SIXKEY: - event->type = PAD6; + case EVT_SIXKEY: + event->type = EVT_PAD6; break; - case SEVENKEY: - event->type = PAD7; + case EVT_SEVENKEY: + event->type = EVT_PAD7; break; - case EIGHTKEY: - event->type = PAD8; + case EVT_EIGHTKEY: + event->type = EVT_PAD8; break; - case NINEKEY: - event->type = PAD9; + case EVT_NINEKEY: + event->type = EVT_PAD9; break; - case MINUSKEY: - event->type = PADMINUS; + case EVT_MINUSKEY: + event->type = EVT_PADMINUS; break; - case EQUALKEY: - event->type = PADPLUSKEY; + case EVT_EQUALKEY: + event->type = EVT_PADPLUSKEY; break; - case BACKSLASHKEY: - event->type = PADSLASHKEY; + case EVT_BACKSLASHKEY: + event->type = EVT_PADSLASHKEY; break; } } @@ -4497,8 +4497,8 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void /* assigning both first and second is strange - campbell */ switch (event.type) { - case LEFTSHIFTKEY: - case RIGHTSHIFTKEY: + case EVT_LEFTSHIFTKEY: + case EVT_RIGHTSHIFTKEY: if (event.val == KM_PRESS) { if (evt->ctrl || evt->alt || evt->oskey) { keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND); @@ -4509,8 +4509,8 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void } event.shift = evt->shift = keymodifier; break; - case LEFTCTRLKEY: - case RIGHTCTRLKEY: + case EVT_LEFTCTRLKEY: + case EVT_RIGHTCTRLKEY: if (event.val == KM_PRESS) { if (evt->shift || evt->alt || evt->oskey) { keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND); @@ -4521,8 +4521,8 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void } event.ctrl = evt->ctrl = keymodifier; break; - case LEFTALTKEY: - case RIGHTALTKEY: + case EVT_LEFTALTKEY: + case EVT_RIGHTALTKEY: if (event.val == KM_PRESS) { if (evt->ctrl || evt->shift || evt->oskey) { keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND); @@ -4533,7 +4533,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void } event.alt = evt->alt = keymodifier; break; - case OSKEY: + case EVT_OSKEY: if (event.val == KM_PRESS) { if (evt->ctrl || evt->alt || evt->shift) { keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND); @@ -4572,13 +4572,13 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void * (to compose complex latin characters e.g.), it's not really clear why. * Since it's impossible to map a key modifier to an unknown key, * it shouldn't harm to clear it. */ - if (event.keymodifier == UNKNOWNKEY) { + if (event.keymodifier == EVT_UNKNOWNKEY) { evt->keymodifier = event.keymodifier = 0; } /* if test_break set, it catches this. Do not set with modifier presses. * XXX Keep global for now? */ - if ((event.type == ESCKEY && event.val == KM_PRESS) && + if ((event.type == EVT_ESCKEY && event.val == KM_PRESS) && /* check other modifiers because ms-windows uses these to bring up the task manager */ (event.shift == 0 && event.ctrl == 0 && event.alt == 0)) { G.is_break = true; diff --git a/source/blender/windowmanager/intern/wm_gesture_ops.c b/source/blender/windowmanager/intern/wm_gesture_ops.c index 82bc591e2a4..341bd4a16f7 100644 --- a/source/blender/windowmanager/intern/wm_gesture_ops.c +++ b/source/blender/windowmanager/intern/wm_gesture_ops.c @@ -687,7 +687,7 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_FINISHED; } break; - case ESCKEY: + case EVT_ESCKEY: gesture_modal_end(C, op); return OPERATOR_CANCELLED; } diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 0aa146bbc83..a8c52aa1314 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -1096,29 +1096,29 @@ const char *WM_key_event_string(const short type, const bool compact) ; switch (type) { - case LEFTSHIFTKEY: - case RIGHTSHIFTKEY: { + case EVT_LEFTSHIFTKEY: + case EVT_RIGHTSHIFTKEY: { if (platform == MACOS) { single_glyph = "\xe2\x87\xa7"; } return key_event_glyph_or_text( font_id, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, "Shift"), single_glyph); } - case LEFTCTRLKEY: - case RIGHTCTRLKEY: + case EVT_LEFTCTRLKEY: + case EVT_RIGHTCTRLKEY: if (platform == MACOS) { return key_event_glyph_or_text(font_id, "^", "\xe2\x8c\x83"); } return IFACE_("Ctrl"); - case LEFTALTKEY: - case RIGHTALTKEY: { + case EVT_LEFTALTKEY: + case EVT_RIGHTALTKEY: { if (platform == MACOS) { /* Option symbol on Mac keyboard. */ single_glyph = "\xe2\x8c\xa5"; } return key_event_glyph_or_text(font_id, IFACE_("Alt"), single_glyph); } - case OSKEY: { + case EVT_OSKEY: { if (platform == MACOS) { return key_event_glyph_or_text(font_id, IFACE_("Cmd"), "\xe2\x8c\x98"); } @@ -1127,26 +1127,26 @@ const char *WM_key_event_string(const short type, const bool compact) } return IFACE_("OS"); } break; - case TABKEY: + case EVT_TABKEY: return key_event_glyph_or_text(font_id, IFACE_("Tab"), "\xe2\xad\xbe"); - case BACKSPACEKEY: + case EVT_BACKSPACEKEY: return key_event_glyph_or_text(font_id, IFACE_("Bksp"), "\xe2\x8c\xab"); - case ESCKEY: + case EVT_ESCKEY: if (platform == MACOS) { single_glyph = "\xe2\x8e\x8b"; } return key_event_glyph_or_text(font_id, IFACE_("Esc"), single_glyph); - case RETKEY: + case EVT_RETKEY: return key_event_glyph_or_text(font_id, IFACE_("Enter"), "\xe2\x86\xb5"); - case SPACEKEY: + case EVT_SPACEKEY: return key_event_glyph_or_text(font_id, IFACE_("Space"), "\xe2\x90\xa3"); - case LEFTARROWKEY: + case EVT_LEFTARROWKEY: return key_event_glyph_or_text(font_id, IFACE_("Left"), "\xe2\x86\x90"); - case UPARROWKEY: + case EVT_UPARROWKEY: return key_event_glyph_or_text(font_id, IFACE_("Up"), "\xe2\x86\x91"); - case RIGHTARROWKEY: + case EVT_RIGHTARROWKEY: return key_event_glyph_or_text(font_id, IFACE_("Right"), "\xe2\x86\x92"); - case DOWNARROWKEY: + case EVT_DOWNARROWKEY: return key_event_glyph_or_text(font_id, IFACE_("Down"), "\xe2\x86\x93"); } } @@ -1198,22 +1198,22 @@ int WM_keymap_item_raw_to_string(const short shift, else { if (shift) { ADD_SEP; - p += BLI_strcpy_rlen(p, WM_key_event_string(LEFTSHIFTKEY, true)); + p += BLI_strcpy_rlen(p, WM_key_event_string(EVT_LEFTSHIFTKEY, true)); } if (ctrl) { ADD_SEP; - p += BLI_strcpy_rlen(p, WM_key_event_string(LEFTCTRLKEY, true)); + p += BLI_strcpy_rlen(p, WM_key_event_string(EVT_LEFTCTRLKEY, true)); } if (alt) { ADD_SEP; - p += BLI_strcpy_rlen(p, WM_key_event_string(LEFTALTKEY, true)); + p += BLI_strcpy_rlen(p, WM_key_event_string(EVT_LEFTALTKEY, true)); } if (oskey) { ADD_SEP; - p += BLI_strcpy_rlen(p, WM_key_event_string(OSKEY, true)); + p += BLI_strcpy_rlen(p, WM_key_event_string(EVT_OSKEY, true)); } } diff --git a/source/blender/windowmanager/intern/wm_operator_utils.c b/source/blender/windowmanager/intern/wm_operator_utils.c index d0abdec1376..c3dab133e44 100644 --- a/source/blender/windowmanager/intern/wm_operator_utils.c +++ b/source/blender/windowmanager/intern/wm_operator_utils.c @@ -252,10 +252,10 @@ static int op_generic_value_modal(bContext *C, wmOperator *op, const wmEvent *ev switch (event->type) { case MOUSEMOVE: - case LEFTCTRLKEY: - case RIGHTCTRLKEY: - case LEFTSHIFTKEY: - case RIGHTSHIFTKEY: { + case EVT_LEFTCTRLKEY: + case EVT_RIGHTCTRLKEY: + case EVT_LEFTSHIFTKEY: + case EVT_RIGHTSHIFTKEY: { float value_final; if (cd->is_active && interactive_value_update(&cd->inter, event, &value_final)) { wmWindowManager *wm = CTX_wm_manager(C); @@ -279,8 +279,8 @@ static int op_generic_value_modal(bContext *C, wmOperator *op, const wmEvent *ev } break; } - case RETKEY: - case PADENTER: + case EVT_RETKEY: + case EVT_PADENTER: case LEFTMOUSE: { if (cd->wait_for_input) { if (event->val == KM_PRESS) { @@ -304,7 +304,7 @@ static int op_generic_value_modal(bContext *C, wmOperator *op, const wmEvent *ev } break; } - case ESCKEY: + case EVT_ESCKEY: case RIGHTMOUSE: { if (event->val == KM_PRESS) { if (cd->is_active == true) { diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 1d6ae10c396..b67d05d8b7a 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1749,7 +1749,7 @@ static int wm_search_menu_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) static int wm_search_menu_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) { /* Exception for launching via spacebar */ - if (event->type == SPACEKEY) { + if (event->type == EVT_SPACEKEY) { bool ok = true; ScrArea *sa = CTX_wm_area(C); if (sa) { @@ -2815,7 +2815,7 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even else { handled = false; switch (event->type) { - case ESCKEY: + case EVT_ESCKEY: case RIGHTMOUSE: /* canceled; restore original value */ radial_control_set_value(rc, rc->initial_value); @@ -2823,8 +2823,8 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even break; case LEFTMOUSE: - case PADENTER: - case RETKEY: + case EVT_PADENTER: + case EVT_RETKEY: /* done; value already set */ RNA_property_update(C, &rc->ptr, rc->prop); ret = OPERATOR_FINISHED; @@ -2930,8 +2930,8 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even } break; - case LEFTSHIFTKEY: - case RIGHTSHIFTKEY: { + case EVT_LEFTSHIFTKEY: + case EVT_RIGHTSHIFTKEY: { if (event->val == KM_PRESS) { rc->slow_mouse[0] = event->x; rc->slow_mouse[1] = event->y; diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h index 046783b157b..f16056cc91e 100644 --- a/source/blender/windowmanager/wm_event_types.h +++ b/source/blender/windowmanager/wm_event_types.h @@ -96,144 +96,140 @@ enum { /* Standard keyboard. * From 0x0020 to 0x00ff, and 0x012c to 0x0143 for function keys! */ - ZEROKEY = 0x0030, /* '0' (48). */ - ONEKEY = 0x0031, /* '1' (49). */ - TWOKEY = 0x0032, /* '2' (50). */ - THREEKEY = 0x0033, /* '3' (51). */ - FOURKEY = 0x0034, /* '4' (52). */ - FIVEKEY = 0x0035, /* '5' (53). */ - SIXKEY = 0x0036, /* '6' (54). */ - SEVENKEY = 0x0037, /* '7' (55). */ - EIGHTKEY = 0x0038, /* '8' (56). */ - NINEKEY = 0x0039, /* '9' (57). */ - - AKEY = 0x0061, /* 'a' (97). */ - BKEY = 0x0062, /* 'b' (98). */ - CKEY = 0x0063, /* 'c' (99). */ - DKEY = 0x0064, /* 'd' (100). */ - EKEY = 0x0065, /* 'e' (101). */ - FKEY = 0x0066, /* 'f' (102). */ - GKEY = 0x0067, /* 'g' (103). */ -#ifndef WIN32 - HKEY = 0x0068, /* 'h' (104). */ -#else -# define HKEY 0x0068 -#endif - IKEY = 0x0069, /* 'i' (105). */ - JKEY = 0x006a, /* 'j' (106). */ - KKEY = 0x006b, /* 'k' (107). */ - LKEY = 0x006c, /* 'l' (108). */ - MKEY = 0x006d, /* 'm' (109). */ - NKEY = 0x006e, /* 'n' (110). */ - OKEY = 0x006f, /* 'o' (111). */ - PKEY = 0x0070, /* 'p' (112). */ - QKEY = 0x0071, /* 'q' (113). */ - RKEY = 0x0072, /* 'r' (114). */ - SKEY = 0x0073, /* 's' (115). */ - TKEY = 0x0074, /* 't' (116). */ - UKEY = 0x0075, /* 'u' (117). */ - VKEY = 0x0076, /* 'v' (118). */ - WKEY = 0x0077, /* 'w' (119). */ - XKEY = 0x0078, /* 'x' (120). */ - YKEY = 0x0079, /* 'y' (121). */ - ZKEY = 0x007a, /* 'z' (122). */ - - LEFTARROWKEY = 0x0089, /* 137 */ - DOWNARROWKEY = 0x008a, /* 138 */ - RIGHTARROWKEY = 0x008b, /* 139 */ - UPARROWKEY = 0x008c, /* 140 */ - - PAD0 = 0x0096, /* 150 */ - PAD1 = 0x0097, /* 151 */ - PAD2 = 0x0098, /* 152 */ - PAD3 = 0x0099, /* 153 */ - PAD4 = 0x009a, /* 154 */ - PAD5 = 0x009b, /* 155 */ - PAD6 = 0x009c, /* 156 */ - PAD7 = 0x009d, /* 157 */ - PAD8 = 0x009e, /* 158 */ - PAD9 = 0x009f, /* 159 */ + EVT_ZEROKEY = 0x0030, /* '0' (48). */ + EVT_ONEKEY = 0x0031, /* '1' (49). */ + EVT_TWOKEY = 0x0032, /* '2' (50). */ + EVT_THREEKEY = 0x0033, /* '3' (51). */ + EVT_FOURKEY = 0x0034, /* '4' (52). */ + EVT_FIVEKEY = 0x0035, /* '5' (53). */ + EVT_SIXKEY = 0x0036, /* '6' (54). */ + EVT_SEVENKEY = 0x0037, /* '7' (55). */ + EVT_EIGHTKEY = 0x0038, /* '8' (56). */ + EVT_NINEKEY = 0x0039, /* '9' (57). */ + + EVT_AKEY = 0x0061, /* 'a' (97). */ + EVT_BKEY = 0x0062, /* 'b' (98). */ + EVT_CKEY = 0x0063, /* 'c' (99). */ + EVT_DKEY = 0x0064, /* 'd' (100). */ + EVT_EKEY = 0x0065, /* 'e' (101). */ + EVT_FKEY = 0x0066, /* 'f' (102). */ + EVT_GKEY = 0x0067, /* 'g' (103). */ + EVT_HKEY = 0x0068, /* 'h' (104). */ + EVT_IKEY = 0x0069, /* 'i' (105). */ + EVT_JKEY = 0x006a, /* 'j' (106). */ + EVT_KKEY = 0x006b, /* 'k' (107). */ + EVT_LKEY = 0x006c, /* 'l' (108). */ + EVT_MKEY = 0x006d, /* 'm' (109). */ + EVT_NKEY = 0x006e, /* 'n' (110). */ + EVT_OKEY = 0x006f, /* 'o' (111). */ + EVT_PKEY = 0x0070, /* 'p' (112). */ + EVT_QKEY = 0x0071, /* 'q' (113). */ + EVT_RKEY = 0x0072, /* 'r' (114). */ + EVT_SKEY = 0x0073, /* 's' (115). */ + EVT_TKEY = 0x0074, /* 't' (116). */ + EVT_UKEY = 0x0075, /* 'u' (117). */ + EVT_VKEY = 0x0076, /* 'v' (118). */ + EVT_WKEY = 0x0077, /* 'w' (119). */ + EVT_XKEY = 0x0078, /* 'x' (120). */ + EVT_YKEY = 0x0079, /* 'y' (121). */ + EVT_ZKEY = 0x007a, /* 'z' (122). */ + + EVT_LEFTARROWKEY = 0x0089, /* 137 */ + EVT_DOWNARROWKEY = 0x008a, /* 138 */ + EVT_RIGHTARROWKEY = 0x008b, /* 139 */ + EVT_UPARROWKEY = 0x008c, /* 140 */ + + EVT_PAD0 = 0x0096, /* 150 */ + EVT_PAD1 = 0x0097, /* 151 */ + EVT_PAD2 = 0x0098, /* 152 */ + EVT_PAD3 = 0x0099, /* 153 */ + EVT_PAD4 = 0x009a, /* 154 */ + EVT_PAD5 = 0x009b, /* 155 */ + EVT_PAD6 = 0x009c, /* 156 */ + EVT_PAD7 = 0x009d, /* 157 */ + EVT_PAD8 = 0x009e, /* 158 */ + EVT_PAD9 = 0x009f, /* 159 */ /* Key-pad keys. */ - PADASTERKEY = 0x00a0, /* 160 */ - PADSLASHKEY = 0x00a1, /* 161 */ - PADMINUS = 0x00a2, /* 162 */ - PADENTER = 0x00a3, /* 163 */ - PADPLUSKEY = 0x00a4, /* 164 */ - - PAUSEKEY = 0x00a5, /* 165 */ - INSERTKEY = 0x00a6, /* 166 */ - HOMEKEY = 0x00a7, /* 167 */ - PAGEUPKEY = 0x00a8, /* 168 */ - PAGEDOWNKEY = 0x00a9, /* 169 */ - ENDKEY = 0x00aa, /* 170 */ + EVT_PADASTERKEY = 0x00a0, /* 160 */ + EVT_PADSLASHKEY = 0x00a1, /* 161 */ + EVT_PADMINUS = 0x00a2, /* 162 */ + EVT_PADENTER = 0x00a3, /* 163 */ + EVT_PADPLUSKEY = 0x00a4, /* 164 */ + + EVT_PAUSEKEY = 0x00a5, /* 165 */ + EVT_INSERTKEY = 0x00a6, /* 166 */ + EVT_HOMEKEY = 0x00a7, /* 167 */ + EVT_PAGEUPKEY = 0x00a8, /* 168 */ + EVT_PAGEDOWNKEY = 0x00a9, /* 169 */ + EVT_ENDKEY = 0x00aa, /* 170 */ /* Note that 'PADPERIOD' is defined out-of-order. */ - UNKNOWNKEY = 0x00ab, /* 171 */ - OSKEY = 0x00ac, /* 172 */ - GRLESSKEY = 0x00ad, /* 173 */ + EVT_UNKNOWNKEY = 0x00ab, /* 171 */ + EVT_OSKEY = 0x00ac, /* 172 */ + EVT_GRLESSKEY = 0x00ad, /* 173 */ /* Media keys. */ - MEDIAPLAY = 0x00ae, /* 174 */ - MEDIASTOP = 0x00af, /* 175 */ - MEDIAFIRST = 0x00b0, /* 176 */ - MEDIALAST = 0x00b1, /* 177 */ + EVT_MEDIAPLAY = 0x00ae, /* 174 */ + EVT_MEDIASTOP = 0x00af, /* 175 */ + EVT_MEDIAFIRST = 0x00b0, /* 176 */ + EVT_MEDIALAST = 0x00b1, /* 177 */ /* Menu/App key. */ - APPKEY = 0x00b2, /* 178 */ + EVT_APPKEY = 0x00b2, /* 178 */ - PADPERIOD = 0x00c7, /* 199 */ + EVT_PADPERIOD = 0x00c7, /* 199 */ - CAPSLOCKKEY = 0x00d3, /* 211 */ + EVT_CAPSLOCKKEY = 0x00d3, /* 211 */ /* Modifier keys. */ - LEFTCTRLKEY = 0x00d4, /* 212 */ - LEFTALTKEY = 0x00d5, /* 213 */ - RIGHTALTKEY = 0x00d6, /* 214 */ - RIGHTCTRLKEY = 0x00d7, /* 215 */ - RIGHTSHIFTKEY = 0x00d8, /* 216 */ - LEFTSHIFTKEY = 0x00d9, /* 217 */ + EVT_LEFTCTRLKEY = 0x00d4, /* 212 */ + EVT_LEFTALTKEY = 0x00d5, /* 213 */ + EVT_RIGHTALTKEY = 0x00d6, /* 214 */ + EVT_RIGHTCTRLKEY = 0x00d7, /* 215 */ + EVT_RIGHTSHIFTKEY = 0x00d8, /* 216 */ + EVT_LEFTSHIFTKEY = 0x00d9, /* 217 */ /* Special characters. */ - ESCKEY = 0x00da, /* 218 */ - TABKEY = 0x00db, /* 219 */ - RETKEY = 0x00dc, /* 220 */ - SPACEKEY = 0x00dd, /* 221 */ - LINEFEEDKEY = 0x00de, /* 222 */ - BACKSPACEKEY = 0x00df, /* 223 */ - DELKEY = 0x00e0, /* 224 */ - SEMICOLONKEY = 0x00e1, /* 225 */ - PERIODKEY = 0x00e2, /* 226 */ - COMMAKEY = 0x00e3, /* 227 */ - QUOTEKEY = 0x00e4, /* 228 */ - ACCENTGRAVEKEY = 0x00e5, /* 229 */ - MINUSKEY = 0x00e6, /* 230 */ - PLUSKEY = 0x00e7, /* 231 */ - SLASHKEY = 0x00e8, /* 232 */ - BACKSLASHKEY = 0x00e9, /* 233 */ - EQUALKEY = 0x00ea, /* 234 */ - LEFTBRACKETKEY = 0x00eb, /* 235 */ - RIGHTBRACKETKEY = 0x00ec, /* 236 */ - - F1KEY = 0x012c, /* 300 */ - F2KEY = 0x012d, /* 301 */ - F3KEY = 0x012e, /* 302 */ - F4KEY = 0x012f, /* 303 */ - F5KEY = 0x0130, /* 304 */ - F6KEY = 0x0131, /* 305 */ - F7KEY = 0x0132, /* 306 */ - F8KEY = 0x0133, /* 307 */ - F9KEY = 0x0134, /* 308 */ - F10KEY = 0x0135, /* 309 */ - F11KEY = 0x0136, /* 310 */ - F12KEY = 0x0137, /* 311 */ - F13KEY = 0x0138, /* 312 */ - F14KEY = 0x0139, /* 313 */ - F15KEY = 0x013a, /* 314 */ - F16KEY = 0x013b, /* 315 */ - F17KEY = 0x013c, /* 316 */ - F18KEY = 0x013d, /* 317 */ - F19KEY = 0x013e, /* 318 */ - F20KEY = 0x013f, /* 319 */ - F21KEY = 0x0140, /* 320 */ - F22KEY = 0x0141, /* 321 */ - F23KEY = 0x0142, /* 322 */ - F24KEY = 0x0143, /* 323 */ + EVT_ESCKEY = 0x00da, /* 218 */ + EVT_TABKEY = 0x00db, /* 219 */ + EVT_RETKEY = 0x00dc, /* 220 */ + EVT_SPACEKEY = 0x00dd, /* 221 */ + EVT_LINEFEEDKEY = 0x00de, /* 222 */ + EVT_BACKSPACEKEY = 0x00df, /* 223 */ + EVT_DELKEY = 0x00e0, /* 224 */ + EVT_SEMICOLONKEY = 0x00e1, /* 225 */ + EVT_PERIODKEY = 0x00e2, /* 226 */ + EVT_COMMAKEY = 0x00e3, /* 227 */ + EVT_QUOTEKEY = 0x00e4, /* 228 */ + EVT_ACCENTGRAVEKEY = 0x00e5, /* 229 */ + EVT_MINUSKEY = 0x00e6, /* 230 */ + EVT_PLUSKEY = 0x00e7, /* 231 */ + EVT_SLASHKEY = 0x00e8, /* 232 */ + EVT_BACKSLASHKEY = 0x00e9, /* 233 */ + EVT_EQUALKEY = 0x00ea, /* 234 */ + EVT_LEFTBRACKETKEY = 0x00eb, /* 235 */ + EVT_RIGHTBRACKETKEY = 0x00ec, /* 236 */ + + EVT_F1KEY = 0x012c, /* 300 */ + EVT_F2KEY = 0x012d, /* 301 */ + EVT_F3KEY = 0x012e, /* 302 */ + EVT_F4KEY = 0x012f, /* 303 */ + EVT_F5KEY = 0x0130, /* 304 */ + EVT_F6KEY = 0x0131, /* 305 */ + EVT_F7KEY = 0x0132, /* 306 */ + EVT_F8KEY = 0x0133, /* 307 */ + EVT_F9KEY = 0x0134, /* 308 */ + EVT_F10KEY = 0x0135, /* 309 */ + EVT_F11KEY = 0x0136, /* 310 */ + EVT_F12KEY = 0x0137, /* 311 */ + EVT_F13KEY = 0x0138, /* 312 */ + EVT_F14KEY = 0x0139, /* 313 */ + EVT_F15KEY = 0x013a, /* 314 */ + EVT_F16KEY = 0x013b, /* 315 */ + EVT_F17KEY = 0x013c, /* 316 */ + EVT_F18KEY = 0x013d, /* 317 */ + EVT_F19KEY = 0x013e, /* 318 */ + EVT_F20KEY = 0x013f, /* 319 */ + EVT_F21KEY = 0x0140, /* 320 */ + EVT_F22KEY = 0x0141, /* 321 */ + EVT_F23KEY = 0x0142, /* 322 */ + EVT_F24KEY = 0x0143, /* 323 */ /* *** End of keyboard codes. *** */ @@ -362,7 +358,8 @@ enum { /* test whether the event is a modifier key */ #define ISKEYMODIFIER(event_type) \ - (((event_type) >= LEFTCTRLKEY && (event_type) <= LEFTSHIFTKEY) || (event_type) == OSKEY) + (((event_type) >= EVT_LEFTCTRLKEY && (event_type) <= EVT_LEFTSHIFTKEY) || \ + (event_type) == EVT_OSKEY) /* test whether the event is a mouse button */ #define ISMOUSE(event_type) \ |