From 15bfdf6e4a02c2afd7419529db835578e9f1dd07 Mon Sep 17 00:00:00 2001 From: Wesley Kerfoot Date: Tue, 30 Jun 2020 23:20:28 -0400 Subject: [PATCH] fix resizing stuff --- src/nimwin.nim | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/nimwin.nim b/src/nimwin.nim index f1382ab..b0a61c7 100644 --- a/src/nimwin.nim +++ b/src/nimwin.nim @@ -402,20 +402,19 @@ when isMainModule: let winAttrs : Option[TXWindowAttributes] = getAttributes(display, ev.xKey.subWindow.addr) - let depth = winAttrs.get.borderWidth.cuint - let borderWidth = winAttrs.get.depth.cuint + let borderWidth = winAttrs.get.borderWidth.cuint discard XMoveResizeWindow(display, ev.xKey.subWindow, - 0, struts.top.cint, - screenWidth.cuint, screenHeight.cuint - struts.bottom.cuint - borderWidth.cuint) + struts.bottom.cint, struts.top.cint, + screenWidth.cuint, screenHeight.cuint - struts.top.cuint - struts.bottom.cuint) elif (ev.theType == ButtonPress) and (ev.xButton.subWindow != None): discard XGetWindowAttributes(display, ev.xButton.subWindow, attr.addr) start = ev.xButton - elif (ev.theType == CreateNotify) and (ev.xcreatewindow.parent == root): + elif (ev.theType == MapNotify) and (ev.xmap.overrideRedirect == 0): let rootAttrs = getAttributes(display, root.addr) if rootAttrs.isSome: let struts = display.calculateStruts @@ -424,17 +423,12 @@ when isMainModule: let winAttrs : Option[TXWindowAttributes] = getAttributes(display, ev.xcreatewindow.window.addr) - let depth = winAttrs.get.borderWidth.cuint - let borderWidth = winAttrs.get.depth.cuint - - if winAttrs.isSome and winAttrs.get.overrideRedirect == 0: - discard XMoveResizeWindow(display, - ev.xcreatewindow.window, - 0, struts.top.cint, - screenWidth.cuint, screenHeight.cuint - struts.bottom.cuint - borderWidth.cuint) + discard XMoveResizeWindow(display, + ev.xmap.window, + struts.bottom.cint, struts.top.cint, + screenWidth.cuint, screenHeight.cuint - struts.top.cuint - struts.bottom.cuint) - elif (ev.theType == MapNotify) and (ev.xmap.overrideRedirect == 0): - discard display.XSetInputFocus(ev.xmap.window, RevertToPointerRoot, CurrentTime) + discard display.XSetInputFocus(ev.xmap.window, RevertToPointerRoot, CurrentTime) elif (ev.theType == MotionNotify) and (start.subWindow != None):