diff --git a/src/nimwin.nim b/src/nimwin.nim index fd7bc50..de689c6 100644 --- a/src/nimwin.nim +++ b/src/nimwin.nim @@ -403,20 +403,18 @@ 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 == MapNotify) and (ev.xmap.overrideRedirect == 0): let rootAttrs = getAttributes(display, root.addr) if rootAttrs.isSome: @@ -424,15 +422,14 @@ when isMainModule: let screenHeight = rootAttrs.get.height let screenWidth = rootAttrs.get.width - let winAttrs : Option[TXWindowAttributes] = getAttributes(display, ev.xmap.window.addr) + let winAttrs : Option[TXWindowAttributes] = getAttributes(display, ev.xcreatewindow.window.addr) - if winAttrs.isSome and winAttrs.get.overrideRedirect == 0: - discard XMoveResizeWindow(display, - ev.xmap.window, - 0, struts.top.cint, - screenWidth.cuint, screenHeight.cuint) + discard XMoveResizeWindow(display, + ev.xmap.window, + struts.bottom.cint, struts.top.cint, + screenWidth.cuint, screenHeight.cuint - struts.top.cuint - struts.bottom.cuint) - discard display.XSetInputFocus(ev.xmap.window, RevertToPointerRoot, CurrentTime) + discard display.XSetInputFocus(ev.xmap.window, RevertToPointerRoot, CurrentTime) elif (ev.theType == MotionNotify) and (start.subWindow != None):