branch: externals/xelb
commit 70599170294397b68f21c9fcc9e13c4aebee38fd
Author: Steven Allen <[email protected]>
Commit: Steven Allen <[email protected]>
Add a new xcb:unmarshal-new that returns the object
Instead of having to write:
(let* ((obj (let ((m (make-instance 'xcb:ClientMessage)))
(xcb:unmarshal m raw-data)
m))
(type (slot-value obj 'type))
We can now write:
(let* ((obj (xcb:unmarshal-new 'xcb:ClientMessage raw-data))
(type (slot-value obj 'type))
---
xcb-types.el | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/xcb-types.el b/xcb-types.el
index 39d2308f28..1a90d5bcfc 100644
--- a/xcb-types.el
+++ b/xcb-types.el
@@ -916,6 +916,13 @@ The optional argument CTX is for <paramref>."
(setf (slot-value obj (eieio-slot-descriptor-name slot)) (car tmp))))
(slot-value obj '~size)))
+(defun xcb:unmarshal-new (type byte-array)
+ "Construct a new object of type TYPE and unmarshal BYTE-ARRAY into it.
+Return the new object."
+ (let ((obj (make-instance type)))
+ (xcb:unmarshal obj byte-array)
+ obj))
+
(provide 'xcb-types)