Browse Source

Merge pull request #10 from weskerfoot/fix-resizing

Fix resizing
master
Wesley Kerfoot 4 years ago
committed by GitHub
parent
commit
1788fe33d4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      src/nimwin.nim

21
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):

Loading…
Cancel
Save