summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorYury Benesh <ybxsoft@tut.by>2013-07-07 23:01:11 +0300
committerYury Benesh <ybxsoft@tut.by>2013-07-07 23:01:11 +0300
commitf74e296f8486fd55d97a7a89e345a783a855e19c (patch)
tree836157109ef1d672d1726fca592ddb71f1ab480a
parent127253c8d510b1594b2eb00ae4547fdc5539fdd4 (diff)
downloadNim-f74e296f8486fd55d97a7a89e345a783a855e19c.tar.gz
Fixed XClientMessageEvent struct, added equals operator fot TAtom from unsigned, added xclient union field access proc to XEvent
-rw-r--r--lib/wrappers/x11/x.nim4
-rw-r--r--lib/wrappers/x11/xlib.nim9
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/wrappers/x11/x.nim b/lib/wrappers/x11/x.nim
index 20420b114..2eefe311f 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 6603d1529..1f7059771 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