aboutsummaryrefslogtreecommitdiff
path: root/towers.c
diff options
context:
space:
mode:
Diffstat (limited to 'towers.c')
-rw-r--r--towers.c47
1 files changed, 36 insertions, 11 deletions
diff --git a/towers.c b/towers.c
index 297ada8..0e93c09 100644
--- a/towers.c
+++ b/towers.c
@@ -1174,6 +1174,17 @@ struct game_ui {
* it in just in case.
*/
int three_d;
+
+ /*
+ * User preference option: if the user right-clicks in a square
+ * and presses a number key to add/remove a pencil mark, do we
+ * hide the mouse highlight again afterwards?
+ *
+ * Historically our answer was yes. The Android port prefers no.
+ * There are advantages both ways, depending how much you dislike
+ * the highlight cluttering your view. So it's a preference.
+ */
+ bool pencil_keep_highlight;
};
static void legacy_prefs_override(struct game_ui *ui_out)
@@ -1199,6 +1210,7 @@ static game_ui *new_ui(const game_state *state)
ui->hshow = ui->hcursor = getenv_bool("PUZZLES_SHOW_CURSOR", false);
ui->three_d = true;
+ ui->pencil_keep_highlight = false;
legacy_prefs_override(ui);
return ui;
@@ -1213,24 +1225,30 @@ static config_item *get_prefs(game_ui *ui)
{
config_item *ret;
- ret = snewn(2, config_item);
+ ret = snewn(3, config_item);
- ret[0].name = "Puzzle appearance";
- ret[0].kw = "appearance";
- ret[0].type = C_CHOICES;
- ret[0].u.choices.choicenames = ":2D:3D";
- ret[0].u.choices.choicekws = ":2d:3d";
- ret[0].u.choices.selected = ui->three_d;
+ ret[0].name = "Keep mouse highlight after changing a pencil mark";
+ ret[0].kw = "pencil-keep-highlight";
+ ret[0].type = C_BOOLEAN;
+ ret[0].u.boolean.bval = ui->pencil_keep_highlight;
- ret[1].name = NULL;
- ret[1].type = C_END;
+ ret[1].name = "Puzzle appearance";
+ ret[1].kw = "appearance";
+ ret[1].type = C_CHOICES;
+ ret[1].u.choices.choicenames = ":2D:3D";
+ ret[1].u.choices.choicekws = ":2d:3d";
+ ret[1].u.choices.selected = ui->three_d;
+
+ ret[2].name = NULL;
+ ret[2].type = C_END;
return ret;
}
static void set_prefs(game_ui *ui, const config_item *cfg)
{
- ui->three_d = cfg[0].u.choices.selected;
+ ui->pencil_keep_highlight = cfg[0].u.boolean.bval;
+ ui->three_d = cfg[1].u.choices.selected;
}
static void game_changed_state(game_ui *ui, const game_state *oldstate,
@@ -1550,7 +1568,14 @@ static char *interpret_move(const game_state *state, game_ui *ui,
sprintf(buf, "%c%d,%d,%d",
(char)(ui->hpencil && n > 0 ? 'P' : 'R'), ui->hx, ui->hy, n);
- if (!ui->hcursor) ui->hshow = false;
+ /*
+ * Hide the highlight after a keypress, if it was mouse-
+ * generated. Also, don't hide it if this move has changed
+ * pencil marks and the user preference says not to hide the
+ * highlight in that situation.
+ */
+ if (!ui->hcursor && !(ui->hpencil && ui->pencil_keep_highlight))
+ ui->hshow = false;
return dupstr(buf);
}