mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
Jonas Koelker points out that the backspace key didn't work in GTK
Guess, because Guess expected ^H whereas GTK generated ^?. Other puzzles that use Backspace do it by being prepared to see either, which seems wasteful. Now the midend normalises both into ^H, so front ends can generate whichever they like while puzzles can safely just look for ^H. [originally from svn r8786]
This commit is contained in:
@ -1097,7 +1097,6 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
|
|||||||
case '\r':
|
case '\r':
|
||||||
case '\n':
|
case '\n':
|
||||||
case '\b':
|
case '\b':
|
||||||
case '\177':
|
|
||||||
button = 0;
|
button = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
9
midend.c
9
midend.c
@ -752,6 +752,15 @@ int midend_process_key(midend *me, int x, int y, int button)
|
|||||||
if (button == ' ')
|
if (button == ' ')
|
||||||
button = CURSOR_SELECT2;
|
button = CURSOR_SELECT2;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Normalise both backspace characters (8 and 127) to \b. Easier
|
||||||
|
* to do this once, here, than to require all front ends to
|
||||||
|
* carefully generate the same one - now each front end can
|
||||||
|
* generate whichever is easiest.
|
||||||
|
*/
|
||||||
|
if (button == '\177')
|
||||||
|
button = '\b';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now send on the event we originally received.
|
* Now send on the event we originally received.
|
||||||
*/
|
*/
|
||||||
|
4
solo.c
4
solo.c
@ -4551,13 +4551,13 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
|
|||||||
((button >= '0' && button <= '9' && button - '0' <= cr) ||
|
((button >= '0' && button <= '9' && button - '0' <= cr) ||
|
||||||
(button >= 'a' && button <= 'z' && button - 'a' + 10 <= cr) ||
|
(button >= 'a' && button <= 'z' && button - 'a' + 10 <= cr) ||
|
||||||
(button >= 'A' && button <= 'Z' && button - 'A' + 10 <= cr) ||
|
(button >= 'A' && button <= 'Z' && button - 'A' + 10 <= cr) ||
|
||||||
button == CURSOR_SELECT2 || button == '\010' || button == '\177')) {
|
button == CURSOR_SELECT2 || button == '\b')) {
|
||||||
int n = button - '0';
|
int n = button - '0';
|
||||||
if (button >= 'A' && button <= 'Z')
|
if (button >= 'A' && button <= 'Z')
|
||||||
n = button - 'A' + 10;
|
n = button - 'A' + 10;
|
||||||
if (button >= 'a' && button <= 'z')
|
if (button >= 'a' && button <= 'z')
|
||||||
n = button - 'a' + 10;
|
n = button - 'a' + 10;
|
||||||
if (button == CURSOR_SELECT2 || button == '\010' || button == '\177')
|
if (button == CURSOR_SELECT2 || button == '\b')
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -392,7 +392,7 @@ static char n2c(digit n, int order) {
|
|||||||
static int c2n(int c, int order) {
|
static int c2n(int c, int order) {
|
||||||
if (c < 0 || c > 0xff)
|
if (c < 0 || c > 0xff)
|
||||||
return -1;
|
return -1;
|
||||||
if (c == ' ' || c == '\010' || c == '\177')
|
if (c == ' ' || c == '\b')
|
||||||
return 0;
|
return 0;
|
||||||
if (order < 10) {
|
if (order < 10) {
|
||||||
if (c >= '1' && c <= '9')
|
if (c >= '1' && c <= '9')
|
||||||
|
Reference in New Issue
Block a user