commit 7886b54
neauoire
·
2022-03-28 02:47:05 +0000 UTC
parent a5d1172
Removed cursor
1 files changed,
+18,
-2
+18,
-2
1@@ -90,6 +90,21 @@ redraw(void)
2 XPutImage(display, window, DefaultGC(display, 0), ximage, 0, 0, 0, 0, uxn_screen.width, uxn_screen.height);
3 }
4
5+static void
6+hide_cursor(void)
7+{
8+ Cursor blank;
9+ Pixmap bitmap;
10+ XColor black;
11+ static char empty[] = {0, 0, 0, 0, 0, 0, 0, 0};
12+ black.red = black.green = black.blue = 0;
13+ bitmap = XCreateBitmapFromData(display, window, empty, 8, 8);
14+ blank = XCreatePixmapCursor(display, bitmap, bitmap, &black, &black, 0, 0);
15+ XDefineCursor(display, window, blank);
16+ XFreeCursor(display, blank);
17+ XFreePixmap(display, bitmap);
18+}
19+
20 /* /usr/include/X11/keysymdef.h */
21
22 #define XK_Escape 0xff1b
23@@ -145,11 +160,11 @@ processEvent(void)
24 } break;
25 case ButtonPress: {
26 XButtonPressedEvent *e = (XButtonPressedEvent *)&ev;
27- mouse_down(devmouse, 0x1 << e->button - 1);
28+ mouse_down(devmouse, 0x1 << (e->button - 1));
29 } break;
30 case ButtonRelease: {
31 XButtonPressedEvent *e = (XButtonPressedEvent *)&ev;
32- mouse_up(devmouse, 0x1 << e->button - 1);
33+ mouse_up(devmouse, 0x1 << (e->button - 1));
34 } break;
35 case MotionNotify: {
36 XMotionEvent *e = (XMotionEvent *)&ev;
37@@ -201,6 +216,7 @@ init(void)
38 XSetWMProtocols(display, window, &wmDelete, 1);
39 XMapWindow(display, window);
40 ximage = XCreateImage(display, visual, DefaultDepth(display, DefaultScreen(display)), ZPixmap, 0, (char *)uxn_screen.pixels, uxn_screen.width, uxn_screen.height, 32, 0);
41+ hide_cursor();
42 return 1;
43 }
44