diff options
author | kitty piapiac <kcp@bsd.computer> | 2020-08-07 21:48:13 -0700 |
---|---|---|
committer | kitty piapiac <kcp@bsd.computer> | 2020-08-07 21:48:13 -0700 |
commit | ddfdac5c2f1a53e96c4c7b6c73f0cdd4fb34235b (patch) | |
tree | a81a9532b8bb2cad53ed492193d59cac6833735d /src/windowmanager.nim | |
parent | bd129d47e4fb75e7e680cd65b97e807f9bee900d (diff) |
(/・・)ノ fixes #1
use swap() as well instead of a temp variable
Diffstat (limited to 'src/windowmanager.nim')
-rw-r--r-- | src/windowmanager.nim | 8 |
1 files 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() |