From f74e296f8486fd55d97a7a89e345a783a855e19c Mon Sep 17 00:00:00 2001 From: Yury Benesh Date: Sun, 7 Jul 2013 23:01:11 +0300 Subject: [PATCH] Fixed XClientMessageEvent struct, added equals operator fot TAtom from unsigned, added xclient union field access proc to XEvent --- lib/wrappers/x11/x.nim | 4 +++- lib/wrappers/x11/xlib.nim | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/wrappers/x11/x.nim b/lib/wrappers/x11/x.nim index 20420b114b..2eefe311ff 100644 --- a/lib/wrappers/x11/x.nim +++ b/lib/wrappers/x11/x.nim @@ -10,6 +10,7 @@ # x.h # # Pointers to basic pascal types, inserted by h2pas conversion program. +import unsigned const X_PROTOCOL* = 11 @@ -47,7 +48,8 @@ type PKeyCode* = ptr TKeyCode TKeyCode* = cuchar -proc `==`*(a, b: TAtom): bool {.borrow.} +proc `==`*(a, b: TAtom): bool = + return unsigned.`==`(a,b) const None* = 0 diff --git a/lib/wrappers/x11/xlib.nim b/lib/wrappers/x11/xlib.nim index 6603d15290..1f70597718 100644 --- a/lib/wrappers/x11/xlib.nim +++ b/lib/wrappers/x11/xlib.nim @@ -694,7 +694,7 @@ type window*: TWindow message_type*: TAtom format*: cint - data*: array[0..19, char] + data*: array[0..4, clong] PXMappingEvent* = ptr TXMappingEvent TXMappingEvent*{.final.} = object @@ -766,6 +766,13 @@ type # +proc xclient*(e: PXEvent): PXClientMessageEvent = + ## Treats XEvent as XClientMessageEvent + return cast[PXClientMessageEvent](e) + +proc xclient*(e: var TXEvent): PXClientMessageEvent = + return xclient(PXEvent(e.addr)) + type PXCharStruct* = ptr TXCharStruct TXCharStruct*{.final.} = object