shithub: puzzles

Download patch

ref: a9af3fda1d784c42d486a019a0a4e947f762af70
parent: b08c13f5f47a8541961fc150142523b061d3d9c6
author: Ben Harris <bjh21@bjh21.me.uk>
date: Sun Jun 4 14:42:58 EDT 2023

Rename UI_UPDATE as MOVE_UI_UPDATE

All the other constants named UI_* are special key names that can be
passed to midend_process_key(), but UI_UPDATE is a special return value
from the back-end interpret_move() function instead.  This renaming
makes the distinction clear and provides a naming convention for future
special return values from interpret_move().

--- a/blackbox.c
+++ b/blackbox.c
@@ -939,7 +939,7 @@
         ui->cur_x = cx;
         ui->cur_y = cy;
         ui->cur_visible = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (button == LEFT_BUTTON || button == RIGHT_BUTTON) {
@@ -949,7 +949,7 @@
         wouldflash = 1;
     } else if (button == LEFT_RELEASE) {
         ui->flash_laser = 0;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     } else if (IS_CURSOR_SELECT(button)) {
         if (ui->cur_visible) {
             gx = ui->cur_x;
@@ -958,7 +958,7 @@
             wouldflash = 2;
         } else {
             ui->cur_visible = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
         /* Fix up 'button' for the below logic. */
         if (button == CURSOR_SELECT2) button = RIGHT_BUTTON;
@@ -1007,9 +1007,9 @@
 	    return nullret;
         ui->flash_laserno = rangeno;
         ui->flash_laser = wouldflash;
-        nullret = UI_UPDATE;
+        nullret = MOVE_UI_UPDATE;
         if (state->exits[rangeno] != LASER_EMPTY)
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         sprintf(buf, "F%d", rangeno);
         break;
 
--- a/bridges.c
+++ b/bridges.c
@@ -2126,7 +2126,7 @@
     ui->dragx_src = ui->dragy_src = -1;
     ui->dragx_dst = ui->dragy_dst = -1;
     ui->dragging = false;
-    return UI_UPDATE;
+    return MOVE_UI_UPDATE;
 }
 
 static game_ui *new_ui(const game_state *state)
@@ -2333,7 +2333,7 @@
     /*debug(("update_drag src (%d,%d) d(%d,%d) dst (%d,%d)\n",
            ui->dragx_src, ui->dragy_src, dx, dy,
            ui->dragx_dst, ui->dragy_dst));*/
-    return UI_UPDATE;
+    return MOVE_UI_UPDATE;
 }
 
 static char *finish_drag(const game_state *state, game_ui *ui)
@@ -2376,7 +2376,7 @@
         if (ggrid & G_ISLAND) {
             ui->dragx_src = gx;
             ui->dragy_src = gy;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         } else
             return ui_cancel_drag(ui);
     } else if (button == LEFT_DRAG || button == RIGHT_DRAG) {
@@ -2390,7 +2390,7 @@
             /* cancel a drag when we go back to the starting point */
             ui->dragx_dst = -1;
             ui->dragy_dst = -1;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
     } else if (button == LEFT_RELEASE || button == RIGHT_RELEASE) {
         if (ui->dragging) {
@@ -2477,7 +2477,7 @@
 
                     if (!dingrid) break;
                 }
-                if (!oingrid) return UI_UPDATE;
+                if (!oingrid) return MOVE_UI_UPDATE;
             }
             /* not reached */
 
