commit aaa70e1

Devine Lu Linvega  ·  2024-01-15 19:29:37 +0000 UTC
parent 909cc1b
Housekeeping
1 files changed,  +7, -9
+7, -9
 1@@ -139,9 +139,9 @@ emu_event(Uxn *u)
 2 	case Expose:
 3 		XPutImage(display, window, DefaultGC(display, 0), ximage, 0, 0, PAD, PAD, uxn_screen.width * uxn_screen.scale, uxn_screen.height * uxn_screen.scale);
 4 		break;
 5-	case ClientMessage: {
 6+	case ClientMessage:
 7 		emu_end(u);
 8-	} break;
 9+		break;
10 	case KeyPress: {
11 		KeySym sym;
12 		char buf[7];
13@@ -178,10 +178,8 @@ emu_event(Uxn *u)
14 	} break;
15 	case MotionNotify: {
16 		XMotionEvent *e = (XMotionEvent *)&ev;
17-		int ex = (e->x - PAD) / uxn_screen.scale;
18-		int ey = (e->y - PAD) / uxn_screen.scale;
19-		int x = clamp(ex, 0, uxn_screen.width - 1);
20-		int y = clamp(ey, 0, uxn_screen.height - 1);
21+		int x = clamp((e->x - PAD) / uxn_screen.scale, 0, uxn_screen.width - 1);
22+		int y = clamp((e->y - PAD) / uxn_screen.scale, 0, uxn_screen.height - 1);
23 		mouse_pos(u, &u->dev[0x90], x, y);
24 	} break;
25 	}
26@@ -244,10 +242,10 @@ emu_run(Uxn *u, char *rom)
27 			read(fds[1].fd, expirations, 8);
28 			uxn_eval(u, u->dev[0x20] << 8 | u->dev[0x21]);
29 			if(uxn_screen.x2) {
30-				int s = uxn_screen.scale;
31-				int x1 = uxn_screen.x1 * s, y1 = uxn_screen.y1 * s, x2 = uxn_screen.x2 * s, y2 = uxn_screen.y2 * s;
32+				int x = uxn_screen.x1 * uxn_screen.scale, y = uxn_screen.y1 * uxn_screen.scale;
33+				int w = uxn_screen.x2 * uxn_screen.scale - x, h = uxn_screen.y2 * uxn_screen.scale - y;
34 				screen_redraw(u);
35-				XPutImage(display, window, DefaultGC(display, 0), ximage, x1, y1, x1 + PAD, y1 + PAD, x2 - x1, y2 - y1);
36+				XPutImage(display, window, DefaultGC(display, 0), ximage, x, y, x + PAD, y + PAD, w, h);
37 			}
38 		}
39 		if((fds[2].revents & POLLIN) != 0) {