branch: externals/exwm
commit e489bc01e7ced6ed708d6fad7383ff290b7f9005
Author: Steven Allen <[email protected]>
Commit: Steven Allen <[email protected]>

    Use xcb:unmarshal-new where appropriate
    
    * exwm-floating.el (exwm-floating--unmarshal-motion-notify): Remove
    function made redundant by `xcb:unmarshal-new'.
    (exwm-floating--do-moveresize): Use xcb:unmarshal-new.
    * exwm-input.el (exwm-input--on-PropertyNotify):
    (exwm-input--on-EnterNotify):
    (exwm-input--on-ButtonPress):
    (exwm-input--on-KeyPress):
    (exwm-input--on-CreateNotify): Same as above.
    * exwm-manage.el (exwm-manage--on-ConfigureRequest):
    (exwm-manage--on-MapRequest):
    (exwm-manage--on-UnmapNotify):
    (exwm-manage--on-MapNotify):
    (exwm-manage--on-DestroyNotify):  Same as above.
    * exwm-randr.el (exwm-randr--on-ScreenChangeNotify):
    (exwm-randr--on-Notify):
    (exwm-randr--on-ConfigureNotify):  Same as above.
    * exwm-systemtray.el (exwm-systemtray--on-DestroyNotify):
    (exwm-systemtray--on-ReparentNotify):
    (exwm-systemtray--on-ResizeRequest):
    (exwm-systemtray--on-PropertyNotify):
    (exwm-systemtray--on-ClientMessage):
    (exwm-systemtray--on-KeyPress):  Same as above.
    * exwm-workspace.el (exwm-workspace--on-ConfigureNotify): Same as
    above.
    * exwm-xim.el (exwm-xim--on-SelectionRequest):
    (exwm-xim--on-ClientMessage-0):
    (exwm-xim--on-ClientMessage):
    (exwm-xim--on-request):
    (exwm-xim--handle-forward-event-request):
    (exwm-xim--on-DestroyNotify):  Same as above.
    * exwm.el (exwm--on-PropertyNotify):
    (exwm--on-ClientMessage):
    (exwm--on-SelectionClear):  Same as above.
---
 exwm-floating.el   |  8 +-------
 exwm-input.el      | 15 +++++----------
 exwm-manage.el     | 15 +++++----------
 exwm-randr.el      |  9 +++------
 exwm-systemtray.el | 18 ++++++------------
 exwm-workspace.el  |  3 +--
 exwm-xim.el        | 54 ++++++++++++++++++------------------------------------
 exwm.el            | 10 +++-------
 8 files changed, 42 insertions(+), 90 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index 62e1256f3a..c4bca0c6aa 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -643,16 +643,10 @@ Float resizing is stopped when TYPE is nil."
                              (frame-root-window exwm--floating-frame)))))
     (setq exwm-floating--moveresize-calculate nil)))
 
-(defsubst exwm-floating--unmarshal-motion-notify (data)
-  "Unmarshal DATA as a MotionNotify event."
-  (let ((obj (make-instance 'xcb:MotionNotify)))
-    (xcb:unmarshal obj data)
-    obj))
-
 (defun exwm-floating--do-moveresize (data _synthetic)
   "Perform move/resize on floating window with DATA."
   (when exwm-floating--moveresize-calculate
-    (let* ((obj (exwm-floating--unmarshal-motion-notify data))
+    (let* ((obj (xcb:unmarshal-new 'xcb:MotionNotify data))
            (result (funcall exwm-floating--moveresize-calculate
                             (slot-value obj 'root-x)
                             (slot-value obj 'root-y)))
diff --git a/exwm-input.el b/exwm-input.el
index c34b62d78d..fe10e6d6f9 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -227,8 +227,7 @@ ARGS are additional arguments to CALLBACK."
   "Handle PropertyNotify events with DATA."
   (exwm--log)
   (when exwm-input--timestamp-callback
-    (let ((obj (make-instance 'xcb:PropertyNotify)))
-      (xcb:unmarshal obj data)
+    (let ((obj (xcb:unmarshal-new 'xcb:PropertyNotify data)))
       (when (= exwm-input--timestamp-window
                (slot-value obj 'window))
         (apply (car exwm-input--timestamp-callback)
@@ -240,9 +239,8 @@ ARGS are additional arguments to CALLBACK."
 
 (defun exwm-input--on-EnterNotify (data _synthetic)
   "Handle EnterNotify events with DATA."
-  (let ((evt (make-instance 'xcb:EnterNotify))
+  (let ((evt (xcb:unmarshal-new 'xcb:EnterNotify data))
         buffer window frame frame-xid edges fake-evt)
-    (xcb:unmarshal evt data)
     (with-slots (time root event root-x root-y event-x event-y state) evt
       (setq buffer (exwm--id->buffer event)
             window (get-buffer-window buffer t))
@@ -392,10 +390,9 @@ attempt later."
 
 (defun exwm-input--on-ButtonPress (data _synthetic)
   "Handle ButtonPress event with DATA."
-  (let ((obj (make-instance 'xcb:ButtonPress))
+  (let ((obj (xcb:unmarshal-new 'xcb:ButtonPress data))
         (mode xcb:Allow:SyncPointer)
         button-event window buffer frame fake-last-command)
-    (xcb:unmarshal obj data)
     (exwm--log "major-mode=%s buffer=%s"
                major-mode (buffer-name (current-buffer)))
     (with-slots (detail event state) obj
@@ -465,8 +462,7 @@ attempt later."
 (defun exwm-input--on-KeyPress (data _synthetic)
   "Handle KeyPress event with DATA."
   (with-current-buffer (window-buffer (selected-window))
-    (let ((obj (make-instance 'xcb:KeyPress)))
-      (xcb:unmarshal obj data)
+    (let ((obj (xcb:unmarshal-new 'xcb:KeyPress data)))
       (exwm--log "major-mode=%s buffer=%s"
                  major-mode (buffer-name (current-buffer)))
       (if (derived-mode-p 'exwm-mode)
@@ -481,8 +477,7 @@ attempt later."
 (defun exwm-input--on-CreateNotify (data _synthetic)
   "Handle CreateNotify events with DATA."
   (exwm--log)
-  (let ((evt (make-instance 'xcb:CreateNotify)))
-    (xcb:unmarshal evt data)
+  (let ((evt (xcb:unmarshal-new 'xcb:CreateNotify data)))
     (with-slots (window) evt
       (exwm-input--grab-global-prefix-keys window))))
 
diff --git a/exwm-manage.el b/exwm-manage.el
index 2cb0c15790..5171d5bf76 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -664,9 +664,8 @@ FRAME is the frame to be deleted."
   "Handle ConfigureRequest event.
 DATA contains unmarshalled ConfigureRequest event data."
   (exwm--log)
-  (let ((obj (make-instance 'xcb:ConfigureRequest))
+  (let ((obj (xcb:unmarshal-new 'xcb:ConfigureRequest data))
         buffer edges width-delta height-delta)
-    (xcb:unmarshal obj data)
     (with-slots (window x y width height
                         border-width sibling stack-mode value-mask)
         obj
@@ -754,8 +753,7 @@ border-width: %d; sibling: #x%x; stack-mode: %d"
 (defun exwm-manage--on-MapRequest (data _synthetic)
   "Handle MapRequest event.
 DATA contains unmarshalled MapRequest event data."
-  (let ((obj (make-instance 'xcb:MapRequest)))
-    (xcb:unmarshal obj data)
+  (let ((obj (xcb:unmarshal-new 'xcb:MapRequest data)))
     (with-slots (parent window) obj
       (exwm--log "id=#x%x parent=#x%x" window parent)
       (if (assoc window exwm--id-buffer-alist)
@@ -775,8 +773,7 @@ DATA contains unmarshalled MapRequest event data."
 (defun exwm-manage--on-UnmapNotify (data _synthetic)
   "Handle UnmapNotify event.
 DATA contains unmarshalled UnmapNotify event data."
-  (let ((obj (make-instance 'xcb:UnmapNotify)))
-    (xcb:unmarshal obj data)
+  (let ((obj (xcb:unmarshal-new 'xcb:UnmapNotify data)))
     (with-slots (window) obj
       (exwm--log "id=#x%x" window)
       (exwm-manage--unmanage-window window t))))
@@ -784,8 +781,7 @@ DATA contains unmarshalled UnmapNotify event data."
 (defun exwm-manage--on-MapNotify (data _synthetic)
   "Handle MapNotify event.
 DATA contains unmarshalled MapNotify event data."
-  (let ((obj (make-instance 'xcb:MapNotify)))
-    (xcb:unmarshal obj data)
+  (let ((obj (xcb:unmarshal-new 'xcb:MapNotify data)))
     (with-slots (window) obj
       (when (assoc window exwm--id-buffer-alist)
         (exwm--log "id=#x%x" window)
@@ -813,8 +809,7 @@ DATA contains unmarshalled DestroyNotify event data.
 SYNTHETIC indicates whether the event is a synthetic event."
   (unless synthetic
     (exwm--log)
-    (let ((obj (make-instance 'xcb:DestroyNotify)))
-      (xcb:unmarshal obj data)
+    (let ((obj (xcb:unmarshal-new 'xcb:DestroyNotify data)))
       (exwm--log "#x%x" (slot-value obj 'window))
       (exwm-manage--unmanage-window (slot-value obj 'window)))))
 
diff --git a/exwm-randr.el b/exwm-randr.el
index 62fb465924..6fb5e3bbe9 100644
--- a/exwm-randr.el
+++ b/exwm-randr.el
@@ -295,8 +295,7 @@ In a mirroring setup some monitors overlap and should be 
treated as one."
 
 Run `exwm-randr-screen-change-hook' (usually user scripts to configure RandR)."
   (exwm--log)