@@ -2484,12 +2484,12 @@
 found:
             ui->cur_x = nx;
             ui->cur_y = ny;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
     } else if (IS_CURSOR_SELECT(button)) {
         if (!ui->cur_visible) {
             ui->cur_visible = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
         if (ui->dragging || button == CURSOR_SELECT2) {
             ui_cancel_drag(ui);
@@ -2497,7 +2497,7 @@
                 sprintf(buf, "M%d,%d", ui->cur_x, ui->cur_y);
                 return dupstr(buf);
             } else
-                return UI_UPDATE;
+                return MOVE_UI_UPDATE;
         } else {
             grid_type v = GRID(state, ui->cur_x, ui->cur_y);
             if (v & G_ISLAND) {
@@ -2506,7 +2506,7 @@
                 ui->dragy_src = ui->cur_y;
                 ui->dragx_dst = ui->dragy_dst = -1;
                 ui->drag_is_noline = (button == CURSOR_SELECT2);
-                return UI_UPDATE;
+                return MOVE_UI_UPDATE;
             }
         }
     } else if ((button >= '0' && button <= '9') ||
@@ -2524,7 +2524,7 @@
 
         if (!ui->cur_visible) {
             ui->cur_visible = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
 
         for (i = 0; i < state->n_islands; ++i) {
@@ -2551,12 +2551,12 @@
         if (best_x != -1 && best_y != -1) {
             ui->cur_x = best_x;
             ui->cur_y = best_y;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         } else
             return NULL;
     } else if (button == 'g' || button == 'G') {
         ui->show_hints = !ui->show_hints;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     return NULL;
--- a/devel.but
+++ b/devel.but
@@ -1062,7 +1062,7 @@
 in response to the input event; the puzzle was not interested in it
 at all.
 
-\b Returning the special value \cw{UI_UPDATE} indicates that the input
+\b Returning the special value \cw{MOVE_UI_UPDATE} indicates that the input
 event has resulted in a change being made to the \c{game_ui} which
 will require a redraw of the game window, but that no actual \e{move}
 was made (i.e. no new \c{game_state} needs to be created).
@@ -1080,7 +1080,7 @@
 
 The return value from \cw{interpret_move()} is expected to be
 dynamically allocated if and only if it is not either \cw{NULL}
-\e{or} the special string constant \c{UI_UPDATE}.
+\e{or} the special string constant \c{MOVE_UI_UPDATE}.
 
 After this function is called, the back end is permitted to rely on
 some subsequent operations happening in sequence:
@@ -5804,7 +5804,7 @@
 \b Put cursor position fields in the \c{game_ui}.
 
 \b \cw{interpret_move()} responds to arrow keys by modifying the
-cursor position fields and returning \cw{UI_UPDATE}.
+cursor position fields and returning \cw{MOVE_UI_UPDATE}.
 
 \b \cw{interpret_move()} responds to some other button \dash either
 \cw{CURSOR_SELECT} or some more specific thing like a number key \dash
--- a/dominosa.c
+++ b/dominosa.c
@@ -2834,7 +2834,7 @@
 
         move_cursor(button, &ui->cur_x, &ui->cur_y, 2*w-1, 2*h-1, false);
 
-	return UI_UPDATE;
+	return MOVE_UI_UPDATE;
     } else if (IS_CURSOR_SELECT(button)) {
         int d1, d2;
 
@@ -2867,7 +2867,7 @@
         } else {
             return NULL;
         }
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     return NULL;
--- a/filling.c
+++ b/filling.c
@@ -1493,7 +1493,7 @@
                 ui->sel[w*ty+tx] = true;
         }
         ui->cur_visible = false;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (IS_CURSOR_MOVE(button)) {
@@ -1500,15 +1500,15 @@
         ui->cur_visible = true;
         move_cursor(button, &ui->cur_x, &ui->cur_y, w, h, false);
 	if (ui->keydragging) goto select_square;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
     if (button == CURSOR_SELECT) {
         if (!ui->cur_visible) {
             ui->cur_visible = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
 	ui->keydragging = !ui->keydragging;
-	if (!ui->keydragging) return UI_UPDATE;
+	if (!ui->keydragging) return MOVE_UI_UPDATE;
 
       select_square:
         if (!ui->sel) {
@@ -1517,12 +1517,12 @@
         }
 	if (!state->shared->clues[w*ui->cur_y + ui->cur_x])
 	    ui->sel[w*ui->cur_y + ui->cur_x] = true;
-	return UI_UPDATE;
+	return MOVE_UI_UPDATE;
     }
     if (button == CURSOR_SELECT2) {
 	if (!ui->cur_visible) {
 	    ui->cur_visible = true;
-	    return UI_UPDATE;
+	    return MOVE_UI_UPDATE;
 	}
         if (!ui->sel) {
             ui->sel = snewn(w*h, bool);
@@ -1536,7 +1536,7 @@
 	    sfree(ui->sel);
 	    ui->sel = NULL;
 	}
-	return UI_UPDATE;
+	return MOVE_UI_UPDATE;
     }
 
     if (button == '\b' || button == 27) {
@@ -1543,7 +1543,7 @@
 	sfree(ui->sel);
 	ui->sel = NULL;
 	ui->keydragging = false;
-	return UI_UPDATE;
+	return MOVE_UI_UPDATE;
     }
 
     if (button < '0' || button > '9') return NULL;
@@ -1578,7 +1578,7 @@
     sfree(ui->sel);
     ui->sel = NULL;
     /* Need to update UI at least, as we cleared the selection */
-    return move ? move : UI_UPDATE;
+    return move ? move : MOVE_UI_UPDATE;
 }
 
 static game_state *execute_move(const game_state *state, const char *move)
--- a/flip.c
+++ b/flip.c
@@ -961,7 +961,7 @@
             tx = ui->cx; ty = ui->cy;
             ui->cdraw = true;
         }
-        nullret = UI_UPDATE;
+        nullret = MOVE_UI_UPDATE;
 
         if (tx >= 0 && tx < w && ty >= 0 && ty < h) {
             /*
@@ -996,7 +996,7 @@
         ui->cx = min(max(ui->cx, 0), state->w - 1);
         ui->cy = min(max(ui->cy, 0), state->h - 1);
         ui->cdraw = true;
-        nullret = UI_UPDATE;
+        nullret = MOVE_UI_UPDATE;
     }
 
     return nullret;
--- a/flood.c
+++ b/flood.c
@@ -838,19 +838,19 @@
     } else if (button == CURSOR_LEFT && ui->cx > 0) {
         ui->cx--;
         ui->cursor_visible = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     } else if (button == CURSOR_RIGHT && ui->cx+1 < w) {
         ui->cx++;
         ui->cursor_visible = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     } else if (button == CURSOR_UP && ui->cy > 0) {
         ui->cy--;
         ui->cursor_visible = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     } else if (button == CURSOR_DOWN && ui->cy+1 < h) {
         ui->cy++;
         ui->cursor_visible = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     } else if (button == CURSOR_SELECT) {
         tx = ui->cx;
         ty = ui->cy;
--- a/galaxies.c
+++ b/galaxies.c
@@ -2963,13 +2963,13 @@
             ui->dy = y;
             ui->dotx = dot->x;
             ui->doty = dot->y;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
     } else if (button == RIGHT_DRAG && ui->dragging) {
         /* just move the drag coords. */
         ui->dx = x;
         ui->dy = y;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     } else if (button == RIGHT_RELEASE && ui->dragging) {
         /*
          * Drags are always targeted at a single square.
@@ -2984,7 +2984,7 @@
 	 * is a null move; just update the ui and finish.
 	 */
 	if (px == ui->srcx && py == ui->srcy)
-	    return UI_UPDATE;
+	    return MOVE_UI_UPDATE;
 
 	/*
 	 * Otherwise, we remove the arrow from its starting
@@ -3018,7 +3018,7 @@
 	if (buf[0])
 	    return dupstr(buf);
 	else
-	    return UI_UPDATE;
+	    return MOVE_UI_UPDATE;
     } else if (IS_CURSOR_MOVE(button)) {
         move_cursor(button, &ui->cur_x, &ui->cur_y, state->sx-1, state->sy-1, false);
         if (ui->cur_x < 1) ui->cur_x = 1;
@@ -3028,11 +3028,11 @@
             ui->dx = SCOORD(ui->cur_x);
             ui->dy = SCOORD(ui->cur_y);
         }
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     } else if (IS_CURSOR_SELECT(button)) {
         if (!ui->cur_visible) {
             ui->cur_visible = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
         sp = &SPACE(state, ui->cur_x, ui->cur_y);
         if (ui->dragging) {
@@ -3044,7 +3044,7 @@
             ui->dy = SCOORD(ui->cur_y);
             ui->dotx = ui->srcx = ui->cur_x;
             ui->doty = ui->srcy = ui->cur_y;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         } else if (sp->flags & F_TILE_ASSOC) {
             assert(sp->type == s_tile);
             ui->dragging = true;
@@ -3054,7 +3054,7 @@
             ui->doty = sp->doty;
             ui->srcx = ui->cur_x;
             ui->srcy = ui->cur_y;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         } else if (sp->type == s_edge &&
                    edge_placement_legal(state, ui->cur_x, ui->cur_y)) {
             sprintf(buf, "E%d,%d", ui->cur_x, ui->cur_y);
--- a/guess.c
+++ b/guess.c
@@ -814,7 +814,7 @@
      */
     if (button == 'l' || button == 'L') {
         ui->show_labels = !ui->show_labels;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (from->solved) return NULL;
@@ -871,13 +871,13 @@
             ui->drag_y = y;
             debug(("Start dragging, col = %d, (%d,%d)",
                    ui->drag_col, ui->drag_x, ui->drag_y));
-            ret = UI_UPDATE;
+            ret = MOVE_UI_UPDATE;
         }
     } else if (button == LEFT_DRAG && ui->drag_col) {
         ui->drag_x = x;
         ui->drag_y = y;
         debug(("Keep dragging, (%d,%d)", ui->drag_x, ui->drag_y));
-        ret = UI_UPDATE;
+        ret = MOVE_UI_UPDATE;
     } else if (button == LEFT_RELEASE && ui->drag_col) {
         if (over_guess > -1) {
             debug(("Dropping colour %d onto guess peg %d",
@@ -894,13 +894,13 @@
         ui->drag_opeg = -1;
         ui->display_cur = false;
         debug(("Stop dragging."));
-        ret = UI_UPDATE;
+        ret = MOVE_UI_UPDATE;
     } else if (button == RIGHT_BUTTON) {
         if (over_guess > -1) {
             /* we use ths feedback in the game_ui to signify
              * 'carry this peg to the next guess as well'. */
             ui->holds[over_guess] ^= 1;
-            ret = UI_UPDATE;
+            ret = MOVE_UI_UPDATE;
         }
     } else if (button == LEFT_RELEASE && over_hint && ui->markable) {
         /* NB this won't trigger if on the end of a drag; that's on
@@ -915,10 +915,10 @@
             ui->colour_cur++;
         if (button == CURSOR_UP && ui->colour_cur > 0)
             ui->colour_cur--;
-        ret = UI_UPDATE;
+        ret = MOVE_UI_UPDATE;
     } else if (button == 'h' || button == 'H' || button == '?') {
         compute_hint(from, ui);
-        ret = UI_UPDATE;
+        ret = MOVE_UI_UPDATE;
     } else if (button == CURSOR_LEFT || button == CURSOR_RIGHT) {
         int maxcur = from->params.npegs;
         if (ui->markable) maxcur++;
@@ -928,7 +928,7 @@
             ui->peg_cur++;
         if (button == CURSOR_LEFT && ui->peg_cur > 0)
             ui->peg_cur--;
-        ret = UI_UPDATE;
+        ret = MOVE_UI_UPDATE;
     } else if (button == CURSOR_SELECT) {
         ui->display_cur = true;
         if (ui->peg_cur == from->params.npegs) {
@@ -935,7 +935,7 @@
             ret = encode_move(from, ui);
         } else {
             set_peg(&from->params, ui, ui->peg_cur, ui->colour_cur+1);
-            ret = UI_UPDATE;
+            ret = MOVE_UI_UPDATE;
         }
     } else if (((button >= '1' && button <= '0' + from->params.ncolours) ||
                 (button == '0' && from->params.ncolours == 10)) &&
@@ -946,17 +946,17 @@
                 button == '0' ? 10 : button - '0');
         if (ui->peg_cur + 1 < from->params.npegs + ui->markable)
             ui->peg_cur++;
-        ret = UI_UPDATE;
+        ret = MOVE_UI_UPDATE;
     } else if (button == 'D' || button == 'd' || button == '\b') {
         ui->display_cur = true;
         set_peg(&from->params, ui, ui->peg_cur, 0);
-        ret = UI_UPDATE;
+        ret = MOVE_UI_UPDATE;
     } else if (button == CURSOR_SELECT2) {
         if (ui->peg_cur == from->params.npegs)
             return NULL;
         ui->display_cur = true;
         ui->holds[ui->peg_cur] ^= 1;
-        ret = UI_UPDATE;
+        ret = MOVE_UI_UPDATE;
     }
     return ret;
 }
--- a/keen.c
+++ b/keen.c
@@ -1724,7 +1724,7 @@
                 ui->hpencil = false;
             }
             ui->hcursor = false;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
         if (button == RIGHT_BUTTON) {
             /*
@@ -1744,7 +1744,7 @@
                 ui->hshow = false;
             }
             ui->hcursor = false;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
     }
     if (IS_CURSOR_MOVE(button)) {
@@ -1751,13 +1751,13 @@
         move_cursor(button, &ui->hx, &ui->hy, w, w, false);
         ui->hshow = true;
         ui->hcursor = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
     if (ui->hshow &&
         (button == CURSOR_SELECT)) {
         ui->hpencil ^= 1;
         ui->hcursor = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (ui->hshow &&
@@ -1783,7 +1783,7 @@
             /* ... expect to remove the cursor in mouse mode. */
             if (!ui->hcursor) {
                 ui->hshow = false;
-                return UI_UPDATE;
+                return MOVE_UI_UPDATE;
             }
             return NULL;
         }
--- a/lightup.c
+++ b/lightup.c
@@ -1954,7 +1954,7 @@
     enum { NONE, FLIP_LIGHT, FLIP_IMPOSSIBLE } action = NONE;
     int cx = -1, cy = -1;
     unsigned int flags;
-    char buf[80], *nullret = UI_UPDATE, *empty = UI_UPDATE, c;
+    char buf[80], *nullret = MOVE_UI_UPDATE, *empty = MOVE_UI_UPDATE, c;
 
     if (button == LEFT_BUTTON || button == RIGHT_BUTTON) {
         if (ui->cur_visible)
--- a/magnets.c
+++ b/magnets.c
@@ -1845,11 +1845,11 @@
     if (IS_CURSOR_MOVE(button)) {
         move_cursor(button, &ui->cur_x, &ui->cur_y, state->w, state->h, false);
         ui->cur_visible = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     } else if (IS_CURSOR_SELECT(button)) {
         if (!ui->cur_visible) {
             ui->cur_visible = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
         action = (button == CURSOR_SELECT) ? CYCLE_MAGNET : CYCLE_NEUTRAL;
         gx = ui->cur_x;
@@ -1858,7 +1858,7 @@
                (button == LEFT_BUTTON || button == RIGHT_BUTTON)) {
         if (ui->cur_visible) {
             ui->cur_visible = false;
-            nullret = UI_UPDATE;
+            nullret = MOVE_UI_UPDATE;
         }
         action = (button == LEFT_BUTTON) ? CYCLE_MAGNET : CYCLE_NEUTRAL;
     } else if (button == LEFT_BUTTON && is_clue(state, gx, gy)) {
--- a/map.c
+++ b/map.c
@@ -2481,7 +2481,7 @@
      */
     if (button == 'l' || button == 'L') {
         ui->show_numbers = !ui->show_numbers;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (IS_CURSOR_MOVE(button)) {
@@ -2490,12 +2490,12 @@
         ui->cur_visible = true;
         ui->cur_moved = true;
         ui->cur_lastmove = button;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
     if (IS_CURSOR_SELECT(button)) {
         if (!ui->cur_visible) {
             ui->cur_visible = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
         if (ui->drag_colour == -2) { /* not currently cursor-dragging, start. */
             int r = region_from_ui_cursor(state, ui);
@@ -2507,7 +2507,7 @@
                 ui->drag_pencil = 0;
             }
             ui->cur_moved = false;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         } else { /* currently cursor-dragging; drop the colour in the new region. */
             alt_button = (button == CURSOR_SELECT2);
             /* Double-select removes current colour. */
@@ -2532,7 +2532,7 @@
         ui->dragx = x;
         ui->dragy = y;
         ui->cur_visible = false;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if ((button == LEFT_DRAG || button == RIGHT_DRAG) &&
@@ -2539,7 +2539,7 @@
         ui->drag_colour > -2) {
         ui->dragx = x;
         ui->dragy = y;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if ((button == LEFT_RELEASE || button == RIGHT_RELEASE) &&
@@ -2564,18 +2564,18 @@
         ui->drag_colour = -2;
 
 	if (r < 0)
-            return UI_UPDATE;          /* drag into border; do nothing else */
+            return MOVE_UI_UPDATE;          /* drag into border; do nothing else */
 
 	if (state->map->immutable[r])
-	    return UI_UPDATE;          /* can't change this region */
+	    return MOVE_UI_UPDATE;          /* can't change this region */
 
         if (state->colouring[r] == c && state->pencil[r] == p)
-            return UI_UPDATE;          /* don't _need_ to change this region */
+            return MOVE_UI_UPDATE;          /* don't _need_ to change this region */
 
 	if (alt_button) {
 	    if (state->colouring[r] >= 0) {
 		/* Can't pencil on a coloured region */
-		return UI_UPDATE;
+		return MOVE_UI_UPDATE;
 	    } else if (c >= 0) {
 		/* Right-dragging from colour to blank toggles one pencil */
 		p = state->pencil[r] ^ (1 << c);
--- a/midend.c
+++ b/midend.c
@@ -1027,7 +1027,7 @@
 	    goto done;
     } else {
         *handled = true;
-	if (movestr == UI_UPDATE)
+	if (movestr == MOVE_UI_UPDATE)
 	    s = me->states[me->statepos-1].state;
 	else {
 	    assert_printable_ascii(movestr);
@@ -2039,7 +2039,7 @@
     movestr = me->ourgame->solve(me->states[0].state,
 				 me->states[me->statepos-1].state,
 				 me->aux_info, &msg);
-    assert(movestr != UI_UPDATE);
+    assert(movestr != MOVE_UI_UPDATE);
     if (!movestr) {
 	if (!msg)
 	    msg = "Solve operation failed";   /* _shouldn't_ happen, but can */
--- a/mines.c
+++ b/mines.c
@@ -2425,7 +2425,7 @@
     if (IS_CURSOR_MOVE(button)) {
         move_cursor(button, &ui->cur_x, &ui->cur_y, from->w, from->h, false);
         ui->cur_visible = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
     if (IS_CURSOR_SELECT(button)) {
         int v = from->grid[ui->cur_y * from->w + ui->cur_x];
@@ -2432,7 +2432,7 @@
 
         if (!ui->cur_visible) {
             ui->cur_visible = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
         if (button == CURSOR_SELECT2) {
             /* As for RIGHT_BUTTON; only works on covered square. */
@@ -2472,7 +2472,7 @@
 	else if (button == MIDDLE_BUTTON)
 	    ui->validradius = 1;
         ui->cur_visible = false;
-	return UI_UPDATE;
+	return MOVE_UI_UPDATE;
     }
 
     if (button == RIGHT_BUTTON) {
@@ -2500,10 +2500,10 @@
 
 	/*
 	 * At this stage we must never return NULL: we have adjusted
-	 * the ui, so at worst we return UI_UPDATE.
+	 * the ui, so at worst we return MOVE_UI_UPDATE.
 	 */
 	if (cx < 0 || cx >= from->w || cy < 0 || cy >= from->h)
-	    return UI_UPDATE;
+	    return MOVE_UI_UPDATE;
 
 	/*
 	 * Left-clicking on a covered square opens a tile. Not
@@ -2581,7 +2581,7 @@
 	    }
 	}
 
-	return UI_UPDATE;
+	return MOVE_UI_UPDATE;
     }
 }
 
--- a/misc.c
+++ b/misc.c
@@ -15,7 +15,7 @@
 
 #include "puzzles.h"
 
-char UI_UPDATE[] = "";
+char MOVE_UI_UPDATE[] = "";
 
 void free_cfg(config_item *cfg)
 {
--- a/mosaic.c
+++ b/mosaic.c
@@ -1194,13 +1194,13 @@
         move_cursor(button, &ui->cur_x, &ui->cur_y, state->width,
                     state->height, false);
         ui->cur_visible = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     } else if (IS_CURSOR_SELECT(button)) {
         if (!ui->cur_visible) {
             ui->cur_x = 0;
             ui->cur_y = 0;
             ui->cur_visible = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
 
         if (button == CURSOR_SELECT2) {
--- a/net.c
+++ b/net.c
@@ -2161,7 +2161,7 @@
 
 	if (ui->cur_visible) {
 	    ui->cur_visible = false;
-	    nullret = UI_UPDATE;
+	    nullret = MOVE_UI_UPDATE;
 	}
 
 	/*
@@ -2401,7 +2401,7 @@
             OFFSET(ui->cur_x, ui->cur_y, ui->cur_x, ui->cur_y, dir, state);
             ui->cur_visible = true;
         }
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     } else {
 	return NULL;
     }
--- a/netslide.c
+++ b/netslide.c
@@ -1073,7 +1073,7 @@
         }
 
         ui->cur_visible = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (button == LEFT_BUTTON || button == RIGHT_BUTTON) {
@@ -1087,7 +1087,7 @@
         } else {
             /* 'click' when cursor is invisible just makes cursor visible. */
             ui->cur_visible = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
     } else
         return NULL;
--- a/palisade.c
+++ b/palisade.c
@@ -993,7 +993,7 @@
                           ui->x, ui->y, flag, x, y, newflag);
         } else {
             move_cursor(button, &ui->x, &ui->y, w, h, false);
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
     }
 
--- a/pattern.c
+++ b/pattern.c
@@ -1336,7 +1336,7 @@
         ui->drag_start_y = ui->drag_end_y = y;
         ui->cur_visible = false;
 
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (ui->dragging && button == ui->drag) {
@@ -1365,7 +1365,7 @@
         ui->drag_end_x = x;
         ui->drag_end_y = y;
 
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (ui->dragging && button == ui->release) {
@@ -1393,7 +1393,7 @@
 		    x1, y1, x2-x1+1, y2-y1+1);
 	    return dupstr(buf);
         } else
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
     }
 
     if (IS_CURSOR_MOVE(button)) {
@@ -1401,12 +1401,12 @@
 	char buf[80];
         move_cursor(button, &ui->cur_x, &ui->cur_y, state->common->w, state->common->h, false);
         ui->cur_visible = true;
-	if (!control && !shift) return UI_UPDATE;
+	if (!control && !shift) return MOVE_UI_UPDATE;
 
 	newstate = control ? shift ? GRID_UNKNOWN : GRID_FULL : GRID_EMPTY;
 	if (state->grid[y * state->common->w + x] == newstate &&
 	    state->grid[ui->cur_y * state->common->w + ui->cur_x] == newstate)
-	    return UI_UPDATE;
+	    return MOVE_UI_UPDATE;
 
 	sprintf(buf, "%c%d,%d,%d,%d", control ? shift ? 'U' : 'F' : 'E',
 		min(x, ui->cur_x), min(y, ui->cur_y),
@@ -1421,7 +1421,7 @@
 
         if (!ui->cur_visible) {
             ui->cur_visible = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
 
         if (button == CURSOR_SELECT2)
--- a/pearl.c
+++ b/pearl.c
@@ -2144,11 +2144,11 @@
 
     char ch = primary ? 'F' : 'M', *other;
 
-    if (!INGRID(state, x, y) || !INGRID(state, x2, y2)) return UI_UPDATE;
+    if (!INGRID(state, x, y) || !INGRID(state, x2, y2)) return MOVE_UI_UPDATE;
 
     /* disallow laying a mark over a line, or vice versa. */
     other = primary ? state->marks : state->lines;
-    if (other[y*w+x] & dir || other[y2*w+x2] & dir2) return UI_UPDATE;
+    if (other[y*w+x] & dir || other[y2*w+x2] & dir2) return MOVE_UI_UPDATE;
     
     sprintf(buf, "%c%d,%d,%d;%c%d,%d,%d", ch, dir, x, y, ch, dir2, x2, y2);
     return dupstr(buf);
@@ -2182,12 +2182,12 @@
         ui->dragcoords[0] = gy * w + gx;
         ui->ndragcoords = 0;           /* will be 1 once drag is confirmed */
 
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (button == LEFT_DRAG && ui->ndragcoords >= 0) {
         update_ui_drag(state, ui, gx, gy);
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (IS_MOUSE_RELEASE(button)) release = true;
@@ -2209,13 +2209,13 @@
 	    if (ui->ndragcoords >= 0)
 		update_ui_drag(state, ui, ui->curx, ui->cury);
 	}
-	return UI_UPDATE;
+	return MOVE_UI_UPDATE;
     }
 
     if (IS_CURSOR_SELECT(button)) {
 	if (!ui->cursor_active) {
 	    ui->cursor_active = true;
-	    return UI_UPDATE;
+	    return MOVE_UI_UPDATE;
 	} else if (button == CURSOR_SELECT) {
 	    if (ui->ndragcoords == -1) {
 		ui->ndragcoords = 0;
@@ -2222,17 +2222,17 @@
 		ui->dragcoords[0] = ui->cury * w + ui->curx;
 		ui->clickx = CENTERED_COORD(ui->curx);
 		ui->clicky = CENTERED_COORD(ui->cury);
-		return UI_UPDATE;
+		return MOVE_UI_UPDATE;
 	    } else release = true;
 	} else if (button == CURSOR_SELECT2 && ui->ndragcoords >= 0) {
 	    ui->ndragcoords = -1;
-	    return UI_UPDATE;
+	    return MOVE_UI_UPDATE;
 	}
     }
 
     if ((button == 27 || button == '\b') && ui->ndragcoords >= 0) {
         ui->ndragcoords = -1;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (release) {
@@ -2264,7 +2264,7 @@
 
             ui->ndragcoords = -1;
 
-            return buf ? buf : UI_UPDATE;
+            return buf ? buf : MOVE_UI_UPDATE;
         } else if (ui->ndragcoords == 0) {
             /* Click (or tiny drag). Work out which edge we were
              * closest to. */
@@ -2285,12 +2285,12 @@
             cx = CENTERED_COORD(gx);
             cy = CENTERED_COORD(gy);
 
-            if (!INGRID(state, gx, gy)) return UI_UPDATE;
+            if (!INGRID(state, gx, gy)) return MOVE_UI_UPDATE;
 
             if (max(abs(x-cx),abs(y-cy)) < TILE_SIZE/4) {
                 /* TODO closer to centre of grid: process as a cell click not an edge click. */
 
-                return UI_UPDATE;
+                return MOVE_UI_UPDATE;
             } else {
 		int direction;
                 if (abs(x-cx) < abs(y-cy)) {
--- a/pegs.c
+++ b/pegs.c
@@ -896,7 +896,7 @@
 	    ui->dy = y;
             ui->cur_visible = false;
             ui->cur_jumping = false;
-	    return UI_UPDATE;
+	    return MOVE_UI_UPDATE;
 	}
     } else if (button == LEFT_DRAG && ui->dragging) {
 	/*
@@ -904,7 +904,7 @@
 	 */
 	ui->dx = x;
 	ui->dy = y;
-	return UI_UPDATE;
+	return MOVE_UI_UPDATE;
     } else if (button == LEFT_RELEASE && ui->dragging) {
 	int tx, ty, dx, dy;
 
@@ -916,11 +916,11 @@
 	tx = FROMCOORD(x);
 	ty = FROMCOORD(y);
 	if (tx < 0 || tx >= w || ty < 0 || ty >= h)
-	    return UI_UPDATE;	       /* target out of range */
+	    return MOVE_UI_UPDATE;	       /* target out of range */
 	dx = tx - ui->sx;
 	dy = ty - ui->sy;
 	if (max(abs(dx),abs(dy)) != 2 || min(abs(dx),abs(dy)) != 0)
-	    return UI_UPDATE;	       /* move length was wrong */
+	    return MOVE_UI_UPDATE;	       /* move length was wrong */
 	dx /= 2;
 	dy /= 2;
 
@@ -927,7 +927,7 @@
 	if (state->grid[ty*w+tx] != GRID_HOLE ||
 	    state->grid[(ty-dy)*w+(tx-dx)] != GRID_PEG ||
 	    state->grid[ui->sy*w+ui->sx] != GRID_PEG)
-	    return UI_UPDATE;	       /* grid contents were invalid */
+	    return MOVE_UI_UPDATE;	       /* grid contents were invalid */
 
 	/*
 	 * We have a valid move. Encode it simply as source and
@@ -947,7 +947,7 @@
                 ui->cur_x = cx;
                 ui->cur_y = cy;
             }
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         } else {
             int dx, dy, mx, my, jx, jy;
 
@@ -970,21 +970,21 @@
                 ui->cur_x = jx; ui->cur_y = jy;
                 return dupstr(buf);
             }
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
     } else if (IS_CURSOR_SELECT(button)) {
         if (!ui->cur_visible) {
             ui->cur_visible = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
         if (ui->cur_jumping) {
             ui->cur_jumping = false;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
         if (state->grid[ui->cur_y*w+ui->cur_x] == GRID_PEG) {
             /* cursor is on peg: next arrow-move wil jump. */
             ui->cur_jumping = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
         return NULL;
     }
--- a/puzzles.h
+++ b/puzzles.h
@@ -805,7 +805,7 @@
  * appended to the undo chain. Must be declared as a non-const char,
  * but should never actually be modified by anyone.
  */
-extern char UI_UPDATE[];
+extern char MOVE_UI_UPDATE[];
 
 /* A little bit of help to lazy developers */
 #define DEFAULT_STATUSBAR_TEXT "Use status_bar() to fill this in."
--- a/range.c
+++ b/range.c
@@ -1405,7 +1405,7 @@
                 else if (do_post)
                     return nfmtstr(40, "W,%d,%d", ui->r, ui->c);
                 else
-                    return UI_UPDATE;
+                    return MOVE_UI_UPDATE;
 
             } else if (!out_of_bounds(ui->r + dr[i], ui->c + dc[i], w, h)) {
                 ui->r += dr[i];
@@ -1412,7 +1412,7 @@
                 ui->c += dc[i];
             }
         } else ui->cursor_show = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (action == hint) {
--- a/rect.c
+++ b/rect.c
@@ -2418,7 +2418,7 @@
         move_cursor(button, &ui->cur_x, &ui->cur_y, from->w, from->h, false);
         ui->cur_visible = true;
         active = true;
-        if (!ui->cur_dragging) return UI_UPDATE;
+        if (!ui->cur_dragging) return MOVE_UI_UPDATE;
         coord_round((float)ui->cur_x + 0.5F, (float)ui->cur_y + 0.5F, &xc, &yc);
     } else if (IS_CURSOR_SELECT(button)) {
         if (ui->drag_start_x >= 0 && !ui->cur_dragging) {
@@ -2431,7 +2431,7 @@
         if (!ui->cur_visible) {
             assert(!ui->cur_dragging);
             ui->cur_visible = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
         coord_round((float)ui->cur_x + 0.5F, (float)ui->cur_y + 0.5F, &xc, &yc);
         erasing = (button == CURSOR_SELECT2);
@@ -2452,7 +2452,7 @@
             reset_ui(ui); /* cancel keyboard dragging */
             ui->cur_dragging = false;
         }
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     } else if (button != LEFT_DRAG && button != RIGHT_DRAG) {
         return NULL;
     }
@@ -2536,7 +2536,7 @@
     if (ret)
 	return ret;		       /* a move has been made */
     else if (active)
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     else
 	return NULL;
 }
--- a/samegame.c
+++ b/samegame.c
@@ -1285,7 +1285,7 @@
                             int x, int y, int button)
 {
     int tx, ty;
-    char *ret = UI_UPDATE;
+    char *ret = MOVE_UI_UPDATE;
 
     ui->displaysel = false;
 
--- a/signpost.c
+++ b/signpost.c
@@ -1517,20 +1517,20 @@
             ui->dx = COORD(ui->cx) + TILE_SIZE/2;
             ui->dy = COORD(ui->cy) + TILE_SIZE/2;
         }
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     } else if (IS_CURSOR_SELECT(button)) {
         if (!ui->cshow)
             ui->cshow = true;
         else if (ui->dragging) {
             ui->dragging = false;
-            if (ui->sx == ui->cx && ui->sy == ui->cy) return UI_UPDATE;
+            if (ui->sx == ui->cx && ui->sy == ui->cy) return MOVE_UI_UPDATE;
             if (ui->drag_is_from) {
                 if (!isvalidmove(state, false, ui->sx, ui->sy, ui->cx, ui->cy))
-                    return UI_UPDATE;
+                    return MOVE_UI_UPDATE;
                 sprintf(buf, "L%d,%d-%d,%d", ui->sx, ui->sy, ui->cx, ui->cy);
             } else {
                 if (!isvalidmove(state, false, ui->cx, ui->cy, ui->sx, ui->sy))
-                    return UI_UPDATE;
+                    return MOVE_UI_UPDATE;
                 sprintf(buf, "L%d,%d-%d,%d", ui->cx, ui->cy, ui->sx, ui->sy);
             }
             return dupstr(buf);
@@ -1542,7 +1542,7 @@
             ui->dy = COORD(ui->cy) + TILE_SIZE/2;
             ui->drag_is_from = (button == CURSOR_SELECT);
         }
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
     if (IS_MOUSE_DOWN(button)) {
         if (ui->cshow) {
@@ -1571,19 +1571,19 @@
         ui->dx = mx;
         ui->dy = my;
         ui->cshow = false;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     } else if (IS_MOUSE_DRAG(button) && ui->dragging) {
         ui->dx = mx;
         ui->dy = my;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     } else if (IS_MOUSE_RELEASE(button) && ui->dragging) {
         ui->dragging = false;
-        if (ui->sx == x && ui->sy == y) return UI_UPDATE; /* single click */
+        if (ui->sx == x && ui->sy == y) return MOVE_UI_UPDATE; /* single click */
 
         if (!INGRID(state, x, y)) {
             int si = ui->sy*w+ui->sx;
             if (state->prev[si] == -1 && state->next[si] == -1)
-                return UI_UPDATE;
+                return MOVE_UI_UPDATE;
             sprintf(buf, "%c%d,%d",
                     (int)(ui->drag_is_from ? 'C' : 'X'), ui->sx, ui->sy);
             return dupstr(buf);
@@ -1591,11 +1591,11 @@
 
         if (ui->drag_is_from) {
             if (!isvalidmove(state, false, ui->sx, ui->sy, x, y))
-                return UI_UPDATE;
+                return MOVE_UI_UPDATE;
             sprintf(buf, "L%d,%d-%d,%d", ui->sx, ui->sy, x, y);
         } else {
             if (!isvalidmove(state, false, x, y, ui->sx, ui->sy))
-                return UI_UPDATE;
+                return MOVE_UI_UPDATE;
             sprintf(buf, "L%d,%d-%d,%d", x, y, ui->sx, ui->sy);
         }
         return dupstr(buf);
@@ -1604,7 +1604,7 @@
     else if ((button == 'x' || button == 'X') && ui->cshow) {
         int si = ui->cy*w + ui->cx;
         if (state->prev[si] == -1 && state->next[si] == -1)
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         sprintf(buf, "%c%d,%d",
                 (int)((button == 'x') ? 'C' : 'X'), ui->cx, ui->cy);
         return dupstr(buf);
--- a/singles.c
+++ b/singles.c
@@ -1533,7 +1533,7 @@
             action = TOGGLE_CIRCLE;
         }
     }
-    if (action == UI) return UI_UPDATE;
+    if (action == UI) return MOVE_UI_UPDATE;
 
     if (action == TOGGLE_BLACK || action == TOGGLE_CIRCLE) {
         i = y * state->w + x;
--- a/sixteen.c
+++ b/sixteen.c
@@ -626,7 +626,7 @@
     if (IS_CURSOR_MOVE(button) || pad) {
         if (!ui->cur_visible) {
             ui->cur_visible = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
 
         if (control || shift || ui->cur_mode) {
@@ -681,7 +681,7 @@
             }
 
             ui->cur_visible = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
     }
 
@@ -699,11 +699,11 @@
                 const enum cursor_mode m = (button == CURSOR_SELECT2 ?
                                             lock_position : lock_tile);
                 ui->cur_mode = (ui->cur_mode == m ? unlocked : m);
-                return UI_UPDATE;
+                return MOVE_UI_UPDATE;
             }
         } else {
             ui->cur_visible = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
     } else {
 	return NULL;
@@ -718,7 +718,7 @@
     else if (cy == state->h && cx >= 0 && cx < state->w)
         dy = +1, dx = 0;
     else
-        return UI_UPDATE;            /* invalid click location */
+        return MOVE_UI_UPDATE;            /* invalid click location */
 
     /* reverse direction if right hand button is pressed */
     if (button == RIGHT_BUTTON || button == CURSOR_SELECT2) {
--- a/slant.c
+++ b/slant.c
@@ -1732,7 +1732,7 @@
     } else if (IS_CURSOR_SELECT(button)) {
         if (!ui->cur_visible) {
             ui->cur_visible = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
         x = ui->cur_x;
         y = ui->cur_y;
@@ -1741,7 +1741,7 @@
     } else if (IS_CURSOR_MOVE(button)) {
         move_cursor(button, &ui->cur_x, &ui->cur_y, w, h, false);
         ui->cur_visible = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     } else if (button == '\\' || button == '\b' || button == '/') {
 	int x = ui->cur_x, y = ui->cur_y;
 	if (button == ("\\" "\b" "/")[state->soln[y*w + x] + 1]) return NULL;
--- a/solo.c
+++ b/solo.c
@@ -4637,7 +4637,7 @@
                 ui->hpencil = false;
             }
             ui->hcursor = false;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
         if (button == RIGHT_BUTTON) {
             /*
@@ -4657,7 +4657,7 @@
                 ui->hshow = false;
             }
             ui->hcursor = false;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
     }
     if (IS_CURSOR_MOVE(button)) {
@@ -4664,13 +4664,13 @@
         move_cursor(button, &ui->hx, &ui->hy, cr, cr, false);
         ui->hshow = true;
         ui->hcursor = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
     if (ui->hshow &&
         (button == CURSOR_SELECT)) {
         ui->hpencil = !ui->hpencil;
         ui->hcursor = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (ui->hshow &&
@@ -4714,7 +4714,7 @@
                 /* ... expect to remove the cursor in mouse mode. */
                 if (!ui->hcursor) {
                     ui->hshow = false;
-                    return UI_UPDATE;
+                    return MOVE_UI_UPDATE;
                 }
                 return NULL;
             }
--- a/tents.c
+++ b/tents.c
@@ -1589,7 +1589,7 @@
         ui->dsy = ui->dey = y;
         ui->drag_ok = true;
         ui->cdisp = false;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if ((IS_MOUSE_DRAG(button) || IS_MOUSE_RELEASE(button)) &&
@@ -1621,7 +1621,7 @@
         }
 
         if (IS_MOUSE_DRAG(button))
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
 
         /*
          * The drag has been released. Enact it.
@@ -1628,7 +1628,7 @@
          */
         if (!ui->drag_ok) {
             ui->drag_button = -1;
-            return UI_UPDATE;          /* drag was just cancelled */
+            return MOVE_UI_UPDATE;          /* drag was just cancelled */
         }
 
         xmin = min(ui->dsx, ui->dex);
@@ -1666,7 +1666,7 @@
 
         if (buflen == 0) {
             sfree(buf);
-            return UI_UPDATE;          /* drag was terminated */
+            return MOVE_UI_UPDATE;          /* drag was terminated */
         } else {
             buf[buflen] = '\0';
             return buf;
@@ -1694,7 +1694,7 @@
             if (len) return dupstr(tmpbuf);
         } else
             move_cursor(button, &ui->cx, &ui->cy, w, h, false);
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
     if (ui->cdisp) {
         char rep = 0;
@@ -1721,7 +1721,7 @@
         }
     } else if (IS_CURSOR_SELECT(button)) {
         ui->cdisp = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     return NULL;
--- a/towers.c
+++ b/towers.c
@@ -1458,7 +1458,7 @@
                 ui->hpencil = false;
             }
             ui->hcursor = false;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
         if (button == RIGHT_BUTTON) {
             /*
@@ -1478,7 +1478,7 @@
                 ui->hshow = false;
             }
             ui->hcursor = false;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
     } else if (button == LEFT_BUTTON) {
         if (is_clue(state, tx, ty)) {
@@ -1504,13 +1504,13 @@
         move_cursor(button, &ui->hx, &ui->hy, w, w, false);
         ui->hshow = true;
         ui->hcursor = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
     if (ui->hshow &&
         (button == CURSOR_SELECT)) {
         ui->hpencil = !ui->hpencil;
         ui->hcursor = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (ui->hshow &&
@@ -1542,7 +1542,7 @@
             /* ... expect to remove the cursor in mouse mode. */
             if (!ui->hcursor) {
                 ui->hshow = false;
-                return UI_UPDATE;
+                return MOVE_UI_UPDATE;
             }
             return NULL;
         }
--- a/tracks.c
+++ b/tracks.c
@@ -2279,13 +2279,13 @@
         ui->drag_sx = ui->drag_ex = gx;
         ui->drag_sy = ui->drag_ey = gy;
 
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (IS_MOUSE_DRAG(button)) {
         ui->cursor_active = false;
         update_ui_drag(state, ui, gx, gy);
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (IS_MOUSE_RELEASE(button)) {
@@ -2322,12 +2322,12 @@
             cy = CENTERED_COORD(gy);
 
             if (!INGRID(state, gx, gy) || FROMCOORD(x) != gx || FROMCOORD(y) != gy)
-                return UI_UPDATE;
+                return MOVE_UI_UPDATE;
 
             if (max(abs(x-cx),abs(y-cy)) < TILE_SIZE/4) {
                 if (ui_can_flip_square(state, gx, gy, button == RIGHT_RELEASE))
                     return square_flip_str(state, gx, gy, button == RIGHT_RELEASE, tmpbuf);
-                return UI_UPDATE;
+                return MOVE_UI_UPDATE;
             } else {
                 if (abs(x-cx) < abs(y-cy)) {
                     /* Closest to top/bottom edge. */
@@ -2341,7 +2341,7 @@
                     return edge_flip_str(state, gx, gy, direction,
                             button == RIGHT_RELEASE, tmpbuf);
                 else
-                    return UI_UPDATE;
+                    return MOVE_UI_UPDATE;
             }
         }
     }
@@ -2354,7 +2354,7 @@
 
         if (!ui->cursor_active) {
             ui->cursor_active = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
 
         ui->curx = ui->curx + dx;
@@ -2365,17 +2365,17 @@
         }
         ui->curx = min(max(ui->curx, 1), 2*w-1);
         ui->cury = min(max(ui->cury, 1), 2*h-1);
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (IS_CURSOR_SELECT(button)) {
         if (!ui->cursor_active) {
             ui->cursor_active = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
         /* click on square corner does nothing (shouldn't get here) */
         if ((ui->curx % 2) == 0 && (ui->cury % 2 == 0))
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
 
         gx = ui->curx / 2;
         gy = ui->cury / 2;
@@ -2387,7 +2387,7 @@
         else if (!direction &&
                  ui_can_flip_square(state, gx, gy, button == CURSOR_SELECT2))
             return square_flip_str(state, gx, gy, button == CURSOR_SELECT2, tmpbuf);
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
 #if 0
--- a/twiddle.c
+++ b/twiddle.c
@@ -676,7 +676,7 @@
         if (button == CURSOR_DOWN && (ui->cur_y+n) < (h))
             ui->cur_y++;
         ui->cur_visible = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (button == LEFT_BUTTON || button == RIGHT_BUTTON) {
@@ -700,7 +700,7 @@
             dir = (button == CURSOR_SELECT2) ? -1 : +1;
         } else {
             ui->cur_visible = true;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
     } else if (button == 'a' || button == 'A' || button==MOD_NUM_KEYPAD+'7') {
         x = y = 0;
--- a/undead.c
+++ b/undead.c
@@ -1774,7 +1774,7 @@
 
     if (button == 'a' || button == 'A') {
         ui->ascii = !ui->ascii;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (button == 'm' || button == 'M') {
@@ -1787,7 +1787,7 @@
             if (button == 'g' || button == 'G' || button == '1') {
                 if (!ui->hcursor) ui->hshow = false;
                 if (state->guess[xi] == 1)
-                    return ui->hcursor ? NULL : UI_UPDATE;
+                    return ui->hcursor ? NULL : MOVE_UI_UPDATE;
                 sprintf(buf,"G%d",xi);
                 return dupstr(buf);
             }
@@ -1794,7 +1794,7 @@
             if (button == 'v' || button == 'V' || button == '2') {
                 if (!ui->hcursor) ui->hshow = false;
                 if (state->guess[xi] == 2)
-                    return ui->hcursor ? NULL : UI_UPDATE;
+                    return ui->hcursor ? NULL : MOVE_UI_UPDATE;
                 sprintf(buf,"V%d",xi);
                 return dupstr(buf);
             }
@@ -1801,7 +1801,7 @@
             if (button == 'z' || button == 'Z' || button == '3') {
                 if (!ui->hcursor) ui->hshow = false;
                 if (state->guess[xi] == 4)
-                    return ui->hcursor ? NULL : UI_UPDATE;
+                    return ui->hcursor ? NULL : MOVE_UI_UPDATE;
                 sprintf(buf,"Z%d",xi);
                 return dupstr(buf);
             }
@@ -1809,7 +1809,7 @@
                 button == '0' || button == '\b' ) {
                 if (!ui->hcursor) ui->hshow = false;
                 if (state->guess[xi] == 7 && state->pencils[xi] == 0)
-                    return ui->hcursor ? NULL : UI_UPDATE;
+                    return ui->hcursor ? NULL : MOVE_UI_UPDATE;
                 sprintf(buf,"E%d",xi);
                 return dupstr(buf);
             }
@@ -1829,12 +1829,12 @@
             }
         ui->hshow = true;
         ui->hcursor = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
     if (ui->hshow && button == CURSOR_SELECT) {
         ui->hpencil = !ui->hpencil;
         ui->hcursor = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (ui->hshow && ui->hpencil) {
@@ -1871,7 +1871,7 @@
                     ui->hshow = false;
                 }
                 if (state->pencils[xi] == 0)
-                    return ui->hcursor ? NULL : UI_UPDATE;
+                    return ui->hcursor ? NULL : MOVE_UI_UPDATE;
                 sprintf(buf,"E%d",xi);
                 return dupstr(buf);
             }
@@ -1888,7 +1888,7 @@
                     ui->hpencil = false;
                     ui->hcursor = false;
                     ui->hx = gx; ui->hy = gy;
-                    return UI_UPDATE;
+                    return MOVE_UI_UPDATE;
                 }
                 else if (button == RIGHT_BUTTON && g == 7) {
                     ui->hshow = true;
@@ -1895,7 +1895,7 @@
                     ui->hpencil = true;
                     ui->hcursor = false;
                     ui->hx = gx; ui->hy = gy;
-                    return UI_UPDATE;
+                    return MOVE_UI_UPDATE;
                 }
             }
             else if (ui->hshow) {
@@ -1906,7 +1906,7 @@
                             ui->hpencil = false;
                             ui->hcursor = false;
                             ui->hx = 0; ui->hy = 0;
-                            return UI_UPDATE;
+                            return MOVE_UI_UPDATE;
                         }
                         else {
                             ui->hshow = true;
@@ -1913,7 +1913,7 @@
                             ui->hpencil = false;
                             ui->hcursor = false;
                             ui->hx = gx; ui->hy = gy;
-                            return UI_UPDATE;
+                            return MOVE_UI_UPDATE;
                         }
                     }
                     else {
@@ -1921,7 +1921,7 @@
                         ui->hpencil = false;
                         ui->hcursor = false;
                         ui->hx = gx; ui->hy = gy;
-                        return UI_UPDATE;
+                        return MOVE_UI_UPDATE;
                     }
                 }
                 else if (button == RIGHT_BUTTON) {
@@ -1930,7 +1930,7 @@
                         ui->hpencil = true;
                         ui->hcursor = false;
                         ui->hx = gx; ui->hy = gy;
-                        return UI_UPDATE;
+                        return MOVE_UI_UPDATE;
                     }
                     else {
                         if (gx == ui->hx && gy == ui->hy) {
@@ -1938,7 +1938,7 @@
                             ui->hpencil = false;
                             ui->hcursor = false;
                             ui->hx = 0; ui->hy = 0;
-                            return UI_UPDATE;
+                            return MOVE_UI_UPDATE;
                         }
                         else if (g == 7) {
                             ui->hshow = true;
@@ -1945,7 +1945,7 @@
                             ui->hpencil = true;
                             ui->hcursor = false;
                             ui->hx = gx; ui->hy = gy;
-                            return UI_UPDATE;
+                            return MOVE_UI_UPDATE;
                         }
                     }
                 }
--- a/unequal.c
+++ b/unequal.c
@@ -1531,7 +1531,7 @@
                 ui->hshow = true;
             }
             ui->hcursor = false;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
         if (button == RIGHT_BUTTON) {
             /* pencil highlighting for non-filled squares */
@@ -1545,7 +1545,7 @@
                 ui->hshow = true;
             }
             ui->hcursor = false;
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
     }
 
@@ -1561,12 +1561,12 @@
 				  ny != ui->hy + adjthan[i].dy); ++i);
 
 	    if (i == 4)
-		return UI_UPDATE; /* invalid direction, i.e. out of
+		return MOVE_UI_UPDATE; /* invalid direction, i.e. out of
                                    * the board */
 
 	    if (!(GRID(state, flags, ui->hx, ui->hy) & adjthan[i].f ||
 		  GRID(state, flags, nx,     ny    ) & adjthan[i].fo))
-		return UI_UPDATE; /* no clue to toggle */
+		return MOVE_UI_UPDATE; /* no clue to toggle */
 
 	    if (state->mode == MODE_ADJACENT)
 		self = (adjthan[i].dx >= 0 && adjthan[i].dy >= 0);
@@ -1585,13 +1585,13 @@
 	    move_cursor(button, &ui->hx, &ui->hy, ds->order, ds->order, false);
 	    ui->hshow = true;
             ui->hcursor = true;
-	    return UI_UPDATE;
+	    return MOVE_UI_UPDATE;
 	}
     }
     if (ui->hshow && IS_CURSOR_SELECT(button)) {
         ui->hpencil = !ui->hpencil;
         ui->hcursor = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     n = c2n(button, state->order);
@@ -1622,7 +1622,7 @@
                 /* ... expect to remove the cursor in mouse mode. */
                 if (!ui->hcursor) {
                     ui->hshow = false;
-                    return UI_UPDATE;
+                    return MOVE_UI_UPDATE;
                 }
                 return NULL;
             }
--- a/unfinished/group.c
+++ b/unfinished/group.c
@@ -1519,13 +1519,13 @@
             ui->drag |= 4;             /* some movement has happened */
             if (tcoord >= 0 && tcoord < w) {
                 ui->dragpos = tcoord;
-                return UI_UPDATE;
+                return MOVE_UI_UPDATE;
             }
         } else if (IS_MOUSE_RELEASE(button)) {
             if (ui->drag & 4) {
                 ui->drag = 0;          /* end drag */
                 if (state->sequence[ui->dragpos] == ui->dragnum)
-                    return UI_UPDATE;  /* drag was a no-op overall */
+                    return MOVE_UI_UPDATE;  /* drag was a no-op overall */
                 sprintf(buf, "D%d,%d", ui->dragnum, ui->dragpos);
                 return dupstr(buf);
             } else {
@@ -1536,7 +1536,7 @@
                             state->sequence[ui->edgepos]);
                     return dupstr(buf);
                 } else
-                    return UI_UPDATE;  /* no-op */
+                    return MOVE_UI_UPDATE;  /* no-op */
             }
         }
     } else if (IS_MOUSE_DOWN(button)) {
@@ -1559,7 +1559,7 @@
                     ui->hpencil = false;
                 }
                 ui->hcursor = false;
-                return UI_UPDATE;
+                return MOVE_UI_UPDATE;
             }
             if (button == RIGHT_BUTTON) {
                 /*
@@ -1583,7 +1583,7 @@
                     ui->hshow = false;
                 }
                 ui->hcursor = false;
-                return UI_UPDATE;
+                return MOVE_UI_UPDATE;
             }
         } else if (tx >= 0 && tx < w && ty == -1) {
             ui->drag = 2;
@@ -1590,13 +1590,13 @@
             ui->dragnum = state->sequence[tx];
             ui->dragpos = tx;
             ui->edgepos = FROMCOORD(x + TILESIZE/2);
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         } else if (ty >= 0 && ty < w && tx == -1) {
             ui->drag = 1;
             ui->dragnum = state->sequence[ty];
             ui->dragpos = ty;
             ui->edgepos = FROMCOORD(y + TILESIZE/2);
-            return UI_UPDATE;
+            return MOVE_UI_UPDATE;
         }
     } else if (IS_MOUSE_DRAG(button)) {
         if (!ui->hpencil &&
@@ -1609,7 +1609,7 @@
             ui->odx = ui->ody = 0;
             ui->odn = 1;
         }
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (IS_CURSOR_MOVE(button)) {
@@ -1620,13 +1620,13 @@
         ui->hy = state->sequence[cy];
         ui->hshow = true;
         ui->hcursor = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
     if (ui->hshow &&
         (button == CURSOR_SELECT)) {
         ui->hpencil = !ui->hpencil;
         ui->hcursor = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     if (ui->hshow &&
--- a/unfinished/slide.c
+++ b/unfinished/slide.c
@@ -1345,7 +1345,7 @@
 	 * And that's it. Update the display to reflect the start
 	 * of a drag.
 	 */
-	return UI_UPDATE;
+	return MOVE_UI_UPDATE;
     } else if (button == LEFT_DRAG && ui->dragging) {
 	int dist, distlimit, dx, dy, s, px, py;
 
@@ -1372,7 +1372,7 @@
 		    if (px >= 0 && px < w && py >= 0 && py < h &&
 			ui->reachable[py*w+px]) {
 			ui->drag_currpos = py*w+px;
-			return UI_UPDATE;
+			return MOVE_UI_UPDATE;
 		    }
 		}
 	}
@@ -1389,7 +1389,7 @@
 	    sprintf(data, "M%d-%d", ui->drag_anchor, ui->drag_currpos);
 	    str = dupstr(data);
 	} else
-	    str = UI_UPDATE;
+	    str = MOVE_UI_UPDATE;
 	
 	ui->dragging = false;
 	ui->drag_anchor = ui->drag_currpos = -1;
--- a/unruly.c
+++ b/unruly.c
@@ -1628,7 +1628,7 @@
     if (IS_CURSOR_MOVE(button)) {
         move_cursor(button, &ui->cx, &ui->cy, w2, h2, false);
         ui->cursor = true;
-        return UI_UPDATE;
+        return MOVE_UI_UPDATE;
     }
 
     /* Place one */
--- a/untangle.c
+++ b/untangle.c
@@ -1208,12 +1208,12 @@
 	if (bestd <= DRAG_THRESHOLD * DRAG_THRESHOLD) {
 	    ui->dragpoint = best;
             place_dragged_point(state, ui, ds, x, y);
-	    return UI_UPDATE;
+	    return MOVE_UI_UPDATE;
 	}
 
     } else if (IS_MOUSE_DRAG(button) && ui->dragpoint >= 0) {
         place_dragged_point(state, ui, ds, x, y);
-	return UI_UPDATE;
+	return MOVE_UI_UPDATE;
     } else if (IS_MOUSE_RELEASE(button) && ui->dragpoint >= 0) {
 	int p = ui->dragpoint;
 	char buf[80];
@@ -1228,7 +1228,7 @@
             ui->newpoint.x >= (long)state->w*ui->newpoint.d ||
 	    ui->newpoint.y < 0 ||
             ui->newpoint.y >= (long)state->h*ui->newpoint.d)
-	    return UI_UPDATE;
+	    return MOVE_UI_UPDATE;
 
 	/*
 	 * We aren't cancelling the drag. Construct a move string