Prevented chat start event from disabling alt-enter fullscreen

This commit is contained in:
MysterD 2020-09-15 09:54:04 -07:00
parent 6d89ed5a9f
commit 128b3f2b33

View file

@ -58,7 +58,7 @@ static int keyboard_map_scancode(int scancode) {
return ret; return ret;
} }
static void keyboard_alter_text_input_modifier(int scancode, bool down) { static void keyboard_alter_modifier(int scancode, bool down) {
if (down) { if (down) {
switch (scancode) { switch (scancode) {
case SCANCODE_CTRL1: held_ctrl |= (1 << 0); break; case SCANCODE_CTRL1: held_ctrl |= (1 << 0); break;
@ -81,15 +81,15 @@ static void keyboard_alter_text_input_modifier(int scancode, bool down) {
} }
bool keyboard_on_key_down(int scancode) { bool keyboard_on_key_down(int scancode) {
// alter the held value of modifier keys
keyboard_alter_modifier(scancode, true);
#ifdef DEBUG #ifdef DEBUG
if (!inTextInput) { if (!inTextInput) {
debug_keyboard_on_key_down(scancode); debug_keyboard_on_key_down(scancode);
} }
#endif #endif
if (inTextInput) { if (inTextInput) {
// alter the held value of modifier keys
keyboard_alter_text_input_modifier(scancode, true);
// perform text-input-specific actions // perform text-input-specific actions
switch (scancode) { switch (scancode) {
case SCANCODE_BACKSPACE: case SCANCODE_BACKSPACE:
@ -113,7 +113,7 @@ bool keyboard_on_key_down(int scancode) {
return FALSE; return FALSE;
} }
if (scancode == SCANCODE_ENTER) { if (!held_alt && (scancode == SCANCODE_ENTER)) {
if (sSelectedFileNum != 0) { if (sSelectedFileNum != 0) {
chat_start_input(); chat_start_input();
return FALSE; return FALSE;
@ -127,10 +127,10 @@ bool keyboard_on_key_down(int scancode) {
} }
bool keyboard_on_key_up(int scancode) { bool keyboard_on_key_up(int scancode) {
if (inTextInput) { // alter the held value of modifier keys
// alter the held value of modifier keys keyboard_alter_modifier(scancode, false);
keyboard_alter_text_input_modifier(scancode, false);
if (inTextInput) {
// ignore any key up event if we're in text-input mode // ignore any key up event if we're in text-input mode
return FALSE; return FALSE;
} }