Mercurial > games > semicongine
diff src/xlib_helpers.nim @ 2:213fdf8d31dd
did: hello world triangle, a bit of code organization
author | Sam <sam@basx.dev> |
---|---|
date | Mon, 19 Dec 2022 10:41:20 +0700 |
parents | 5daf3f236d87 |
children |
line wrap: on
line diff
--- a/src/xlib_helpers.nim Fri Dec 16 00:05:41 2022 +0700 +++ b/src/xlib_helpers.nim Mon Dec 19 10:41:20 2022 +0700 @@ -1,7 +1,10 @@ import x11/xlib, x11/xutil, - x11/x + x11/x, + x11/keysym + +export keysym var deleteMessage*: Atom @@ -11,6 +14,7 @@ raise newException(Exception, "Xlib error: " & astToStr(call) & " returned " & $value) proc xlibInit*(): (PDisplay, Window) = + checkXlibResult XInitThreads() let display = XOpenDisplay(nil) if display == nil: quit "Failed to open display" @@ -26,7 +30,7 @@ checkXlibResult XSelectInput(display, window, ButtonPressMask or KeyPressMask or ExposureMask) checkXlibResult XMapWindow(display, window) - deleteMessage = XInternAtom(display, "WM_DELETE_WINDOW", false.XBool) + deleteMessage = XInternAtom(display, "WM_DELETE_WINDOW", XBool(false)) checkXlibResult XSetWMProtocols(display, window, addr(deleteMessage), 1) return (display, window)