From ddfdac5c2f1a53e96c4c7b6c73f0cdd4fb34235b Mon Sep 17 00:00:00 2001 From: kitty piapiac Date: Fri, 7 Aug 2020 21:48:13 -0700 Subject: =?UTF-8?q?(/=E3=83=BB=E3=83=BB)=E3=83=8E=20fixes=20#1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit use swap() as well instead of a temp variable --- src/windowmanager.nim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/windowmanager.nim b/src/windowmanager.nim index 0ccbe87..1bda674 100644 --- a/src/windowmanager.nim +++ b/src/windowmanager.nim @@ -155,9 +155,7 @@ proc λnextWindow (wm: WindowManager) = proc λsetMaster (wm: WindowManager) = var n = wm.focused if n != 0: - let temp = wm.clients[n] - wm.clients[n] = wm.clients[0] - wm.clients[0] = temp + swap(wm.clients[n], wm.clients[0]) wm.focused = 0 tileWindows wm lvlDebug.log $wm.focused @@ -244,7 +242,9 @@ proc onReparentNotify (wm: WindowManager, e: PXReparentEvent) = return proc onMapNotify (wm: WindowManager, e: PXMapEvent) = return proc onUnmapNotify (wm: WindowManager, e: PXUnmapEvent) = if wm.focused == wm.clients.high: wm.focused -= 1 - discard wm.display.XSetInputFocus(wm.clients[wm.focused], RevertToParent, CurrentTime) + 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 wm.tileWindows() -- cgit v1.2.3