1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

gtk: make Ctrl processing notice if use_ucsoutput is true.

Again in the GDK Broadway backend, where we never get a non-Unicode
translation of any keystroke: when we come to the code that handles
Ctrl+letter (and other symbols), we were basing the Ctrl transform on
output[1], that is, the non-Unicode translation we had so far. But we
didn't have one.

Now we check the use_ucsoutput flag to decide which of output and
ucsoutput to start from, and as a result, Ctrl+keys works again on
Broadway.
This commit is contained in:
Simon Tatham 2020-11-24 20:41:25 +00:00
parent ffce7d8e70
commit 8dfc39bfb4

View File

@ -1674,35 +1674,37 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
* The translations below are in line with X11 policy as far * The translations below are in line with X11 policy as far
* as I know. */ * as I know. */
if ((event->state & GDK_CONTROL_MASK) && end == 2) { if ((event->state & GDK_CONTROL_MASK) && end == 2) {
#ifdef KEY_EVENT_DIAGNOSTICS int orig = use_ucsoutput ? ucsoutput[1] : output[1];
int orig = output[1]; int new = orig;
#endif
if (output[1] >= '3' && output[1] <= '7') { if (new >= '3' && new <= '7') {
/* ^3,...,^7 map to 0x1B,...,0x1F */ /* ^3,...,^7 map to 0x1B,...,0x1F */
output[1] += '\x1B' - '3'; new += '\x1B' - '3';
} else if (output[1] == '2' || output[1] == ' ') { } else if (new == '2' || new == ' ') {
/* ^2 and ^Space are both ^@, i.e. \0 */ /* ^2 and ^Space are both ^@, i.e. \0 */
output[1] = '\0'; new = '\0';
} else if (output[1] == '8') { } else if (new == '8') {
/* ^8 is DEL */ /* ^8 is DEL */
output[1] = '\x7F'; new = '\x7F';
} else if (output[1] == '/') { } else if (new == '/') {
/* ^/ is the same as ^_ */ /* ^/ is the same as ^_ */
output[1] = '\x1F'; new = '\x1F';
} else if (output[1] >= 0x40 && output[1] < 0x7F) { } else if (new >= 0x40 && new < 0x7F) {
/* Everything anywhere near the alphabetics just gets /* Everything anywhere near the alphabetics just gets
* masked. */ * masked. */
output[1] &= 0x1F; new &= 0x1F;
} }
/* Anything else, e.g. '0', is unchanged. */ /* Anything else, e.g. '0', is unchanged. */
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
if (orig == output[1]) if (orig == new) {
debug(" - manual Ctrl key handling did nothing\n"); debug(" - manual Ctrl key handling did nothing\n");
else } else {
debug(" - manual Ctrl key handling: %02x -> %02x\n", debug(" - manual Ctrl key handling: %02x -> %02x\n",
(unsigned)orig, (unsigned)output[1]); (unsigned)orig, (unsigned)new);
output[1] = new;
use_ucsoutput = false;
}
#endif #endif
} }