Fix T75047: Number input advanced mode is not working in JP keyboard

Check for special ascii values for number input first so that we can
quickly decide if we should go into advanced mode.

Reviewed By: Bastien
This commit is contained in:
Sebastian Parborg 2020-03-26 12:42:37 +01:00
parent 90e8f94558
commit 08b9b95147
Notes: blender-bot 2023-02-14 10:21:11 +01:00
Referenced by issue #75047, Number input advanced mode is not working in JP keyboard
1 changed files with 15 additions and 15 deletions

View File

@ -340,6 +340,21 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
}
}
#ifdef USE_FAKE_EDIT
/* XXX Hack around keyboards without direct access to '=' nor '*'... */
if (ELEM(event->ascii, '=', '*')) {
if (!(n->flag & NUM_EDIT_FULL)) {
n->flag |= NUM_EDIT_FULL;
n->val_flag[idx] |= NUM_EDITED;
return true;
}
else if (event->ctrl) {
n->flag &= ~NUM_EDIT_FULL;
return true;
}
}
#endif
switch (event->type) {
case EVT_MODAL_MAP:
if (ELEM(event->val, NUM_MODAL_INCREMENT_UP, NUM_MODAL_INCREMENT_DOWN)) {
@ -523,21 +538,6 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
ascii[0] = event->ascii;
}
#ifdef USE_FAKE_EDIT
/* XXX Hack around keyboards without direct access to '=' nor '*'... */
if (ELEM(ascii[0], '=', '*')) {
if (!(n->flag & NUM_EDIT_FULL)) {
n->flag |= NUM_EDIT_FULL;
n->val_flag[idx] |= NUM_EDITED;
return true;
}
else if (event->ctrl) {
n->flag &= ~NUM_EDIT_FULL;
return true;
}
}
#endif
/* Up to this point, if we have a ctrl modifier, skip.
* This allows to still access most of modals' shortcuts even in numinput mode.
*/