aboutsummaryrefslogtreecommitdiff
path: root/unfinished
diff options
context:
space:
mode:
Diffstat (limited to 'unfinished')
-rw-r--r--unfinished/group.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/unfinished/group.c b/unfinished/group.c
index 8eac96a..c622e9a 100644
--- a/unfinished/group.c
+++ b/unfinished/group.c
@@ -1252,6 +1252,17 @@ struct game_ui {
int dragnum; /* element being dragged */
int dragpos; /* its current position */
int edgepos;
+
+ /*
+ * User preference option: if the user right-clicks in a square
+ * and presses a letter 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 game_ui *new_ui(const game_state *state)
@@ -1264,6 +1275,8 @@ static game_ui *new_ui(const game_state *state)
ui->hcursor = false;
ui->drag = 0;
+ ui->pencil_keep_highlight = false;
+
return ui;
}
@@ -1272,6 +1285,28 @@ static void free_ui(game_ui *ui)
sfree(ui);
}
+static config_item *get_prefs(game_ui *ui)
+{
+ config_item *ret;
+
+ ret = snewn(2, config_item);
+
+ 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;
+
+ return ret;
+}
+
+static void set_prefs(game_ui *ui, const config_item *cfg)
+{
+ ui->pencil_keep_highlight = cfg[0].u.boolean.bval;
+}
+
static void game_changed_state(game_ui *ui, const game_state *oldstate,
const game_state *newstate)
{
@@ -1676,7 +1711,14 @@ static char *interpret_move(const game_state *state, game_ui *ui,
}
movebuf = sresize(movebuf, buflen+1, char);
- 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 movebuf;
}
@@ -2323,7 +2365,7 @@ const struct game thegame = {
free_game,
true, solve_game,
true, game_can_format_as_text_now, game_text_format,
- NULL, NULL, /* get_prefs, set_prefs */
+ get_prefs, set_prefs,
new_ui,
free_ui,
NULL, /* encode_ui */