diff options
| author | Simon Tatham <anakin@pobox.com> | 2005-08-06 10:33:46 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2005-08-06 10:33:46 +0000 |
| commit | 98a9f06a6704192c983f1d40100dd41714331bf2 (patch) | |
| tree | 2bd2ee0284e0c373663f89296fac2abfab37ac7e | |
| parent | 8392232d57b4d1aba82b8005813d39854e8cf74e (diff) | |
| download | puzzles-98a9f06a6704192c983f1d40100dd41714331bf2.zip puzzles-98a9f06a6704192c983f1d40100dd41714331bf2.tar.gz puzzles-98a9f06a6704192c983f1d40100dd41714331bf2.tar.bz2 puzzles-98a9f06a6704192c983f1d40100dd41714331bf2.tar.xz | |
Introduce an environment variable setting (SLANT_SWAP_BUTTONS=yes)
to reverse the effect of the mouse buttons. Gareth has been
complaining about this for days: apparently he finds precisely the
opposite control system intuitive to me.
This is a horrendous hack, and pushes me one step closer to losing
my temper and designing a proper preferences architecture.
[originally from svn r6168]
| -rw-r--r-- | slant.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -1402,6 +1402,29 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds, int v; char buf[80]; + /* + * This is an utterly awful hack which I should really sort out + * by means of a proper configuration mechanism. One Slant + * player has observed that they prefer the mouse buttons to + * function exactly the opposite way round, so here's a + * mechanism for environment-based configuration. I cache the + * result in a global variable - yuck! - to avoid repeated + * lookups. + */ + { + static int swap_buttons = -1; + if (swap_buttons < 0) { + char *env = getenv("SLANT_SWAP_BUTTONS"); + swap_buttons = (env && (env[0] == 'y' || env[0] == 'Y')); + } + if (swap_buttons) { + if (button == LEFT_BUTTON) + button = RIGHT_BUTTON; + else + button = LEFT_BUTTON; + } + } + x = FROMCOORD(x); y = FROMCOORD(y); if (x < 0 || y < 0 || x >= w || y >= h) |