+ sprintf(buf, "M%d,%d", tx, ty);
+ return dupstr(buf);
+ }
+ }
+ else if (button == CURSOR_UP || button == CURSOR_DOWN ||
+ button == CURSOR_RIGHT || button == CURSOR_LEFT) {
+ int dx = 0, dy = 0;
+ switch (button) {
+ case CURSOR_UP: dy = -1; break;
+ case CURSOR_DOWN: dy = 1; break;
+ case CURSOR_RIGHT: dx = 1; break;
+ case CURSOR_LEFT: dx = -1; break;
+ default: assert(!"shouldn't get here");
+ }
+ ui->cx += dx; ui->cy += dy;
+ ui->cx = min(max(ui->cx, 0), state->w - 1);
+ ui->cy = min(max(ui->cy, 0), state->h - 1);
+ ui->cdraw = 1;
+ nullret = "";
+ }