[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/xelb 247d6d2 17/42: Make the manipulation of message ca
From: |
Chris Feng |
Subject: |
[elpa] externals/xelb 247d6d2 17/42: Make the manipulation of message cache more robust |
Date: |
Thu, 17 Sep 2015 23:16:43 +0000 |
branch: externals/xelb
commit 247d6d29ef4624fa27e9a1f1b86510ff56924904
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>
Make the manipulation of message cache more robust
On Fedora 22 with Xorg 1.17.2, lots of redundant bytes are received during
connection setup. This commit uses a more reliable way to calculate the
consumed bytes.
Fix ch11ng/exwm#26.
---
xcb.el | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/xcb.el b/xcb.el
index e1a1d30..dc7d001 100644
--- a/xcb.el
+++ b/xcb.el
@@ -210,21 +210,24 @@ Concurrency is disabled as it breaks the orders of
errors, replies and events."
(substring cache 6 8)))))
obj)
(when (>= (length cache) data-len)
+ (xcb:-log "Setup response: %s" cache)
(pcase (elt cache 0)
(0 ;failed
(setq obj (make-instance 'xcb:SetupFailed))
(xcb:unmarshal obj cache)
- (setq cache [])
+ (setq cache (substring cache data-len))
(error "[XELB] Connection failed: %s"
(slot-value obj 'reason)))
(1 ;success
(setq obj (make-instance 'xcb:Setup))
- (setq cache (substring cache (xcb:unmarshal obj cache)))
+ (xcb:unmarshal obj cache)
+ (setq cache (substring cache data-len))
(setf (slot-value connection 'setup-data) obj)
(setf (slot-value connection 'connected) t))
(2 ;authentication
(setq obj (make-instance 'xcb:SetupAuthenticate))
- (setq cache (substring cache (xcb:unmarshal obj cache)))
+ (xcb:unmarshal obj cache)
+ (setq cache (substring cache data-len))
(error "[XELB] Authentication not supported: %s"
(slot-value obj 'reason)))
(x (error "Unrecognized setup status: %d" x))))))
@@ -235,6 +238,7 @@ Concurrency is disabled as it breaks the orders of errors,
replies and events."
(while (<= 32 (length cache))
(pcase (elt cache 0)
(0 ;error
+ (xcb:-log "Error received: %s" (substring cache 0 32))
(let ((sequence (funcall (if xcb:lsb 'xcb:-unpack-u2-lsb
'xcb:-unpack-u2)
(substring cache 2 4)))
@@ -257,6 +261,7 @@ Concurrency is disabled as it breaks the orders of errors,
replies and events."
struct sequence plist)
(when (< (length cache) reply-length) ;too short, do next time
(throw 'break nil))
+ (xcb:-log "Reply received: %s" (substring cache 0 reply-length))
(setq sequence (funcall (if xcb:lsb 'xcb:-unpack-u2-lsb
'xcb:-unpack-u2)
(substring cache 2 4)))
@@ -276,6 +281,7 @@ Concurrency is disabled as it breaks the orders of errors,
replies and events."
(setq cache (substring cache reply-length))
(setf (slot-value connection 'reply-sequence) sequence)))
(x ;event
+ (xcb:-log "Event received: %s" (substring cache 0 32))
(let (synthetic listener)
(when (/= 0 (logand x #x80)) ;synthetic event
(setq synthetic t
@@ -292,10 +298,10 @@ Concurrency is disabled as it breaks the orders of
errors, replies and events."
(setf (slot-value connection 'lock) nil))
(unless (slot-value connection 'lock)
(with-slots (message-cache) connection
- (let ((current-cache-lenght (length message-cache)))
+ (let ((current-cache-length (length message-cache)))
(setf message-cache
(substring message-cache (- cache-length (length cache))))
- (when (/= current-cache-lenght cache-length)
+ (when (/= current-cache-length cache-length)
(xcb:-connection-filter process []))))
(with-slots (event-lock event-queue) connection
(unless event-lock
- [elpa] externals/xelb 6a7bccc 09/42: Disable concurrency of events, (continued)
- [elpa] externals/xelb 6a7bccc 09/42: Disable concurrency of events, Chris Feng, 2015/09/17
- [elpa] externals/xelb 11005f2 10/42: Fix ch11ng/exwm#16 (cursor size not matching), Chris Feng, 2015/09/17
- [elpa] externals/xelb cd67b51 11/42: Set the `display` slot of `xcb:connection` in `xcb:connect-to-socket`, Chris Feng, 2015/09/17
- [elpa] externals/xelb 23cb30b 12/42: Fix an emacsclient bug, Chris Feng, 2015/09/17
- [elpa] externals/xelb 946d3ed 14/42: Fix keyboard mapping update problem, Chris Feng, 2015/09/17
- [elpa] externals/xelb 76246b4 13/42: Check `length` slot in `xcb:icccm:-GetProperty~reply`, Chris Feng, 2015/09/17
- [elpa] externals/xelb bf39d9b 15/42: allow key mappings without mode switch or NumLock keys, Chris Feng, 2015/09/17
- [elpa] externals/xelb 518b17a 16/42: Merge branch 'pipcet-no-num-lock', Chris Feng, 2015/09/17
- [elpa] externals/xelb 4e42bf2 04/42: Cleanup code, Chris Feng, 2015/09/17
- [elpa] externals/xelb 1cea22d 20/42: Provide a way to disable auto-padding, Chris Feng, 2015/09/17
- [elpa] externals/xelb 247d6d2 17/42: Make the manipulation of message cache more robust,
Chris Feng <=
- [elpa] externals/xelb 677623a 19/42: Disable auto-padding for xcb-xim, Chris Feng, 2015/09/17
- [elpa] externals/xelb 7c194e7 21/42: Don't assume key events are numbers; they can be symbols., Chris Feng, 2015/09/17
- [elpa] externals/xelb f465091 22/42: It's valid for WM_NORMAL_HINTS responses only to have 15 words., Chris Feng, 2015/09/17
- [elpa] externals/xelb aaddcd9 18/42: Add implicit paddings after variable-length <list>, Chris Feng, 2015/09/17
- [elpa] externals/xelb e153829 23/42: Merge pull request #2 from pipcet/shift-keypad-fix, Chris Feng, 2015/09/17
- [elpa] externals/xelb 520120a 24/42: Merge pull request #3 from pipcet/ignore-missing-values, Chris Feng, 2015/09/17
- [elpa] externals/xelb 1e20b20 26/42: Adjust to unmarshalling API changes., Chris Feng, 2015/09/17
- [elpa] externals/xelb ad845df 28/42: Merge pull request #4 from pipcet/data-offset, Chris Feng, 2015/09/17
- [elpa] externals/xelb 1ab5bb9 29/42: Fix a typo in 32-bit version `xcb:-unpack-u4-lsb`, Chris Feng, 2015/09/17
- [elpa] externals/xelb 76ab2fb 25/42: Improve performance when unmarshalling long vectors., Chris Feng, 2015/09/17