From 2e6bc96b25ae3ad5be7f04934be01f63dfd23ce2 Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Wed, 17 Jun 2020 00:47:56 +0300 Subject: [PATCH] implemented glutSetCursor(GLUT_CURSOR_NONE) in miniglut --- src/glut/miniglut.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/glut/miniglut.c b/src/glut/miniglut.c index eb63946..b098651 100644 --- a/src/glut/miniglut.c +++ b/src/glut/miniglut.c @@ -40,6 +40,7 @@ static Atom xa_net_wm_state, xa_net_wm_state_fullscr; static Atom xa_motif_wm_hints; static Atom xa_motion_event, xa_button_press_event, xa_button_release_event, xa_command_event; static unsigned int evmask; +static Cursor blank_cursor; static int have_netwm_fullscr(void); @@ -111,6 +112,9 @@ static int modstate; void glutInit(int *argc, char **argv) { #ifdef BUILD_X11 + Pixmap blankpix = 0; + XColor xcol; + if(!(dpy = XOpenDisplay(0))) { panic("Failed to connect to the X server\n"); } @@ -131,6 +135,11 @@ void glutInit(int *argc, char **argv) evmask = ExposureMask | StructureNotifyMask; + if((blankpix = XCreateBitmapFromData(dpy, root, (char*)&blankpix, 1, 1))) { + blank_cursor = XCreatePixmapCursor(dpy, blankpix, blankpix, &xcol, &xcol, 0, 0); + XFreePixmap(dpy, blankpix); + } + #endif #ifdef BUILD_WIN32 WNDCLASSEX wc = {0}; @@ -779,7 +788,8 @@ void glutSetCursor(int cidx) case GLUT_CURSOR_INHERIT: break; case GLUT_CURSOR_NONE: - /* TODO */ + cur = blank_cursor; + break; default: return; } -- 1.7.10.4