-  (let ((evt (make-instance 'xcb:randr:ScreenChangeNotify)))
-    (xcb:unmarshal evt data)
+  (let ((evt (xcb:unmarshal-new 'xcb:randr:ScreenChangeNotify data)))
     (let ((ts (slot-value evt 'config-timestamp)))
       (unless (equal ts exwm-randr--prev-screen-change-timestamp)
         (setq exwm-randr--prev-screen-change-timestamp ts)
@@ -307,9 +306,8 @@ Run `exwm-randr-screen-change-hook' (usually user scripts 
to configure RandR)."
 
 Refresh when any CRTC/output changes."
   (exwm--log)
-  (let ((evt (make-instance 'xcb:randr:Notify))
+  (let ((evt (xcb:unmarshal-new 'xcb:randr:Notify data))
         notify)
-    (xcb:unmarshal evt data)
     (with-slots (subCode u) evt
       (cond ((= subCode xcb:randr:Notify:CrtcChange)
              (setq notify (slot-value u 'cc)))
@@ -326,8 +324,7 @@ Refresh when any CRTC/output changes."
 
 Refresh when any RandR 1.5 monitor changes."
   (exwm--log)
-  (let ((evt (make-instance 'xcb:ConfigureNotify)))
-    (xcb:unmarshal evt data)
+  (let ((evt (xcb:unmarshal-new 'xcb:ConfigureNotify data)))
     (with-slots (window) evt
       (when (eq window exwm--root)
         (exwm-randr-refresh)))))
diff --git a/exwm-systemtray.el b/exwm-systemtray.el
index 8bb170ad45..32e2da1055 100644
--- a/exwm-systemtray.el
+++ b/exwm-systemtray.el
@@ -349,8 +349,7 @@ indicate how to support actual transparency."
   "Unembed icons on DestroyNotify.
 Argument DATA contains the raw event data."
   (exwm--log)
-  (let ((obj (make-instance 'xcb:DestroyNotify)))
-    (xcb:unmarshal obj data)
+  (let ((obj (xcb:unmarshal-new 'xcb:DestroyNotify data)))
     (with-slots (window) obj
       (when (assoc window exwm-systemtray--list)
         (exwm-systemtray--unembed window)))))
@@ -359,8 +358,7 @@ Argument DATA contains the raw event data."
   "Unembed icons on ReparentNotify.
 Argument DATA contains the raw event data."
   (exwm--log)
-  (let ((obj (make-instance 'xcb:ReparentNotify)))
-    (xcb:unmarshal obj data)
+  (let ((obj (xcb:unmarshal-new 'xcb:ReparentNotify data)))
     (with-slots (window parent) obj
       (when (and (/= parent exwm-systemtray--embedder-window)
                  (assoc window exwm-systemtray--list))
@@ -370,9 +368,8 @@ Argument DATA contains the raw event data."
   "Resize the tray icon on ResizeRequest.
 Argument DATA contains the raw event data."
   (exwm--log)
-  (let ((obj (make-instance 'xcb:ResizeRequest))
+  (let ((obj (xcb:unmarshal-new 'xcb:ResizeRequest data))
         attr)
-    (xcb:unmarshal obj data)
     (with-slots (window width height) obj
       (when (setq attr (cdr (assoc window exwm-systemtray--list)))
         (with-slots ((width* width)
@@ -399,9 +396,8 @@ Argument DATA contains the raw event data."
   "Map/Unmap the tray icon on PropertyNotify.
 Argument DATA contains the raw event data."
   (exwm--log)
-  (let ((obj (make-instance 'xcb:PropertyNotify))
+  (let ((obj (xcb:unmarshal-new 'xcb:PropertyNotify data))
         attr info visible)
-    (xcb:unmarshal obj data)
     (with-slots (window atom state) obj
       (when (and (eq state xcb:Property:NewValue)
                  (eq atom xcb:Atom:_XEMBED_INFO)
@@ -424,9 +420,8 @@ Argument DATA contains the raw event data."
 (defun exwm-systemtray--on-ClientMessage (data _synthetic)
   "Handle client messages.
 Argument DATA contains the raw event data."
-  (let ((obj (make-instance 'xcb:ClientMessage))
+  (let ((obj (xcb:unmarshal-new 'xcb:ClientMessage data))
         opcode data32)
-    (xcb:unmarshal obj data)
     (with-slots (window type data) obj
       (when (eq type xcb:Atom:_NET_SYSTEM_TRAY_OPCODE)
         (setq data32 (slot-value data 'data32)
@@ -449,8 +444,7 @@ Argument DATA contains the raw event data."
   ;; a workspace frame has the input focus and the pointer is over a
   ;; tray icon.
   (let ((dest (frame-parameter (selected-frame) 'exwm-outer-id))
-        (obj (make-instance 'xcb:KeyPress)))
-    (xcb:unmarshal obj data)
+        (obj (xcb:unmarshal-new 'xcb:KeyPress data)))
     (setf (slot-value obj 'event) dest)
     (xcb:+request exwm-systemtray--connection
         (make-instance 'xcb:SendEvent
diff --git a/exwm-workspace.el b/exwm-workspace.el
index cc9c0625ee..d81031751c 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -1133,8 +1133,7 @@ account when calculating the height."
 (defun exwm-workspace--on-ConfigureNotify (data _synthetic)
   "Adjust the container to fit the minibuffer frame.
 DATA contains unmarshalled ConfigureNotify event data."
-  (let ((obj (make-instance 'xcb:ConfigureNotify)) y)
-    (xcb:unmarshal obj data)
+  (let ((obj (xcb:unmarshal-new 'xcb:ConfigureNotify data)) y)
     (with-slots (window height) obj
       (when (eq (frame-parameter exwm-workspace--minibuffer 'exwm-outer-id)
                 window)
diff --git a/exwm-xim.el b/exwm-xim.el
index 0c501b7d1d..fcc5703219 100644
--- a/exwm-xim.el
+++ b/exwm-xim.el
@@ -170,9 +170,8 @@ DATA contains unmarshalled SelectionRequest event data.
 
 Such events would be received when clients query for LOCALES or TRANSPORT."
   (exwm--log)
-  (let ((evt (make-instance 'xcb:SelectionRequest))
+  (let ((evt (xcb:unmarshal-new 'xcb:SelectionRequest data))
         value fake-event)
-    (xcb:unmarshal evt data)
     (with-slots (time requestor selection target property) evt
       (setq value (cond ((= target exwm-xim--LOCALES)
                          ;; Return supported locales.
@@ -213,9 +212,8 @@ Such events would be received when clients request for 
_XIM_XCONNECT.
 A new X connection and server window would be created to communicate with
 this client."
   (exwm--log)
-  (let ((evt (make-instance 'xcb:ClientMessage))
+  (let ((evt (xcb:unmarshal-new 'xcb:ClientMessage data))
         conn client-xwin server-xwin)
-    (xcb:unmarshal evt data)
     (with-slots (window type data) evt
       (unless (= type exwm-xim--_XIM_XCONNECT)
         ;; Only handle _XIM_XCONNECT.
@@ -274,9 +272,8 @@ this client."
 Such events would be received when clients request for _XIM_PROTOCOL.
 The actual XIM request is in client message data or a property."
   (exwm--log)
-  (let ((evt (make-instance 'xcb:ClientMessage))
+  (let ((evt (xcb:unmarshal-new 'xcb:ClientMessage data))
         conn client-xwin server-xwin)
-    (xcb:unmarshal evt data)
     (with-slots (format window type data) evt
       (unless (= type exwm-xim--_XIM_PROTOCOL)
         (exwm--log "Ignore ClientMessage %s" type)
@@ -320,8 +317,7 @@ The actual XIM request is in client message data or a 
property."
            ;; Store byte-order.
            (setf (elt (plist-get exwm-xim--server-client-plist server-xwin) 2)
                  xim:lsb)
-           (setq req (make-instance 'xim:connect))
-           (xcb:unmarshal req data)
+           (setq req (xcb:unmarshal-new 'xim:connect data))
            (if (and (= (slot-value req 'major-version) 1)
                     (= (slot-value req 'minor-version) 0)
                     ;; Do not support authentication.
@@ -374,8 +370,7 @@ The actual XIM request is in client message data or a 
property."
                                  xcb:EventMask:NoEvent))))
           ((= opcode xim:opcode:close)
            (exwm--log "CLOSE")
-           (setq req (make-instance 'xim:close))
-           (xcb:unmarshal req data)
+           (setq req (xcb:unmarshal-new 'xim:close data))
            (push (make-instance 'xim:close-reply
                                 :im-id (slot-value req 'im-id))
                  replies))
@@ -385,8 +380,7 @@ The actual XIM request is in client message data or a 
property."
            (push exwm-xim--default-error replies))
           ((= opcode xim:opcode:encoding-negotiation)
            (exwm--log "ENCODING-NEGOTIATION")
-           (setq req (make-instance 'xim:encoding-negotiation))
-           (xcb:unmarshal req data)
+           (setq req (xcb:unmarshal-new 'xim:encoding-negotiation data))
            (let ((index (cl-position "COMPOUND_TEXT"
                                      (mapcar (lambda (i) (slot-value i 'name))
                                              (slot-value req 'names))
@@ -402,8 +396,7 @@ The actual XIM request is in client message data or a 
property."
                    replies)))
           ((= opcode xim:opcode:query-extension)
            (exwm--log "QUERY-EXTENSION")
-           (setq req (make-instance 'xim:query-extension))
-           (xcb:unmarshal req data)
+           (setq req (xcb:unmarshal-new 'xim:query-extension data))
            (push (make-instance 'xim:query-extension-reply
                                 :im-id (slot-value req 'im-id)
                                 ;; No extension support.
@@ -413,16 +406,14 @@ The actual XIM request is in client message data or a 
property."
           ((= opcode xim:opcode:set-im-values)
            (exwm--log "SET-IM-VALUES")
            ;; There's only one possible input method attribute.
-           (setq req (make-instance 'xim:set-im-values))
-           (xcb:unmarshal req data)
+           (setq req (xcb:unmarshal-new 'xim:set-im-values data))
            (push (make-instance 'xim:set-im-values-reply
                                 :im-id (slot-value req 'im-id))
                  replies))
           ((= opcode xim:opcode:get-im-values)
            (exwm--log "GET-IM-VALUES")
-           (setq req (make-instance 'xim:get-im-values))
            (let (im-attributes-id)
-             (xcb:unmarshal req data)
+             (setq req (xcb:unmarshal-new 'xim:get-im-values data))
              (setq im-attributes-id (slot-value req 'im-attributes-id))
              (if (cl-notevery (lambda (i) (= i 0)) im-attributes-id)
                  ;; Only support one IM attributes.
@@ -443,8 +434,7 @@ The actual XIM request is in client message data or a 
property."
                 replies))))
           ((= opcode xim:opcode:create-ic)
            (exwm--log "CREATE-IC")
-           (setq req (make-instance 'xim:create-ic))
-           (xcb:unmarshal req data)
+           (setq req (xcb:unmarshal-new 'xim:create-ic data))
            ;; Note: The ic-attributes slot is ignored.
            (setq exwm-xim--ic-id (if (< exwm-xim--ic-id #xffff)
                                      (1+ exwm-xim--ic-id)
@@ -455,16 +445,14 @@ The actual XIM request is in client message data or a 
property."
                  replies))
           ((= opcode xim:opcode:destroy-ic)
            (exwm--log "DESTROY-IC")
-           (setq req (make-instance 'xim:destroy-ic))
-           (xcb:unmarshal req data)
+           (setq req (xcb:unmarshal-new 'xim:destroy-ic data))
            (push (make-instance 'xim:destroy-ic-reply
                                 :im-id (slot-value req 'im-id)
                                 :ic-id (slot-value req 'ic-id))
                  replies))
           ((= opcode xim:opcode:set-ic-values)
            (exwm--log "SET-IC-VALUES")
-           (setq req (make-instance 'xim:set-ic-values))
-           (xcb:unmarshal req data)
+           (setq req (xcb:unmarshal-new 'xim:set-ic-values data))
            ;; We don't distinguish between input contexts.
            (push (make-instance 'xim:set-ic-values-reply
                                 :im-id (slot-value req 'im-id)
@@ -472,8 +460,7 @@ The actual XIM request is in client message data or a 
property."
                  replies))
           ((= opcode xim:opcode:get-ic-values)
            (exwm--log "GET-IC-VALUES")
-           (setq req (make-instance 'xim:get-ic-values))
-           (xcb:unmarshal req data)
+           (setq req (xcb:unmarshal-new 'xim:get-ic-values data))
            (push (make-instance 'xim:get-ic-values-reply
                                 :im-id (slot-value req 'im-id)
                                 :ic-id (slot-value req 'ic-id)
@@ -490,14 +477,12 @@ The actual XIM request is in client message data or a 
property."
            )
           ((= opcode xim:opcode:forward-event)
            (exwm--log "FORWARD-EVENT")
-           (setq req (make-instance 'xim:forward-event))
-           (xcb:unmarshal req data)
+           (setq req (xcb:unmarshal-new 'xim:forward-event data))
            (exwm-xim--handle-forward-event-request req xim:lsb conn
                                                    client-xwin))
           ((= opcode xim:opcode:sync)
            (exwm--log "SYNC")
-           (setq req (make-instance 'xim:sync))
-           (xcb:unmarshal req data)
+           (setq req (xcb:unmarshal-new 'xim:sync data))
            (push (make-instance 'xim:sync-reply
                                 :im-id (slot-value req 'im-id)
                                 :ic-id (slot-value req 'ic-id))
@@ -507,8 +492,7 @@ The actual XIM request is in client message data or a 
property."
           ((= opcode xim:opcode:reset-ic)
            (exwm--log "RESET-IC")
            ;; No context-specific data saved.
-           (setq req (make-instance 'xim:reset-ic))
-           (xcb:unmarshal req data)
+           (setq req (xcb:unmarshal-new 'xim:reset-ic data))
            (push (make-instance 'xim:reset-ic-reply
                                 :im-id (slot-value req 'im-id)
                                 :ic-id (slot-value req 'ic-id)
@@ -538,8 +522,7 @@ The actual XIM request is in client message data or a 
property."
     ;; Note: The flag slot is ignored.
     ;; Do conversion in client's byte-order.
     (let ((xcb:lsb lsb))
-      (setq key-event (make-instance 'xcb:KeyPress))
-      (xcb:unmarshal key-event (slot-value req 'event)))
+      (setq key-event (xcb:unmarshal-new 'xcb:KeyPress (slot-value req 
'event))))
     (with-slots (detail state) key-event
       (setq keysym (xcb:keysyms:keycode->keysym exwm-xim--conn detail
                                                 state))
@@ -671,9 +654,8 @@ the request data or where to fetch the data."
 Such event would be received when the client window is destroyed."
   (exwm--log)
   (unless synthetic
-    (let ((evt (make-instance 'xcb:DestroyNotify))
+    (let ((evt (xcb:unmarshal-new 'xcb:DestroyNotify data))
           conn client-xwin server-xwin)
-      (xcb:unmarshal evt data)
       (setq client-xwin (slot-value evt 'window)
             server-xwin (plist-get exwm-xim--client-server-plist client-xwin))
       (when server-xwin
diff --git a/exwm.el b/exwm.el
index 73e2631db0..3d863066cd 100644
--- a/exwm.el
+++ b/exwm.el
@@ -554,9 +554,8 @@ Descriptors' for the list of supported properties."
 (defun exwm--on-PropertyNotify (data _synthetic)
   "Handle PropertyNotify event.
 DATA contains unmarshalled PropertyNotify event data."
-  (let ((obj (make-instance 'xcb:PropertyNotify))
+  (let ((obj (xcb:unmarshal-new 'xcb:PropertyNotify data))
         atom id buffer)
-    (xcb:unmarshal obj data)
     (setq id (slot-value obj 'window)
           atom (slot-value obj 'atom))
     (exwm--log "atom=%s(%s)" (x-get-atom-name atom exwm-workspace--current) 
atom)
@@ -784,9 +783,7 @@ DATA contains unmarshalled PropertyNotify event data."
 (defun exwm--on-ClientMessage (raw-data _synthetic)
   "Handle ClientMessage event.
 RAW-DATA contains unmarshalled ClientMessage event data."
-  (let* ((obj (let ((m (make-instance 'xcb:ClientMessage)))
-                (xcb:unmarshal m raw-data)
-                m))
+  (let* ((obj (xcb:unmarshal-new 'xcb:ClientMessage raw-data))
          (type (slot-value obj 'type))
          (id (slot-value obj 'window))
          (data (slot-value (slot-value obj 'data) 'data32))
@@ -803,9 +800,8 @@ RAW-DATA contains unmarshalled ClientMessage event data."
   "Handle SelectionClear events.
 DATA contains unmarshalled SelectionClear event data."
   (exwm--log)
-  (let ((obj (make-instance 'xcb:SelectionClear))
+  (let ((obj (xcb:unmarshal-new 'xcb:SelectionClear data))
         owner selection)
-    (xcb:unmarshal obj data)
     (setq owner (slot-value obj 'owner)
           selection (slot-value obj 'selection))
     (when (and (eq owner exwm--wmsn-window)

Reply via email to