commit f73141c
Devine Lu Linvega
·
2025-01-20 00:02:34 +0000 UTC
parent 1d53e04
Removed padding
1 files changed,
+6,
-10
+6,
-10
1@@ -38,9 +38,7 @@ static Window window;
2
3 #define WIDTH (64 * 8)
4 #define HEIGHT (40 * 8)
5-#define PAD 2
6 #define CONINBUFSIZE 256
7-#define clamp(v,a,b) { if(v < a) v = a; else if(v >= b) v = b; }
8
9 /* clang-format on */
10
11@@ -81,7 +79,7 @@ emu_resize(int w, int h)
12 w *= uxn_screen.scale, h *= uxn_screen.scale;
13 visual = DefaultVisual(display, 0);
14 ximage = XCreateImage(display, visual, DefaultDepth(display, DefaultScreen(display)), ZPixmap, 0, (char *)uxn_screen.pixels, w, h, 32, 0);
15- XResizeWindow(display, window, w + PAD * 2, h + PAD * 2);
16+ XResizeWindow(display, window, w, h);
17 XMapWindow(display, window);
18 }
19 return 1;
20@@ -128,8 +126,8 @@ emu_event(void)
21 case Expose: {
22 int w = uxn_screen.width * uxn_screen.scale;
23 int h = uxn_screen.height * uxn_screen.scale;
24- XResizeWindow(display, window, w + PAD * 2, h + PAD * 2);
25- XPutImage(display, window, DefaultGC(display, 0), ximage, 0, 0, PAD, PAD, w, h);
26+ XResizeWindow(display, window, w, h);
27+ XPutImage(display, window, DefaultGC(display, 0), ximage, 0, 0, 0, 0, w, h);
28 } break;
29 case ClientMessage:
30 uxn.dev[0x0f] = 0x80;
31@@ -169,9 +167,7 @@ emu_event(void)
32 } break;
33 case MotionNotify: {
34 XMotionEvent *e = (XMotionEvent *)&ev;
35- int x = (e->x - PAD) / uxn_screen.scale, y = (e->y - PAD) / uxn_screen.scale;
36- clamp(x, 0, uxn_screen.width - 1);
37- clamp(y, 0, uxn_screen.height - 1);
38+ int x = e->x / uxn_screen.scale, y = e->y / uxn_screen.scale;
39 mouse_pos(x, y);
40 } break;
41 }
42@@ -203,7 +199,7 @@ display_init(void)
43 visual = DefaultVisual(display, 0);
44 if(visual->class != TrueColor)
45 return system_error("init", "True-color visual failed");
46- window = XCreateSimpleWindow(display, RootWindow(display, 0), 0, 0, uxn_screen.width + PAD * 2, uxn_screen.height + PAD * 2, 1, 0, 0);
47+ window = XCreateSimpleWindow(display, RootWindow(display, 0), 0, 0, uxn_screen.width, uxn_screen.height, 1, 0, 0);
48 XSelectInput(display, window, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ExposureMask | KeyPressMask | KeyReleaseMask);
49 wmDelete = XInternAtom(display, "WM_DELETE_WINDOW", True);
50 XSetWMProtocols(display, window, &wmDelete, 1);
51@@ -241,7 +237,7 @@ emu_run(void)
52 int x = uxn_screen.x1 * uxn_screen.scale, y = uxn_screen.y1 * uxn_screen.scale;
53 int w = uxn_screen.x2 * uxn_screen.scale - x, h = uxn_screen.y2 * uxn_screen.scale - y;
54 screen_redraw();
55- XPutImage(display, window, DefaultGC(display, 0), ximage, x, y, x + PAD, y + PAD, w, h);
56+ XPutImage(display, window, DefaultGC(display, 0), ximage, x, y, x, y, w, h);
57 }
58 }
59 if((fds[2].revents & POLLIN) != 0) {