Merge branch 'rigatoni' into 'next'

Fix being unable to use CTRL keyboard shortcuts on menu input fields (resolves #1338)

Closes #1338

See merge request STJr/SRB2!2580
This commit is contained in:
LJ Sonic 2025-01-08 12:52:49 +00:00
commit 41549005ed

View file

@ -3399,6 +3399,13 @@ boolean M_Responder(event_t *ev)
// Handle menuitems which need a specific key handling // Handle menuitems which need a specific key handling
if (routine && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_KEYHANDLER) if (routine && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_KEYHANDLER)
{ {
// block text input if ctrl is held, to allow using ctrl+c ctrl+v and ctrl+x
if (ctrldown)
{
routine(ch);
return true;
}
// ignore ev_keydown events if the key maps to a character, since // ignore ev_keydown events if the key maps to a character, since
// the ev_text event will follow immediately after in that case. // the ev_text event will follow immediately after in that case.
if (ev->type == ev_keydown && ((ch >= 32 && ch <= 127) || (ch >= KEY_KEYPAD7 && ch <= KEY_KPADDEL))) if (ev->type == ev_keydown && ((ch >= 32 && ch <= 127) || (ch >= KEY_KEYPAD7 && ch <= KEY_KPADDEL)))
@ -12116,8 +12123,7 @@ static void M_HandleConnectIP(INT32 choice)
if ( ctrldown ) { if ( ctrldown ) {
switch (choice) { switch (choice) {
case 'v': case 'v': // ctrl+v, pasting
case 'V': // ctrl+v, pasting
{ {
const char *paste = I_ClipboardPaste(); const char *paste = I_ClipboardPaste();
@ -12130,8 +12136,7 @@ static void M_HandleConnectIP(INT32 choice)
break; break;
} }
case KEY_INS: case KEY_INS:
case 'c': case 'c': // ctrl+c, ctrl+insert, copying
case 'C': // ctrl+c, ctrl+insert, copying
if (l != 0) // Don't replace the clipboard without any text if (l != 0) // Don't replace the clipboard without any text
{ {
I_ClipboardCopy(setupm_ip, l); I_ClipboardCopy(setupm_ip, l);
@ -12139,8 +12144,7 @@ static void M_HandleConnectIP(INT32 choice)
} }
break; break;
case 'x': case 'x': // ctrl+x, cutting
case 'X': // ctrl+x, cutting
if (l != 0) // Don't replace the clipboard without any text if (l != 0) // Don't replace the clipboard without any text
{ {
I_ClipboardCopy(setupm_ip, l); I_ClipboardCopy(setupm_ip, l);