From 0f7e320fa198ffebaaea98d142eabee25d8fdafb Mon Sep 17 00:00:00 2001 From: kitty piapiac Date: Mon, 10 Aug 2020 20:52:16 -0700 Subject: =?UTF-8?q?(/=E3=83=BB=E3=83=BB)=E3=83=8E=20better=20default=20con?= =?UTF-8?q?fig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/windowmanager.nim | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/windowmanager.nim') diff --git a/src/windowmanager.nim b/src/windowmanager.nim index 2eb947e..c67223b 100644 --- a/src/windowmanager.nim +++ b/src/windowmanager.nim @@ -53,7 +53,7 @@ proc createWindowManager*: WindowManager = root: display.DefaultRootWindow(), clients: @[], - focused: 0, + focused: -1, keys: initTable[cuint, objects.Key](1)) # Run window manager @@ -175,10 +175,8 @@ proc onXError (display: PDisplay, e: PXErrorEvent): cint{.cdecl.} = " request: " & $e.request_code & "\n" & " error code: " & $e.error_code & " - " & errorText & "\n" & " resource id: " & $e.resourceid) - return 0 - proc addWindow (wm: WindowManager, w: Window) = wm.clients.add w discard wm.display.XSetInputFocus(w, RevertToParent, CurrentTime) @@ -234,8 +232,8 @@ proc onUnmapNotify (wm: WindowManager, e: PXUnmapEvent) = if wm.focused > -1: discard wm.display.XSetInputFocus(wm.clients[wm.focused], RevertToParent, CurrentTime) - let index = wm.clients.find(e.window) - if index > -1: wm.clients.delete index + let ti = wm.clients.find(e.window) + if ti > -1: wm.clients.delete ti wm.tileWindows() proc onConfigureNotify (wm: WindowManager, e: PXConfigureEvent) = return -- cgit v1.2.3