Browse Source

handle window property types

master
Wesley Kerfoot 4 years ago
parent
commit
2d69e0452b
  1. 14
      src/nimwin.nim

14
src/nimwin.nim

@ -31,13 +31,14 @@ template RunProcess(procedure : untyped) : untyped =
spawn handleProcess(p) spawn handleProcess(p)
type type
WinPropKind = enum pkString, pkCardinal, pkAtom WinPropKind = enum pkString, pkCardinal, pkAtom, pkWindow
WinProp = ref object of RootObj WinProp = ref object of RootObj
name : string name : string
case kind: WinPropKind case kind: WinPropKind
of pkString: strProp : string of pkString: strProp : string
of pkCardinal: cardinalProp : seq[uint] of pkCardinal: cardinalProp : seq[uint]
of pkAtom: atomProps : seq[string] of pkAtom: atomProps : seq[string]
of pkWindow: windowProps : seq[TWindow]
type Window = ref object of RootObj type Window = ref object of RootObj
x : cint x : cint
@ -97,6 +98,8 @@ proc zipperMove[T](zipper: Zipper[T], direction: string) : Zipper[T] =
proc zipperInsert[T](zipper: Zipper[T], item: T) : Zipper[T] = proc zipperInsert[T](zipper: Zipper[T], item: T) : Zipper[T] =
# insert a new item before as the current focus # insert a new item before as the current focus
if zipper.zipperExists(item):
return zipper
result.lhs = zipper.lhs result.lhs = zipper.lhs
result.rhs = @[item] & zipper.rhs result.rhs = @[item] & zipper.rhs
@ -215,6 +218,15 @@ proc getPropertyValue(display : PDisplay, window : TWindow, property : TAtom) :
atomProps: atomPropNames atomProps: atomPropNames
) )
) )
elif typeName == "WINDOW":
result = some(
WinProp(
name: atomName.get,
kind: pkWindow,
windowProps: mapIt(unpackPropValue(actualTypeFormat.int, nItemsReturn.int, propValue), it.culong)
)
)
else: else:
result = none(WinProp) result = none(WinProp)

Loading…
Cancel
Save