Browse Source

fix resizing stuff

fix-resizing
Wesley Kerfoot 5 years ago
parent
commit
15bfdf6e4a
  1. 24
      src/nimwin.nim

24
src/nimwin.nim

@ -402,20 +402,19 @@ when isMainModule:
let winAttrs : Option[TXWindowAttributes] = getAttributes(display, ev.xKey.subWindow.addr) let winAttrs : Option[TXWindowAttributes] = getAttributes(display, ev.xKey.subWindow.addr)
let depth = winAttrs.get.borderWidth.cuint let borderWidth = winAttrs.get.borderWidth.cuint
let borderWidth = winAttrs.get.depth.cuint
discard XMoveResizeWindow(display, discard XMoveResizeWindow(display,
ev.xKey.subWindow, ev.xKey.subWindow,
0, struts.top.cint, struts.bottom.cint, struts.top.cint,
screenWidth.cuint, screenHeight.cuint - struts.bottom.cuint - borderWidth.cuint) screenWidth.cuint, screenHeight.cuint - struts.top.cuint - struts.bottom.cuint)
elif (ev.theType == ButtonPress) and (ev.xButton.subWindow != None): elif (ev.theType == ButtonPress) and (ev.xButton.subWindow != None):
discard XGetWindowAttributes(display, ev.xButton.subWindow, attr.addr) discard XGetWindowAttributes(display, ev.xButton.subWindow, attr.addr)
start = ev.xButton 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) let rootAttrs = getAttributes(display, root.addr)
if rootAttrs.isSome: if rootAttrs.isSome:
let struts = display.calculateStruts let struts = display.calculateStruts
@ -424,17 +423,12 @@ when isMainModule:
let winAttrs : Option[TXWindowAttributes] = getAttributes(display, ev.xcreatewindow.window.addr) let winAttrs : Option[TXWindowAttributes] = getAttributes(display, ev.xcreatewindow.window.addr)
let depth = winAttrs.get.borderWidth.cuint discard XMoveResizeWindow(display,
let borderWidth = winAttrs.get.depth.cuint ev.xmap.window,
struts.bottom.cint, struts.top.cint,
if winAttrs.isSome and winAttrs.get.overrideRedirect == 0: screenWidth.cuint, screenHeight.cuint - struts.top.cuint - struts.bottom.cuint)
discard XMoveResizeWindow(display,
ev.xcreatewindow.window,
0, struts.top.cint,
screenWidth.cuint, screenHeight.cuint - struts.bottom.cuint - borderWidth.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): elif (ev.theType == MotionNotify) and (start.subWindow != None):

Loading…
Cancel
Save