aboutsummaryrefslogtreecommitdiff
path: root/cube.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2005-05-12 18:25:57 +0000
committerSimon Tatham <anakin@pobox.com>2005-05-12 18:25:57 +0000
commit68d27f05262b7928b4d755d2e27868cfc51b3007 (patch)
treeaae64cd5bea2dd7c44230cb0ed9d68a76c937395 /cube.c
parent8f1c713735316422cfe041400ccc49999d563d8b (diff)
downloadpuzzles-68d27f05262b7928b4d755d2e27868cfc51b3007.zip
puzzles-68d27f05262b7928b4d755d2e27868cfc51b3007.tar.gz
puzzles-68d27f05262b7928b4d755d2e27868cfc51b3007.tar.bz2
puzzles-68d27f05262b7928b4d755d2e27868cfc51b3007.tar.xz
I've had two complaints that Solo ought to recognise the numeric
keypad. The reason it doesn't is because front ends were carefully translating the numeric keypad into 8-way directional keys for the benefit of Cube. Therefore, a policy change: - front ends process the numeric keypad by sending MOD_NUM_KEYPAD | '3' and similar - front ends running on a platform with Num Lock SHOULD do this _irrespective_ of the state of Num Lock - back ends do whatever they see fit with numeric keypad keys. Result: the numeric keypad now works in Solo, and also works in OS X Cube (which it previously didn't because I forgot to implement that bit of the front end!). [originally from svn r5774]
Diffstat (limited to 'cube.c')
-rw-r--r--cube.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/cube.c b/cube.c
index 82901e5..0933928 100644
--- a/cube.c
+++ b/cube.c
@@ -1017,23 +1017,23 @@ static game_state *make_move(game_state *from, game_ui *ui,
struct solid *poly;
/*
- * All moves are made with the cursor keys.
+ * All moves are made with the cursor keys or numeric keypad.
*/
- if (button == CURSOR_UP)
+ if (button == CURSOR_UP || button == (MOD_NUM_KEYPAD | '8'))
direction = UP;
- else if (button == CURSOR_DOWN)
+ else if (button == CURSOR_DOWN || button == (MOD_NUM_KEYPAD | '2'))
direction = DOWN;
- else if (button == CURSOR_LEFT)
+ else if (button == CURSOR_LEFT || button == (MOD_NUM_KEYPAD | '4'))
direction = LEFT;
- else if (button == CURSOR_RIGHT)
+ else if (button == CURSOR_RIGHT || button == (MOD_NUM_KEYPAD | '6'))
direction = RIGHT;
- else if (button == CURSOR_UP_LEFT)
+ else if (button == (MOD_NUM_KEYPAD | '7'))
direction = UP_LEFT;
- else if (button == CURSOR_DOWN_LEFT)
+ else if (button == (MOD_NUM_KEYPAD | '1'))
direction = DOWN_LEFT;
- else if (button == CURSOR_UP_RIGHT)
+ else if (button == (MOD_NUM_KEYPAD | '9'))
direction = UP_RIGHT;
- else if (button == CURSOR_DOWN_RIGHT)
+ else if (button == (MOD_NUM_KEYPAD | '3'))
direction = DOWN_RIGHT;
else
return NULL;