--- a/tty-keys.c
+++ b/tty-keys.c
@@ -746,6 +746,8 @@
 	m->sgr = sgr;
 	m->sgr_xb = sgr_b;
 	m->sgr_rel = sgr_rel;
+	m->x = x;
+	m->y = y;
 	if (b & 64) { /* wheel button */
 		b &= 3;
 		if (b == 0)
@@ -773,8 +775,6 @@
 		}
 		m->button = (b & 3);
 	}
-	m->x = x;
-	m->y = y;
 
 	return (0);
 }