diff --git a/src/nimwin.nim b/src/nimwin.nim index 3e759b4..3fd959d 100644 --- a/src/nimwin.nim +++ b/src/nimwin.nim @@ -3,6 +3,11 @@ import threadpool, osproc, tables, sequtils var root : TWindow +proc handleBadWindow(display : PDisplay, ev : PXErrorEvent) : cint {.cdecl.} = + # resourceID maps to the Window's XID + # ev.resourceID + 0 + template HandleKey(key : TKeySym, body : untyped) : untyped = block: if (XLookupKeySym(cast[PXKeyEvent](ev.xkey.addr), 0) == key.cuint): @@ -144,6 +149,8 @@ when isMainModule: var openProcesses = initTable[int, Process]() # hashset of processes + discard XSetErrorHandler(handleBadWindow) + while true: let processExited = processChan.tryRecv()