Hopefully definitively fix the "enter the advanced numinput mode" issue.
Hack around event code and check against ascii code, this way keyboards with "complex" access to '=' and '*' are still able to toggle numinput modes.
This commit is contained in:
parent
d09f2ed322
commit
17d2e6422c
Notes:
blender-bot
2023-02-14 11:16:58 +01:00
Referenced by issue #38662, Change modal number input to press key before activating expressions Referenced by issue #38370, Ubuntu 14.04 opencolorio segfaults blender on parsing colormanagement/config.ocio
|
@ -339,17 +339,13 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
|
|||
utf8_buf = ascii;
|
||||
break;
|
||||
case EQUALKEY:
|
||||
/* XXX Advanced mode toggle, hack around keyboards without direct access to '=' nor '*'... */
|
||||
ascii[0] = '=';
|
||||
break;
|
||||
case PADASTERKEY:
|
||||
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;
|
||||
}
|
||||
/* fall-through */
|
||||
/* XXX Advanced mode toggle, hack around keyboards without direct access to '=' nor '*'... */
|
||||
ascii[0] = '*';
|
||||
break;
|
||||
case PADMINUS:
|
||||
case MINUSKEY:
|
||||
if (event->ctrl || !(n->flag & NUM_EDIT_FULL)) {
|
||||
|
@ -402,6 +398,19 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
|
|||
break;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
||||
if (utf8_buf && !utf8_buf[0] && ascii[0]) {
|
||||
/* Fallback to ascii. */
|
||||
utf8_buf = ascii;
|
||||
|
|
Loading…
Reference in New Issue