From 717ff80ff78c17f2c54f3dbc6b319d10016b7612 Mon Sep 17 00:00:00 2001 From: kitty piapiac Date: Mon, 10 Aug 2020 21:17:45 -0700 Subject: =?UTF-8?q?(.=E3=81=A5=E2=97=A1=EF=B9=8F=E2=97=A1)=E3=81=A5.=20sma?= =?UTF-8?q?ll=20code=20cleanup,=20prepare=20v0.1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/kauw.nim | 3 +-- src/windowmanager.nim | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/kauw.nim b/src/kauw.nim index 6d6e64b..03199b8 100644 --- a/src/kauw.nim +++ b/src/kauw.nim @@ -3,8 +3,7 @@ import /windowmanager, logging, /logger -# 0.0.0 for DOESN'T FUNCTION YET!! -const version = "0.0.0" +const version = "0.1.0" proc main() = if paramCount() > 0: diff --git a/src/windowmanager.nim b/src/windowmanager.nim index c67223b..6e361ec 100644 --- a/src/windowmanager.nim +++ b/src/windowmanager.nim @@ -43,14 +43,13 @@ proc createWindowManager*: WindowManager = lvlError.log("failed to open X display " & $XDisplayName nil) quit QuitFailure - var - screen = display.DefaultScreenOfDisplay() + var screen = display.DefaultScreenOfDisplay return WindowManager( display: display, screen: screen, - colormap: screen.DefaultColormapOfScreen(), - root: display.DefaultRootWindow(), + colormap: screen.DefaultColormapOfScreen, + root: display.DefaultRootWindow, clients: @[], focused: -1, @@ -58,9 +57,9 @@ proc createWindowManager*: WindowManager = # Run window manager proc run* (wm: WindowManager) = - initKeybindings wm - initButtons wm - initCommands wm + wm.initKeybindings + wm.initButtons + wm.initCommands discard XSetErrorHandler onWMDetected # Temporary error handler if there is another window manager running @@ -73,7 +72,7 @@ proc run* (wm: WindowManager) = var e: XEvent discard wm.display.XNextEvent(addr e) - tileWindows wm + wm.tileWindows case e.theType: of CreateNotify: wm.onCreateNotify addr e.xcreatewindow @@ -138,7 +137,7 @@ proc λnextWindow (wm: WindowManager) = if wm.focused == n: wm.focused = 0 else: wm.focused += 1 discard wm.display.XSetInputFocus(wm.clients[wm.focused], RevertToParent, CurrentTime) - tileWindows wm + wm.tileWindows lvlDebug.log $wm.focused proc λsetMaster (wm: WindowManager) = @@ -146,7 +145,7 @@ proc λsetMaster (wm: WindowManager) = if n != 0: swap(wm.clients[n], wm.clients[0]) wm.focused = 0 - tileWindows wm + wm.tileWindows lvlDebug.log $wm.focused proc λspawnCustom (wm: WindowManager, key: objects.Key) = @@ -234,7 +233,7 @@ proc onUnmapNotify (wm: WindowManager, e: PXUnmapEvent) = let ti = wm.clients.find(e.window) if ti > -1: wm.clients.delete ti - wm.tileWindows() + wm.tileWindows proc onConfigureNotify (wm: WindowManager, e: PXConfigureEvent) = return @@ -242,7 +241,7 @@ proc onMapRequest (wm: WindowManager, e: PXMapRequestEvent) = discard wm.display.XMapWindow e.window discard wm.display.XSetWindowBorderWidth(e.window, config.frameWidth) wm.addWindow e.window - wm.tileWindows() + wm.tileWindows proc onConfigureRequest (wm: WindowManager, e: PXConfigureRequestEvent) = var changes: XWindowChanges -- cgit v1.2.3