summaryrefslogtreecommitdiffstats
path: root/src/GLX.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/GLX.hs')
-rw-r--r--src/GLX.hs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/GLX.hs b/src/GLX.hs
index bc2201e..9ad6392 100644
--- a/src/GLX.hs
+++ b/src/GLX.hs
@@ -15,10 +15,11 @@ import Graphics.Rendering.OpenGL.GL.CoordTrans (matrixMode, MatrixMode(..), view
import Graphics.X11.Types
import Graphics.X11.Xlib.Atom (internAtom)
-import Graphics.X11.Xlib.Display (defaultScreen, openDisplay, rootWindow)
-import Graphics.X11.Xlib.Event (XEventPtr, allocaXEvent, nextEvent, get_Window, get_EventType, pending)
+import Graphics.X11.Xlib.Color (queryColor)
+import Graphics.X11.Xlib.Display (defaultScreen, openDisplay, rootWindow, whitePixel)
+import Graphics.X11.Xlib.Event (XEventPtr, allocaXEvent, nextEvent, get_Window, get_EventType, pending, sync)
import Graphics.X11.Xlib.Extras (ClassHint(..), getEvent, ev_event_type, ev_width, ev_height, ev_keycode, ev_data, ev_x, ev_y, getWindowAttributes, wa_width, wa_height)
-import Graphics.X11.Xlib.Misc (keycodeToKeysym, setWMProtocols)
+import Graphics.X11.Xlib.Misc (keycodeToKeysym, setWMProtocols, createPixmap, createPixmapCursor, defineCursor)
import Graphics.X11.Xlib.Types
import Graphics.X11.Xlib.Window (destroyWindow, mapWindow, storeName)
@@ -78,12 +79,19 @@ instance Driver GLX where
setClassHint disp wnd (ClassHint "HTanks" "htanks")
setWMProtocols disp wnd [delwnd]
+ color <- queryColor disp cmap $ Graphics.X11.Xlib.Types.Color (whitePixel disp $ fromIntegral . viScreen $ visualinfo) 0 0 0 0
+ pixmap <- createPixmap disp wnd 1 1 1
+ cursor <- createPixmapCursor disp pixmap pixmap color color 0 0
+ sync disp False
+
storeName disp wnd "HTanks"
mapWindow disp wnd
waitForMapNotify disp wnd
+ defineCursor disp wnd cursor
+
ctx <- with visualinfo $ \vi -> createContext disp vi (Context nullPtr) True
makeCurrent disp wnd ctx