- assert((ui->x == -1) == (ui->y == -1));
- if (ui->x == -1) return NULL;
- assert(state->shared->clues[w*ui->y + ui->x] == 0);
+ if (IS_CURSOR_MOVE(button)) {
+ ui->cur_visible = 1;
+ move_cursor(button, &ui->cur_x, &ui->cur_y, w, h, 0);
+ return "";
+ }
+ if (IS_CURSOR_SELECT(button)) {
+ if (!ui->cur_visible) {
+ ui->cur_visible = 1;
+ return "";
+ }
+ if (!ui->sel) {
+ ui->sel = snewn(w*h, int);
+ memset(ui->sel, 0, w*h*sizeof(int));
+ }
+ if (state->shared->clues[w*ui->cur_y + ui->cur_x] == 0)
+ ui->sel[w*ui->cur_y + ui->cur_x] ^= 1;
+ return "";
+ }