Commit b066f342 authored by Steven Fuller's avatar Steven Fuller

Added code to change mouse pointer in X ports

parent 53a96e5c
...@@ -40,12 +40,15 @@ int main(int argc, char *argv[]) ...@@ -40,12 +40,15 @@ int main(int argc, char *argv[])
/* TODO: move this to the proper functions */ /* TODO: move this to the proper functions */
XSetWindowAttributes attr; XSetWindowAttributes attr;
XVisualInfo vitemp;
XSizeHints sizehints; XSizeHints sizehints;
XGCValues gcvalues; Pixmap bitmap;
Cursor cursor;
XColor bg = { 0 };
XColor fg = { 0 };
char data[8] = { 0x01 };
char *disp, *ext; char *disp, *ext;
int attrmask, numVisuals, i; int attrmask, i;
int major, minor; int major, minor;
disp = getenv("DISPLAY"); disp = getenv("DISPLAY");
...@@ -120,13 +123,16 @@ int main(int argc, char *argv[]) ...@@ -120,13 +123,16 @@ int main(int argc, char *argv[])
XSetWMProperties(dpy, win, NULL, NULL, argv, argc, &sizehints, None, None); XSetWMProperties(dpy, win, NULL, NULL, argv, argc, &sizehints, None, None);
/* TODO: have some global identifier for each game type */
XStoreName(dpy, win, GAMENAME); XStoreName(dpy, win, GAMENAME);
XSetIconName(dpy, win, GAMENAME); XSetIconName(dpy, win, GAMENAME);
wmDeleteWindow = XInternAtom(dpy, "WM_DELETE_WINDOW", False); wmDeleteWindow = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
XSetWMProtocols(dpy, win, &wmDeleteWindow, 1); XSetWMProtocols(dpy, win, &wmDeleteWindow, 1);
bitmap = XCreateBitmapFromData(dpy, win, data, 8, 8);
cursor = XCreatePixmapCursor(dpy, bitmap, bitmap, &fg, &bg, 0, 0);
XDefineCursor(dpy, win, cursor);
XFlush(dpy); XFlush(dpy);
glXMakeCurrent(dpy, win, ctx); glXMakeCurrent(dpy, win, ctx);
......
...@@ -33,6 +33,11 @@ int main(int argc, char *argv[]) ...@@ -33,6 +33,11 @@ int main(int argc, char *argv[])
XVisualInfo vitemp; XVisualInfo vitemp;
XSizeHints sizehints; XSizeHints sizehints;
XGCValues gcvalues; XGCValues gcvalues;
Pixmap bitmap;
Cursor cursor;
XColor bg = { 0 };
XColor fg = { 0 };
char data[8] = { 0x01 };
char *disp; char *disp;
int attrmask, numVisuals, i; int attrmask, numVisuals, i;
...@@ -69,8 +74,6 @@ int main(int argc, char *argv[]) ...@@ -69,8 +74,6 @@ int main(int argc, char *argv[])
clr[i].pixel = i; clr[i].pixel = i;
clr[i].flags = DoRed|DoGreen|DoBlue; clr[i].flags = DoRed|DoGreen|DoBlue;
} }
//XQueryColors(dpy, DefaultColormap(dpy, screen), clr, 256);
//XStoreColors(dpy, cmap, clr, 256);
attr.colormap = cmap; attr.colormap = cmap;
attr.event_mask = KeyPressMask | KeyReleaseMask | ExposureMask; attr.event_mask = KeyPressMask | KeyReleaseMask | ExposureMask;
...@@ -82,7 +85,6 @@ int main(int argc, char *argv[]) ...@@ -82,7 +85,6 @@ int main(int argc, char *argv[])
Quit("Unable to create window!"); Quit("Unable to create window!");
} }
gcvalues.foreground = BlackPixel(dpy, screen); gcvalues.foreground = BlackPixel(dpy, screen);
gcvalues.background = WhitePixel(dpy, screen); gcvalues.background = WhitePixel(dpy, screen);
gc = XCreateGC(dpy, win, GCForeground | GCBackground, &gcvalues); gc = XCreateGC(dpy, win, GCForeground | GCBackground, &gcvalues);
...@@ -97,13 +99,16 @@ int main(int argc, char *argv[]) ...@@ -97,13 +99,16 @@ int main(int argc, char *argv[])
XSetWMProperties(dpy, win, NULL, NULL, argv, argc, &sizehints, None, None); XSetWMProperties(dpy, win, NULL, NULL, argv, argc, &sizehints, None, None);
/* TODO: have some global identifier for each game type */
XStoreName(dpy, win, GAMENAME); XStoreName(dpy, win, GAMENAME);
XSetIconName(dpy, win, GAMENAME); XSetIconName(dpy, win, GAMENAME);
wmDeleteWindow = XInternAtom(dpy, "WM_DELETE_WINDOW", False); wmDeleteWindow = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
XSetWMProtocols(dpy, win, &wmDeleteWindow, 1); XSetWMProtocols(dpy, win, &wmDeleteWindow, 1);
bitmap = XCreateBitmapFromData(dpy, win, data, 8, 8);
cursor = XCreatePixmapCursor(dpy, bitmap, bitmap, &fg, &bg, 0, 0);
XDefineCursor(dpy, win, cursor);
XFlush(dpy); XFlush(dpy);
return WolfMain(argc, argv); return WolfMain(argc, argv);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment