[elpa] externals/xelb 6a7bccc 09/42: Disable concurrency of events

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 6a7bccc9e8a780a22011a6e19e55292564c8e465
Author: Chris Feng 
Commit: Chris Feng 

Disable concurrency of events

The event handling mechanism was designed to be preemptive, which made 
events
arriving in a wrong order (for applications using this library) and caused 
many
problems therefore. This commit disables such behavior.
---
 xcb.el |   30 +++---
 1 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/xcb.el b/xcb.el
index 55e4ba2..ac31c92 100644
--- a/xcb.el
+++ b/xcb.el
@@ -78,6 +78,8 @@
(setup-data :initform nil)   ;X connection setup data
(request-cache :initform []) ;cache for outgoing requests
(message-cache :initform []) ;cache for incoming messages
+   (event-lock :initform nil)
+   (event-queue :initform nil)
(error-plist :initform nil)
(reply-plist :initform nil)
(event-plist :initform nil)
@@ -180,11 +182,10 @@ SCREEN."
 (defun xcb:-connection-filter (process message)
   "Filter function for an X connection.
 
-Concurrency is prevented as it breaks the orders of errors and replies."
+Concurrency is disabled as it breaks the orders of errors, replies and events."
   (let* ((connection (plist-get (process-plist process) 'connection))
  (cache (vconcat (slot-value connection 'message-cache) message))
- (cache-length (length cache))
- events)
+ (cache-length (length cache)))
 (setf (slot-value connection 'message-cache) cache)
 (catch 'return
   ;; Queue message when locked
@@ -194,7 +195,6 @@ Concurrency is prevented as it breaks the orders of errors 
and replies."
   (setf (slot-value connection 'lock) t)
   ;; Connection setup
   (unless (slot-value connection 'connected)
-;; Connection setup
 (when (<= 8 (length cache)) ;at least setup header is available
   (let ((data-len (+ 8 (* 4 (funcall (if xcb:lsb 'xcb:-unpack-u2-lsb
'xcb:-unpack-u2)
@@ -274,10 +274,11 @@ Concurrency is prevented as it breaks the orders of 
errors and replies."
(setq listener
  (plist-get (slot-value connection 'event-plist) x))
(when listener
- (setq events (nconc events
- (list (vector listener
-   (substring cache 0 32)
-   synthetic))
+ (with-slots (event-queue) connection
+   (setf event-queue (nconc event-queue
+`([,listener
+   ,(substring cache 0 32)
+   ,synthetic]))
  (setq cache (substring cache 32))
   (setf (slot-value connection 'lock) nil))
 (unless (slot-value connection 'lock)
@@ -287,9 +288,16 @@ Concurrency is prevented as it breaks the orders of errors 
and replies."
 (substring message-cache (- cache-length (length cache
   (when (/= current-cache-lenght cache-length)
 (xcb:-connection-filter process []
-  (dolist (i events);for each event
-(dolist (j (elt i 0))   ;for each listener
-  (funcall j (elt i 1) (elt i 2)))
+  (with-slots (event-lock event-queue) connection
+(unless event-lock
+  (setf event-lock t)
+  (let (event data synthetic)
+(while (setq event (pop event-queue))
+  (setq data (elt event 1)
+synthetic (elt event 2))
+  (dolist (listener (elt event 0))
+(funcall listener data synthetic
+  (setf event-lock nil))
 
 (cl-defmethod xcb:disconnect ((obj xcb:connection))
   "Disconnect from X server."



[elpa] externals/xelb 677623a 19/42: Disable auto-padding for xcb-xim

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 677623a4173597cc4a4fbea721849bcec95c304f
Author: Chris Feng 
Commit: Chris Feng 

Disable auto-padding for xcb-xim
---
 xcb-xim.el |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/xcb-xim.el b/xcb-xim.el
index 847db54..2678990 100644
--- a/xcb-xim.el
+++ b/xcb-xim.el
@@ -111,7 +111,8 @@
 Consider let-bind it rather than change its global value.")
 
 (defclass xim:-struct (xcb:-struct)
-  ((~lsb :initform (symbol-value 'xim:lsb)))
+  ((~lsb :initform (symbol-value 'xim:lsb))
+   (~auto-padding :initform nil))   ;disable auto padding
   :documentation "Struct type for XIM.")
 
 (defclass xim:-request (xim:-struct)



[elpa] externals/xelb 518b17a 16/42: Merge branch 'pipcet-no-num-lock'

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 518b17ab7af2131bb6c33a520f5792df1f08864c
Merge: 946d3ed bf39d9b
Author: Chris Feng 
Commit: Chris Feng 

Merge branch 'pipcet-no-num-lock'
---
 xcb-keysyms.el |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xcb-keysyms.el b/xcb-keysyms.el
index c82f695..ce6e65b 100644
--- a/xcb-keysyms.el
+++ b/xcb-keysyms.el
@@ -100,6 +100,8 @@ This method must be called before using any other method in 
this module."
xcb:ModMask:Control xcb:ModMask:1 xcb:ModMask:2
xcb:ModMask:3 xcb:ModMask:4 xcb:ModMask:5))
  events keycode keysym)
+(setq xcb:keysyms:mode-switch-mask nil
+  xcb:keysyms:num-lock-mask nil)
 (cl-assert (= (length keycodes) (* 8 keycodes-per-modifier)))
 (dotimes (i 8)
   (setq events nil)
@@ -135,8 +137,8 @@ This method must be called before using any other method in 
this module."
  event)
 (dolist (i (list xcb:ModMask:1 xcb:ModMask:2 xcb:ModMask:3
  xcb:ModMask:4 xcb:ModMask:5))
-  (unless (or (= i xcb:keysyms:mode-switch-mask) ;already determined
-  (= i xcb:keysyms:num-lock-mask))
+  (unless (or (equal i xcb:keysyms:mode-switch-mask) ;already determined
+  (equal i xcb:keysyms:num-lock-mask))
 (setf (slot-value key-press 'state) i
   (slot-value fake-event 'event) (xcb:marshal key-press obj))
 (run-with-idle-timer 0 nil (lambda ()



[elpa] branch externals/xelb created (now f5a7ca9)

2015-09-17 Thread Chris Feng
ch11ng pushed a change to branch externals/xelb.

at  f5a7ca9   Minor fix

This branch includes the following new commits:

   new  1f9470c   First commit
   new  16e774c   First commit
   new  2d78724   Fix shift bit for converting from keysym to Emacs event
   new  4e42bf2   Cleanup code
   new  e665cb3   Update xcb-randr.el
   new  87ebff4   Fix for 32bit platform
   new  1916894   Fix integer overflow on 32-bit platform
   new  c042d3f   Provide more verbose message when connection failed or 
auth required
   new  6a7bccc   Disable concurrency of events
   new  11005f2   Fix ch11ng/exwm#16 (cursor size not matching)
   new  cd67b51   Set the `display` slot of `xcb:connection` in 
`xcb:connect-to-socket`
   new  23cb30b   Fix an emacsclient bug
   new  76246b4   Check `length` slot in `xcb:icccm:-GetProperty~reply`
   new  946d3ed   Fix keyboard mapping update problem
   new  bf39d9b   allow key mappings without mode switch or NumLock keys
   new  518b17a   Merge branch 'pipcet-no-num-lock'
   new  247d6d2   Make the manipulation of message cache more robust
   new  aaddcd9   Add implicit paddings after variable-length 
   new  677623a   Disable auto-padding for xcb-xim
   new  1cea22d   Provide a way to disable auto-padding
   new  7c194e7   Don't assume key events are numbers; they can be symbols.
   new  f465091   It's valid for WM_NORMAL_HINTS responses only to have 15 
words.
   new  e153829   Merge pull request #2 from pipcet/shift-keypad-fix
   new  520120a   Merge pull request #3 from pipcet/ignore-missing-values
   new  76ab2fb   Improve performance when unmarshalling long vectors.
   new  1e20b20   Adjust to unmarshalling API changes.
   new  f655ec9   Merge pull request #2 from pipcet/data-offset
   new  ad845df   Merge pull request #4 from pipcet/data-offset
   new  1ab5bb9   Fix a typo in 32-bit version `xcb:-unpack-u4-lsb`
   new  4621160   Move generated libraries to lib/
   new  c99266a   Merge xelb-util into this repo
   new  5a74daa   Generate implicit paddings at compile time
   new  846f4c0   Fix race conditions
   new  ab96086   Prepare for GNU ELPA release
   new  41cca58   Fix compiling issues
   new  b8f3029   Flatten directory structure
   new  81c699f   Protect process-send-string
   new  2edbaa0   Code cleanups
   new  8215991   Add a missing function key
   new  ae7da13   Add support for XF86 keysyms
   new  9a0612c   Fix remaining compile warnings
   new  f5a7ca9   Minor fix




[elpa] externals/xelb 1916894 07/42: Fix integer overflow on 32-bit platform

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 1916894afcebe2c48c53ceaac9c611b1e89fbba6
Author: Chris Feng 
Commit: Chris Feng 

Fix integer overflow on 32-bit platform
---
 xcb-types.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xcb-types.el b/xcb-types.el
index af31817..e1a5206 100644
--- a/xcb-types.el
+++ b/xcb-types.el
@@ -131,7 +131,7 @@
 (vector (logand (lsh value -24) #xFF) (logand (lsh value -16) #xFF)
 (logand (lsh value -8) #xFF) (logand value #xFF))
   (let* ((msw (truncate value #x1))
- (lsw (truncate (- value (lsh msw 16)
+ (lsw (truncate (- value (* msw 65536.0)
 (vector (logand (lsh msw -8) #xFF) (logand msw #xFF)
 (logand (lsh lsw -8) #xFF) (logand lsw #xFF)
   (defsubst xcb:-pack-u4-lsb (value)
@@ -140,7 +140,7 @@
 (vector (logand value #xFF) (logand (lsh value -8) #xFF)
 (logand (lsh value -16) #xFF) (logand (lsh value -24) #xFF))
   (let* ((msw (truncate value #x1))
- (lsw (truncate (- value (* msw #x1)
+ (lsw (truncate (- value (* msw 65536.0)
 (vector (logand lsw #xFF) (logand (lsh lsw -8) #xFF)
 (logand msw #xFF) (logand (lsh msw -8) #xFF))
 



[elpa] externals/xelb 247d6d2 17/42: Make the manipulation of message cache more robust

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 247d6d29ef4624fa27e9a1f1b86510ff56924904
Author: Chris Feng 
Commit: Chris Feng 

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 4e42bf2 04/42: Cleanup code

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 4e42bf2430fb5388ea15c0febf6099bbd683fb09
Author: Chris Feng 
Commit: Chris Feng 

Cleanup code

Also make  counter more robust.
---
 Makefile  |1 -
 el_client.el  |9 ++---
 xcb-xinput.el |  108 
 xcb-xkb.el|   40 ++--
 xcb.el|4 --
 5 files changed, 78 insertions(+), 84 deletions(-)

diff --git a/Makefile b/Makefile
index 9b2fe7d..efa17da 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,6 @@ EMACS_BIN := emacs -Q
 EXTENSIONS := bigreq dpms ge present render shape xf86dri xinerama xprint \
 xtest composite dri2 glx randr res shm xc_misc xf86vidmode xinput xvmc \
 damage dri3 record screensaver sync xevie xfixes xkb xselinux xv
-# EXTENSIONS := render randr xkb
 
 LIBS = xcb-xproto.el $(addprefix xcb-,$(addsuffix .el,$(EXTENSIONS)))
 
diff --git a/el_client.el b/el_client.el
index 66d7a89..b464607 100644
--- a/el_client.el
+++ b/el_client.el
@@ -56,6 +56,9 @@
 (defvar event-alist nil "Record X events in this module.")
 (make-variable-buffer-local 'event-alist)
 
+(defvar pad-count 0 " node counter.")
+(make-variable-buffer-local 'pad-count)
+
  Helper functions
 
 (defsubst node-name (node)
@@ -150,6 +153,7 @@
 
 (defun parse-top-level-element (node)
   "Parse a top-level element."
+  (setq pad-count 0)
   (pcase (node-name node)
 (`import (parse-import node))
 (`struct (parse-struct node))
@@ -176,7 +180,6 @@
   "Parse ."
   (let ((name (intern (concat prefix (node-attr node 'name
 (contents (node-subnodes node))
-(pad-count 0)
 result)
 (setq contents
   (apply 'nconc
@@ -240,7 +243,6 @@ The `combine-adjacent' attribute is simply ignored."
  (opcode (string-to-int (node-attr node 'opcode)))
  (contents `((~opcode :initform ,opcode :type xcb:-u1)))
  (subnodes (node-subnodes node))
- (pad-count 0)
  (reply-pad-count 0)
  expressions
  result reply-result reply-name reply-contents)
@@ -297,7 +299,6 @@ KeymapNotify event; instead, we handle this case in 
`xcb:unmarshal'."
 (event-number (string-to-int (node-attr node 'number)))
 (xge (node-attr node 'xge))
 (contents (node-subnodes node))
-(pad-count 0)
 result)
 (setq contents
   (apply 'nconc
@@ -325,7 +326,6 @@ KeymapNotify event; instead, we handle this case in 
`xcb:unmarshal'."
   (let ((name (intern (concat prefix (node-attr node 'name
 (error-number (string-to-int (node-attr node 'number)))
 (contents (node-subnodes node))
-(pad-count 0)
 result)
 (setq contents
   (apply 'nconc
@@ -432,7 +432,6 @@ KeymapNotify event; instead, we handle this case in 
`xcb:unmarshal'."
   (let ((name (intern (node-attr-escape node 'name)))
 (expression (parse-expression (car (node-subnodes node
 (cases (cdr (node-subnodes node)))
-(pad-count 10) ;avoid naming duplication (as only one  allowed)
 fields fields-name)
 ;; Avoid duplicated slot names by appending "*" if necessary
 (let (names name)
diff --git a/xcb-xinput.el b/xcb-xinput.el
index 75c992b..3b23ded 100644
--- a/xcb-xinput.el
+++ b/xcb-xinput.el
@@ -111,7 +111,7 @@
   (xcb:-fieldref 'class-id)
   cases
   (((xcb:xinput:InputClass:Key)
-min-keycode max-keycode num-keys pad~10)
+min-keycode max-keycode num-keys pad~0)
((xcb:xinput:InputClass:Button)
 num-buttons)
((xcb:xinput:InputClass:Valuator)
@@ -120,7 +120,7 @@
(min-keycode :initarg :min-keycode :type xcb:xinput:KeyCode)
(max-keycode :initarg :max-keycode :type xcb:xinput:KeyCode)
(num-keys :initarg :num-keys :type xcb:CARD16)
-   (pad~10 :initform 2 :type xcb:-pad)
+   (pad~0 :initform 2 :type xcb:-pad)
(num-buttons :initarg :num-buttons :type xcb:CARD16)
(axes-len :initarg :axes-len :type xcb:CARD8)
(mode :initarg :mode :type xcb:CARD8)
@@ -542,9 +542,9 @@
   (xcb:-fieldref 'class-id)
   cases
   (((xcb:xinput:FeedbackClass:Keyboard)
-pitch duration led-mask led-values global-auto-repeat click 
percent pad~10 auto-repeats)
+pitch duration led-mask led-values global-auto-repeat click 
percent pad~0 auto-repeats)
((xcb:xinput:FeedbackClass:Pointer)
-pad~11 accel-num accel-denom threshold)
+pad~1 accel-num accel-denom threshold)
((xcb:xinput:FeedbackClass:String)
 max-symbols num-keysyms keysyms)
((xcb:xinput:FeedbackClass:Integer)
@@ -552,7 +552,7 @@
((xcb:xinput:FeedbackClass:Led)
 led-mask* led-values*)
((xcb:xinput:FeedbackClass:Bell)
-   

[elpa] externals/xelb bf39d9b 15/42: allow key mappings without mode switch or NumLock keys

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit bf39d9ba94ec4f6c915123dba610715ee023dc92
Author: Philip 
Commit: Philip 

allow key mappings without mode switch or NumLock keys
---
 xcb-keysyms.el |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xcb-keysyms.el b/xcb-keysyms.el
index c82f695..ce6e65b 100644
--- a/xcb-keysyms.el
+++ b/xcb-keysyms.el
@@ -100,6 +100,8 @@ This method must be called before using any other method in 
this module."
xcb:ModMask:Control xcb:ModMask:1 xcb:ModMask:2
xcb:ModMask:3 xcb:ModMask:4 xcb:ModMask:5))
  events keycode keysym)
+(setq xcb:keysyms:mode-switch-mask nil
+  xcb:keysyms:num-lock-mask nil)
 (cl-assert (= (length keycodes) (* 8 keycodes-per-modifier)))
 (dotimes (i 8)
   (setq events nil)
@@ -135,8 +137,8 @@ This method must be called before using any other method in 
this module."
  event)
 (dolist (i (list xcb:ModMask:1 xcb:ModMask:2 xcb:ModMask:3
  xcb:ModMask:4 xcb:ModMask:5))
-  (unless (or (= i xcb:keysyms:mode-switch-mask) ;already determined
-  (= i xcb:keysyms:num-lock-mask))
+  (unless (or (equal i xcb:keysyms:mode-switch-mask) ;already determined
+  (equal i xcb:keysyms:num-lock-mask))
 (setf (slot-value key-press 'state) i
   (slot-value fake-event 'event) (xcb:marshal key-press obj))
 (run-with-idle-timer 0 nil (lambda ()



[elpa] externals/xelb cd67b51 11/42: Set the `display` slot of `xcb:connection` in `xcb:connect-to-socket`

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit cd67b515c591222d386fa0725596a83ba3d72db4
Author: Chris Feng 
Commit: Chris Feng 

Set the `display` slot of `xcb:connection` in `xcb:connect-to-socket`

The slot value is guessed from the socket name, which is not always 
accurate.
---
 xcb.el |   31 ---
 1 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/xcb.el b/xcb.el
index ac31c92..e1a1d30 100644
--- a/xcb.el
+++ b/xcb.el
@@ -137,17 +137,26 @@ SCREEN."
 (defun xcb:connect-to-socket (&optional socket auth-info)
   "Connect to X server with socket SOCKET and authentication info AUTH-INFO."
   (unless (or socket x-display-name) (error "[XELB] No X display available"))
-  (unless socket (setq socket (concat "/tmp/.X11-unix/X"
-  (replace-regexp-in-string
-   ".*:\\([^\\.]+\\)\\(\\..*\\)?" "\\1"
-   x-display-name
-  (let* ((process (make-network-process :name "XELB" :remote socket))
- (auth (if auth-info auth-info (make-instance 'xcb:auth-info)))
- (connection (make-instance 'xcb:connection
-:process process
-:auth-info auth :socket socket)))
-(xcb:-connect connection)
-connection))
+  (let (display)
+(if socket
+;; As there is no general way to deduce the display name from an X11
+;; socket, we assume a standard SOCKET name and hope for the best.
+(setq display
+  (concat ":"   ;local
+  (replace-regexp-in-string "^.*?\\([0-9.]+\\)$" "\\1"
+socket)))
+  (setq display x-display-name
+socket (concat "/tmp/.X11-unix/X"
+   (replace-regexp-in-string
+".*:\\([^\\.]+\\)\\(\\..*\\)?" "\\1"
+x-display-name
+(let* ((process (make-network-process :name "XELB" :remote socket))
+   (auth (if auth-info auth-info (make-instance 'xcb:auth-info)))
+   (connection (make-instance 'xcb:connection
+  :process process :display display
+  :auth-info auth :socket socket)))
+  (xcb:-connect connection)
+  connection)))
 
 (cl-defmethod xcb:-connect ((obj xcb:connection))
   "Connect to X server."



[elpa] externals/xelb e665cb3 05/42: Update xcb-randr.el

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit e665cb35243dd1c936fa08a74ca39b4eb62df341
Author: Chris Feng 
Commit: Chris Feng 

Update xcb-randr.el

Was: randr: add RandR 1.5 requests and data types
---
 xcb-randr.el |   50 +-
 1 files changed, 49 insertions(+), 1 deletions(-)

diff --git a/xcb-randr.el b/xcb-randr.el
index ed78538..ac89acf 100644
--- a/xcb-randr.el
+++ b/xcb-randr.el
@@ -6,7 +6,7 @@
 (defconst xcb:randr:-extension-xname "RANDR")
 (defconst xcb:randr:-extension-name "RandR")
 (defconst xcb:randr:-major-version 1)
-(defconst xcb:randr:-minor-version 4)
+(defconst xcb:randr:-minor-version 5)
 
 (require 'xcb-xproto)
 
@@ -929,6 +929,54 @@
   ((subCode :initarg :subCode :type xcb:CARD8)
(u :initarg :u :type xcb:randr:NotifyData)))
 
+(defclass xcb:randr:MonitorInfo
+  (xcb:-struct)
+  ((name :initarg :name :type xcb:ATOM)
+   (primary :initarg :primary :type xcb:BOOL)
+   (automatic :initarg :automatic :type xcb:BOOL)
+   (nOutput :initarg :nOutput :type xcb:CARD16)
+   (x :initarg :x :type xcb:INT16)
+   (y :initarg :y :type xcb:INT16)
+   (width :initarg :width :type xcb:CARD16)
+   (height :initarg :height :type xcb:CARD16)
+   (width-in-millimeters :initarg :width-in-millimeters :type xcb:CARD32)
+   (height-in-millimeters :initarg :height-in-millimeters :type xcb:CARD32)
+   (outputs :initarg :outputs :type xcb:-ignore)
+   (outputs~ :initform
+'(name outputs type xcb:randr:OUTPUT size
+   (xcb:-fieldref 'nOutput))
+:type xcb:-list)))
+
+(defclass xcb:randr:GetMonitors
+  (xcb:-request)
+  ((~opcode :initform 42 :type xcb:-u1)
+   (window :initarg :window :type xcb:WINDOW)
+   (get-active :initarg :get-active :type xcb:BOOL)))
+(defclass xcb:randr:GetMonitors~reply
+  (xcb:-reply)
+  ((pad~0 :initform 1 :type xcb:-pad)
+   (timestamp :initarg :timestamp :type xcb:TIMESTAMP)
+   (nMonitors :initarg :nMonitors :type xcb:CARD32)
+   (nOutputs :initarg :nOutputs :type xcb:CARD32)
+   (pad~1 :initform 12 :type xcb:-pad)
+   (monitors :initarg :monitors :type xcb:-ignore)
+   (monitors~ :initform
+ '(name monitors type xcb:randr:MonitorInfo size
+(xcb:-fieldref 'nMonitors))
+ :type xcb:-list)))
+
+(defclass xcb:randr:SetMonitor
+  (xcb:-request)
+  ((~opcode :initform 43 :type xcb:-u1)
+   (window :initarg :window :type xcb:WINDOW)
+   (monitorinfo :initarg :monitorinfo :type xcb:randr:MonitorInfo)))
+
+(defclass xcb:randr:DeleteMonitor
+  (xcb:-request)
+  ((~opcode :initform 44 :type xcb:-u1)
+   (window :initarg :window :type xcb:WINDOW)
+   (name :initarg :name :type xcb:ATOM)))
+
 (defconst xcb:randr:error-number-class-alist
   '((0 . xcb:randr:BadOutput)
 (1 . xcb:randr:BadCrtc)



[elpa] externals/xelb 11005f2 10/42: Fix ch11ng/exwm#16 (cursor size not matching)

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 11005f2e0fa3ccc04c546ab99c67e64f73287820
Author: Chris Feng 
Commit: Chris Feng 

Fix ch11ng/exwm#16 (cursor size not matching)
---
 xcb-cursor.el |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/xcb-cursor.el b/xcb-cursor.el
index beb6964..5579fff 100644
--- a/xcb-cursor.el
+++ b/xcb-cursor.el
@@ -251,9 +251,8 @@
   (with-temp-buffer
 (set-buffer-multibyte nil)
 (insert-file-contents path) (buffer-string
-  (best-size 0)
   xcb:lsb   ;override global byte order
-  chunks
+  best-size chunks
   magic file-header file-header-toc chunk-header chunk)
   ;; Determine byte order
   (setq magic (substring data 0 4))
@@ -281,8 +280,9 @@
   (when (= target subtype)
 (setq best-size target)
 (throw 'break nil))
-  (when (> (abs (- target best-size))
-   (abs (- target subtype)))
+  (when (or (not best-size)
+(> (abs (- target best-size))
+   (abs (- target subtype
 (setq best-size subtype)))
 ;; Collect chunks fitting this size
 (setq chunk-header (make-instance 'xcb:cursor:-file-chunk-header))



[elpa] externals/xelb aaddcd9 18/42: Add implicit paddings after variable-length

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit aaddcd92ffd8a656127c457480c96185742b2d25
Author: Chris Feng 
Commit: Chris Feng 

Add implicit paddings after variable-length 

The XCB-XML description files omit paddings after . This commit 
enables
XELB to take these paddings into account when marshalling/unmarshalling.
---
 xcb-types.el |   37 ++---
 xcb.el   |2 +-
 2 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/xcb-types.el b/xcb-types.el
index e1a5206..3fd06bf 100644
--- a/xcb-types.el
+++ b/xcb-types.el
@@ -340,20 +340,31 @@ The optional POS argument indicates current byte index of 
the field (used by
 (`xcb:-pad-align
  (unless (integerp value)
(setq value (eval value `((obj . ,obj)
- (make-vector (% (- 4 (% pos value)) 4) 0))
+ ;; The length slot in xcb:-request is left out
+ (let ((len (if (object-of-class-p obj xcb:-request) (+ pos 2) pos)))
+   (make-vector (% (- value (% len value)) value) 0)))
 (`xcb:-list
  (let* ((list-name (plist-get value 'name))
 (list-type (plist-get value 'type))
 (list-size (plist-get value 'size))
-(data (slot-value obj list-name)))
+(data (slot-value obj list-name))
+implicit-padding)
(unless (integerp list-size)
+ (setq implicit-padding t)
  (setq list-size (eval list-size `((obj . ,obj
  (unless list-size
(setq list-size (length data ;list-size can be nil
(cl-assert (= list-size (length data)))
-   (mapconcat (lambda (i)
-(xcb:-marshal-field obj list-type i))
-  data [])))
+   (let ((result (mapconcat (lambda (i)
+  (xcb:-marshal-field obj list-type i))
+data []))
+ len)
+ (if (not implicit-padding)
+ result
+   ;; The length slot in xcb:-request is left out
+   (setq len (if (object-of-class-p obj xcb:-request) (+ pos 2) pos))
+   (vconcat result
+(make-vector (logand (- 0 len (length result)) #x3) 0))
 (`xcb:-switch
  (let ((slots (eieio-class-slots (eieio-object-class obj)))
(expression (plist-get value 'expression))
@@ -453,8 +464,10 @@ and the second the consumed length."
(setq initform (cadr initform)))
  (let ((list-name (plist-get initform 'name))
(list-type (plist-get initform 'type))
-   (list-size (plist-get initform 'size)))
+   (list-size (plist-get initform 'size))
+   implicit-padding)
(unless (integerp list-size)
+ (setq implicit-padding t)
  (setq list-size (eval list-size `((obj . ,obj) (ctx . ,ctx)
(cl-assert (integerp list-size))
(pcase list-type
@@ -463,11 +476,9 @@ and the second the consumed length."
 (decode-coding-string
  (apply 'unibyte-string
 (append (substring data 0 list-size) nil))
- 'iso-latin-1))
-  (list initform list-size))
+ 'iso-latin-1)))
  (`xcb:void ;for further unmarshalling
-  (setf (slot-value obj list-name) (substring data 0 list-size))
-  (list initform list-size))
+  (setf (slot-value obj list-name) (substring data 0 list-size)))
  (x
   (let ((count 0)
 result tmp)
@@ -477,7 +488,11 @@ and the second the consumed length."
   (setq data (substring data (cadr tmp)))
   (setq count (+ count (cadr tmp
 (setf (slot-value obj list-name) result)
-(list initform count))
+(setq list-size count   ;to byte length
+   (list initform (if implicit-padding
+  ;; Assume DATA is aligned
+  (+ list-size (% (- (length data) list-size) 4))
+list-size
 (`xcb:-switch
  (let ((slots (eieio-class-slots (eieio-object-class obj)))
(expression (plist-get initform 'expression))
diff --git a/xcb.el b/xcb.el
index dc7d001..5732b44 100644
--- a/xcb.el
+++ b/xcb.el
@@ -441,7 +441,7 @@ classes of EVENT (since they have the same event number)."
  (+ (length msg) (length cache))) ;flush on cache full
   (xcb:flush obj)
   (setq cache []))
-(xcb:-log "%s" request)
+(xcb:-log "Cache request: %s" request)
 (with-slots (request-cache request-sequence) obj
   (setf request-cache (vconcat cache msg)
 request-sequence (1+ request-sequence))



[elpa] externals/xelb b8f3029 36/42: Flatten directory structure

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit b8f3029897dd4a182d57da8c2ee7d202bf5d9044
Author: Chris Feng 
Commit: Chris Feng 

Flatten directory structure

It seems to be the only way to get this package built.
---
 lib/Makefile => Makefile |4 ++--
 el_client.el |1 -
 lib/xcb-bigreq.el => xcb-bigreq.el   |0
 lib/xcb-composite.el => xcb-composite.el |0
 util/xcb-cursor.el => xcb-cursor.el  |0
 lib/xcb-damage.el => xcb-damage.el   |0
 lib/xcb-dpms.el => xcb-dpms.el   |0
 lib/xcb-dri2.el => xcb-dri2.el   |0
 lib/xcb-dri3.el => xcb-dri3.el   |0
 util/xcb-ewmh.el => xcb-ewmh.el  |0
 lib/xcb-ge.el => xcb-ge.el   |0
 lib/xcb-glx.el => xcb-glx.el |0
 util/xcb-icccm.el => xcb-icccm.el|0
 util/xcb-keysyms.el => xcb-keysyms.el|0
 lib/xcb-present.el => xcb-present.el |0
 lib/xcb-randr.el => xcb-randr.el |0
 lib/xcb-record.el => xcb-record.el   |0
 lib/xcb-render.el => xcb-render.el   |0
 lib/xcb-res.el => xcb-res.el |0
 lib/xcb-screensaver.el => xcb-screensaver.el |0
 lib/xcb-shape.el => xcb-shape.el |0
 lib/xcb-shm.el => xcb-shm.el |0
 lib/xcb-sync.el => xcb-sync.el   |0
 lib/xcb-xc_misc.el => xcb-xc_misc.el |0
 lib/xcb-xevie.el => xcb-xevie.el |0
 lib/xcb-xf86dri.el => xcb-xf86dri.el |0
 lib/xcb-xf86vidmode.el => xcb-xf86vidmode.el |0
 lib/xcb-xfixes.el => xcb-xfixes.el   |0
 util/xcb-xim.el => xcb-xim.el|0
 lib/xcb-xinerama.el => xcb-xinerama.el   |0
 lib/xcb-xinput.el => xcb-xinput.el   |0
 lib/xcb-xkb.el => xcb-xkb.el |0
 util/xcb-xlib.el => xcb-xlib.el  |0
 lib/xcb-xprint.el => xcb-xprint.el   |0
 lib/xcb-xproto.el => xcb-xproto.el   |0
 lib/xcb-xselinux.el => xcb-xselinux.el   |0
 lib/xcb-xtest.el => xcb-xtest.el |0
 lib/xcb-xv.el => xcb-xv.el   |0
 lib/xcb-xvmc.el => xcb-xvmc.el   |0
 39 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/Makefile b/Makefile
similarity index 89%
rename from lib/Makefile
rename to Makefile
index 3bd2e7e..3f41490 100644
--- a/lib/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-PROTO_PATH := ../../xcb-proto/src
+PROTO_PATH := ../xcb-proto/src
 
 EMACS_BIN := emacs -Q
 
@@ -12,7 +12,7 @@ all: clean $(LIBS)
 
 xcb-%.el: $(PROTO_PATH)/%.xml xcb-xproto.el
@echo -n "\n"Generating $@...
-   @$(EMACS_BIN) --script ../el_client.el $< > $@
+   @$(EMACS_BIN) --script ./el_client.el $< > $@
 
 xcb-composite.el: xcb-xfixes.el
 xcb-damage.el: xcb-xfixes.el
diff --git a/el_client.el b/el_client.el
index ce5fa32..d9b81c3 100644
--- a/el_client.el
+++ b/el_client.el
@@ -536,7 +536,6 @@ KeymapNotify event; instead, we handle this case in 
`xcb:unmarshal'."
 (if (not argv)
 (error "Usage: el_client.el  [additional_load_paths]")
   (add-to-list 'load-path default-directory)
-  (add-to-list 'load-path (concat default-directory "/../"))
   (dolist (i (cdr argv))
 (add-to-list 'load-path i))
   (require 'xcb-types)
diff --git a/lib/xcb-bigreq.el b/xcb-bigreq.el
similarity index 100%
rename from lib/xcb-bigreq.el
rename to xcb-bigreq.el
diff --git a/lib/xcb-composite.el b/xcb-composite.el
similarity index 100%
rename from lib/xcb-composite.el
rename to xcb-composite.el
diff --git a/util/xcb-cursor.el b/xcb-cursor.el
similarity index 100%
rename from util/xcb-cursor.el
rename to xcb-cursor.el
diff --git a/lib/xcb-damage.el b/xcb-damage.el
similarity index 100%
rename from lib/xcb-damage.el
rename to xcb-damage.el
diff --git a/lib/xcb-dpms.el b/xcb-dpms.el
similarity index 100%
rename from lib/xcb-dpms.el
rename to xcb-dpms.el
diff --git a/lib/xcb-dri2.el b/xcb-dri2.el
similarity index 100%
rename from lib/xcb-dri2.el
rename to xcb-dri2.el
diff --git a/lib/xcb-dri3.el b/xcb-dri3.el
similarity index 100%
rename from lib/xcb-dri3.el
rename to xcb-dri3.el
diff --git a/util/xcb-ewmh.el b/xcb-ewmh.el
similarity index 100%
rename from util/xcb-ewmh.el
rename to xcb-ewmh.el
diff --git a/lib/xcb-ge.el b/xcb-ge.el
similarity index 100%
rename from lib/xcb-ge.el
rename to xcb-ge.el
diff --git a/lib/xcb-glx.el b/xcb-glx.el
similarity index 100%
rename from lib/xcb-glx.el
rename to xcb-glx.el
diff --git a/util/xcb-icccm.el b/xcb-icccm.el
similarity index 100%
rename from util/xcb-icccm.el
rename to xcb-icccm.el
diff --git a/util/xcb-keysyms.el b/xcb-keysyms.el
similarity index 100%
rename from util/xcb-keysyms.el
rename to xcb-keysyms

[elpa] externals/xelb 1e20b20 26/42: Adjust to unmarshalling API changes.

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 1e20b20794fdde786be33ed08aa6c64922c10b8f
Author: Philip 
Commit: Philip 

Adjust to unmarshalling API changes.
---
 xcb-icccm.el |   11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/xcb-icccm.el b/xcb-icccm.el
index 1d178d8..b98451a 100644
--- a/xcb-icccm.el
+++ b/xcb-icccm.el
@@ -138,19 +138,22 @@ This method automatically format the value as 8, 16 or 32 
bits array."
(cl-assert (= (* 2 value-len) (length tmp)))
(if ~lsb
(dotimes (i value-len)
- (setf value (vconcat value (vector (xcb:-unpack-u2-lsb tmp
+ (setf value (vconcat value
+  (vector (xcb:-unpack-u2-lsb tmp 0
  (setq tmp (substring tmp 2)))
  (dotimes (i value-len)
-   (setf value (vconcat value (vector (xcb:-unpack-u2 tmp
+   (setf value (vconcat value
+(vector (xcb:-unpack-u2 tmp 0
(setq tmp (substring tmp 2)
   (32
(cl-assert (= (* 4 value-len) (length tmp)))
(if ~lsb
(dotimes (i value-len)
- (setf value (vconcat value (vector (xcb:-unpack-u4-lsb tmp
+ (setf value (vconcat value
+  (vector (xcb:-unpack-u4-lsb tmp 0
  (setq tmp (substring tmp 4)))
  (dotimes (i value-len)
-   (setf value (vconcat value (vector (xcb:-unpack-u4 tmp
+   (setf value (vconcat value (vector (xcb:-unpack-u4 tmp 0
(setq tmp (substring tmp 4)
   (_ (cl-assert nil)
 retval))



[elpa] externals/exwm 15ad591 35/64: Fix bug when moving a window to the current workspace

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 15ad591d978836b753839014f3c7ce67111763c1
Author: Philip 
Commit: Philip 

Fix bug when moving a window to the current workspace

* exwm-workspace.el (exwm-workspace-move-window): Run
  reparenting code when moving a window to the current workspace.
---
 exwm-workspace.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index 09112d2..00f7326 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -168,9 +168,9 @@ The optional FORCE option is for internal use only."
   (unless id (setq id (exwm--buffer->id (window-buffer
   (unless (and (<= 0 index) (< index exwm-workspace-number))
 (user-error "[EXWM] Workspace index out of range: %d" index))
-  (when (/= exwm-workspace-current-index index)
+  (with-current-buffer (exwm--id->buffer id)
 (let ((frame (elt exwm-workspace--list index)))
-  (with-current-buffer (exwm--id->buffer id)
+  (when (not (equal exwm--frame frame))
 (setq exwm--frame frame)
 (exwm-workspace-rename-buffer
  (concat " " (replace-regexp-in-string "^\\s-*" "" (buffer-name



[elpa] externals/xelb ab96086 34/42: Prepare for GNU ELPA release

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit ab96086534bd1ebdd6cbc8b84c0fc7587198d161
Author: Chris Feng 
Commit: Chris Feng 

Prepare for GNU ELPA release

* Transfer copyright to Free Software Foundation
* Add packaging components (e.g. headers)
* Drop support for Emacs < 24.4
* Coding style fixes:
  + Quote functions with "#'"
  + Wrap long lines
  + Fix doc strings / comments
* Replace `string-to-int' with `string-to-number'
* Fix compiling errors / eliminate compiling warnings
* Remove the redundant COPYING file
* Add .gitignore and .elpaignore
* Rename README to README.md since the former may be used as the package
  description by packaging systems (we prefer the ' Commentary' header)
---
 .elpaignore |1 +
 .gitignore  |1 +
 COPYING |  674 ---
 README  |9 -
 README.md   |   10 +
 el_client.el|  132 +-
 lib/xcb-xinput.el   |   20 +-
 lib/xcb-xkb.el  |6 +-
 util/xcb-cursor.el  |   42 ++--
 util/xcb-ewmh.el|   15 +-
 util/xcb-icccm.el   |   47 ++--
 util/xcb-keysyms.el |   26 +-
 util/xcb-xim.el |   36 ++--
 util/xcb-xlib.el|   11 +-
 xcb-types.el|  188 +++---
 xcb.el  |   80 ---
 xelb.el |   68 +
 17 files changed, 380 insertions(+), 986 deletions(-)

diff --git a/.elpaignore b/.elpaignore
new file mode 100644
index 000..8f36919
--- /dev/null
+++ b/.elpaignore
@@ -0,0 +1 @@
+el_client.el
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000..c531d98
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.elc
diff --git a/COPYING b/COPYING
deleted file mode 100644
index 94a9ed0..000
--- a/COPYING
+++ /dev/null
@@ -1,674 +0,0 @@
-GNU GENERAL PUBLIC LICENSE
-   Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domain

[elpa] externals/exwm 7bfd429 33/64: Honor `value-mask` field in ConfigureRequest event

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 7bfd429d5252e8df43d1b19b836a6c4970290fa0
Author: Chris Feng 
Commit: Chris Feng 

Honor `value-mask` field in ConfigureRequest event

Some applications (e.g. JNLP) don't set correct values for fields not 
mentioned
in `value-mask`. This commit corrects this bug together with another Java 
AWT
specific problem.
---
 exwm-manage.el |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/exwm-manage.el b/exwm-manage.el
index 4f11874..ffe21e2 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -71,7 +71,8 @@ corresponding buffer.")
   (memq xcb:Atom:_NET_WM_WINDOW_TYPE_DIALOG exwm-window-type)
   (memq xcb:Atom:_NET_WM_WINDOW_TYPE_NORMAL exwm-window-type)))
  ;; For Java applications
- (and exwm-instance-name
+ (and (memq xcb:Atom:_NET_WM_WINDOW_TYPE_NORMAL exwm-window-type)
+  exwm-instance-name
   (string-prefix-p "sun-awt-X11-" exwm-instance-name)
   (not (string-suffix-p "XFramePeer" exwm-instance-name
 (exwm--log "No need to manage #x%x" id)
@@ -274,9 +275,11 @@ corresponding buffer.")
   (let ((obj (make-instance 'xcb:ConfigureRequest))
 buffer edges)
 (xcb:unmarshal obj data)
-(with-slots (window x y width height border-width) obj
-  (exwm--log "ConfigureRequest from #x%x @%dx%d%+d%+d, border: %d"
- window width height x y border-width)
+(with-slots (stack-mode window sibling x y width height border-width
+value-mask)
+obj
+  (exwm--log "ConfigureRequest from #x%x (#x%x) @%dx%d%+d%+d, border: %d"
+ value-mask window width height x y border-width)
   (if (setq buffer (exwm--id->buffer window))
   ;; Send client message for managed windows
   (with-current-buffer buffer
@@ -308,13 +311,10 @@ corresponding buffer.")
 (xcb:+request exwm--connection
 (make-instance 'xcb:ConfigureWindow
:window window
-   :value-mask (logior xcb:ConfigWindow:X
-   xcb:ConfigWindow:Y
-   xcb:ConfigWindow:Width
-   xcb:ConfigWindow:Height
-   xcb:ConfigWindow:BorderWidth)
+   :value-mask value-mask
:x x :y y :width width :height height
-   :border-width border-width)
+   :border-width border-width
+   :sibling sibling :stack-mode stack-mode)
   (xcb:flush exwm--connection))
 
 (defun exwm-manage--on-MapRequest (data synthetic)



[elpa] externals/xelb 2edbaa0 38/42: Code cleanups

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 2edbaa0ab4057ff8bdf24c4b1c7077f47d5f013d
Author: Chris Feng 
Commit: Chris Feng 

Code cleanups

* xcb-keysyms.el (xcb:keysyms:-function-keys): change from list to vector
* xcb-keysyms.el (xcb:keysyms:event->keysym), xcb-types.el
  (cl--slot-descriptor-name, cl--slot-descriptor-initform)
  (cl--slot-descriptor-type, xcb:-unpack-u1, xcb:-unpack-u2)
  (xcb:-unpack-u2-lsb, xcb:-unpack-u4, xcb:-unpack-u4-lsb)
  (xcb:-unmarshal-field), xcb.el (xcb:-connection-filter): use `aref` 
instead
  of `elt` to index vectors
* xelb.el, xcb.el: fix first line
* .elpaignore: ignore Makefile and README.md
---
 .elpaignore|2 ++
 xcb-keysyms.el |6 +++---
 xcb-types.el   |   44 ++--
 xcb.el |   14 +++---
 xelb.el|2 +-
 5 files changed, 35 insertions(+), 33 deletions(-)

diff --git a/.elpaignore b/.elpaignore
index 8f36919..24d4051 100644
--- a/.elpaignore
+++ b/.elpaignore
@@ -1 +1,3 @@
+Makefile
+README.md
 el_client.el
diff --git a/xcb-keysyms.el b/xcb-keysyms.el
index 01bb96c..8ca7e1f 100644
--- a/xcb-keysyms.el
+++ b/xcb-keysyms.el
@@ -197,7 +197,7 @@ SHIFT LOCK is ignored."
 ;; keysyms, which seems not very useful here.
 ;; FIXME: shall we also include 'iso_lispy_function_keys' there?
 (defconst xcb:keysyms:-function-keys
-  `(;#xff00 - #xff0f
+  `[;#xff00 - #xff0f
 ,@(make-list 8 nil) backspace tab linefeed clear nil return nil nil
 ;#xff10 - #xff1f
 nil nil nil pause nil nil nil nil nil nil nil escape nil nil nil nil
@@ -237,7 +237,7 @@ SHIFT LOCK is ignored."
 f35 lshift* rshift* lcontrol* rcontrol* caps-lock* shift-lock*
 lmeta* rmeta* lalt* ralt* lsuper* rsuper* lhyper* rhyper*
 ;#xff00 - #x
-,@(make-list 15 nil) delete)
+,@(make-list 15 nil) delete]
   "Emacs event representations of X function keys (keysym #xff00 to #x).")
 
 (defun xcb:keysyms:event->keysym (event)
@@ -288,7 +288,7 @@ this function will also return symbols for pure modifiers 
keys."
   (let ((event (cond ((and (<= #x20 keysym) (>= #xff keysym))
   keysym)
  ((and (<= #xff00 keysym) (>= #x keysym))
-  (elt xcb:keysyms:-function-keys (logand keysym #xff)))
+  (aref xcb:keysyms:-function-keys (logand keysym #xff)))
  ((and (<= #x1000100 keysym) (>= #x110 keysym))
   (- keysym #x100))
  ((and (<= 1 keysym) (>= 5 keysym)) ;ButtonPress assuemd
diff --git a/xcb-types.el b/xcb-types.el
index 0d16a08..e093e7a 100644
--- a/xcb-types.el
+++ b/xcb-types.el
@@ -74,9 +74,9 @@
  (elt initforms i)
  (elt types i))
   result))
-  (defsubst cl--slot-descriptor-name (slot) (elt slot 0))
-  (defsubst cl--slot-descriptor-initform (slot) (elt slot 1))
-  (defsubst cl--slot-descriptor-type (slot) (elt slot 2)))
+  (defsubst cl--slot-descriptor-name (slot) (aref slot 0))
+  (defsubst cl--slot-descriptor-initform (slot) (aref slot 1))
+  (defsubst cl--slot-descriptor-type (slot) (aref slot 2)))
 
  Utility functions
 
@@ -155,7 +155,7 @@
 
 (defsubst xcb:-unpack-u1 (data offset)
   "Byte array => 1 byte unsigned integer."
-  (elt data offset))
+  (aref data offset))
 
 (defsubst xcb:-unpack-i1 (data offset)
   "Byte array => 1 byte signed integer."
@@ -166,11 +166,11 @@
 
 (defsubst xcb:-unpack-u2 (data offset)
   "Byte array => 2 bytes unsigned integer (MSB first)."
-  (logior (lsh (elt data offset) 8) (elt data (1+ offset
+  (logior (lsh (aref data offset) 8) (aref data (1+ offset
 
 (defsubst xcb:-unpack-u2-lsb (data offset)
   "Byte array => 2 bytes unsigned integer (LSB first)."
-  (logior (elt data offset) (lsh (elt data (1+ offset)) 8)))
+  (logior (aref data offset) (lsh (aref data (1+ offset)) 8)))
 
 (defsubst xcb:-unpack-i2 (data offset)
   "Byte array => 2 bytes signed integer (MSB first)."
@@ -192,28 +192,28 @@
   (progn
 (defsubst xcb:-unpack-u4 (data offset)
   "Byte array => 4 bytes unsigned integer (MSB first, 64-bit)."
-  (logior (lsh (elt data offset) 24) (lsh (elt data (1+ offset)) 16)
-  (lsh (elt data (+ offset 2)) 8) (elt data (+ offset 3
+  (logior (lsh (aref data offset) 24) (lsh (aref data (1+ offset)) 16)
+  (lsh (aref data (+ offset 2)) 8) (aref data (+ offset 3
 (defsubst xcb:-unpack-u4-lsb (data offset)
   "Byte array => 4 bytes unsigned integer (LSB first, 64-bit)."
-  (logior (elt data offset) 

[elpa] externals/exwm 5f9f673 47/64: Fix window size calculations

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 5f9f6737912f2a18f7adfff8c6f3ef8162ca52f1
Author: Chris Feng 
Commit: Chris Feng 

Fix window size calculations

* When sending the synthetic ConfigureNotify event, make sure we are dealing
  with the correct Emacs window
* When managing a floating window, ensure it can be easily pick up by the 
user
---
 exwm-floating.el |9 +
 exwm-manage.el   |2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index 8c2a8f49..0b4f327 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -98,8 +98,8 @@
width display-width))
 ;; Invalid width
 (when (= 0 width) (setq width (/ display-width 2)))
-;; Completely outsize
-(when (or (> x display-width) (> 0 (+ x display-width)))
+;; Make sure at least half of the window is visible
+(when (or (> (+ x (/ width 2)) display-width) (> 0 (+ x (/ width 2
   (setq x (/ (- display-width width) 2
   (if (> height display-height)
   ;; Too tall
@@ -107,8 +107,9 @@
 height display-height)
 ;; Invalid height
 (when (= 0 height) (setq height (/ display-height 2)))
-;; Completely outside
-(when (or (> y display-height) (> 0 (+ y display-height)))
+;; Make sure at least half of the window is visible
+(when (or (> (+ y (/ height 2)) display-height)
+  (> 0 (+ y (/ height 2
   (setq y (/ (- display-height height) 2
   ;; Center floating windows
   (when (and (= x 0) (= y 0))
diff --git a/exwm-manage.el b/exwm-manage.el
index 0fde4d4..e7134fe 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -289,7 +289,7 @@ corresponding buffer.")
 (frame-pixel-height exwm-workspace--current))
 (or exwm--floating-edges
 (window-inside-absolute-pixel-edges
- (get-buffer-window)
+ (get-buffer-window buffer t)
 (exwm--log "Reply with ConfigureNotify (edges): %s" edges)
 (xcb:+request exwm--connection
 (make-instance 'xcb:SendEvent



[elpa] externals/xelb f465091 22/42: It's valid for WM_NORMAL_HINTS responses only to have 15 words.

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit f465091df5f0e2a3e0f67f2f1b341ee9960aa62e
Author: Philip 
Commit: Philip 

It's valid for WM_NORMAL_HINTS responses only to have 15 words.

* xcb-icccm.el (xcb:unmarshal): Accept short responses to the
WM_NORMAL_HINTS property, such as that provided by Xnest.
---
 xcb-icccm.el |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/xcb-icccm.el b/xcb-icccm.el
index 1d178d8..feff43c 100644
--- a/xcb-icccm.el
+++ b/xcb-icccm.el
@@ -291,9 +291,8 @@ explicitly listed out."
  (slots (nthcdr (length slots-orig) slots))
  (value (slot-value obj 'value)))
 (unless value (setq value (make-vector (length slots) nil))) ;fallback
-(cl-assert (= (length value) (length slots)))
 ;; Set explicit fields from value field
-(dotimes (i (length slots))
+(dotimes (i (length value))
   (setf (slot-value obj (cl--slot-descriptor-name (elt slots i)))
 (elt value i)))
 retval))



[elpa] externals/exwm 874c383 43/64: Merge pull request #42 from pipcet/ewmh-fullscreen

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 874c383672e42cc642aca8b470afe394b39a1965
Merge: 5210e13 94bdbfc
Author: Chris Feng 
Commit: Chris Feng 

Merge pull request #42 from pipcet/ewmh-fullscreen

Avoid using the "no window manager" code in Emacs
---
 exwm-layout.el|   28 
 exwm-randr.el |6 ++
 exwm-workspace.el |   14 ++
 exwm.el   |   18 --
 4 files changed, 60 insertions(+), 6 deletions(-)

diff --git a/exwm-layout.el b/exwm-layout.el
index 1ffb3b9..735b156 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -162,6 +162,34 @@
 (setq exwm--fullscreen nil)
 (exwm-input-grab-keyboard)))
 
+;; This function is superficially similar to `exwm-layout-set-fullscreen', but
+;; they do very different things: `exwm-layout--set-frame-fullscreen' resizes a
+;; frame to the actual monitor size, `exwm-layout-set-fullscreen' resizes an X
+;; window to the frame size.
+(defun exwm-layout--set-frame-fullscreen (frame)
+  "Make frame FRAME fullscreen, with regard to its XRandR output if 
applicable."
+  (let ((geometry (or (frame-parameter frame 'exwm-geometry)
+  (xcb:+request-unchecked+reply
+  exwm--connection
+  (make-instance 'xcb:GetGeometry
+ :drawable exwm--root))
+  (make-instance 'xcb:RECTANGLE :x 0 :y 0
+ :width (x-display-width)
+ :height (x-display-height
+ (id (frame-parameter frame 'exwm-outer-id)))
+(with-slots (x y width height) geometry
+(xcb:+request exwm--connection
+(make-instance 'xcb:ConfigureWindow
+   :window id
+   :value-mask (logior xcb:ConfigWindow:X
+   xcb:ConfigWindow:Y
+   xcb:ConfigWindow:Width
+   xcb:ConfigWindow:Height)
+   :x x :y y
+   :width width
+   :height height))
+(xcb:flush exwm--connection
+
 (defun exwm-layout--refresh ()
   "Refresh layout."
   (let ((frame (selected-frame))
diff --git a/exwm-randr.el b/exwm-randr.el
index cd40fb4..6bddb00 100644
--- a/exwm-randr.el
+++ b/exwm-randr.el
@@ -85,6 +85,12 @@
   (setq geometry default-geometry
 output nil))
 (set-frame-parameter frame 'exwm-randr-output output)
+(set-frame-parameter frame 'exwm-geometry
+ (make-instance 'xcb:RECTANGLE
+:x (elt geometry 0)
+:y (elt geometry 1)
+:width (elt geometry 2)
+:height (elt geometry 3)))
 (set-frame-parameter frame 'exwm-x (elt geometry 0))
 (set-frame-parameter frame 'exwm-y (elt geometry 1))
 (xcb:+request exwm--connection
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 7ac1fec..8e3839f 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -231,13 +231,11 @@ The optional FORCE option is for internal use only."
   (unless (frame-parameter i 'window-id)
 (setq exwm-workspace--list (delq i exwm-workspace--list)
   (cl-assert (= 1 (length exwm-workspace--list)))
-  (exwm--make-emacs-idle-for 0.1)  ;wait for the frame ready
-  ;; Configure the existing frame
-  (set-frame-parameter (car exwm-workspace--list) 'fullscreen 'fullboth)
   ;; Create remaining frames
   (dotimes (i (1- exwm-workspace-number))
 (nconc exwm-workspace--list
-   (list (make-frame '((window-system . x) (fullscreen . fullboth))
+   (list (make-frame '((window-system . x)
+   (visibility . nil))
   ;; Configure workspaces
   (dolist (i exwm-workspace--list)
 (let ((window-id (string-to-int (frame-parameter i 'window-id)))
@@ -256,6 +254,14 @@ The optional FORCE option is for internal use only."
  :window window-id :value-mask xcb:CW:EventMask
  :event-mask xcb:EventMask:SubstructureRedirect
   (xcb:flush exwm--connection)
+  ;; We have to delay making the frame visible until the
+  ;; override-redirect flag has been set.
+  (select-frame-set-input-focus (car exwm-workspace--list))
+  (dolist (i exwm-workspace--list)
+(set-frame-parameter i 'visibility t)
+(lower-frame i)
+(set-frame-parameter i 'fullscreen 'fullboth))
+  (raise-frame (car exwm-workspace--list))
   ;; Handle unexpected f

[elpa] externals/exwm 2ad1a89 14/64: Various input fixes

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 2ad1a89db0c9e3704c79294620c5ed4925b143eb
Author: Chris Feng 
Commit: Chris Feng 

Various input fixes

* Fix `exwm-reset`
* Make input mode buffer local
* Allow window to stay in `char-mode` while setting input focus to other 
window
  or switching to other workspace
---
 exwm-input.el |   30 +++---
 exwm-workspace.el |   20 ++--
 exwm.el   |6 --
 3 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 6d72cc2..f94cf50 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -161,7 +161,9 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
   (let ((obj (make-instance 'xcb:KeyPress)))
 (xcb:unmarshal obj data)
 (setq exwm-input--timestamp (slot-value obj 'time))
-(funcall 'exwm-input--handle-KeyPress obj)))
+(if (eq major-mode 'exwm-mode)
+(funcall exwm--on-KeyPress obj)
+  (exwm-input--on-KeyPress-char-mode obj
 
 (defvar exwm-input--global-keys nil "Global key bindings.")
 (defvar exwm-input--global-prefix-keys nil
@@ -211,7 +213,7 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 ;; ;; in this case.
 ;; ;; P.S.; to use this implementation, comment out the KeyRelease listener
 ;; ;;   together with this one and make GrabKey in Sync mode.
-;; (cl-defmethod exwm-input--handle-KeyPress-line-mode ((obj xcb:KeyPress))
+;; (cl-defmethod exwm-input--on-KeyPress-line-mode ((obj xcb:KeyPress))
 ;;   "Parse X KeyPress event to Emacs key event and then feed the command 
loop."
 ;;   (with-slots (detail state) obj
 ;; (let ((keysym (xcb:keysyms:keycode->keysym exwm--connection detail 
state))
@@ -238,7 +240,7 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 ;; This implementation has a drawback that some (legacy) applications
 ;; (e.g. xterm) ignore the synthetic key events, making it only viable for EXWM
 ;; to work in char-mode in such case.
-(cl-defmethod exwm-input--handle-KeyPress-line-mode ((obj xcb:KeyPress))
+(cl-defmethod exwm-input--on-KeyPress-line-mode ((obj xcb:KeyPress))
   "Parse X KeyPress event to Emacs key event and then feed the command loop."
   (with-slots (detail state) obj
 (let ((keysym (xcb:keysyms:keycode->keysym exwm--connection detail state))
@@ -264,23 +266,22 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
:event (xcb:marshal obj exwm--connection)))
 (xcb:flush exwm--connection)
 
-(cl-defmethod exwm-input--handle-KeyPress-char-mode ((obj xcb:KeyPress))
+(cl-defmethod exwm-input--on-KeyPress-char-mode ((obj xcb:KeyPress))
   "Handle KeyPress event in char-mode."
   (with-slots (detail state) obj
 (let ((keysym (xcb:keysyms:keycode->keysym exwm--connection detail state))
   event)
   (when (and keysym (setq event (xcb:keysyms:keysym->event keysym state)))
-(setq exwm-input--temp-line-mode t
-  exwm-input--during-key-sequence t)
-(push event unread-command-events)
-(exwm-input--grab-keyboard) ;grab keyboard temporarily
-
-(defalias 'exwm-input--handle-KeyPress 'exwm-input--handle-KeyPress-line-mode
-  "Generic function for handling KeyPress event.")
+(when (eq major-mode 'exwm-mode)
+  (setq exwm-input--temp-line-mode t
+exwm-input--during-key-sequence t)
+  (exwm-input--grab-keyboard)) ;grab keyboard temporarily
+(push event unread-command-events)
 
 (defun exwm-input--grab-keyboard (&optional id)
   "Grab all key events on window ID."
   (unless id (setq id (exwm--buffer->id (window-buffer
+  (cl-assert id)
   (when (xcb:+request-checked+request-check exwm--connection
 (make-instance 'xcb:GrabKey
:owner-events 0 :grab-window id
@@ -289,19 +290,18 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
:pointer-mode xcb:GrabMode:Async
:keyboard-mode xcb:GrabMode:Async))
 (exwm--log "Failed to grab keyboard for #x%x" id))
-  (defalias 'exwm-input--handle-KeyPress
-'exwm-input--handle-KeyPress-line-mode))
+  (setq exwm--on-KeyPress 'exwm-input--on-KeyPress-line-mode))
 
 (defun exwm-input--release-keyboard (&optional id)
   "Ungrab all key events on window ID."
   (unless id (setq id (exwm--buffer->id (window-buffer
+  (cl-assert id)
   (when (xcb:+request-checked+request-check exwm--connection
 (make-instance 'xcb:UngrabKey
:key xcb:Grab:Any :grab-window id
:modifiers xcb:ModM

[elpa] externals/exwm cf87bb5 03/64: Add wiki link to README

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit cf87bb55ed2b7070aceaea70783a578563734b7d
Author: Chris Feng 
Commit: Chris Feng 

Add wiki link to README
---
 README |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/README b/README
index a0340f3..a2a2fdc 100644
--- a/README
+++ b/README
@@ -2,7 +2,8 @@ Emacs X Window Manager
 ==
 
 EXWM (Emacs X Window Manager) turns Emacs into a full-featured tiling X window
-manager. Please refer to "exwm.el" for more details.
+manager. Please check the wiki for more details.
+  + Wiki: https://github.com/ch11ng/exwm/wiki
 
 EXWM is built on top of XELB and its utility libraris:
   + XELB: https://github.com/ch11ng/xelb



[elpa] externals/xelb 41cca58 35/42: Fix compiling issues

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 41cca582c040fea69f61135634e0530621867802
Author: Chris Feng 
Commit: Chris Feng 

Fix compiling issues

* util/xcb-ewmh.el, util/xcb-icccm.el: eliminate compile warnings by 
defining
  atom variables at compile time
* xcb.el: `xcb:debug-on' should be used just in this file
---
 util/xcb-ewmh.el  |  188 +++--
 util/xcb-icccm.el |   32 +
 xcb.el|2 +-
 3 files changed, 115 insertions(+), 107 deletions(-)

diff --git a/util/xcb-ewmh.el b/util/xcb-ewmh.el
index 84161ee..3295baa 100644
--- a/util/xcb-ewmh.el
+++ b/util/xcb-ewmh.el
@@ -47,98 +47,102 @@
 
  EWMH Atoms
 
-(defconst xcb:ewmh:-atoms   ;_NET_WM_CM_Sn are left out
-  '(;; Root Window Properties (and Related Messages)
-_NET_SUPPORTED
-_NET_CLIENT_LIST
-_NET_CLIENT_LIST_STACKING
-_NET_NUMBER_OF_DESKTOPS
-_NET_DESKTOP_GEOMETRY
-_NET_DESKTOP_VIEWPORT
-_NET_CURRENT_DESKTOP
-_NET_DESKTOP_NAMES
-_NET_ACTIVE_WINDOW
-_NET_WORKAREA
-_NET_SUPPORTING_WM_CHECK
-_NET_VIRTUAL_ROOTS
-_NET_DESKTOP_LAYOUT
-_NET_SHOWING_DESKTOP
-;; Other Root Window Messages
-_NET_CLOSE_WINDOW
-_NET_MOVERESIZE_WINDOW
-_NET_WM_MOVERESIZE
-_NET_RESTACK_WINDOW
-_NET_REQUEST_FRAME_EXTENTS
-;; Application Window Properties
-_NET_WM_NAME
-_NET_WM_VISIBLE_NAME
-_NET_WM_ICON_NAME
-_NET_WM_VISIBLE_ICON_NAME
-_NET_WM_DESKTOP
-_NET_WM_WINDOW_TYPE
-_NET_WM_STATE
-_NET_WM_ALLOWED_ACTIONS
-_NET_WM_STRUT
-_NET_WM_STRUT_PARTIAL
-_NET_WM_ICON_GEOMETRY
-_NET_WM_ICON
-_NET_WM_PID
-_NET_WM_HANDLED_ICONS
-_NET_WM_USER_TIME
-_NET_WM_USER_TIME_WINDOW
-_NET_FRAME_EXTENTS
-_NET_WM_OPAQUE_REGION
-_NET_WM_BYPASS_COMPOSITOR
-;; Window Manager Protocols
-_NET_WM_PING
-_NET_WM_SYNC_REQUEST
-_NET_WM_SYNC_REQUEST_COUNTER
-_NET_WM_FULLSCREEN_MONITORS
-;; Other Properties
-_NET_WM_FULL_PLACEMENT
-;; _NET_WM_WINDOW_TYPE hint
-_NET_WM_WINDOW_TYPE_DESKTOP
-_NET_WM_WINDOW_TYPE_DOCK
-_NET_WM_WINDOW_TYPE_TOOLBAR
-_NET_WM_WINDOW_TYPE_MENU
-_NET_WM_WINDOW_TYPE_UTILITY
-_NET_WM_WINDOW_TYPE_SPLASH
-_NET_WM_WINDOW_TYPE_DIALOG
-_NET_WM_WINDOW_TYPE_DROPDOWN_MENU
-_NET_WM_WINDOW_TYPE_POPUP_MENU
-_NET_WM_WINDOW_TYPE_TOOLTIP
-_NET_WM_WINDOW_TYPE_NOTIFICATION
-_NET_WM_WINDOW_TYPE_COMBO
-_NET_WM_WINDOW_TYPE_DND
-_NET_WM_WINDOW_TYPE_NORMAL
-;; _NET_WM_STATE hint
-_NET_WM_STATE_MODAL
-_NET_WM_STATE_STICKY
-_NET_WM_STATE_MAXIMIZED_VERT
-_NET_WM_STATE_MAXIMIZED_HORZ
-_NET_WM_STATE_SHADED
-_NET_WM_STATE_SKIP_TASKBAR
-_NET_WM_STATE_SKIP_PAGER
-_NET_WM_STATE_HIDDEN
-_NET_WM_STATE_FULLSCREEN
-_NET_WM_STATE_ABOVE
-_NET_WM_STATE_BELOW
-_NET_WM_STATE_DEMANDS_ATTENTION
-_NET_WM_STATE_FOCUSED
-;; _NET_WM_ACTION hint
-_NET_WM_ACTION_MOVE
-_NET_WM_ACTION_RESIZE
-_NET_WM_ACTION_MINIMIZE
-_NET_WM_ACTION_SHADE
-_NET_WM_ACTION_STICK
-_NET_WM_ACTION_MAXIMIZE_HORZ
-_NET_WM_ACTION_MAXIMIZE_VERT
-_NET_WM_ACTION_FULLSCREEN
-_NET_WM_ACTION_CHANGE_DESKTOP
-_NET_WM_ACTION_CLOSE
-_NET_WM_ACTION_ABOVE
-_NET_WM_ACTION_BELOW)
-  "EWMH atoms.")
+(eval-and-compile
+  (defconst xcb:ewmh:-atoms ;_NET_WM_CM_Sn are left out
+'( ;; Root Window Properties (and Related Messages)
+  _NET_SUPPORTED
+  _NET_CLIENT_LIST
+  _NET_CLIENT_LIST_STACKING
+  _NET_NUMBER_OF_DESKTOPS
+  _NET_DESKTOP_GEOMETRY
+  _NET_DESKTOP_VIEWPORT
+  _NET_CURRENT_DESKTOP
+  _NET_DESKTOP_NAMES
+  _NET_ACTIVE_WINDOW
+  _NET_WORKAREA
+  _NET_SUPPORTING_WM_CHECK
+  _NET_VIRTUAL_ROOTS
+  _NET_DESKTOP_LAYOUT
+  _NET_SHOWING_DESKTOP
+  ;; Other Root Window Messages
+  _NET_CLOSE_WINDOW
+  _NET_MOVERESIZE_WINDOW
+  _NET_WM_MOVERESIZE
+  _NET_RESTACK_WINDOW
+  _NET_REQUEST_FRAME_EXTENTS
+  ;; Application Window Properties
+  _NET_WM_NAME
+  _NET_WM_VISIBLE_NAME
+  _NET_WM_ICON_NAME
+  _NET_WM_VISIBLE_ICON_NAME
+  _NET_WM_DESKTOP
+  _NET_WM_WINDOW_TYPE
+  _NET_WM_STATE
+  _NET_WM_ALLOWED_ACTIONS
+  _NET_WM_STRUT
+  _NET_WM_STRUT_PARTIAL
+  _NET_WM_ICON_GEOMETRY
+  _NET_WM_ICON
+  _NET_WM_PID
+  _NET_WM_HANDLED_ICONS
+  _NET_WM_USER_TIME
+  _NET_WM_USER_TIME_WINDOW
+  _NET_FRAME_EXTENTS
+  _NET_WM_OPAQUE_REGION
+  _NET_WM_BYPASS_COMPOSITOR
+  ;; Window Manager Protocols
+  _NET_WM_PING
+  _NET_WM_SYNC_REQUEST
+  _NET_WM_SYNC_REQUEST_COUNTER
+  _NET_WM_FULLSCREEN_MONITORS
+  ;; Other Properties
+  _NET_WM_FULL_PLACEMENT
+  ;; _NET_WM_WINDOW_TYPE hint
+  _NET_WM_WINDOW_TYPE_DESKTOP
+  _NET_WM_WINDOW_TYPE_DOCK
+  _NET_WM_WINDOW_TYPE_TOOLBAR
+  _NET_WM_WINDOW_TYPE_MENU
+  _N

[elpa] externals/xelb 8215991 39/42: Add a missing function key

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 82159917ea1f8813e38f83491ece5bab2e7b67fe
Author: Chris Feng 
Commit: Chris Feng 

Add a missing function key

* xcb-keysyms.el (xcb:keysyms:-function-keys): add a missing function key
---
 xcb-keysyms.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/xcb-keysyms.el b/xcb-keysyms.el
index 8ca7e1f..91b293b 100644
--- a/xcb-keysyms.el
+++ b/xcb-keysyms.el
@@ -235,7 +235,7 @@ SHIFT LOCK is ignored."
 ;#xffe0 - #xffef
 ;; f35 ,@(make-list 15 nil)
 f35 lshift* rshift* lcontrol* rcontrol* caps-lock* shift-lock*
-lmeta* rmeta* lalt* ralt* lsuper* rsuper* lhyper* rhyper*
+lmeta* rmeta* lalt* ralt* lsuper* rsuper* lhyper* rhyper* nil
 ;#xff00 - #x
 ,@(make-list 15 nil) delete]
   "Emacs event representations of X function keys (keysym #xff00 to #x).")



[elpa] externals/exwm 7032ee7 48/64: Re-enable complete refresh of keyboard mapping

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 7032ee70030273e9a32d3aa444b1247406d15552
Author: Chris Feng 
Commit: Chris Feng 

Re-enable complete refresh of keyboard mapping

Since the performance of `xcb:keysyms:update-keyboard-mapping` is no longer 
an
problem, we allow every possible refresh of keyboard mapping again.
---
 exwm-input.el |   17 +
 1 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index ede635c..eb53b41 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -149,20 +149,13 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
((= request xcb:Mapping:Modifier)
 ;; Modifier keys changed
 (exwm--log "Update modifier mapping")
-(xcb:keysyms:update-modifier-mapping exwm--connection)
-)
+(xcb:keysyms:update-modifier-mapping exwm--connection))
((= request xcb:Mapping:Keyboard)
 ;; Only update changed keys
-(with-slots (min-keycode max-keycode)
-(xcb:get-setup exwm--connection)
-  ;; Since this operation is quite time-consuming, a complete refresh
-  ;; is forbidden as it's unlikely to bring any useful information
-  (unless (and (= min-keycode first-keycode)
-   (= max-keycode (+ first-keycode count -1)))
-(exwm--log "Update keyboard mapping: %d ~ %d"
-   first-keycode (+ first-keycode count))
-(xcb:keysyms:update-keyboard-mapping exwm--connection
- first-keycode count
+(exwm--log "Update keyboard mapping: %d ~ %d"
+   first-keycode (+ first-keycode count))
+(xcb:keysyms:update-keyboard-mapping exwm--connection
+ first-keycode count))
 
 (defun exwm-input--on-ButtonPress (data synthetic)
   "Handle ButtonPress event."



[elpa] externals/xelb c042d3f 08/42: Provide more verbose message when connection failed or auth required

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit c042d3fbe9921f9289fe6831bbb1853eac864b4a
Author: Chris Feng 
Commit: Chris Feng 

Provide more verbose message when connection failed or auth required
---
 xcb.el |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xcb.el b/xcb.el
index 0f5ae1a..55e4ba2 100644
--- a/xcb.el
+++ b/xcb.el
@@ -206,7 +206,8 @@ Concurrency is prevented as it breaks the orders of errors 
and replies."
  (setq obj (make-instance 'xcb:SetupFailed))
  (xcb:unmarshal obj cache)
  (setq cache [])
- (error "[XELB] %s" obj))
+ (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)))
@@ -215,7 +216,8 @@ Concurrency is prevented as it breaks the orders of errors 
and replies."
 (2  ;authentication
  (setq obj (make-instance 'xcb:SetupAuthenticate))
  (setq cache (substring cache (xcb:unmarshal obj cache)))
- (error "[XELB] %s" obj))
+ (error "[XELB] Authentication not supported: %s"
+(slot-value obj 'reason)))
 (x (error "Unrecognized setup status: %d" x))
 (setf (slot-value connection 'lock) nil)
 (throw 'return 'setup))



[elpa] externals/exwm d1806e9 37/64: Improve code robustness.

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit d1806e91888cc2d56e252299d07cb6af05a3e9d0
Author: Philip 
Commit: Philip 

Improve code robustness.

* exwm-layout.el (exwm-layout-unset-fullscreen)
(exwm-layout-set-fullscreen): Use `user-error' rather than
`cl-assert'.
* exwm-input.el (exwm-input--set-focus): Silently accept unknown
ids. (exwm-input--grab-keyboard) (exwm-input--release-keyboard):
Silently ignore calls for windows that have no buffer.
* exwm-manage.el (exwm-manage--kill-client): Don't throw error
when trying to kill a vanished window.
---
 exwm-input.el  |   75 ---
 exwm-layout.el |6 +++-
 exwm-manage.el |7 ++---
 3 files changed, 45 insertions(+), 43 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 6b41fff..760e5c9 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -56,26 +56,27 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 
 (defun exwm-input--set-focus (id)
   "Set input focus to window ID in a proper way."
-  (with-current-buffer (exwm--id->buffer id)
-(if (and (not exwm--hints-input)
- (memq xcb:Atom:WM_TAKE_FOCUS exwm--protocols))
-(progn
-  (exwm--log "Focus on #x%x with WM_TAKE_FOCUS" id)
-  (xcb:+request exwm--connection
-  (make-instance 'xcb:icccm:SendEvent
- :destination id
- :event (xcb:marshal
- (make-instance 'xcb:icccm:WM_TAKE_FOCUS
-:window id
-:time
-exwm-input--timestamp)
- exwm--connection
-  (exwm--log "Focus on #x%x with SetInputFocus" id)
-  (xcb:+request exwm--connection
-  (make-instance 'xcb:SetInputFocus
- :revert-to xcb:InputFocus:Parent :focus id
- :time xcb:Time:CurrentTime)))
-(xcb:flush exwm--connection)))
+  (when (exwm--id->buffer id)
+(with-current-buffer (exwm--id->buffer id)
+  (if (and (not exwm--hints-input)
+   (memq xcb:Atom:WM_TAKE_FOCUS exwm--protocols))
+  (progn
+(exwm--log "Focus on #x%x with WM_TAKE_FOCUS" id)
+(xcb:+request exwm--connection
+(make-instance 'xcb:icccm:SendEvent
+   :destination id
+   :event (xcb:marshal
+   (make-instance 'xcb:icccm:WM_TAKE_FOCUS
+  :window id
+  :time
+  exwm-input--timestamp)
+   exwm--connection
+(exwm--log "Focus on #x%x with SetInputFocus" id)
+(xcb:+request exwm--connection
+(make-instance 'xcb:SetInputFocus
+   :revert-to xcb:InputFocus:Parent :focus id
+   :time xcb:Time:CurrentTime)))
+  (xcb:flush exwm--connection
 
 (defvar exwm-input--focus-window nil "The (Emacs) window to be focused.")
 (defvar exwm-input--redirected nil
@@ -311,27 +312,27 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 (defun exwm-input--grab-keyboard (&optional id)
   "Grab all key events on window ID."
   (unless id (setq id (exwm--buffer->id (window-buffer
-  (cl-assert id)
-  (when (xcb:+request-checked+request-check exwm--connection
-(make-instance 'xcb:GrabKey
-   :owner-events 0 :grab-window id
-   :modifiers xcb:ModMask:Any
-   :key xcb:Grab:Any
-   :pointer-mode xcb:GrabMode:Async
-   :keyboard-mode xcb:GrabMode:Async))
-(exwm--log "Failed to grab keyboard for #x%x" id))
-  (setq exwm--on-KeyPress 'exwm-input--on-KeyPress-line-mode))
+  (when id
+(when (xcb:+request-checked+request-check exwm--connection
+  (make-instance 'xcb:GrabKey
+ :owner-events 0 :grab-window id
+ :modifiers xcb:ModMask:Any
+ :key xcb:Grab:Any
+ :pointer-mode xcb:GrabMode:Async
+ :keyboard-mode xcb:GrabMode:Async))
+  (exwm--log "Failed to grab keyboard for #x%x" id))
+(setq exwm--on-KeyPress 'exwm-input--on-KeyPress-line-mode)))
 
 (defun exwm-input--release-keyboard (&optional id)
   "Ungrab all key events on window ID."
   (unless id (setq id (exwm--buffer->id (window-buffer
-  (cl-assert id)
-  (when (xcb:+request-checked+request-check exwm--connection
-(make-instance 'xcb:UngrabKey
-   

[elpa] externals/exwm 35560a4 30/64: Minor fixes for emacsclient

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 35560a49d6c03f96c1f62bfee72ee667cffadb9e
Author: Chris Feng 
Commit: Chris Feng 

Minor fixes for emacsclient
---
 exwm-input.el |4 ++--
 exwm.el   |6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 454521f..b9a5f20 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -175,8 +175,8 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
  ;; Resize
  (exwm-floating--start-moveresize event))
 (t
- (select-window (get-buffer-window (exwm--id->buffer event)
-   'visible))
+ ;; Click to focus
+ (select-window (get-buffer-window (exwm--id->buffer event) t))
  ;; The event should be replayed
  (setq mode xcb:Allow:ReplayPointer
 (xcb:+request exwm--connection
diff --git a/exwm.el b/exwm.el
index 989bf88..d33ab26 100644
--- a/exwm.el
+++ b/exwm.el
@@ -590,6 +590,7 @@
   (if (not (eq 'x (framep (or frame (selected-frame)
   (exwm--log "Not running under X environment")
 (unless exwm--connection
+  (exwm-enable 'undo)   ;never initialize again
   (setq exwm--connection (xcb:connect-to-socket))
   (set-process-query-on-exit-flag (slot-value exwm--connection 'process)
   nil) ;prevent query message on exit
@@ -604,7 +605,6 @@
   ;; Other window manager is running
   (progn (xcb:disconnect exwm--connection)
  (setq exwm--connection nil)
- (exwm-enable 'undo)
  (exwm--log "Other window manager detected"))
 ;; Initialize ICCCM/EWMH support
 ;; (xcb:icccm:init exwm--connection)
@@ -694,11 +694,11 @@
 
 (defun exwm-enable (&optional undo)
   "Enable/Disable EXWM"
-  (setq frame-resize-pixelwise t)   ;mandatory; before init
   (if (eq undo 'undo)
   (progn (remove-hook 'window-setup-hook 'exwm-init)
  (remove-hook 'after-make-frame-functions 'exwm-init))
-(add-hook 'window-setup-hook 'exwm-init t);for Emacs
+(setq frame-resize-pixelwise t);mandatory; before init
+(add-hook 'window-setup-hook 'exwm-init t) ;for Emacs
 (add-hook 'after-make-frame-functions 'exwm-init t))) ;for Emacs Client
 
 (defun exwm--ido-buffer-window-other-frame (orig-fun buffer)



[elpa] externals/exwm 5222dc1 49/64: Avoid deleting the frame created by Emacs client by accident

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 5222dc17d66375f20485d65573043e5a8286ae9d
Author: Chris Feng 
Commit: Chris Feng 

Avoid deleting the frame created by Emacs client by accident

When Emacs is invoked as `emacsclient -a '' -c`, it creates a frame that can
be deleted without any prompt. This commit removes the `client` parameter 
from
that frame to avoid such inconvenience.
---
 exwm-workspace.el |9 -
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index 27e3179..f4e1dd1 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -24,9 +24,6 @@
 
 ;; This module adds workspace support for EXWM.
 
-;; Todo:
-;; + prevent from deleting frames of Emacs client (`frame-delete-functions')
-
 ;;; Code:
 
 (defvar exwm-workspace-number 4 "Number of workspaces (1 ~ 10).")
@@ -230,8 +227,10 @@ The optional FORCE option is for internal use only."
 ;; Emacs client creates an extra (but unusable) frame
 (dolist (i exwm-workspace--list)
   (unless (frame-parameter i 'window-id)
-(setq exwm-workspace--list (delq i exwm-workspace--list)
-  (cl-assert (= 1 (length exwm-workspace--list)))
+(setq exwm-workspace--list (delq i exwm-workspace--list
+(cl-assert (= 1 (length exwm-workspace--list)))
+;; Prevent user from deleting this frame by accident
+(set-frame-parameter (car exwm-workspace--list) 'client nil))
   ;; Create remaining frames
   (dotimes (i (1- exwm-workspace-number))
 (nconc exwm-workspace--list



[elpa] externals/exwm f4416a1 06/64: Fix potential naming conflicts

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit f4416a10e3f87ceddc70ae02f065f14c5e6dc3fd
Author: Chris Feng 
Commit: Chris Feng 

Fix potential naming conflicts

Buffers may share a same name (without the possible leading space) when 
created
in different workspaces.
---
 exwm-workspace.el |   21 +
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index bab2612..b46b2e8 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -119,9 +119,9 @@ The optional FORCE option is for internal use only "
 (dolist (i exwm--id-buffer-alist)
   (with-current-buffer (cdr i)
 (let ((name (replace-regexp-in-string "^\\s-*" "" (buffer-name
-  (rename-buffer (if (eq (selected-frame) exwm--frame)
- name
-   (concat " " name))
+  (exwm-workspace-rename-buffer (if (eq (selected-frame) exwm--frame)
+name
+  (concat " " name))
 ;; Update demands attention flag
 (set-frame-parameter (selected-frame) 'exwm--urgency nil)
 ;; Update switch workspace history
@@ -151,7 +151,7 @@ The optional FORCE option is for internal use only "
 (let ((frame (elt exwm-workspace--list index)))
   (with-current-buffer (exwm--id->buffer id)
 (setq exwm--frame frame)
-(rename-buffer
+(exwm-workspace-rename-buffer
  (concat " " (replace-regexp-in-string "^\\s-*" "" (buffer-name
 (if exwm--floating-frame
 ;; Move the floating frame is enough
@@ -172,6 +172,19 @@ The optional FORCE option is for internal use only "
 (xcb:flush exwm--connection)
 (exwm-workspace--update-switch-history)))
 
+(defun exwm-workspace-rename-buffer (newname)
+  "Rename a buffer."
+  (if (/= ?  (aref newname 0))
+  (rename-buffer newname t)
+;; If a buffer name is prefixed with a space, Emacs append a random
+;; number before renaming it. This is not desired behavior.
+(let ((name (replace-regexp-in-string "<[0-9]+>$" "" newname))
+  (counter 1))
+  (while (and (get-buffer newname)
+  (not (eq (get-buffer newname) (current-buffer
+(setq newname (format "%s<%d>" name (cl-incf counter)
+(rename-buffer newname)))
+
 (defun exwm-workspace--init ()
   "Initialize workspace module."
   (cl-assert (and (< 0 exwm-workspace-number) (>= 10 exwm-workspace-number)))



[elpa] externals/exwm 3fb90b9 12/64: Fix fullscreen issues

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 3fb90b9eaac752760fc32404cbd1574b8ef61669
Author: Chris Feng 
Commit: Chris Feng 

Fix fullscreen issues

* Correct ConfigureNotify events sent to fullscreen windows.
* Exit fullscreen mode before switching workspace.
* Temporarily treat `xcb:Atom:_NET_WM_STATE_ABOVE` as
  `xcb:Atom:_NET_WM_STATE_FULLSCREEN` since
  a) "plugin-container" (Flash Player) seems only set this, and
  b) it's not normally used by applications.
  This makes fullscreen videos working in e.g. iceweasel.
---
 exwm-manage.el|   14 +-
 exwm-workspace.el |5 +
 exwm.el   |3 ++-
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/exwm-manage.el b/exwm-manage.el
index afab18e..0d2c74f 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -133,7 +133,7 @@ corresponding buffer.")
   (exwm-input-grab-keyboard id)
   (exwm-workspace--update-switch-history)
   (setq exwm-input--focus-lock nil) ;unlocked in advance
-  (with-current-buffer (exwm--id->buffer id)
+  (exwm--with-current-id id
 (run-hooks 'exwm-manage-finish-hook
   (setq exwm-input--focus-lock nil))
 
@@ -266,10 +266,14 @@ corresponding buffer.")
 (with-slots (window x y width height border-width) obj
   (if (setq buffer (exwm--id->buffer window))
   ;; Send client message for managed windows
-  (progn
-(setq edges (or (with-current-buffer buffer exwm--floating-edges)
-(window-inside-absolute-pixel-edges
- (get-buffer-window buffer
+  (with-current-buffer buffer
+(setq edges
+  (if exwm--fullscreen
+  (list 0 0
+(x-display-pixel-width) (x-display-pixel-height))
+(or exwm--floating-edges
+(window-inside-absolute-pixel-edges
+ (get-buffer-window)
 (xcb:+request exwm--connection
 (make-instance 'xcb:SendEvent
:propagate 0 :destination window
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 3add212..ed06f64 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -111,6 +111,11 @@ The optional FORCE option is for internal use only."
 (unless (and (<= 0 index) (< index exwm-workspace-number))
   (user-error "[EXWM] Workspace index out of range: %d" index))
 (when (or force (/= exwm-workspace-current-index index))
+  ;; Exit fullscreen mode
+  (with-current-buffer (window-buffer)
+(when (and (eq major-mode 'exwm-mode) exwm--fullscreen)
+  (exwm-layout-unset-fullscreen)
+  (exwm-input-grab-keyboard)))
   (let ((frame (elt exwm-workspace--list index)))
 (setq exwm-workspace--current frame
   exwm-workspace-current-index index)
diff --git a/exwm.el b/exwm.el
index 3f38b66..c8f10af 100644
--- a/exwm.el
+++ b/exwm.el
@@ -462,7 +462,8 @@
(exwm-floating--set-floating id)
(push xcb:Atom:_NET_WM_STATE_MODAL props-new)
 ;; _NET_WM_STATE_FULLSCREEN
-(when (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN props)
+(when (or (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN props)
+  (memq xcb:Atom:_NET_WM_STATE_ABOVE props))
   (cond ((= action xcb:ewmh:_NET_WM_STATE_ADD)
  (unless exwm--fullscreen (exwm-layout-set-fullscreen id))
  (push xcb:Atom:_NET_WM_STATE_FULLSCREEN props-new))



[elpa] externals/xelb f5a7ca9 42/42: Minor fix

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit f5a7ca962057900a0e960520d1bf5db02c68a602
Author: Chris Feng 
Commit: Chris Feng 

Minor fix

* el_client.el: Should require `pp' library.
---
 el_client.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/el_client.el b/el_client.el
index b662caa..bc0be64 100644
--- a/el_client.el
+++ b/el_client.el
@@ -41,6 +41,7 @@
 ;;; Code:
 
 (require 'cl-lib)
+(require 'pp)
 
  Variables
 
@@ -116,7 +117,6 @@ an `xelb-auto-padding' attribute."
   "Parse an XCB protocol description file FILE (XML)."
   (let ((pp-escape-newlines nil);do not escape newlines
 result header)
-(cl-assert (not pp-escape-newlines)) ;only to remove a compile warning
 (with-temp-buffer
   (insert-file-contents file)
   (setq result (libxml-parse-xml-region (point-min) (point-max) nil t))



[elpa] externals/exwm 42f4ec6 20/64: Show moved window by default

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 42f4ec6db50fc0d62792847e63349c46b056ad8f
Author: Chris Feng 
Commit: Chris Feng 

Show moved window by default
---
 exwm-workspace.el |   21 +
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index efecf57..148ff36 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -180,12 +180,15 @@ The optional FORCE option is for internal use only."
  (concat " " (replace-regexp-in-string "^\\s-*" "" (buffer-name
 (if exwm--floating-frame
 ;; Move the floating frame is enough
-(xcb:+request exwm--connection
-(make-instance 'xcb:ReparentWindow
-   :window (frame-parameter exwm--floating-frame
-'exwm-outer-id)
-   :parent (frame-parameter frame 'exwm-window-id)
-   :x 0 :y 0))
+(progn
+  (xcb:+request exwm--connection
+  (make-instance 'xcb:ReparentWindow
+ :window (frame-parameter exwm--floating-frame
+  'exwm-outer-id)
+ :parent (frame-parameter frame
+  'exwm-window-id)
+ :x 0 :y 0))
+  (xcb:flush exwm--connection))
   ;; Move the window itself
   (bury-buffer)
   (exwm-layout--hide id)
@@ -196,8 +199,10 @@ The optional FORCE option is for internal use only."
   (make-instance 'xcb:ReparentWindow
  :window id
  :parent (frame-parameter frame 'exwm-window-id)
- :x 0 :y 0)
-(xcb:flush exwm--connection)
+ :x 0 :y 0))
+  (xcb:flush exwm--connection)
+  (set-window-buffer (frame-first-window frame)
+ (exwm--id->buffer id)
 (exwm-workspace--update-switch-history)))
 
 (defun exwm-workspace-rename-buffer (newname)



[elpa] externals/exwm 1ce18af 28/64: Center floating windows by default

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 1ce18afd0559bacc3a7c43f5a73342814a5b176f
Author: Chris Feng 
Commit: Chris Feng 

Center floating windows by default

This commit makes a floating window centered to its leading window if it has
a valid WM_TRANSIENT_FOR property set. Other it's placed at the center of 
the
screen.
---
 exwm-floating.el |   20 +++-
 exwm-input.el|1 -
 exwm-manage.el   |7 +++
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index 3971fa4..7888fd2 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -67,6 +67,7 @@
  (y (slot-value exwm--geometry 'y))
  (width (slot-value exwm--geometry 'width))
  (height (slot-value exwm--geometry 'height)))
+(exwm--log "Floating geometry (original): %dx%d%+d%+d" width height x y)
 ;; Save window IDs
 (set-frame-parameter frame 'exwm-window-id frame-id)
 (set-frame-parameter frame 'exwm-outer-id outer-id)
@@ -102,7 +103,24 @@
 (when (= 0 height) (setq height (/ display-height 2)))
 ;; Completely outside
 (when (or (> y display-height) (> 0 (+ y display-height)))
-  (setq y (/ (- display-height height) 2)
+  (setq y (/ (- display-height height) 2
+  ;; Center floating windows
+  (when (and (= x 0) (= y 0))
+(let ((buffer (exwm--id->buffer exwm-transient-for))
+  window edges)
+  (when (and buffer (setq window (get-buffer-window buffer)))
+(setq edges (window-inside-absolute-pixel-edges window))
+(unless (and (<= width (- (elt edges 2) (elt edges 0)))
+ (<= height (- (elt edges 3) (elt edges 1
+  (setq edges nil)))
+  (if edges
+  ;; Put at the center of leading window
+  (setq x (/ (- (+ (elt edges 2) (elt edges 0)) width) 2)
+y (/ (- (+ (elt edges 3) (elt edges 1)) height) 2))
+;; Put at the center of screen
+(setq x (/ (- display-width width) 2)
+  y (/ (- display-height height) 2))
+(exwm--log "Floating geometry (corrected): %dx%d%+d%+d" width height x y)
 ;; Set OverrideRedirect on this frame
 (xcb:+request exwm--connection
 (make-instance 'xcb:ChangeWindowAttributes
diff --git a/exwm-input.el b/exwm-input.el
index a193314..4acacdf 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -86,7 +86,6 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
   "Update input focus."
   (when (and (frame-parameter nil 'exwm-window-id) ;e.g. emacsclient frame
  (eq (current-buffer) (window-buffer))) ;e.g. `with-temp-buffer'
-(exwm--log "EXWM-INPUT--UPDATE-FOCUS")
 (if (eq major-mode 'exwm-mode)
 (progn (exwm--log "Set focus ID to #x%x" exwm--id)
(setq exwm-input--focus-id exwm--id)
diff --git a/exwm-manage.el b/exwm-manage.el
index 79cff22..fc61e50 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -276,6 +276,8 @@ corresponding buffer.")
 buffer edges)
 (xcb:unmarshal obj data)
 (with-slots (window x y width height border-width) obj
+  (exwm--log "ConfigureRequest from #x%x @%dx%d%+d%+d, border: %d"
+ window width height x y border-width)
   (if (setq buffer (exwm--id->buffer window))
   ;; Send client message for managed windows
   (with-current-buffer buffer
@@ -286,6 +288,7 @@ corresponding buffer.")
 (or exwm--floating-edges
 (window-inside-absolute-pixel-edges
  (get-buffer-window)
+(exwm--log "Reply with ConfigureNotify (edges): %s" edges)
 (xcb:+request exwm--connection
 (make-instance 'xcb:SendEvent
:propagate 0 :destination window
@@ -300,6 +303,7 @@ corresponding buffer.")
 :height (- (elt edges 3) (elt edges 1))
 :border-width 0 :override-redirect 0)
exwm--connection
+(exwm--log "ConfigureWindow (preserve geometry)")
 ;; Configure unmanaged windows
 (xcb:+request exwm--connection
 (make-instance 'xcb:ConfigureWindow
@@ -317,6 +321,7 @@ corresponding buffer.")
   "Handle MapRequest event."
   (let ((obj (make-instance 'xcb:MapRequest)))
 (xcb:unmarshal obj data)
+(exwm--log "MapRequest from #x%x" (slot-value obj 'window))
 (exwm-manage--manage-window (slot-value obj 'window
 
 (defun exwm-manage--on-UnmapNotify (data synthetic)
@@ -324,6 +329,7 @@ corresponding buffer.")
   (unless synth

[elpa] externals/exwm dba43b0 32/64: Fix input focus stealing

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit dba43b018d791f59f0462b56a46a4eced2d8a3c1
Author: Chris Feng 
Commit: Chris Feng 

Fix input focus stealing

This was fixed in b755296 but broken by 04e4269.
---
 exwm-input.el |   18 ++
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 0ef7232..6b41fff 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -112,20 +112,22 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
   "Update input focus."
   (when exwm-input--focus-window
 (with-current-buffer (window-buffer exwm-input--focus-window)
-  (exwm--log "Set focus on %s" exwm-input--focus-window)
   (if (eq major-mode 'exwm-mode)
   (progn
 (when exwm--floating-frame
   (redirect-frame-focus exwm--floating-frame nil)
   (select-frame-set-input-focus exwm--floating-frame t))
+(exwm--log "Set focus on #x%x" exwm--id)
 (exwm-input--set-focus exwm--id))
-(select-frame-set-input-focus (window-frame exwm-input--focus-window)
-  t)
-(dolist (pair exwm--id-buffer-alist)
-  (with-current-buffer (cdr pair)
-(when (and exwm--floating-frame
-   (eq exwm--frame exwm-workspace--current))
-  (redirect-frame-focus exwm--floating-frame exwm--frame)
+(when (eq (selected-window) exwm-input--focus-window)
+  (exwm--log "Focus on %s" exwm-input--focus-window)
+  (select-frame-set-input-focus (window-frame exwm-input--focus-window)
+t)
+  (dolist (pair exwm--id-buffer-alist)
+(with-current-buffer (cdr pair)
+  (when (and exwm--floating-frame
+ (eq exwm--frame exwm-workspace--current))
+(redirect-frame-focus exwm--floating-frame exwm--frame))
   (setq exwm-input--focus-window nil
 
 (defun exwm-input--finish-key-sequence ()



[elpa] externals/exwm 9eee94e 52/64: Merge pull request #52 from pipcet/minor-fix

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 9eee94e530d40d190a9bc6b5c345d17491b674de
Merge: 76f4849 f7bec7a
Author: Chris Feng 
Commit: Chris Feng 

Merge pull request #52 from pipcet/minor-fix

Minor fix (quote class for make-instance)
---
 exwm-manage.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/exwm-manage.el b/exwm-manage.el
index e7134fe..648b42b 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -83,7 +83,7 @@ corresponding buffer.")
:event-mask xcb:EventMask:NoEvent))
 ;; The window needs to be mapped
 (xcb:+request exwm--connection
-(make-instance xcb:MapWindow :window id))
+(make-instance 'xcb:MapWindow :window id))
 (with-slots (x y width height) exwm--geometry
   ;; Reparent to virtual root (essential)
   (xcb:+request exwm--connection
@@ -323,7 +323,7 @@ corresponding buffer.")
 (with-slots (parent window) obj
   (if (/= exwm--root parent)
   (progn (xcb:+request exwm--connection
- (make-instance xcb:MapWindow :window window))
+ (make-instance 'xcb:MapWindow :window window))
  (xcb:flush exwm--connection))
 (exwm--log "MapRequest from #x%x" window)
 (exwm-manage--manage-window window)



[elpa] externals/xelb e153829 23/42: Merge pull request #2 from pipcet/shift-keypad-fix

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit e1538298856405c4bc5ad4a686ad9890f8b346bd
Merge: 677623a 7c194e7
Author: Chris Feng 
Commit: Chris Feng 

Merge pull request #2 from pipcet/shift-keypad-fix

Don't assume key events are numbers; they can be symbols.
---
 xcb-keysyms.el |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/xcb-keysyms.el b/xcb-keysyms.el
index ce6e65b..7f9e5e5 100644
--- a/xcb-keysyms.el
+++ b/xcb-keysyms.el
@@ -308,6 +308,7 @@ This function returns nil when it fails to convert an 
event."
   (push 'control event))
 (when (and (/= 0 (logand mask xcb:keysyms:shift-mask))
;; Emacs only set shift bit for letters
+   (integerp (car (last event)))
(<= ?A (car (last event))) (>= ?Z (car (last event
   (push 'shift event))
 (when (and xcb:keysyms:hyper-mask



[elpa] externals/exwm 36e8361 05/64: Various fixes

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 36e8361b9bd581e89d593b32002404bbf4811b62
Author: Chris Feng 
Commit: Chris Feng 

Various fixes

Remove wrong shift modifiers.
Hide a Window when it's moved to another workspace.
---
 exwm-input.el |2 +-
 exwm-workspace.el |   14 +++---
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 1f8e4f4..e185b1a 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -380,7 +380,7 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 ;; (exwm-input--fake-key last-input-event)))
 
 (defvar exwm-input-prefix-keys
-  '(?\C-x ?\C-u ?\C-h ?\M-x ?\M-` ?\M-\S-! ?\M-\S-& ?\M-\S-:)
+  '(?\C-x ?\C-u ?\C-h ?\M-x ?\M-` ?\M-! ?\M-& ?\M-:)
   "List of prefix keys EXWM should forward to Emacs when in line-mode.")
 
 (defvar exwm-input--simulation-keys nil "Simulation keys in line-mode.")
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 94d0e75..bab2612 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -162,21 +162,13 @@ The optional FORCE option is for internal use only "
:parent (frame-parameter frame 'exwm-window-id)
:x 0 :y 0))
   ;; Move the window itself
-  (set-window-buffer (get-buffer-window (exwm--id->buffer id))
- (other-buffer))
-  (xcb:+request exwm--connection
-  (make-instance 'xcb:ChangeWindowAttributes
- :window id :value-mask xcb:CW:EventMask
- :event-mask xcb:EventMask:NoEvent))
+  (bury-buffer)
+  (exwm-layout--hide id)
   (xcb:+request exwm--connection
   (make-instance 'xcb:ReparentWindow
  :window id
  :parent (frame-parameter frame 'exwm-window-id)
- :x 0 :y 0))
-  (xcb:+request exwm--connection
-  (make-instance 'xcb:ChangeWindowAttributes
- :window id :value-mask xcb:CW:EventMask
- :event-mask exwm--client-event-mask)
+ :x 0 :y 0)
 (xcb:flush exwm--connection)
 (exwm-workspace--update-switch-history)))
 



[elpa] externals/exwm 94bdbfc 42/64: Avoid using the "no window manager" code in Emacs

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 94bdbfc0da7c8ef14acdc8aa4e73dc1c8fee9700
Author: Philip 
Commit: Philip 

Avoid using the "no window manager" code in Emacs

* exwm.el (exwm--on-ClientMessage): Handle fullscreen requests
for frames.
(exwm-init): Initialize workspaces after unlocking events.

* exwm-workspace.el (exwm-workspace--init): Create frames as
invisible, then make them visible only once their OverrideRedirect
property has been set.

* exwm-randr.el (exwm-randr--refresh): New frame parameter
`exwm-geometry'.

* exwm-layout.el (exwm-layout--set-frame-fullscreen): New
function.

The Emacs code is buggy, see https://github.com/ch11ng/exwm/issues/39

https://github.com/ch11ng/exwm/pull/42
---
 exwm-layout.el|   28 
 exwm-randr.el |6 ++
 exwm-workspace.el |   14 ++
 exwm.el   |   18 --
 4 files changed, 60 insertions(+), 6 deletions(-)

diff --git a/exwm-layout.el b/exwm-layout.el
index 1ffb3b9..735b156 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -162,6 +162,34 @@
 (setq exwm--fullscreen nil)
 (exwm-input-grab-keyboard)))
 
+;; This function is superficially similar to `exwm-layout-set-fullscreen', but
+;; they do very different things: `exwm-layout--set-frame-fullscreen' resizes a
+;; frame to the actual monitor size, `exwm-layout-set-fullscreen' resizes an X
+;; window to the frame size.
+(defun exwm-layout--set-frame-fullscreen (frame)
+  "Make frame FRAME fullscreen, with regard to its XRandR output if 
applicable."
+  (let ((geometry (or (frame-parameter frame 'exwm-geometry)
+  (xcb:+request-unchecked+reply
+  exwm--connection
+  (make-instance 'xcb:GetGeometry
+ :drawable exwm--root))
+  (make-instance 'xcb:RECTANGLE :x 0 :y 0
+ :width (x-display-width)
+ :height (x-display-height
+ (id (frame-parameter frame 'exwm-outer-id)))
+(with-slots (x y width height) geometry
+(xcb:+request exwm--connection
+(make-instance 'xcb:ConfigureWindow
+   :window id
+   :value-mask (logior xcb:ConfigWindow:X
+   xcb:ConfigWindow:Y
+   xcb:ConfigWindow:Width
+   xcb:ConfigWindow:Height)
+   :x x :y y
+   :width width
+   :height height))
+(xcb:flush exwm--connection
+
 (defun exwm-layout--refresh ()
   "Refresh layout."
   (let ((frame (selected-frame))
diff --git a/exwm-randr.el b/exwm-randr.el
index cd40fb4..6bddb00 100644
--- a/exwm-randr.el
+++ b/exwm-randr.el
@@ -85,6 +85,12 @@
   (setq geometry default-geometry
 output nil))
 (set-frame-parameter frame 'exwm-randr-output output)
+(set-frame-parameter frame 'exwm-geometry
+ (make-instance 'xcb:RECTANGLE
+:x (elt geometry 0)
+:y (elt geometry 1)
+:width (elt geometry 2)
+:height (elt geometry 3)))
 (set-frame-parameter frame 'exwm-x (elt geometry 0))
 (set-frame-parameter frame 'exwm-y (elt geometry 1))
 (xcb:+request exwm--connection
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 7ac1fec..8e3839f 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -231,13 +231,11 @@ The optional FORCE option is for internal use only."
   (unless (frame-parameter i 'window-id)
 (setq exwm-workspace--list (delq i exwm-workspace--list)
   (cl-assert (= 1 (length exwm-workspace--list)))
-  (exwm--make-emacs-idle-for 0.1)  ;wait for the frame ready
-  ;; Configure the existing frame
-  (set-frame-parameter (car exwm-workspace--list) 'fullscreen 'fullboth)
   ;; Create remaining frames
   (dotimes (i (1- exwm-workspace-number))
 (nconc exwm-workspace--list
-   (list (make-frame '((window-system . x) (fullscreen . fullboth))
+   (list (make-frame '((window-system . x)
+   (visibility . nil))
   ;; Configure workspaces
   (dolist (i exwm-workspace--list)
 (let ((window-id (string-to-int (frame-parameter i 'window-id)))
@@ -256,6 +254,14 @@ The optional FORCE option is for internal use only."
  :window window-id :value-mask xcb:CW:EventMask
  :event-mask xcb:EventMask:SubstructureRedirect

[elpa] externals/exwm f1d37b9 53/64: Ungrab pointer timely when resizing is aborted

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit f1d37b9a8c8d5dbe223b9099c09b2b25f0236c64
Author: Chris Feng 
Commit: Chris Feng 

Ungrab pointer timely when resizing is aborted

* exwm-floating.el (exwm-floating--start-moveresize): when resizing type 
cannot
  be decided, ungrab the previously grabbed pointer.
---
 exwm-floating.el |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index 0b4f327..851a586 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -278,7 +278,8 @@
((> x 2) xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_RIGHT)
((> y 2) xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOM)
((< x 1) xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_LEFT
-(when type
+(if (not type)
+(exwm-floating--stop-moveresize)
   (cond ((= type xcb:ewmh:_NET_WM_MOVERESIZE_MOVE)
  (setq cursor exwm-floating--cursor-move
exwm-floating--moveresize-calculate



[elpa] externals/xelb 76246b4 13/42: Check `length` slot in `xcb:icccm:-GetProperty~reply`

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 76246b4b11a18339cc5d2b472f188ad83403ce59
Author: Chris Feng 
Commit: Chris Feng 

Check `length` slot in `xcb:icccm:-GetProperty~reply`

Some program (GIMP sometimes) seems only set `length` slot to 0 while 
leaving
other slots (including `value-len`) uninitialized. This commit makes sure
`length` slot is also checked.
---
 xcb-icccm.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xcb-icccm.el b/xcb-icccm.el
index 0fabbc8..1d178d8 100644
--- a/xcb-icccm.el
+++ b/xcb-icccm.el
@@ -123,8 +123,8 @@ according to BYTE-ARRAY.
 This method automatically format the value as 8, 16 or 32 bits array."
   (let ((retval (cl-call-next-method obj byte-array))
 tmp)
-(with-slots (~lsb format bytes-after value-len value) obj
-  (if (= 0 value-len)
+(with-slots (~lsb length format bytes-after value-len value) obj
+  (if (or (= 0 value-len) (= 0 length))
   (setf value nil)  ;no available value
 (setq tmp (substring value
  0  ;long-offset



[elpa] master bdc4927: Add external packages xelb and exwm

2015-09-17 Thread Chris Feng
branch: master
commit bdc4927c27b2eaf7315527a0b3946fe9afc6657e
Author: Chris Feng 
Commit: Chris Feng 

Add external packages xelb and exwm

* .gitignore:
* externals-list:
  Add external packages xelb and exwm.
---
 .gitignore |2 ++
 externals-list |2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index 6b309aa..1b07f9c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,7 +13,9 @@ packages/auctex
 packages/chess
 packages/dismal
 packages/ergoemacs-mode
+packages/exwm
 packages/omn-mode/
 packages/pabbrev
 packages/rudel
 packages/w3
+packages/xelb
diff --git a/externals-list b/externals-list
index 7566e72..541b412 100644
--- a/externals-list
+++ b/externals-list
@@ -47,6 +47,7 @@
  ("eldoc-eval" :subtree 
"https://github.com/thierryvolpiatto/eldoc-eval.git";)
  ("enwc"   :subtree 
"bzr::bzr://bzr.savannah.nongnu.org/enwc/trunk")
  ("ergoemacs-mode" :external 
"https://github.com/ergoemacs/ergoemacs-mode.git";)
+ ("exwm"   :external "https://github.com/ch11ng/exwm.git";)
  ("f90-interface-browser" :subtree "https://github.com/wence-/f90-iface";)
  ("ggtags" :subtree "https://github.com/leoliu/ggtags";)
  ("gnorb"   :subtree "https://github.com/girzel/gnorb";)
@@ -65,5 +66,6 @@
  ("wcheck-mode":subtree 
"https://github.com/tlikonen/wcheck-mode.git";)
  ("web-server" :subtree 
"https://github.com/eschulte/emacs-web-server.git";)
  ("websocket"  :subtree 
"https://github.com/ahyatt/emacs-websocket.git";)
+ ("xelb"   :external "https://github.com/ch11ng/xelb.git";)
  ("yasnippet"  :subtree 
"https://github.com/capitaomorte/yasnippet.git";)
  )



[elpa] externals/exwm 63402b0 19/64: Correct layout refresh problems

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 63402b0efc19a50e89d868fad3f91b134170aab6
Author: Chris Feng 
Commit: Chris Feng 

Correct layout refresh problems

* Relax the conditions to refresh layout; this may introduce some overheads
  though
* Fix the problem when `*scratch*` buffer is killed; close #12
* Enhance `exwm-reset` by forcing layout refresh in it. This should allow 
users
  to overcome some layout bugs
---
 exwm-layout.el |   34 ++
 exwm.el|3 +++
 2 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/exwm-layout.el b/exwm-layout.el
index 1dd8333..906357e 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -157,23 +157,25 @@
 (setq exwm--fullscreen nil)
 (exwm-input-grab-keyboard)))
 
-(defvar exwm-layout--window-configuration (current-window-configuration)
-  "Last saved window configuration, for avoiding unnecessary refreshes.")
-
 (defun exwm-layout--refresh ()
   "Refresh layout."
-  (unless (compare-window-configurations exwm-layout--window-configuration
- (current-window-configuration))
-(exwm--log "Refresh layout")
-(setq exwm-layout--window-configuration (current-window-configuration))
-(let ((frame (selected-frame))
-  windows)
-  (if (not (memq frame exwm-workspace--list))
-  ;; Refresh a floating frame
-  (when (eq major-mode 'exwm-mode)
-(with-current-buffer (window-buffer (frame-first-window frame))
-  (exwm-layout--show exwm--id (frame-first-window frame
-;; Refresh the whole workspace
+  (let ((frame (selected-frame))
+windows placeholder)
+(if (not (memq frame exwm-workspace--list))
+;; Refresh a floating frame
+(progn
+  (cl-assert (eq major-mode 'exwm-mode))
+  (let ((window (frame-first-window frame)))
+(with-current-buffer (window-buffer window)
+  (exwm--log "Refresh floating window #x%x" exwm--id)
+  (exwm-layout--show exwm--id window
+  ;; Refresh the whole workspace
+  ;; Workspaces other than the active one can also be refreshed (RandR)
+  (exwm--log "Refresh workspace %s" frame)
+  (let ((placeholder (get-buffer "*scratch*")))
+(unless placeholder ;create the *scratch* buffer if it's killed
+  (setq placeholder (get-buffer-create "*scratch*"))
+  (set-buffer-major-mode placeholder))
 (dolist (pair exwm--id-buffer-alist)
   (with-current-buffer (cdr pair)
 ;; Exclude windows on other workspaces and floating frames
@@ -183,7 +185,7 @@
   (exwm-layout--hide exwm--id)
 (exwm-layout--show exwm--id (car windows))
 (dolist (i (cdr windows))
-  (set-window-buffer i "*scratch*"))
+  (set-window-buffer i placeholder))
 
 (defun exwm-layout--init ()
   "Initialize layout module."
diff --git a/exwm.el b/exwm.el
index 984f8ee..7c9fa59 100644
--- a/exwm.el
+++ b/exwm.el
@@ -201,6 +201,8 @@
   ;; Force update input focus
   (setq exwm-input--focus-id xcb:Window:None)
   (exwm-input--update-focus)
+  ;; Force refresh
+  (exwm-layout--refresh)
   (exwm-input-grab-keyboard
 
 (defmacro exwm--with-current-id (id &rest body)
@@ -396,6 +398,7 @@
(exwm--update-protocols id t))
   ((= atom xcb:Atom:WM_STATE)
(exwm--update-state id t))
+  ((= atom xcb:Atom:_NET_WM_USER_TIME)) ;ignored
   (t (exwm--log "Unhandled PropertyNotify: %s(%d)"
 (x-get-atom-name atom) atom)))
 



[elpa] externals/xelb f655ec9 27/42: Merge pull request #2 from pipcet/data-offset

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit f655ec9dc7c85d04256a7408f591f61df0bdd990
Merge: 1cea22d 76ab2fb
Author: Chris Feng 
Commit: Chris Feng 

Merge pull request #2 from pipcet/data-offset

Improve performance when unmarshalling long vectors
---
 xcb-types.el |  103 --
 xcb.el   |8 ++--
 2 files changed, 61 insertions(+), 50 deletions(-)

diff --git a/xcb-types.el b/xcb-types.el
index b3eecdb..2af911f 100644
--- a/xcb-types.el
+++ b/xcb-types.el
@@ -156,35 +156,35 @@
 value
   (+ value #x1 ;treated as float for 32-bit
 
-(defsubst xcb:-unpack-u1 (data)
+(defsubst xcb:-unpack-u1 (data offset)
   "Byte array => 1 byte unsigned integer."
-  (elt data 0))
+  (elt data offset))
 
-(defsubst xcb:-unpack-i1 (data)
+(defsubst xcb:-unpack-i1 (data offset)
   "Byte array => 1 byte signed integer."
-  (let ((value (xcb:-unpack-u1 data)))
+  (let ((value (xcb:-unpack-u1 data offset)))
 (if (= 0 (logand #x80 value))
 value
   (- (logand #xFF (lognot (1- value)))
 
-(defsubst xcb:-unpack-u2 (data)
+(defsubst xcb:-unpack-u2 (data offset)
   "Byte array => 2 bytes unsigned integer (MSB first)."
-  (logior (lsh (elt data 0) 8) (elt data 1)))
+  (logior (lsh (elt data offset) 8) (elt data (1+ offset
 
-(defsubst xcb:-unpack-u2-lsb (data)
+(defsubst xcb:-unpack-u2-lsb (data offset)
   "Byte array => 2 bytes unsigned integer (LSB first)."
-  (logior (elt data 0) (lsh (elt data 1) 8)))
+  (logior (elt data offset) (lsh (elt data (1+ offset)) 8)))
 
-(defsubst xcb:-unpack-i2 (data)
+(defsubst xcb:-unpack-i2 (data offset)
   "Byte array => 2 bytes signed integer (MSB first)."
-  (let ((value (xcb:-unpack-u2 data)))
+  (let ((value (xcb:-unpack-u2 data offset)))
 (if (= 0 (logand #x8000 value))
 value
   (- (logand #x (lognot (1- value)))
 
-(defsubst xcb:-unpack-i2-lsb (data)
+(defsubst xcb:-unpack-i2-lsb (data offset)
   "Byte array => 2 bytes signed integer (LSB first)."
-  (let ((value (xcb:-unpack-u2-lsb data)))
+  (let ((value (xcb:-unpack-u2-lsb data offset)))
 (if (= 0 (logand #x8000 value))
 value
   (- (logand #x (lognot (1- value)))
@@ -192,36 +192,41 @@
 (if (/= 0 (lsh 1 32))
 ;; 64-bit
 (progn
-  (defsubst xcb:-unpack-u4 (data)
+  (defsubst xcb:-unpack-u4 (data offset)
 "Byte array => 4 bytes unsigned integer (MSB first, 64-bit)."
-(logior (lsh (elt data 0) 24) (lsh (elt data 1) 16)
-(lsh (elt data 2) 8) (elt data 3)))
-  (defsubst xcb:-unpack-u4-lsb (data)
+(logior (lsh (elt data offset) 24) (lsh (elt data (1+ offset)) 16)
+(lsh (elt data (+ offset 2)) 8) (elt data (+ offset 3
+  (defsubst xcb:-unpack-u4-lsb (data offset)
 "Byte array => 4 bytes unsigned integer (LSB first, 64-bit)."
-(logior (elt data 0) (lsh (elt data 1) 8)
-(lsh (elt data 2) 16) (lsh (elt data 3) 24
+(logior (elt data offset) (lsh (elt data (1+ offset)) 8)
+(lsh (elt data (+ offset 2)) 16)
+(lsh (elt data (+ offset 3)) 24
   ;; 32-bit (30-bit actually; large numbers are represented as float type)
-  (defsubst xcb:-unpack-u4 (data)
+  (defsubst xcb:-unpack-u4 (data offset)
 "Byte array => 4 bytes unsigned integer (MSB first, 32-bit)."
-(let ((msb (elt data 0)))
+(let ((msb (elt data offset)))
   (+ (if (> msb 31) (* msb 16777216.0) (lsh msb 24))
- (logior (lsh (elt data 1) 16) (lsh (elt data 2) 8) (elt data 3)
-  (defsubst xcb:-unpack-u4-lsb (data)
+ (logior (lsh (elt data (1+ offset)) 16)
+ (lsh (elt data (+ offset 2)) 8)
+ (elt data (+ offset 3))
+  (defsubst xcb:-unpack-u4-lsb (data offset)
 "Byte array => 4 bytes unsigned integer (LSB first, 32-bit)."
-(let ((msb (elt data 3)))
+(let ((msb (elt data (+ offset 3
   (+ (if (> msb 31) (* msb 16777216.0) (lsh msb 24))
- (logior (elt data 0) (lsh (elt data 1) 8) (lsh (elt data 2) 16))
+ (logior (elt data offset)
+ (lsh (elt data (1+ offset)) 8)
+ (lsh (+ offset 2) 16))
 
-(defsubst xcb:-unpack-i4 (data)
+(defsubst xcb:-unpack-i4 (data offset)
   "Byte array => 4 bytes signed integer (MSB first)."
-  (let ((value (xcb:-unpack-u4 data)))
+  (let ((value (xcb:-unpack-u4 data offset)))
 (if (< value #x8000);treated as float for 32-bit
 value
   (- value #x1  ;treated as float for 32-bit
 
-(defsubst xcb:-unpack-i4-lsb (data)
+(defsubst xcb:-unpack-i4-lsb (data offset)
   "Byte array => 4 bytes signed integer (LSB first)."
-  (let ((value (xcb:-unpack-u4-lsb data)))
+  (let ((value (xcb:-u

[elpa] externals/xelb 7c194e7 21/42: Don't assume key events are numbers; they can be symbols.

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 7c194e7a7fd18b1913133f7b450b6bb0b9dd300e
Author: Philip 
Commit: Philip 

Don't assume key events are numbers; they can be symbols.

* xcb-keysyms.el (xcb:keysyms:keysym->event): Don't die when
translating events like shift-KP7.
---
 xcb-keysyms.el |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/xcb-keysyms.el b/xcb-keysyms.el
index ce6e65b..7f9e5e5 100644
--- a/xcb-keysyms.el
+++ b/xcb-keysyms.el
@@ -308,6 +308,7 @@ This function returns nil when it fails to convert an 
event."
   (push 'control event))
 (when (and (/= 0 (logand mask xcb:keysyms:shift-mask))
;; Emacs only set shift bit for letters
+   (integerp (car (last event)))
(<= ?A (car (last event))) (>= ?Z (car (last event
   (push 'shift event))
 (when (and xcb:keysyms:hyper-mask



[elpa] externals/xelb 87ebff4 06/42: Fix for 32bit platform

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 87ebff4b0f649605adbbdeadd4b3db4083212b18
Author: Chris Feng 
Commit: Chris Feng 

Fix for 32bit platform
---
 xcb-types.el |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/xcb-types.el b/xcb-types.el
index 33ddeb3..af31817 100644
--- a/xcb-types.el
+++ b/xcb-types.el
@@ -130,8 +130,8 @@
 (if (integerp value)
 (vector (logand (lsh value -24) #xFF) (logand (lsh value -16) #xFF)
 (logand (lsh value -8) #xFF) (logand value #xFF))
-  (let ((msw (truncate value #x1))
-(lsw (truncate (- value (lsh msw 16)
+  (let* ((msw (truncate value #x1))
+ (lsw (truncate (- value (lsh msw 16)
 (vector (logand (lsh msw -8) #xFF) (logand msw #xFF)
 (logand (lsh lsw -8) #xFF) (logand lsw #xFF)
   (defsubst xcb:-pack-u4-lsb (value)
@@ -139,8 +139,8 @@
 (if (integerp value)
 (vector (logand value #xFF) (logand (lsh value -8) #xFF)
 (logand (lsh value -16) #xFF) (logand (lsh value -24) #xFF))
-  (let ((msw (truncate value #x1))
-(lsw (truncate (- value (* msw #x1)
+  (let* ((msw (truncate value #x1))
+ (lsw (truncate (- value (* msw #x1)
 (vector (logand lsw #xFF) (logand (lsh lsw -8) #xFF)
 (logand msw #xFF) (logand (lsh msw -8) #xFF))
 



[elpa] externals/exwm 1e36a22 13/64: Check buffer mode in exwm-reset

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 1e36a22b3f5fd3867f29eaf3e1891422a3bb952c
Author: Chris Feng 
Commit: Chris Feng 

Check buffer mode in exwm-reset

This should prevent users from misoperation.
---
 exwm-workspace.el |6 +-
 exwm.el   |7 ---
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index ed06f64..d700f41 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -111,11 +111,7 @@ The optional FORCE option is for internal use only."
 (unless (and (<= 0 index) (< index exwm-workspace-number))
   (user-error "[EXWM] Workspace index out of range: %d" index))
 (when (or force (/= exwm-workspace-current-index index))
-  ;; Exit fullscreen mode
-  (with-current-buffer (window-buffer)
-(when (and (eq major-mode 'exwm-mode) exwm--fullscreen)
-  (exwm-layout-unset-fullscreen)
-  (exwm-input-grab-keyboard)))
+  (exwm-reset)  ;exit full screen
   (let ((frame (elt exwm-workspace--list index)))
 (setq exwm-workspace--current frame
   exwm-workspace-current-index index)
diff --git a/exwm.el b/exwm.el
index c8f10af..18d8dda 100644
--- a/exwm.el
+++ b/exwm.el
@@ -195,9 +195,10 @@
 (defun exwm-reset ()
   "Reset window to standard state: non-fullscreen, line-mode."
   (interactive)
-  (with-current-buffer (window-buffer (selected-window))
-(when exwm--fullscreen (exwm-layout-unset-fullscreen))
-(exwm-input-grab-keyboard)))
+  (with-current-buffer (window-buffer)
+(when (and (eq major-mode 'exwm-mode) exwm--fullscreen)
+  (exwm-layout-unset-fullscreen)
+  (exwm-input-grab-keyboard
 
 (defmacro exwm--with-current-id (id &rest body)
   "Evaluate BODY in the context of the buffer corresponding to window ID."



[elpa] externals/xelb 5a74daa 32/42: Generate implicit paddings at compile time

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 5a74daa9ef6ee7db6bd7c17300300cf7f19d0249
Author: Chris Feng 
Commit: Chris Feng 

Generate implicit paddings at compile time

This commit improves aaddcd9 by generating implicit paddings at compile time
rather than deducting them at runtime.
---
 el_client.el   |  141 +++-
 lib/xcb-dri2.el|2 +
 lib/xcb-glx.el |4 ++
 lib/xcb-randr.el   |   23 
 lib/xcb-record.el  |2 +
 lib/xcb-render.el  |9 +++
 lib/xcb-xf86dri.el |1 +
 lib/xcb-xf86vidmode.el |8 +++
 lib/xcb-xfixes.el  |1 +
 lib/xcb-xinput.el  |   49 -
 lib/xcb-xkb.el |   57 +--
 lib/xcb-xprint.el  |5 ++
 lib/xcb-xproto.el  |6 ++
 lib/xcb-xselinux.el|1 +
 lib/xcb-xv.el  |3 +
 util/xcb-xim.el|3 +-
 xcb-types.el   |   27 ++
 17 files changed, 201 insertions(+), 141 deletions(-)

diff --git a/el_client.el b/el_client.el
index a66f9d1..9a5b6a1 100644
--- a/el_client.el
+++ b/el_client.el
@@ -56,7 +56,7 @@
 (defvar event-alist nil "Record X events in this module.")
 (make-variable-buffer-local 'event-alist)
 
-(defvar pad-count 0 " node counter.")
+(defvar pad-count -1 " node counter.")
 (make-variable-buffer-local 'pad-count)
 
  Helper functions
@@ -81,9 +81,24 @@
   "Return the attribute ATTR of node NODE and escape it."
   (escape-name (node-attr node attr)))
 
-(defsubst node-subnodes (node)
-  "Return all the subnodes of node NODE as a list."
-  (cddr node))
+(defsubst node-subnodes (node &optional mark-auto-padding)
+  "Return all the subnodes of node NODE as a list.
+
+If MARK-AUTO-PADDING is non-nil, all 's fitting for padding will include
+an `xelb-auto-padding' attribute."
+  (let ((subnodes (cddr node)))
+(when mark-auto-padding
+  ;; Remove all 's and 's
+  (cl-delete-if (lambda (i) (or (eq 'comment (car i)) (eq 'doc (car i
+subnodes)
+  (dotimes (i (1- (length subnodes)))
+(when (and (eq 'list (node-name (elt subnodes i)))
+   (pcase (node-name (elt subnodes (1+ i)))
+ ((or `reply `pad))
+ (_ t)))
+  (setf (cadr (elt subnodes i))
+(nconc (cadr (elt subnodes i)) `((xelb-auto-padding . t)))
+subnodes))
 
 (defsubst node-subnode (node)
   "Return the (only) subnode of node NODE with useless contents skipped."
@@ -94,6 +109,10 @@
  (or (eq (node-name i) 'comment) (eq (node-name i) 'doc)))
   (throw 'break i))
 
+(defsubst generate-pad-name ()
+  "Generate a new slot name for ."
+  (make-symbol (format "pad~%d" (cl-incf pad-count
+
  Entry & root element
 
 (defun parse (file)
@@ -153,7 +172,7 @@
 
 (defun parse-top-level-element (node)
   "Parse a top-level element."
-  (setq pad-count 0)
+  (setq pad-count -1)
   (pcase (node-name node)
 (`import (parse-import node))
 (`struct (parse-struct node))
@@ -179,31 +198,16 @@
 (defun parse-struct (node)
   "Parse ."
   (let ((name (intern (concat prefix (node-attr node 'name
-(contents (node-subnodes node))
-result)
-(setq contents
-  (apply 'nconc
- (mapcar (lambda (i)
-   (setq result (parse-structure-content i))
-   (when (eq (node-name i) 'pad) ;rename pad~
- (setq result
-   `((,(intern (format "pad~%d" pad-count))
-  ,@(cdar result
- (setq pad-count (1+ pad-count)))
-   result)
- contents)))
-`((defclass ,name (xcb:-struct) ,contents
+(contents (node-subnodes node t)))
+`((defclass ,name (xcb:-struct)
+,(apply 'nconc (mapcar 'parse-structure-content contents))
 
 (defun parse-union (node)
   "Parse ."
   (let ((name (intern (concat prefix (node-attr node 'name
 (contents (node-subnodes node)))
-(setq contents
-  (apply 'nconc
- (mapcar (lambda (i)
-   (parse-structure-content i))
- contents)))
-`((defclass ,name (xcb:-union) ,contents
+`((defclass ,name (xcb:-union)
+,(apply 'nconc (mapcar 'parse-structure-content contents))
 
 (defun parse-xidtype (node)
   "Parse ."
@@ -242,41 +246,26 @@ The `combine-adjacent' attribute is simply ignored."
   (let* ((name (intern (concat prefix (node-attr node 'name
  (opcode (string-to-int (node-attr node 'opcode)))

[elpa] externals/xelb 4621160 30/42: Move generated libraries to lib/

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 46211603089002521c0474ce5e35087c24f6147a
Author: Chris Feng 
Commit: Chris Feng 

Move generated libraries to lib/
---
 el_client.el |1 +
 Makefile => lib/Makefile |   10 --
 xcb-bigreq.el => lib/xcb-bigreq.el   |0
 xcb-composite.el => lib/xcb-composite.el |0
 xcb-damage.el => lib/xcb-damage.el   |0
 xcb-dpms.el => lib/xcb-dpms.el   |0
 xcb-dri2.el => lib/xcb-dri2.el   |0
 xcb-dri3.el => lib/xcb-dri3.el   |0
 xcb-ge.el => lib/xcb-ge.el   |0
 xcb-glx.el => lib/xcb-glx.el |0
 xcb-present.el => lib/xcb-present.el |0
 xcb-randr.el => lib/xcb-randr.el |0
 xcb-record.el => lib/xcb-record.el   |0
 xcb-render.el => lib/xcb-render.el   |0
 xcb-res.el => lib/xcb-res.el |0
 xcb-screensaver.el => lib/xcb-screensaver.el |0
 xcb-shape.el => lib/xcb-shape.el |0
 xcb-shm.el => lib/xcb-shm.el |0
 xcb-sync.el => lib/xcb-sync.el   |0
 xcb-xc_misc.el => lib/xcb-xc_misc.el |0
 xcb-xevie.el => lib/xcb-xevie.el |0
 xcb-xf86dri.el => lib/xcb-xf86dri.el |0
 xcb-xf86vidmode.el => lib/xcb-xf86vidmode.el |0
 xcb-xfixes.el => lib/xcb-xfixes.el   |0
 xcb-xinerama.el => lib/xcb-xinerama.el   |0
 xcb-xinput.el => lib/xcb-xinput.el   |0
 xcb-xkb.el => lib/xcb-xkb.el |0
 xcb-xprint.el => lib/xcb-xprint.el   |0
 xcb-xproto.el => lib/xcb-xproto.el   |0
 xcb-xselinux.el => lib/xcb-xselinux.el   |0
 xcb-xtest.el => lib/xcb-xtest.el |0
 xcb-xv.el => lib/xcb-xv.el   |0
 xcb-xvmc.el => lib/xcb-xvmc.el   |0
 33 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/el_client.el b/el_client.el
index b464607..a66f9d1 100644
--- a/el_client.el
+++ b/el_client.el
@@ -569,6 +569,7 @@ KeymapNotify event; instead, we handle this case in 
`xcb:unmarshal'."
 (if (not argv)
 (error "Usage: el_client.el  [additional_load_paths]")
   (add-to-list 'load-path default-directory)
+  (add-to-list 'load-path (concat default-directory "/../"))
   (dolist (i (cdr argv))
 (add-to-list 'load-path i))
   (require 'xcb-types)
diff --git a/Makefile b/lib/Makefile
similarity index 75%
rename from Makefile
rename to lib/Makefile
index efa17da..3bd2e7e 100644
--- a/Makefile
+++ b/lib/Makefile
@@ -1,4 +1,4 @@
-PROTO_PATH := ../xcb-proto/src
+PROTO_PATH := ../../xcb-proto/src
 
 EMACS_BIN := emacs -Q
 
@@ -10,18 +10,16 @@ LIBS = xcb-xproto.el $(addprefix xcb-,$(addsuffix 
.el,$(EXTENSIONS)))
 
 all: clean $(LIBS)
 
-xcb-%.el: $(PROTO_PATH)/%.xml
+xcb-%.el: $(PROTO_PATH)/%.xml xcb-xproto.el
@echo -n "\n"Generating $@...
-   @$(EMACS_BIN) --script ./el_client.el $< > $@
+   @$(EMACS_BIN) --script ../el_client.el $< > $@
 
 xcb-composite.el: xcb-xfixes.el
 xcb-damage.el: xcb-xfixes.el
 xcb-xvmc.el: xcb-xv.el
 xcb-randr.el: xcb-render.el
 xcb-xfixes.el: xcb-render.el xcb-shape.el
-xcb-present.el: xcb-randr.el
-xcb-present.el: xcb-xfixes.el
-xcb-present.el: xcb-sync.el
+xcb-present.el: xcb-randr.el xcb-xfixes.el xcb-sync.el
 xcb-xv.el: xcb-shm.el
 xcb-xinput.el: xcb-xfixes.el
 
diff --git a/xcb-bigreq.el b/lib/xcb-bigreq.el
similarity index 100%
rename from xcb-bigreq.el
rename to lib/xcb-bigreq.el
diff --git a/xcb-composite.el b/lib/xcb-composite.el
similarity index 100%
rename from xcb-composite.el
rename to lib/xcb-composite.el
diff --git a/xcb-damage.el b/lib/xcb-damage.el
similarity index 100%
rename from xcb-damage.el
rename to lib/xcb-damage.el
diff --git a/xcb-dpms.el b/lib/xcb-dpms.el
similarity index 100%
rename from xcb-dpms.el
rename to lib/xcb-dpms.el
diff --git a/xcb-dri2.el b/lib/xcb-dri2.el
similarity index 100%
rename from xcb-dri2.el
rename to lib/xcb-dri2.el
diff --git a/xcb-dri3.el b/lib/xcb-dri3.el
similarity index 100%
rename from xcb-dri3.el
rename to lib/xcb-dri3.el
diff --git a/xcb-ge.el b/lib/xcb-ge.el
similarity index 100%
rename from xcb-ge.el
rename to lib/xcb-ge.el
diff --git a/xcb-glx.el b/lib/xcb-glx.el
similarity index 100%
rename from xcb-glx.el
rename to lib/xcb-glx.el
diff --git a/xcb-present.el b/lib/xcb-present.el
similarity index 100%
rename from xcb-present.el
rename to lib/xcb-present.el
diff --git a/xcb-randr.el b/lib/xcb-randr.el
similarity index 100%
rename from xcb-randr.el
rename to lib/xcb-randr.el
diff --git a/xcb-record.el b/lib/xcb-record.el
similarity index 100%
rename from xcb-record.el
rename to lib/xcb-record.el
diff --git a/xcb-render.el b/lib/xcb-render.el
similarity index 100%
rename from xcb-render.el
rename to li

[elpa] externals/exwm 968d0b4 04/64: Various fixes for workspace

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 968d0b48825e9d4b7f0c918f7f34c1db7487
Author: Chris Feng 
Commit: Chris Feng 

Various fixes for workspace

Fixes for full screen, move window, etc.
---
 exwm-input.el |2 --
 exwm-workspace.el |   11 +++
 exwm.el   |4 
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 107df05..1f8e4f4 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -30,8 +30,6 @@
 ;; Todo:
 ;; + Pointer simulation mode (e.g. 'C-c 1'/'C-c 2' for single/double click,
 ;;   move with arrow keys).
-;; + Demonstrate how to add a local key binding (add global prefix key and
-;;   modify `exwm-mode-map').
 ;; + Simulation keys to mimic Emacs key bindings for text edit (redo, select,
 ;;   cancel, clear, etc). Some of them are not present on common keyboard
 ;;   (keycode = 0). May need to use XKB extension.
diff --git a/exwm-workspace.el b/exwm-workspace.el
index c225c43..94d0e75 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -68,8 +68,9 @@
 (not-empty (make-vector exwm-workspace-number nil)))
 (dolist (i exwm--id-buffer-alist)
   (with-current-buffer (cdr i)
-(setf (elt not-empty (cl-position exwm--frame exwm-workspace--list))
-  t)))
+(when exwm--frame
+  (setf (elt not-empty (cl-position exwm--frame exwm-workspace--list))
+t
 (setq exwm-workspace--switch-history
   (mapcar
(lambda (i)
@@ -147,8 +148,6 @@ The optional FORCE option is for internal use only "
   (unless (and (<= 0 index) (< index exwm-workspace-number))
 (user-error "[EXWM] Workspace index out of range: %d" index))
   (when (/= exwm-workspace-current-index index)
-(set-window-buffer (get-buffer-window (exwm--id->buffer id))
-   (other-buffer))
 (let ((frame (elt exwm-workspace--list index)))
   (with-current-buffer (exwm--id->buffer id)
 (setq exwm--frame frame)
@@ -163,6 +162,8 @@ The optional FORCE option is for internal use only "
:parent (frame-parameter frame 'exwm-window-id)
:x 0 :y 0))
   ;; Move the window itself
+  (set-window-buffer (get-buffer-window (exwm--id->buffer id))
+ (other-buffer))
   (xcb:+request exwm--connection
   (make-instance 'xcb:ChangeWindowAttributes
  :window id :value-mask xcb:CW:EventMask
@@ -197,6 +198,7 @@ The optional FORCE option is for internal use only "
   (unless (frame-parameter i 'window-id)
 (setq exwm-workspace--list (delq i exwm-workspace--list)
   (cl-assert (= 1 (length exwm-workspace--list)))
+  (exwm--make-emacs-idle-for 0.1)  ;wait for the frame ready
   ;; Configure the existing frame
   (set-frame-parameter (car exwm-workspace--list) 'fullscreen 'fullboth)
   ;; Create remaining frames
@@ -220,6 +222,7 @@ The optional FORCE option is for internal use only "
   (make-instance 'xcb:ChangeWindowAttributes
  :window window-id :value-mask xcb:CW:EventMask
  :event-mask xcb:EventMask:SubstructureRedirect
+  (xcb:flush exwm--connection)
   ;; Switch to the first workspace
   (exwm-workspace-switch 0 t))
 
diff --git a/exwm.el b/exwm.el
index 49c4380..c6e0059 100644
--- a/exwm.el
+++ b/exwm.el
@@ -188,6 +188,10 @@
  xcb:EventMask:SubstructureRedirect)))
   (xcb:flush exwm--connection))
 
+(defun exwm--make-emacs-idle-for (seconds)
+  "Put Emacs in idle state for SECONDS seconds."
+  (with-timeout (seconds) (read-event)))
+
 (defun exwm-reset ()
   "Reset window to standard state: non-fullscreen, line-mode."
   (interactive)



[elpa] externals/xelb 76ab2fb 25/42: Improve performance when unmarshalling long vectors.

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 76ab2fbdd509bacf3a1dec70573d18e070bf266c
Author: Philip 
Commit: Philip 

Improve performance when unmarshalling long vectors.

Avoid using `substring'; instead, use an extra offset argument.

https://github.com/ch11ng/xelb/pull/2
---
 xcb-types.el |  103 --
 xcb.el   |8 ++--
 2 files changed, 61 insertions(+), 50 deletions(-)

diff --git a/xcb-types.el b/xcb-types.el
index b3eecdb..2af911f 100644
--- a/xcb-types.el
+++ b/xcb-types.el
@@ -156,35 +156,35 @@
 value
   (+ value #x1 ;treated as float for 32-bit
 
-(defsubst xcb:-unpack-u1 (data)
+(defsubst xcb:-unpack-u1 (data offset)
   "Byte array => 1 byte unsigned integer."
-  (elt data 0))
+  (elt data offset))
 
-(defsubst xcb:-unpack-i1 (data)
+(defsubst xcb:-unpack-i1 (data offset)
   "Byte array => 1 byte signed integer."
-  (let ((value (xcb:-unpack-u1 data)))
+  (let ((value (xcb:-unpack-u1 data offset)))
 (if (= 0 (logand #x80 value))
 value
   (- (logand #xFF (lognot (1- value)))
 
-(defsubst xcb:-unpack-u2 (data)
+(defsubst xcb:-unpack-u2 (data offset)
   "Byte array => 2 bytes unsigned integer (MSB first)."
-  (logior (lsh (elt data 0) 8) (elt data 1)))
+  (logior (lsh (elt data offset) 8) (elt data (1+ offset
 
-(defsubst xcb:-unpack-u2-lsb (data)
+(defsubst xcb:-unpack-u2-lsb (data offset)
   "Byte array => 2 bytes unsigned integer (LSB first)."
-  (logior (elt data 0) (lsh (elt data 1) 8)))
+  (logior (elt data offset) (lsh (elt data (1+ offset)) 8)))
 
-(defsubst xcb:-unpack-i2 (data)
+(defsubst xcb:-unpack-i2 (data offset)
   "Byte array => 2 bytes signed integer (MSB first)."
-  (let ((value (xcb:-unpack-u2 data)))
+  (let ((value (xcb:-unpack-u2 data offset)))
 (if (= 0 (logand #x8000 value))
 value
   (- (logand #x (lognot (1- value)))
 
-(defsubst xcb:-unpack-i2-lsb (data)
+(defsubst xcb:-unpack-i2-lsb (data offset)
   "Byte array => 2 bytes signed integer (LSB first)."
-  (let ((value (xcb:-unpack-u2-lsb data)))
+  (let ((value (xcb:-unpack-u2-lsb data offset)))
 (if (= 0 (logand #x8000 value))
 value
   (- (logand #x (lognot (1- value)))
@@ -192,36 +192,41 @@
 (if (/= 0 (lsh 1 32))
 ;; 64-bit
 (progn
-  (defsubst xcb:-unpack-u4 (data)
+  (defsubst xcb:-unpack-u4 (data offset)
 "Byte array => 4 bytes unsigned integer (MSB first, 64-bit)."
-(logior (lsh (elt data 0) 24) (lsh (elt data 1) 16)
-(lsh (elt data 2) 8) (elt data 3)))
-  (defsubst xcb:-unpack-u4-lsb (data)
+(logior (lsh (elt data offset) 24) (lsh (elt data (1+ offset)) 16)
+(lsh (elt data (+ offset 2)) 8) (elt data (+ offset 3
+  (defsubst xcb:-unpack-u4-lsb (data offset)
 "Byte array => 4 bytes unsigned integer (LSB first, 64-bit)."
-(logior (elt data 0) (lsh (elt data 1) 8)
-(lsh (elt data 2) 16) (lsh (elt data 3) 24
+(logior (elt data offset) (lsh (elt data (1+ offset)) 8)
+(lsh (elt data (+ offset 2)) 16)
+(lsh (elt data (+ offset 3)) 24
   ;; 32-bit (30-bit actually; large numbers are represented as float type)
-  (defsubst xcb:-unpack-u4 (data)
+  (defsubst xcb:-unpack-u4 (data offset)
 "Byte array => 4 bytes unsigned integer (MSB first, 32-bit)."
-(let ((msb (elt data 0)))
+(let ((msb (elt data offset)))
   (+ (if (> msb 31) (* msb 16777216.0) (lsh msb 24))
- (logior (lsh (elt data 1) 16) (lsh (elt data 2) 8) (elt data 3)
-  (defsubst xcb:-unpack-u4-lsb (data)
+ (logior (lsh (elt data (1+ offset)) 16)
+ (lsh (elt data (+ offset 2)) 8)
+ (elt data (+ offset 3))
+  (defsubst xcb:-unpack-u4-lsb (data offset)
 "Byte array => 4 bytes unsigned integer (LSB first, 32-bit)."
-(let ((msb (elt data 3)))
+(let ((msb (elt data (+ offset 3
   (+ (if (> msb 31) (* msb 16777216.0) (lsh msb 24))
- (logior (elt data 0) (lsh (elt data 1) 8) (lsh (elt data 2) 16))
+ (logior (elt data offset)
+ (lsh (elt data (1+ offset)) 8)
+ (lsh (+ offset 2) 16))
 
-(defsubst xcb:-unpack-i4 (data)
+(defsubst xcb:-unpack-i4 (data offset)
   "Byte array => 4 bytes signed integer (MSB first)."
-  (let ((value (xcb:-unpack-u4 data)))
+  (let ((value (xcb:-unpack-u4 data offset)))
 (if (< value #x8000);treated as float for 32-bit
 value
   (- value #x1  ;treated as float for 32-bit
 
-(defsubst xcb:-unpack-i4-lsb (data)
+(defsubst xcb:-unpack-i4-lsb (data offset)
   "Byte array => 4 bytes signed integer (LSB first)."
-  (let ((value (xcb:-unpack-u4-lsb data)))
+  (let ((value (xcb:-unpack-u4-lsb data offset)))
 (if (< value #x8000);treated as float for 32-bit
 value
   (- value #x10

[elpa] externals/exwm eafd031 56/64: Allow hide/show mode-line on floating frames

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit eafd031c556ecfe986c656ca72fcde7e06ac819a
Author: Chris Feng 
Commit: Chris Feng 

Allow hide/show mode-line on floating frames

* exwm-core.el: new buffer-local variable exwm--floating-mode-line-format 
for
  saving mode-line-format when mode-line is hidden
* exwm-floating.el (exwm-floating--fit-frame-to-window)
  (exwm-floating-hide-mode-line, exwm-floating-show-mode-line): new 
functions
  for resizing frames, hiding/showing mode-line respectively;
  (exwm-floating--set-floating): use exwm-floating--fit-frame-to-window to
  resize frames
---
 exwm-core.el |   15 ++-
 exwm-floating.el |   65 -
 2 files changed, 62 insertions(+), 18 deletions(-)

diff --git a/exwm-core.el b/exwm-core.el
index 9810de4..74eb94f 100644
--- a/exwm-core.el
+++ b/exwm-core.el
@@ -78,13 +78,14 @@
   "Event mask set on all managed windows.")
 
 ;; Internal variables
-(defvar-local exwm--id nil)  ;window ID
-(defvar-local exwm--frame nil)   ;workspace frame
-(defvar-local exwm--floating-frame nil)  ;floating frame
-(defvar-local exwm--floating-edges nil)  ;four edges
-(defvar-local exwm--fullscreen nil)  ;used in fullscreen
-(defvar-local exwm--floating-frame-geometry nil) ;in fullscreen
-(defvar-local exwm--fixed-size nil)  ;fixed size
+(defvar-local exwm--id nil);window ID
+(defvar-local exwm--frame nil) ;workspace frame
+(defvar-local exwm--floating-frame nil);floating frame
+(defvar-local exwm--floating-edges nil);four edges
+(defvar-local exwm--floating-mode-line-format nil) ;save mode-line-format
+(defvar-local exwm--fullscreen nil);used in fullscreen
+(defvar-local exwm--floating-frame-geometry nil)   ;in fullscreen
+(defvar-local exwm--fixed-size nil);fixed size
 (defvar-local exwm--on-KeyPress ;KeyPress event handler
   #'exwm-input--on-KeyPress-line-mode)
 ;; Properties
diff --git a/exwm-floating.el b/exwm-floating.el
index 6bb635a..4ea495d 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -166,17 +166,7 @@
 (+ width exwm-floating-border-width)
 (+ height exwm-floating-border-width
 ;; Fit frame to client
-(xcb:+request exwm--connection
-(make-instance 'xcb:ConfigureWindow
-   :window outer-id
-   :value-mask (logior xcb:ConfigWindow:Width
-   xcb:ConfigWindow:Height
-   xcb:ConfigWindow:StackMode)
-   :width (+ width (* 2 exwm-floating-border-width))
-   :height (+ height (* 2 exwm-floating-border-width)
-  (window-mode-line-height)
-  (window-header-line-height))
-   :stack-mode xcb:StackMode:Above)) ;top-most
+(exwm-floating--fit-frame-to-window outer-id width height)
 ;; Reparent window to this frame
 (xcb:+request exwm--connection
 (make-instance 'xcb:ChangeWindowAttributes
@@ -246,6 +236,59 @@
 (exwm-floating--unset-floating exwm--id)
   (exwm-floating--set-floating exwm--id
 
+(defun exwm-floating--fit-frame-to-window (&optional frame-outer-id
+ width height)
+  "Resize a floating frame to make it fit the size of the window.
+
+Default to resize `exwm--floating-frame' unless FRAME-OUTER-ID is non-nil.
+This function will issue an `xcb:GetGeometry' request unless WIDTH and HEIGHT
+are provided. You should call `xcb:flush' and assign `window-size-fixed' a
+non-nil value afterwards."
+  (setq window-size-fixed nil)
+  (unless (and width height)
+(let ((geometry (xcb:+request-unchecked+reply exwm--connection
+(make-instance 'xcb:GetGeometry :drawable exwm--id
+  (setq width (slot-value geometry 'width)
+height (slot-value geometry 'height
+  (xcb:+request exwm--connection
+  (make-instance 'xcb:ConfigureWindow
+ :window (or frame-outer-id
+ (frame-parameter exwm--floating-frame
+  'exwm-outer-id))
+ :value-mask (logior xcb:ConfigWindow:Width
+ xcb:ConfigWindow:Height
+ xcb:ConfigWindow:StackMode)
+ :width (+ width (* 2 exwm-floating-border-width))
+ :height (+ height (* 2 exwm-floating-border-width)
+(window-mode-line-height)
+(window-header-line-height))
+

[elpa] branch externals/exwm created (now 4255f07)

2015-09-17 Thread Chris Feng
ch11ng pushed a change to branch externals/exwm.

at  4255f07   On-demand update exwm-workspace--switch-history

This branch includes the following new commits:

   new  10a7fe8   First commit
   new  7892ed3   Improve move/resize
   new  cf87bb5   Add wiki link to README
   new  968d0b4   Various fixes for workspace
   new  36e8361   Various fixes
   new  f4416a1   Fix potential naming conflicts
   new  86764d2   Add basic RandR support
   new  ea7c6c7   Fix typos
   new  ee3ce55   Merge pull request #2 from KAMiKAZOW/patch-1
   new  3fc0cb2   Various fixes
   new  caf2fee   Drop intro to EXIM
   new  3fb90b9   Fix fullscreen issues
   new  1e36a22   Check buffer mode in exwm-reset
   new  2ad1a89   Various input fixes
   new  84f0f03   Fix input focus lost after closing window
   new  14628a9   Fix race conditions when managing a window
   new  3b9d0dd   Fixes for manage/unmanage window
   new  5298489   Fix some input focus issues
   new  63402b0   Correct layout refresh problems
   new  42f4ec6   Show moved window by default
   new  36bb579   Refresh when minibuffer grows (fix #10)
   new  edc70eb   Remove redundant code caused by the concurrency of events
   new  2d4104a   Fix emacsclient bugs
   new  048994c   Remove redundant code caused by the concurrency of events 
(continued)
   new  24b964b   Ignore repeated `MappingNotify` events
   new  b755296   Remove redundant code caused by the concurrency of events 
(contd, 2)
   new  801185c   Fix buffer switch problems
   new  1ce18af   Center floating windows by default
   new  04e4269   Improve input focus switch mechanism
   new  35560a4   Minor fixes for emacsclient
   new  07e59e0   Fix multi-screen bugs
   new  dba43b0   Fix input focus stealing
   new  7bfd429   Honor `value-mask` field in ConfigureRequest event
   new  d998b42   Provide hooks run when the floating state of a window 
changes (close #28)
   new  15ad591   Fix bug when moving a window to the current workspace
   new  43b00d2   fix buffer renaming
   new  d1806e9   Improve code robustness.
   new  7120291   Merge branch 'pipcet-robustness'
   new  2d07429   Merge branch 'move-window-fix' of 
https://github.com/pipcet/exwm into pipcet-move-window-fix
   new  5882015   Merge branch 'pipcet-move-window-fix'
   new  5210e13   Only manage windows mapped as the direct children of root 
window (close #38)
   new  94bdbfc   Avoid using the "no window manager" code in Emacs
   new  874c383   Merge pull request #42 from pipcet/ewmh-fullscreen
   new  981293f   Replay KeyPress events instead of fake them in line-mode
   new  b50a6e6   Correct several EWMH properties
   new  bb4ebde   Fix `exwm-workspace-rename-buffer`
   new  5f9f673   Fix window size calculations
   new  7032ee7   Re-enable complete refresh of keyboard mapping
   new  5222dc1   Avoid deleting the frame created by Emacs client by 
accident
   new  76f4849   Drop intro to xelb-util
   new  f7bec7a   Minor fix
   new  9eee94e   Merge pull request #52 from pipcet/minor-fix
   new  f1d37b9   Ungrab pointer timely when resizing is aborted
   new  6d63c71   Prepare for GNU ELPA release
   new  637ac15   Code cleanups
   new  eafd031   Allow hide/show mode-line on floating frames
   new  5373c1d   Add support for xcb:Atom:_NET_CLIENT_LIST_STACKING etc
   new  3f2f844   Add a command to interactively move X window to the 
current workspace
   new  1d43515   Allow switch to normal buffers in 
exwm-workspace-switch-to-window
   new  dbcabe7   Implement move/resize with keyboard
   new  cfbd9a5   Minor fix for window move
   new  576a676   Fix with-slots
   new  b458d5a   Allow showing buffers on other workspaces and moving an X 
window by switching to its buffer
   new  4255f07   On-demand update exwm-workspace--switch-history




[elpa] externals/exwm 24b964b 25/64: Ignore repeated `MappingNotify` events

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 24b964bb4af100b959a33215cc91b9c896c9359e
Author: Chris Feng 
Commit: Chris Feng 

Ignore repeated `MappingNotify` events

For some reason, `MappingNotify` events are generated quite frequently and
greatly impact the performance. This commit disables the complete refresh of
keyboard mapping.
---
 exwm-input.el |   25 ++---
 1 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 24aa94a..293fd67 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -139,13 +139,24 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
   (let ((obj (make-instance 'xcb:MappingNotify)))
 (xcb:unmarshal obj data)
 (with-slots (request first-keycode count) obj
-  (cond ((= request xcb:Mapping:Modifier)
- ;; Modifier keys changed
- (xcb:keysyms:update-modifier-mapping exwm--connection))
-((= request xcb:Mapping:Keyboard)
- ;; Only updated changed keys
- (xcb:keysyms:update-keyboard-mapping exwm--connection
-  first-keycode count))
+  (cond
+   ((= request xcb:Mapping:Modifier)
+;; Modifier keys changed
+(exwm--log "Update modifier mapping")
+(xcb:keysyms:update-modifier-mapping exwm--connection)
+)
+   ((= request xcb:Mapping:Keyboard)
+;; Only update changed keys
+(with-slots (min-keycode max-keycode)
+(xcb:get-setup exwm--connection)
+  ;; Since this operation is quite time-consuming, a complete refresh
+  ;; is forbidden as it's unlikely to bring any useful information
+  (unless (and (= min-keycode first-keycode)
+   (= max-keycode (+ first-keycode count -1)))
+(exwm--log "Update keyboard mapping: %d ~ %d"
+   first-keycode (+ first-keycode count))
+(xcb:keysyms:update-keyboard-mapping exwm--connection
+ first-keycode count
 
 (defun exwm-input--on-ButtonPress (data synthetic)
   "Handle ButtonPress event."



[elpa] externals/xelb 2d78724 03/42: Fix shift bit for converting from keysym to Emacs event

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 2d78724580849d91a9b5a2b45180b21117d3a315
Author: Chris Feng 
Commit: Chris Feng 

Fix shift bit for converting from keysym to Emacs event

Emacs only set shift bit for letters.
---
 xcb-keysyms.el |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/xcb-keysyms.el b/xcb-keysyms.el
index 5a118a4..87c8247 100644
--- a/xcb-keysyms.el
+++ b/xcb-keysyms.el
@@ -297,7 +297,9 @@ This function returns nil when it fails to convert an 
event."
   (push 'meta event))
 (when (/= 0 (logand mask xcb:keysyms:control-mask))
   (push 'control event))
-(when (/= 0 (logand mask xcb:keysyms:shift-mask))
+(when (and (/= 0 (logand mask xcb:keysyms:shift-mask))
+   ;; Emacs only set shift bit for letters
+   (<= ?A (car (last event))) (>= ?Z (car (last event
   (push 'shift event))
 (when (and xcb:keysyms:hyper-mask
(/= 0 (logand mask xcb:keysyms:hyper-mask)))



[elpa] externals/exwm 36bb579 21/64: Refresh when minibuffer grows (fix #10)

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 36bb5793c2026230a2a660d443dde1c3b1a98de6
Author: Chris Feng 
Commit: Chris Feng 

Refresh when minibuffer grows (fix #10)

The expansion of echo area is not handled however.
---
 exwm-layout.el |   13 -
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/exwm-layout.el b/exwm-layout.el
index 906357e..414aa37 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -187,10 +187,21 @@
 (dolist (i (cdr windows))
   (set-window-buffer i placeholder))
 
+(defun exwm-layout--on-minibuffer-setup ()
+  "Refresh layout when minibuffer grows."
+  (run-with-idle-timer 0.01 nil ;FIXME
+   (lambda ()
+ (when (and (< 1 (window-height (minibuffer-window)))
+(not (and (eq major-mode 'exwm-mode)
+  exwm--floating-frame)))
+   (exwm-layout--refresh)
+
 (defun exwm-layout--init ()
   "Initialize layout module."
   ;; Auto refresh layout
-  (add-hook 'window-configuration-change-hook 'exwm-layout--refresh))
+  (add-hook 'window-configuration-change-hook 'exwm-layout--refresh)
+  ;; Refresh when minibuffer grows
+  (add-hook 'minibuffer-setup-hook 'exwm-layout--on-minibuffer-setup t))
 
 
 



[elpa] externals/exwm caf2fee 11/64: Drop intro to EXIM

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit caf2feec639e26506b787a07889aaf28ee9c3c3f
Author: Chris Feng 
Commit: Chris Feng 

Drop intro to EXIM
---
 README |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/README b/README
index a2a2fdc..a8b9fa7 100644
--- a/README
+++ b/README
@@ -8,6 +8,3 @@ manager. Please check the wiki for more details.
 EXWM is built on top of XELB and its utility libraris:
   + XELB: https://github.com/ch11ng/xelb
   + XELB utilility libraries: https://github.com/ch11ng/xelb-util
-
-You may also be intrested in an input method server designed for EXWM:
-  + EXIM: https://github.com/ch11ng/exim



[elpa] externals/exwm f7bec7a 51/64: Minor fix

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit f7bec7a97729848f201d474b2984c71a8a981466
Author: Philip 
Commit: Philip 

Minor fix
---
 exwm-manage.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/exwm-manage.el b/exwm-manage.el
index e7134fe..648b42b 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -83,7 +83,7 @@ corresponding buffer.")
:event-mask xcb:EventMask:NoEvent))
 ;; The window needs to be mapped
 (xcb:+request exwm--connection
-(make-instance xcb:MapWindow :window id))
+(make-instance 'xcb:MapWindow :window id))
 (with-slots (x y width height) exwm--geometry
   ;; Reparent to virtual root (essential)
   (xcb:+request exwm--connection
@@ -323,7 +323,7 @@ corresponding buffer.")
 (with-slots (parent window) obj
   (if (/= exwm--root parent)
   (progn (xcb:+request exwm--connection
- (make-instance xcb:MapWindow :window window))
+ (make-instance 'xcb:MapWindow :window window))
  (xcb:flush exwm--connection))
 (exwm--log "MapRequest from #x%x" window)
 (exwm-manage--manage-window window)



[elpa] externals/xelb 23cb30b 12/42: Fix an emacsclient bug

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 23cb30b3d948f09de2ec0fe351e37463f3b190b7
Author: Chris Feng 
Commit: Chris Feng 

Fix an emacsclient bug

When calling `xcb:keysyms:update-modifier-mapping` from a terminal
(e.g. created by `emacsclient -t`), the selected frame cannot be used to
receive X events.
---
 xcb-keysyms.el |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/xcb-keysyms.el b/xcb-keysyms.el
index 87c8247..d64abe5 100644
--- a/xcb-keysyms.el
+++ b/xcb-keysyms.el
@@ -112,7 +112,12 @@ This method must be called before using any other method 
in this module."
 ((memq 'kp-numlock events)
  (setq xcb:keysyms:num-lock-mask (elt mode-masks i))
   ;; Determine remaining keys
-  (let* ((id (string-to-int (frame-parameter nil 'window-id)))
+  (let* ((frame (unless (frame-parameter nil 'window-id)
+  (catch 'break
+(dolist (i (frame-list))
+  (when (frame-parameter i 'window-id)
+(throw 'break i))
+ (id (string-to-int (frame-parameter frame 'window-id)))
  (root
   (slot-value (car (slot-value (xcb:get-setup obj) 'roots)) 'root))
  (keycode (xcb:keysyms:keysym->keycode obj ?a))



[elpa] externals/exwm 76f4849 50/64: Drop intro to xelb-util

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 76f48490b175e30d520c2dbf05f18807b03b10de
Author: Chris Feng 
Commit: Chris Feng 

Drop intro to xelb-util
---
 README |8 +++-
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/README b/README
index a8b9fa7..5e2bedd 100644
--- a/README
+++ b/README
@@ -2,9 +2,7 @@ Emacs X Window Manager
 ==
 
 EXWM (Emacs X Window Manager) turns Emacs into a full-featured tiling X window
-manager. Please check the wiki for more details.
-  + Wiki: https://github.com/ch11ng/exwm/wiki
+manager. Please check the wiki (https://github.com/ch11ng/exwm/wiki) for more
+details.
 
-EXWM is built on top of XELB and its utility libraris:
-  + XELB: https://github.com/ch11ng/xelb
-  + XELB utilility libraries: https://github.com/ch11ng/xelb-util
+EXWM is built on top of XELB (https://github.com/ch11ng/xelb).



[elpa] externals/exwm 5298489 18/64: Fix some input focus issues

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 52984898ec8d59fe42e86a311c7e7dbeec95c611
Author: Chris Feng 
Commit: Chris Feng 

Fix some input focus issues

* Fix input focus lost after moving window to another workspace
* Enhance `exwm-reset` to provide user a way to reset input focus when it's
  lost unexpectedly
---
 exwm-workspace.el |   13 -
 exwm.el   |3 +++
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index da3f9ce..efecf57 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -181,14 +181,17 @@ The optional FORCE option is for internal use only."
 (if exwm--floating-frame
 ;; Move the floating frame is enough
 (xcb:+request exwm--connection
-(make-instance 'xcb:ReparentWindow
-   :window (frame-parameter exwm--floating-frame
-'exwm-outer-id)
-   :parent (frame-parameter frame 'exwm-window-id)
-   :x 0 :y 0))
+(make-instance 'xcb:ReparentWindow
+   :window (frame-parameter exwm--floating-frame
+'exwm-outer-id)
+   :parent (frame-parameter frame 'exwm-window-id)
+   :x 0 :y 0))
   ;; Move the window itself
   (bury-buffer)
   (exwm-layout--hide id)
+  ;; Force update input focus
+  (setq exwm-input--focus-id xcb:Window:None)
+  (exwm-input--update-focus)
   (xcb:+request exwm--connection
   (make-instance 'xcb:ReparentWindow
  :window id
diff --git a/exwm.el b/exwm.el
index 88d7674..984f8ee 100644
--- a/exwm.el
+++ b/exwm.el
@@ -198,6 +198,9 @@
   (with-current-buffer (window-buffer)
 (when (eq major-mode 'exwm-mode)
   (when exwm--fullscreen (exwm-layout-unset-fullscreen))
+  ;; Force update input focus
+  (setq exwm-input--focus-id xcb:Window:None)
+  (exwm-input--update-focus)
   (exwm-input-grab-keyboard
 
 (defmacro exwm--with-current-id (id &rest body)



[elpa] externals/exwm ee3ce55 09/64: Merge pull request #2 from KAMiKAZOW/patch-1

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit ee3ce55c4834f9925d5f349e182eb68a3c1c0365
Merge: 86764d2 ea7c6c7
Author: Chris Feng 
Commit: Chris Feng 

Merge pull request #2 from KAMiKAZOW/patch-1

Fix typos
---
 exwm.el |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/exwm.el b/exwm.el
index a38744f..3f38b66 100644
--- a/exwm.el
+++ b/exwm.el
@@ -40,9 +40,9 @@
 
 ;; How it works
 ;; 
-;; Emacs itself is an tiling window manager, though unfortunately not for
-;; managing X things. EXWM is therefore created to overcome this limitation by
-;; relating X concepts to Emacs ones as shown in the following table.
+;; Emacs itself is a tiling window manager, though unfortunately not for
+;; managing X things. EXWM has therefore been created to overcome this 
limitation
+;; by relating X concepts to Emacs ones as shown in the following table.
 ;;
 ;; +=+=+
 ;; | X Window| Emacs   |



[elpa] externals/exwm 10a7fe8 01/64: First commit

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 10a7fe8d65e8f0ce9c1fc24ba6080afedcc1a76a
Author: Chris Feng 
Commit: Chris Feng 

First commit
---
 COPYING   |  674 ++
 README|   12 +
 exwm-floating.el  |  431 
 exwm-input.el |  451 ++
 exwm-layout.el|  194 +++
 exwm-manage.el|  333 +
 exwm-workspace.el |  230 +
 exwm.el   |  706 +
 8 files changed, 3031 insertions(+), 0 deletions(-)

diff --git a/COPYING b/COPYING
new file mode 100644
index 000..94a9ed0
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,674 @@
+GNU GENERAL PUBLIC LICENSE
+   Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+   TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To 

[elpa] externals/exwm 2d07429 39/64: Merge branch 'move-window-fix' of https://github.com/pipcet/exwm into pipcet-move-window-fix

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 2d07429d0f2e77054b565926ac6c8b7f592f8a44
Merge: 7120291 43b00d2
Author: Chris Feng 
Commit: Chris Feng 

Merge branch 'move-window-fix' of https://github.com/pipcet/exwm into 
pipcet-move-window-fix
---
 exwm-workspace.el |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index 09112d2..7ac1fec 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -168,12 +168,14 @@ The optional FORCE option is for internal use only."
   (unless id (setq id (exwm--buffer->id (window-buffer
   (unless (and (<= 0 index) (< index exwm-workspace-number))
 (user-error "[EXWM] Workspace index out of range: %d" index))
-  (when (/= exwm-workspace-current-index index)
+  (with-current-buffer (exwm--id->buffer id)
 (let ((frame (elt exwm-workspace--list index)))
-  (with-current-buffer (exwm--id->buffer id)
+  (when (not (equal exwm--frame frame))
+(let ((name (replace-regexp-in-string "^\\s-*" "" (buffer-name
+  (exwm-workspace-rename-buffer (if (= index 
exwm-workspace-current-index)
+name
+  (concat " " name
 (setq exwm--frame frame)
-(exwm-workspace-rename-buffer
- (concat " " (replace-regexp-in-string "^\\s-*" "" (buffer-name
 (if exwm--floating-frame
 ;; Move the floating frame is enough
 (progn



[elpa] externals/exwm 1d43515 59/64: Allow switch to normal buffers in exwm-workspace-switch-to-window

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 1d435157d3c9b3f807aca55bb4e6d16d5cb6c5df
Author: Chris Feng 
Commit: Chris Feng 

Allow switch to normal buffers in exwm-workspace-switch-to-window

* exwm-workspace.el (exwm-workspace-switch-to-window): Allow switch to 
normal
  buffers.
---
 exwm-workspace.el |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index 5fae713..d2619ee 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -219,10 +219,11 @@ The optional FORCE option is for internal use only."
   (let ((buffer (read-buffer "Switch to window: " nil t)))
 (when buffer
   (with-current-buffer buffer
-(when (and (eq major-mode 'exwm-mode)
-   (not (eq exwm--frame exwm-workspace--current)))
-  (exwm-workspace-move-window exwm-workspace-current-index
-  exwm--id)
+(if (and (eq major-mode 'exwm-mode)
+ (not (eq exwm--frame exwm-workspace--current)))
+(exwm-workspace-move-window exwm-workspace-current-index
+exwm--id)
+  (switch-to-buffer buffer)
   ;; Hide buffers on other workspaces
   (dolist (pair exwm--id-buffer-alist)
 (with-current-buffer (cdr pair)



[elpa] externals/exwm ea7c6c7 08/64: Fix typos

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit ea7c6c7035ee412fa126a430e38f2694c351a2f6
Author: Markus S. 
Commit: Markus S. 

Fix typos
---
 exwm.el |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/exwm.el b/exwm.el
index a38744f..3f38b66 100644
--- a/exwm.el
+++ b/exwm.el
@@ -40,9 +40,9 @@
 
 ;; How it works
 ;; 
-;; Emacs itself is an tiling window manager, though unfortunately not for
-;; managing X things. EXWM is therefore created to overcome this limitation by
-;; relating X concepts to Emacs ones as shown in the following table.
+;; Emacs itself is a tiling window manager, though unfortunately not for
+;; managing X things. EXWM has therefore been created to overcome this 
limitation
+;; by relating X concepts to Emacs ones as shown in the following table.
 ;;
 ;; +=+=+
 ;; | X Window| Emacs   |



[elpa] externals/exwm 5373c1d 57/64: Add support for xcb:Atom:_NET_CLIENT_LIST_STACKING etc

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 5373c1df1a8432f6a54e8ded8c9a145842c067e2
Author: Chris Feng 
Commit: Chris Feng 

Add support for xcb:Atom:_NET_CLIENT_LIST_STACKING etc

The _NET_CLIENT_LIST_STACKING EWMH property is essential for e.g. the 
tabbar of
chromium to work correctly.

* exwm-input.el: Remove invalid TODO item.
* exwm.el (exwm--init-icccm-ewmh): Add xcb:Atom:_NET_CLIENT_LIST and
  xcb:Atom:_NET_CLIENT_LIST_STACKING to _NET_SUPPORTED.
* exwm-layout.el (exwm-layout--refresh): Update _NET_CLIENT_LIST_STACKING.
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window):
  Update _NET_CLIENT_LIST.
---
 exwm-input.el  |1 -
 exwm-layout.el |   15 ++-
 exwm-manage.el |9 +
 exwm.el|2 ++
 4 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 69d2aff..afa619b 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -32,7 +32,6 @@
 ;; + Simulation keys to mimic Emacs key bindings for text edit (redo, select,
 ;;   cancel, clear, etc). Some of them are not present on common keyboard
 ;;   (keycode = 0). May need to use XKB extension.
-;; + Investigate DnD support (e.g. drag a chromium tab to another window).
 
 ;;; Code:
 
diff --git a/exwm-layout.el b/exwm-layout.el
index a14651a..ae1f48d 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -239,7 +239,20 @@
 (with-current-buffer (window-buffer window)
   (when (and (eq major-mode 'exwm-mode)
  (or exwm--floating-frame (not (eq frame exwm--frame
-(set-window-buffer window placeholder)))
+(set-window-buffer window placeholder
+  ;; Update _NET_CLIENT_LIST_STACKING
+  (xcb:+request exwm--connection
+  (make-instance 'xcb:ewmh:set-_NET_CLIENT_LIST_STACKING
+ :window exwm--root
+ :data (vconcat
+(delq nil
+  (mapcar
+   (lambda (buffer)
+ (with-current-buffer buffer
+   (when (eq major-mode 'exwm-mode)
+ exwm--id)))
+   (buffer-list))
+  (xcb:flush exwm--connection
 
 (defun exwm-layout--on-minibuffer-setup ()
   "Refresh layout when minibuffer grows."
diff --git a/exwm-manage.el b/exwm-manage.el
index a8d0e59..2636c01 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -128,6 +128,10 @@ corresponding buffer.")
  :cursor xcb:Cursor:None
  :button xcb:ButtonIndex:Any
  :modifiers xcb:ModMask:Any))
+  (xcb:+request exwm--connection;update _NET_CLIENT_LIST
+  (make-instance 'xcb:ewmh:set-_NET_CLIENT_LIST
+ :window exwm--root
+ :data (vconcat (mapcar #'car exwm--id-buffer-alist
   (xcb:flush exwm--connection)
   (exwm--update-title id)
   (exwm--update-transient-for id)
@@ -150,6 +154,11 @@ corresponding buffer.")
   (let ((buffer (exwm--id->buffer id)))
 (exwm--log "Unmanage #x%x (buffer: %s)" id buffer)
 (setq exwm--id-buffer-alist (assq-delete-all id exwm--id-buffer-alist))
+(xcb:+request exwm--connection  ;update _NET_CLIENT_LIST
+(make-instance 'xcb:ewmh:set-_NET_CLIENT_LIST
+   :window exwm--root
+   :data (vconcat (mapcar #'car exwm--id-buffer-alist
+(xcb:flush exwm--connection)
 (when (buffer-live-p buffer)
   (with-current-buffer buffer
 (exwm-workspace--update-switch-history)
diff --git a/exwm.el b/exwm.el
index 84fbc15..bf45e40 100644
--- a/exwm.el
+++ b/exwm.el
@@ -417,6 +417,8 @@
   (make-instance 'xcb:ewmh:set-_NET_SUPPORTED
  :window exwm--root
  :data (vector xcb:Atom:_NET_SUPPORTED
+   xcb:Atom:_NET_CLIENT_LIST
+   xcb:Atom:_NET_CLIENT_LIST_STACKING
xcb:Atom:_NET_NUMBER_OF_DESKTOPS
xcb:Atom:_NET_DESKTOP_VIEWPORT
xcb:Atom:_NET_CURRENT_DESKTOP



[elpa] externals/xelb ae7da13 40/42: Add support for XF86 keysyms

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit ae7da13819420dbebf17b2635cc43c38cf269627
Author: Chris Feng 
Commit: Chris Feng 

Add support for XF86 keysyms

* xcb-keysyms.el: new vector xcb:keysyms:-xf86-keys
* xcb-keysyms.el (xcb:keysyms:event->keysym, xcb:keysyms:keysym->event): add
  support for XF86 keysyms
---
 xcb-keysyms.el |   73 
 1 files changed, 68 insertions(+), 5 deletions(-)

diff --git a/xcb-keysyms.el b/xcb-keysyms.el
index 91b293b..a4c795f 100644
--- a/xcb-keysyms.el
+++ b/xcb-keysyms.el
@@ -240,6 +240,63 @@ SHIFT LOCK is ignored."
 ,@(make-list 15 nil) delete]
   "Emacs event representations of X function keys (keysym #xff00 to #x).")
 
+;; This list is adapted from 'XF86keysym.h' in X source.
+;; FIXME: We've intentionally left out keysyms outside the range 0x1008FF00 ~
+;;0x1008.
+;; REVIEW: Could anybody verify this list?
+(defconst xcb:keysyms:-xf86-keys
+  `[;#x1008ff00 - #x1008ff0f
+nil XF86ModeLock XF86MonBrightnessUp XF86MonBrightnessDown
+XF86KbdLightOnOff XF86KbdBrightnessUp XF86KbdBrightnessDown
+,@(make-list 9 0)
+;#x1008ff10 - #x1008ff1f
+XF86Standby XF86AudioLowerVolume XF86AudioMute XF86AudioRaiseVolume
+XF86AudioPlay XF86AudioStop XF86AudioPrev XF86AudioNext XF86HomePage
+XF86Mail XF86Start XF86Search XF86AudioRecord XF86Calculator XF86Memo
+XF86ToDoList
+;#x1008ff20 - #x1008ff2f
+XF86Calendar XF86PowerDown XF86ContrastAdjust XF86RockerUp
+XF86RockerDown XF86RockerEnter XF86Back XF86Forward XF86Stop
+XF86Refresh XF86PowerOff XF86WakeUp XF86Eject XF86ScreenSaver XF86WWW
+XF86Sleep
+;#x1008ff30 - #x1008ff3f
+XF86Favorites XF86AudioPause XF86AudioMedia XF86MyComputer
+XF86VendorHome XF86LightBulb XF86Shop XF86History XF86OpenURL
+XF86AddFavorite XF86HotLinks XF86BrightnessAdjust XF86Finance
+XF86Community XF86AudioRewind XF86BackForward
+;#x1008ff40 - #x1008ff4f
+XF86Launch0 XF86Launch1 XF86Launch2 XF86Launch3 XF86Launch4 XF86Launch5
+XF86Launch6 XF86Launch7 XF86Launch8 XF86Launch9 XF86LaunchA XF86LaunchB
+XF86LaunchC XF86LaunchD XF86LaunchE XF86LaunchF
+;#x1008ff50 - #x1008ff5f
+XF86ApplicationLeft XF86ApplicationRight XF86Book XF86CD XF86Calculater
+XF86Clear XF86Close XF86Copy XF86Cut XF86Display XF86DOS XF86Documents
+XF86Excel XF86Explorer XF86Game XF86Go
+;#x1008ff60 - #x1008ff6f
+XF86iTouch XF86LogOff XF86Market XF86Meeting nil XF86MenuKB XF86MenuPB
+XF86MySites XF86New XF86News XF86OfficeHome XF86Open XF86Option
+XF86Paste XF86Phone nil
+;#x1008ff70 - #x1008ff7f
+XF86Q nil XF86Reply XF86Reload XF86RotateWindows XF86RotationPB
+XF86RotationKB XF86Save XF86ScrollUp XF86ScrollDown XF86ScrollClick
+XF86Send XF86Spell XF86SplitScreen XF86Support XF86TaskPane
+;#x1008ff80 - #x1008ff8f
+XF86Terminal XF86Tools XF86Travel nil XF86UserPB XF86User1KB
+XF86User2KB XF86Video XF86WheelButton XF86Word XF86Xfer XF86ZoomIn
+XF86ZoomOut XF86Away XF86Messenger XF86WebCam
+;#x1008ff90 - #x1008ff9f
+XF86MailForward XF86Pictures XF86Music XF86Battery XF86Bluetooth
+XF86WLAN XF86UWB XF86AudioForward XF86AudioRepeat XF86AudioRandomPlay
+XF86Subtitle XF86AudioCycleTrack XF86CycleAngle XF86FrameBack
+XF86FrameForward XF86Time
+;#x1008ffa0 - #x1008ffaf
+XF86Select XF86View XF86TopMenu XF86Red XF86Green XF86Yellow XF86Blue
+XF86Suspend XF86Hibernate XF86TouchpadToggle ,@(make-list 6 0)
+;#x1008ffb0 - #x1008ffbf
+XF86TouchpadOn XF86TouchpadOff XF86AudioMicMute ,@(make-list 13 0)
+;everything rest
+,@(make-list 64 0)])
+
 (defun xcb:keysyms:event->keysym (event)
   "Translate Emacs key event EVENT to X Keysym.
 
@@ -255,15 +312,19 @@ This function returns nil when it fails to convert an 
event."
 (`mouse-3 xcb:ButtonIndex:3)
 (`mouse-4 xcb:ButtonIndex:4)
 (`mouse-5 xcb:ButtonIndex:5)
-;; Function keys
-(_ (cl-position event xcb:keysyms:-function-keys
+(_ (if (setq keysym (cl-position event
+ xcb:keysyms:-function-keys))
+   ;; Function keys
+   (logior keysym #xff00)
+   

[elpa] externals/exwm 2d4104a 23/64: Fix emacsclient bugs

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 2d4104a0eceb7d043ed1cd6bdd1bda1db4f91a73
Author: Chris Feng 
Commit: Chris Feng 

Fix emacsclient bugs

`emacsclient` started with `-c` or `-t` argument create a new frame that 
shall
not be used to manage X windows.
Also fix some related input focus issues (with some remaining unfixed).
Close #17.
---
 exwm-floating.el |   14 --
 exwm-input.el|6 --
 exwm-layout.el   |   53 -
 exwm.el  |9 +
 4 files changed, 49 insertions(+), 33 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index 3e9cade..bc7ee33 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -53,12 +53,14 @@
  (original-id (frame-parameter original-frame 'exwm-window-id))
  ;; Create new frame
  (frame (with-current-buffer "*scratch*"
-  (make-frame `((minibuffer . nil) ;use the one on workspace
-(background-color
- . ,exwm-floating-border-color)
-(internal-border-width
- . ,exwm-floating-border-width)
-(unsplittable . t) ;and fix the size later
+  (prog2
+  (exwm--lock)
+  (make-frame
+   `((minibuffer . nil) ;use the one on workspace
+ (background-color . ,exwm-floating-border-color)
+ (internal-border-width . ,exwm-floating-border-width)
+ (unsplittable . t))) ;and fix the size later
+(exwm--unlock
  (frame-id (string-to-int (frame-parameter frame 'window-id)))
  (outer-id (string-to-int (frame-parameter frame 'outer-window-id)))
  (window (frame-first-window frame)) ;and it's the only window
diff --git a/exwm-input.el b/exwm-input.el
index c312ff7..97dfd53 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -88,7 +88,8 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
   "Update input focus."
   (unless exwm-input--focus-lock
 (setq exwm-input--focus-lock t)
-(when (eq (current-buffer) (window-buffer)) ;e.g. with-temp-buffer
+(when (and (frame-parameter nil 'exwm-window-id) ;e.g. emacsclient frame
+   (eq (current-buffer) (window-buffer))) ;e.g. `with-temp-buffer'
   (if (eq major-mode 'exwm-mode)
   (progn (exwm--log "Set focus ID to #x%x" exwm--id)
  (setq exwm-input--focus-id exwm--id)
@@ -163,7 +164,8 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
  ;; Click to focus
  (unless (and (boundp 'exwm--id) (= event exwm--id))
(exwm--with-current-id event
- (raise-frame (or exwm--floating-frame exwm--frame))
+ (select-frame-set-input-focus (or exwm--floating-frame
+   exwm--frame))
  (select-window (get-buffer-window nil 'visible
  ;; The event should be replayed
  (setq mode xcb:Allow:ReplayPointer
diff --git a/exwm-layout.el b/exwm-layout.el
index 414aa37..4ae4859 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -160,32 +160,43 @@
 (defun exwm-layout--refresh ()
   "Refresh layout."
   (let ((frame (selected-frame))
-windows placeholder)
+(placeholder (get-buffer "*scratch*"))
+windows)
 (if (not (memq frame exwm-workspace--list))
-;; Refresh a floating frame
-(progn
-  (cl-assert (eq major-mode 'exwm-mode))
-  (let ((window (frame-first-window frame)))
+(if (frame-parameter frame 'exwm-window-id)
+;; Refresh a floating frame
+(progn
+  (cl-assert (eq major-mode 'exwm-mode))
+  (let ((window (frame-first-window frame)))
+(with-current-buffer (window-buffer window)
+  (exwm--log "Refresh floating window #x%x" exwm--id)
+  (exwm-layout--show exwm--id window
+  ;; Other frames (e.g. terminal/graphical frame of emacsclient)
+  ;; We shall bury all `exwm-mode' buffers in this case
+  (unless placeholder ;create the *scratch* buffer if it's killed
+(setq placeholder (get-buffer-create "*scratch*"))
+(set-buffer-major-mode placeholder))
+  (setq windows (window-list frame 0)) ;exclude minibuffer
+  (dolist (window windows)
 (with-current-buffer (window-buffer window)
-  (exwm--log "Refresh floating window #x%x" exwm--id)
-  (exwm-layout--show exwm--id window
+

[elpa] externals/exwm bb4ebde 46/64: Fix `exwm-workspace-rename-buffer`

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit bb4ebde55b3bdd903cfc3bcaba3001957763c83d
Author: Chris Feng 
Commit: Chris Feng 

Fix `exwm-workspace-rename-buffer`

Ensure buffer names are unique.
---
 exwm-workspace.el |   21 +++--
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index cf8caa8..27e3179 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -202,16 +202,17 @@ The optional FORCE option is for internal use only."
 
 (defun exwm-workspace-rename-buffer (newname)
   "Rename a buffer."
-  (if (/= ?\s (aref newname 0))
-  (rename-buffer newname t)
-;; If a buffer name is prefixed with a space, Emacs append a random
-;; number before renaming it. This is not desired behavior.
-(let ((name (replace-regexp-in-string "<[0-9]+>$" "" newname))
-  (counter 1))
-  (while (and (get-buffer newname)
-  (not (eq (get-buffer newname) (current-buffer
-(setq newname (format "%s<%d>" name (cl-incf counter)
-(rename-buffer newname)))
+  (let ((hidden (= ?\s (aref newname 0)))
+(basename (replace-regexp-in-string "<[0-9]+>$" "" newname))
+(counter 1)
+tmp)
+(when hidden (setq basename (substring basename 1)))
+(setq newname basename)
+(while (and (setq tmp (or (get-buffer newname)
+  (get-buffer (concat " " newname
+(not (eq tmp (current-buffer
+  (setq newname (format "%s<%d>" basename (cl-incf counter
+(rename-buffer (concat (and hidden " ") newname
 
 (defun exwm-workspace--init ()
   "Initialize workspace module."



[elpa] externals/exwm 14628a9 16/64: Fix race conditions when managing a window

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 14628a940c12051f2538556b97a2ef4531c75201
Author: Chris Feng 
Commit: Chris Feng 

Fix race conditions when managing a window

Since it takes some time for EXWM to create a buffer for a window (to do 
some
checking for example), the window may send several MapRequest events before
it's mapped. This commit should fix such issue.
---
 exwm-manage.el |   14 +-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/exwm-manage.el b/exwm-manage.el
index 7c82696..8594066 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -42,19 +42,28 @@ corresponding buffer.")
 (when reply ;nil when destroyed
   (setq exwm--geometry reply))
 
+(defvar exwm-manage--manage-window-queue nil
+  "List of window IDs to prevent race conditions.")
+
 (defun exwm-manage--manage-window (id)
   "Manage window ID."
+  (exwm--log "Try to manage #x%x" id)
   (setq exwm-input--focus-lock t)
   (catch 'return
 ;; Ensure it's not managed
-(when (assoc id exwm--id-buffer-alist)
+(when (or (assoc id exwm--id-buffer-alist)
+  (memq id exwm-manage--manage-window-queue))
+  (exwm--log "#x%x is already managed" id)
   (throw 'return 'managed))
+(push id exwm-manage--manage-window-queue) ;prevent reentering
 ;; Ensure it's alive
 (when (xcb:+request-checked+request-check exwm--connection
   (make-instance 'xcb:ChangeWindowAttributes
  :window id :value-mask xcb:CW:EventMask
  :event-mask exwm--client-event-mask))
+  (delq id exwm-manage--manage-window-queue) ;cleanup
   (throw 'return 'dead))
+(delq id exwm-manage--manage-window-queue) ;cleanup (late enough)
 (with-current-buffer (generate-new-buffer "*EXWM*")
   (push `(,id . ,(current-buffer)) exwm--id-buffer-alist)
   (exwm-mode)
@@ -73,6 +82,7 @@ corresponding buffer.")
  (and exwm-instance-name
   (string-prefix-p "sun-awt-X11-" exwm-instance-name)
   (not (string-suffix-p "XFramePeer" exwm-instance-name
+(exwm--log "No need to manage #x%x" id)
 ;; Remove all events
 (xcb:+request-checked+request-check exwm--connection
 (make-instance 'xcb:ChangeWindowAttributes
@@ -104,6 +114,7 @@ corresponding buffer.")
 (kill-buffer (current-buffer))
 (throw 'return 'ignored))
   ;; Manage the window
+  (exwm--log "Manage #x%x" id)
   (xcb:+request exwm--connection;remove border
   (make-instance 'xcb:ConfigureWindow
  :window id :value-mask xcb:ConfigWindow:BorderWidth
@@ -140,6 +151,7 @@ corresponding buffer.")
 (defun exwm-manage--unmanage-window (id &optional withdraw-only)
   "Unmanage window ID."
   (let ((buffer (exwm--id->buffer id)))
+(exwm--log "Unmanage #x%x (buffer: %s)" id buffer)
 (setq exwm--id-buffer-alist (assq-delete-all id exwm--id-buffer-alist))
 (when (buffer-live-p buffer)
   (with-current-buffer buffer



[elpa] externals/xelb 1ab5bb9 29/42: Fix a typo in 32-bit version `xcb:-unpack-u4-lsb`

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 1ab5bb9feb2e8be5015b78a07499a19649ce73cb
Author: Chris Feng 
Commit: Chris Feng 

Fix a typo in 32-bit version `xcb:-unpack-u4-lsb`
---
 xcb-types.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/xcb-types.el b/xcb-types.el
index 2af911f..a81b80e 100644
--- a/xcb-types.el
+++ b/xcb-types.el
@@ -215,7 +215,7 @@
   (+ (if (> msb 31) (* msb 16777216.0) (lsh msb 24))
  (logior (elt data offset)
  (lsh (elt data (1+ offset)) 8)
- (lsh (+ offset 2) 16))
+ (lsh (elt data (+ offset 2)) 16))
 
 (defsubst xcb:-unpack-i4 (data offset)
   "Byte array => 4 bytes signed integer (MSB first)."



[elpa] externals/exwm 7120291 38/64: Merge branch 'pipcet-robustness'

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 7120291197fb5ceb032671ba02345d181c77399d
Merge: d998b42 d1806e9
Author: Chris Feng 
Commit: Chris Feng 

Merge branch 'pipcet-robustness'
---
 exwm-input.el  |   75 ---
 exwm-layout.el |6 +++-
 exwm-manage.el |7 ++---
 3 files changed, 45 insertions(+), 43 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 6b41fff..760e5c9 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -56,26 +56,27 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 
 (defun exwm-input--set-focus (id)
   "Set input focus to window ID in a proper way."
-  (with-current-buffer (exwm--id->buffer id)
-(if (and (not exwm--hints-input)
- (memq xcb:Atom:WM_TAKE_FOCUS exwm--protocols))
-(progn
-  (exwm--log "Focus on #x%x with WM_TAKE_FOCUS" id)
-  (xcb:+request exwm--connection
-  (make-instance 'xcb:icccm:SendEvent
- :destination id
- :event (xcb:marshal
- (make-instance 'xcb:icccm:WM_TAKE_FOCUS
-:window id
-:time
-exwm-input--timestamp)
- exwm--connection
-  (exwm--log "Focus on #x%x with SetInputFocus" id)
-  (xcb:+request exwm--connection
-  (make-instance 'xcb:SetInputFocus
- :revert-to xcb:InputFocus:Parent :focus id
- :time xcb:Time:CurrentTime)))
-(xcb:flush exwm--connection)))
+  (when (exwm--id->buffer id)
+(with-current-buffer (exwm--id->buffer id)
+  (if (and (not exwm--hints-input)
+   (memq xcb:Atom:WM_TAKE_FOCUS exwm--protocols))
+  (progn
+(exwm--log "Focus on #x%x with WM_TAKE_FOCUS" id)
+(xcb:+request exwm--connection
+(make-instance 'xcb:icccm:SendEvent
+   :destination id
+   :event (xcb:marshal
+   (make-instance 'xcb:icccm:WM_TAKE_FOCUS
+  :window id
+  :time
+  exwm-input--timestamp)
+   exwm--connection
+(exwm--log "Focus on #x%x with SetInputFocus" id)
+(xcb:+request exwm--connection
+(make-instance 'xcb:SetInputFocus
+   :revert-to xcb:InputFocus:Parent :focus id
+   :time xcb:Time:CurrentTime)))
+  (xcb:flush exwm--connection
 
 (defvar exwm-input--focus-window nil "The (Emacs) window to be focused.")
 (defvar exwm-input--redirected nil
@@ -311,27 +312,27 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 (defun exwm-input--grab-keyboard (&optional id)
   "Grab all key events on window ID."
   (unless id (setq id (exwm--buffer->id (window-buffer
-  (cl-assert id)
-  (when (xcb:+request-checked+request-check exwm--connection
-(make-instance 'xcb:GrabKey
-   :owner-events 0 :grab-window id
-   :modifiers xcb:ModMask:Any
-   :key xcb:Grab:Any
-   :pointer-mode xcb:GrabMode:Async
-   :keyboard-mode xcb:GrabMode:Async))
-(exwm--log "Failed to grab keyboard for #x%x" id))
-  (setq exwm--on-KeyPress 'exwm-input--on-KeyPress-line-mode))
+  (when id
+(when (xcb:+request-checked+request-check exwm--connection
+  (make-instance 'xcb:GrabKey
+ :owner-events 0 :grab-window id
+ :modifiers xcb:ModMask:Any
+ :key xcb:Grab:Any
+ :pointer-mode xcb:GrabMode:Async
+ :keyboard-mode xcb:GrabMode:Async))
+  (exwm--log "Failed to grab keyboard for #x%x" id))
+(setq exwm--on-KeyPress 'exwm-input--on-KeyPress-line-mode)))
 
 (defun exwm-input--release-keyboard (&optional id)
   "Ungrab all key events on window ID."
   (unless id (setq id (exwm--buffer->id (window-buffer
-  (cl-assert id)
-  (when (xcb:+request-checked+request-check exwm--connection
-(make-instance 'xcb:UngrabKey
-   :key xcb:Grab:Any :grab-window id
-   :modifiers xcb:ModMask:Any))
-(exwm--log "Failed to release keyboard for #x%x" id))
-  (setq exwm--on-Ke

[elpa] externals/xelb ad845df 28/42: Merge pull request #4 from pipcet/data-offset

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit ad845df3b5818943ea97f73902f12fd6a6c7cfd5
Merge: 520120a 1e20b20
Author: Chris Feng 
Commit: Chris Feng 

Merge pull request #4 from pipcet/data-offset

Adjust to unmarshalling API changes.
---
 xcb-icccm.el |   11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/xcb-icccm.el b/xcb-icccm.el
index feff43c..0e96849 100644
--- a/xcb-icccm.el
+++ b/xcb-icccm.el
@@ -138,19 +138,22 @@ This method automatically format the value as 8, 16 or 32 
bits array."
(cl-assert (= (* 2 value-len) (length tmp)))
(if ~lsb
(dotimes (i value-len)
- (setf value (vconcat value (vector (xcb:-unpack-u2-lsb tmp
+ (setf value (vconcat value
+  (vector (xcb:-unpack-u2-lsb tmp 0
  (setq tmp (substring tmp 2)))
  (dotimes (i value-len)
-   (setf value (vconcat value (vector (xcb:-unpack-u2 tmp
+   (setf value (vconcat value
+(vector (xcb:-unpack-u2 tmp 0
(setq tmp (substring tmp 2)
   (32
(cl-assert (= (* 4 value-len) (length tmp)))
(if ~lsb
(dotimes (i value-len)
- (setf value (vconcat value (vector (xcb:-unpack-u4-lsb tmp
+ (setf value (vconcat value
+  (vector (xcb:-unpack-u4-lsb tmp 0
  (setq tmp (substring tmp 4)))
  (dotimes (i value-len)
-   (setf value (vconcat value (vector (xcb:-unpack-u4 tmp
+   (setf value (vconcat value (vector (xcb:-unpack-u4 tmp 0
(setq tmp (substring tmp 4)
   (_ (cl-assert nil)
 retval))



[elpa] externals/exwm cfbd9a5 61/64: Minor fix for window move

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit cfbd9a5a451cf57149215accbecc75ff7b4a8c3d
Author: Chris Feng 
Commit: Chris Feng 

Minor fix for window move

* exwm-workspace.el (exwm-workspace-move-window): Move to selected instead 
of
  the first window of a frame (workspace).
---
 exwm-workspace.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index d2619ee..40dd57c 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -204,7 +204,7 @@ The optional FORCE option is for internal use only."
  :parent (frame-parameter frame 'exwm-window-id)
  :x 0 :y 0))
   (xcb:flush exwm--connection)
-  (set-window-buffer (frame-first-window frame)
+  (set-window-buffer (frame-selected-window frame)
  (exwm--id->buffer id)
 (exwm-workspace--update-switch-history)))
 



[elpa] externals/xelb c99266a 31/42: Merge xelb-util into this repo

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit c99266a3318c077ef4ef9ca6d26582be0af90b16
Merge: 4621160 ad845df
Author: Chris Feng 
Commit: Chris Feng 

Merge xelb-util into this repo
---
 util/xcb-cursor.el  |  433 ++
 util/xcb-ewmh.el|  757 +
 util/xcb-icccm.el   |  542 +++
 util/xcb-keysyms.el |  326 
 util/xcb-xim.el | 1026 +++
 util/xcb-xlib.el|  113 ++
 6 files changed, 3197 insertions(+), 0 deletions(-)

diff --git a/util/xcb-cursor.el b/util/xcb-cursor.el
new file mode 100644
index 000..5579fff
--- /dev/null
+++ b/util/xcb-cursor.el
@@ -0,0 +1,433 @@
+;;; xcb-cursor.el --- Port of Xcursor  -*- lexical-binding: t -*-
+
+;; Copyright (C) 2015 Chris Feng
+
+;; Author: Chris Feng 
+;; Keywords: unix
+
+;; This file is not part of GNU Emacs.
+
+;; This file is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this file.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This library is a port of Xcursor in Xlib, and roughly corresponds to the
+;; xcb/util-cursor project.
+
+;; Usage tips:
+;; + Do not forget to call `xcb:cursor:init' for _every_ connection using this
+;;   library.
+;; + The only useful method in this library is `xcb:cursor:load-cursor', which
+;;   loads a cursor by its name (e.g. "left_ptr"), in the following order:
+;;   1. themed cursor
+;;   2. inherited themed cursor
+;;   3. standard X cursor
+
+;; Todo:
+;; + Add legacy support for RENDER.
+;; + Cursor should be set per screen (only the first is used right now).
+;; + Move codes corresponding to xcb/util-renderutil or xcb/util-image
+;;   elsewhere.
+
+;; References:
+;; + Xcursor(3).
+;; + xcb/util-cursor (git://anongit.freedesktop.org/xcb/util-cursor)
+;; + xcb/util-renderutil (git://anongit.freedesktop.org/xcb/util-renderutil)
+;; + xcb/util-image (git://anongit.freedesktop.org/xcb/util-image)
+
+;;; Code:
+
+(require 'xcb-xproto)
+(require 'xcb-render)
+
+;; FIXME: check if resource manager really works
+(cl-defmethod xcb:cursor:init ((obj xcb:connection))
+  "Initialize Xcursor for connection OBJ."
+  ;; Initialize resource manager
+  (let* ((root (slot-value (car (slot-value (xcb:get-setup obj) 'roots))
+   'root))
+ (rm (xcb:+request-unchecked+reply obj
+ (make-instance 'xcb:GetProperty
+:delete 0 :window root
+:property xcb:Atom:RESOURCE_MANAGER
+:type xcb:Atom:STRING
+:long-offset 0
+:long-length 16384))) ;FIXME: xcb/util-cursor
+ (rm (split-string
+  (decode-coding-string
+   (apply 'unibyte-string (append (slot-value rm 'value) nil))
+   'iso-latin-1)
+  "\n"))
+ theme size dpi)
+(dolist (i rm)
+  (pcase (replace-regexp-in-string "^\\(\\S-+\\)" "\\1" i)
+("Xcursor.theme"
+ (setq theme
+   (replace-regexp-in-string "^[^:]+:\\s-*\\(.+$\\)" "\\1" i)))
+("Xcursor.size"
+ (setq size
+   (string-to-int (replace-regexp-in-string "^[^:]+:\\s-*\\(.+$\\)"
+"\\1" i
+("Xft.dpi"
+ (setq dpi
+   (string-to-int (replace-regexp-in-string "^[^:]+:\\s-*\\(.+$\\)"
+"\\1" i))
+;; Get cursor size from XCURSOR_SIZE environment variable
+(let ((default-size (getenv "XCURSOR_SIZE")))
+  (when default-size
+(setq default-size (string-to-int default-size)))
+  (setq size (or default-size size)))
+;; Alternatives
+(when (and (not size) dpi)
+  (setq size (/ (* dpi 16) 72)));FIXME: xcb/util-cursor
+(unless size
+  (setq size
+;; FIXME: xcb/util-cursor
+(/ (min (x-display-pixel-width) (x-display-pixel-height)) 48)))
+;; Save default values
+(let ((plist (plist-get (slot-value obj 'extra-plist) 'cursor)))
+  (setq plist (plist-put plist 'theme theme)
+plist (plist-put plist '

[elpa] externals/xelb 846f4c0 33/42: Fix race conditions

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 846f4c098b5545312ad3eec6ed3d8bce3152f88b
Author: Chris Feng 
Commit: Chris Feng 

Fix race conditions

* Ensure event handlers are running sequentially
* Only accept outputs from the current process when calling
  `accept-process-output process` (close ch11ng/exwm#53)
---
 xcb.el |   24 ++--
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/xcb.el b/xcb.el
index 29475f8..c356c63 100644
--- a/xcb.el
+++ b/xcb.el
@@ -78,7 +78,7 @@
(setup-data :initform nil)   ;X connection setup data
(request-cache :initform []) ;cache for outgoing requests
(message-cache :initform []) ;cache for incoming messages
-   (event-lock :initform nil)
+   (event-lock :initform 0)
(event-queue :initform nil)
(error-plist :initform nil)
(reply-plist :initform nil)
@@ -186,7 +186,7 @@ SCREEN."
 (with-timeout (xcb:connection-timeout (xcb:disconnect obj)
(error "[XELB] Connection timeout"))
   (while (not (slot-value obj 'setup-data))
-(accept-process-output process 1)
+(accept-process-output process 1 nil 1)
 
 (defun xcb:-connection-filter (process message)
   "Filter function for an X connection.
@@ -304,15 +304,15 @@ Concurrency is disabled as it breaks the orders of 
errors, replies and events."
   (when (/= current-cache-length cache-length)
 (xcb:-connection-filter process []
   (with-slots (event-lock event-queue) connection
-(unless event-lock
-  (setf event-lock t)
+(unless (< 0 event-lock)
+  (cl-incf event-lock)
   (let (event data synthetic)
 (while (setq event (pop event-queue))
   (setq data (elt event 1)
 synthetic (elt event 2))
   (dolist (listener (elt event 0))
 (funcall listener data synthetic
-  (setf event-lock nil))
+  (cl-decf event-lock))
 
 (cl-defmethod xcb:disconnect ((obj xcb:connection))
   "Disconnect from X server."
@@ -441,10 +441,10 @@ classes of EVENT (since they have the same event number)."
  (+ (length msg) (length cache))) ;flush on cache full
   (xcb:flush obj)
   (setq cache []))
-(xcb:-log "Cache request: %s" request)
 (with-slots (request-cache request-sequence) obj
   (setf request-cache (vconcat cache msg)
 request-sequence (1+ request-sequence))
+  (xcb:-log "Cache request #%d: %s" request-sequence request)
   request-sequence)))
 
 (cl-defmethod xcb:-+request ((obj xcb:connection) request)
@@ -510,10 +510,12 @@ Otherwise no error will ever be reported."
 ;; Single reply
 (let ((process (slot-value obj 'process)))
   ;; Wait until the request processed
-  (with-timeout (xcb:connection-timeout (error "[XELB] Retrieve reply 
timeout"))
+  (cl-incf (slot-value obj 'event-lock))
+  (with-timeout (xcb:connection-timeout (warn "[XELB] Retrieve reply 
timeout"))
 (while (and (> sequence (slot-value obj 'reply-sequence))
 (> sequence (slot-value obj 'error-sequence)))
-  (accept-process-output process 1)
+  (accept-process-output process 1 nil 1)))
+  (cl-decf (slot-value obj 'event-lock
   (let* ((reply-plist (slot-value obj 'reply-plist))
  (reply-data (plist-get reply-plist sequence))
  (error-plist (slot-value obj 'error-plist))
@@ -622,9 +624,11 @@ Sync by sending a GetInputFocus request and waiting until 
it's processed."
 (process (slot-value obj 'process)))
 (xcb:flush obj)
 ;; Wait until request processed
-(with-timeout (xcb:connection-timeout (error "[XELB] Sync timeout"))
+(cl-incf (slot-value obj 'event-lock))
+(with-timeout (xcb:connection-timeout (warn "[XELB] Sync timeout"))
   (while (> sequence (slot-value obj 'reply-sequence))
-(accept-process-output process 1)
+(accept-process-output process 1 nil 1)))
+(cl-decf (slot-value obj 'event-lock
 
 (cl-defmethod xcb:-error-or-event-class->number ((obj xcb:connection) class)
   "Return the error/event number of a error/event class CLASS."



[elpa] externals/exwm 3b9d0dd 17/64: Fixes for manage/unmanage window

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 3b9d0dd9217add078415ecda644b5cd19632f1fc
Author: Chris Feng 
Commit: Chris Feng 

Fixes for manage/unmanage window

* Make sure `exwm-manage--manage-window-queue` is cleaned
* Improve input focus handling after unmanaging a window
* Remove a redundant call to `exwm-layout--show`
---
 exwm-floating.el |1 -
 exwm-manage.el   |   16 +---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index f302bc0..3e9cade 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -199,7 +199,6 @@
 exwm--frame exwm-workspace--current))
 (select-frame exwm-workspace--current t)
 (set-window-buffer nil buffer)
-(exwm-layout--show id)
 (exwm-input--set-focus id))
   (setq exwm-input--focus-lock nil))
 
diff --git a/exwm-manage.el b/exwm-manage.el
index 8594066..8bf118e 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -61,9 +61,11 @@ corresponding buffer.")
   (make-instance 'xcb:ChangeWindowAttributes
  :window id :value-mask xcb:CW:EventMask
  :event-mask exwm--client-event-mask))
-  (delq id exwm-manage--manage-window-queue) ;cleanup
+  (setq exwm-manage--manage-window-queue
+(delq id exwm-manage--manage-window-queue)) ;cleanup
   (throw 'return 'dead))
-(delq id exwm-manage--manage-window-queue) ;cleanup (late enough)
+(setq exwm-manage--manage-window-queue
+  (delq id exwm-manage--manage-window-queue)) ;cleanup (late enough)
 (with-current-buffer (generate-new-buffer "*EXWM*")
   (push `(,id . ,(current-buffer)) exwm--id-buffer-alist)
   (exwm-mode)
@@ -193,7 +195,15 @@ corresponding buffer.")
 (let ((floating exwm--floating-frame))
   (kill-buffer)
   (when floating
-(select-frame-set-input-focus exwm-workspace--current)))
+(if (eq 'exwm-mode
+(with-current-buffer
+(window-buffer
+ (frame-first-window exwm-workspace--current))
+  major-mode))
+;; Input focus is to be set on a window
+(x-focus-frame exwm-workspace--current)
+  ;; Set input focus on a frame
+  (select-frame-set-input-focus exwm-workspace--current
 
 (defun exwm-manage--scan ()
   "Search for existing windows and try to manage them."



[elpa] externals/xelb 946d3ed 14/42: Fix keyboard mapping update problem

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 946d3edbf0dc5074e76c0577e3cbb8e97017ff96
Author: Chris Feng 
Commit: Chris Feng 

Fix keyboard mapping update problem

Keep result from previous update.
---
 xcb-keysyms.el |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/xcb-keysyms.el b/xcb-keysyms.el
index d64abe5..c82f695 100644
--- a/xcb-keysyms.el
+++ b/xcb-keysyms.el
@@ -74,12 +74,14 @@ This method must be called before using any other method in 
this module."
:first-keycode first-keycode :count count)))
  (keysyms-per-keycode (slot-value reply 'keysyms-per-keycode))
  (keysyms (slot-value reply 'keysyms))
- result keycode index row-index keysym)
+ (result (plist-get (slot-value obj 'extra-plist) 'keysyms))
+ keycode index row-index keysym)
 (dotimes (i count)
   (setq keycode (+ i first-keycode)
 index (* i keysyms-per-keycode)
 row-index 0)
   (setq keysym (nth (+ index row-index) keysyms))
+  (setq result (assq-delete-all keycode result))
   (while (and (/= keysym 0) (< row-index keysyms-per-keycode))
 (setq result (append result `((,keycode . ,keysym)))
   row-index (1+ row-index)



[elpa] externals/exwm 048994c 24/64: Remove redundant code caused by the concurrency of events (continued)

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 048994c7948528630b5c13f56dd22a9b2972e09c
Author: Chris Feng 
Commit: Chris Feng 

Remove redundant code caused by the concurrency of events (continued)

Remove `exwm--with-current-id`, which was introduced to as a wrapper to
`with-current-buffer` to do extra checks. Note that in functions run as 
hooks,
the validation of window ID is still required as they are not synchronized 
with
events.
---
 exwm-input.el  |   37 -
 exwm-layout.el |4 +++-
 exwm-manage.el |4 ++--
 exwm.el|   26 +-
 4 files changed, 34 insertions(+), 37 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 97dfd53..24aa94a 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -56,7 +56,7 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 
 (defun exwm-input--set-focus (id)
   "Set input focus to window ID in a proper way."
-  (exwm--with-current-id id
+  (with-current-buffer (exwm--id->buffer id)
 (exwm--log "Set focus ID to #x%x" id)
 (setq exwm-input--focus-id id)
 (if (and (not exwm--hints-input)
@@ -105,21 +105,24 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 exwm--floating-frame)
  (x-focus-frame exwm--floating-frame)))
  ;; Finally focus the window
- (exwm-input--set-focus exwm-input--focus-id))
-(exwm--with-current-id exwm-input--focus-id
-  (exwm--log "Set focus ID to #x%x" xcb:Window:None)
-  (setq exwm-input--focus-id xcb:Window:None)
-  (let ((frame (selected-frame)))
-(if exwm--floating-frame
-(unless (or (eq frame exwm--floating-frame)
-(active-minibuffer-window))
-  ;; Redirect input focus to the workspace frame
-  (exwm--log "Redirect input focus (%s => %s)"
- exwm--floating-frame frame)
-  (redirect-frame-focus exwm--floating-frame frame))
-  ;; Focus the workspace frame
-  (exwm--log "Focus on workspace %s" frame)
-  (x-focus-frame frame))
+ (when (exwm--id->buffer exwm-input--focus-id)
+   (exwm-input--set-focus exwm-input--focus-id)))
+(let ((buffer (exwm--id->buffer exwm-input--focus-id)))
+  (when buffer
+(with-current-buffer buffer
+  (exwm--log "Set focus ID to #x%x" xcb:Window:None)
+  (setq exwm-input--focus-id xcb:Window:None)
+  (let ((frame (selected-frame)))
+(if exwm--floating-frame
+(unless (or (eq frame exwm--floating-frame)
+(active-minibuffer-window))
+  ;; Redirect input focus to the workspace frame
+  (exwm--log "Redirect input focus (%s => %s)"
+ exwm--floating-frame frame)
+  (redirect-frame-focus exwm--floating-frame frame))
+  ;; Focus the workspace frame
+  (exwm--log "Focus on workspace %s" frame)
+  (x-focus-frame frame
 (setq exwm-input--focus-lock nil)))
 
 (defun exwm-input--finish-key-sequence ()
@@ -163,7 +166,7 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 (t
  ;; Click to focus
  (unless (and (boundp 'exwm--id) (= event exwm--id))
-   (exwm--with-current-id event
+   (with-current-buffer (exwm--id->buffer event)
  (select-frame-set-input-focus (or exwm--floating-frame
exwm--frame))
  (select-window (get-buffer-window nil 'visible
diff --git a/exwm-layout.el b/exwm-layout.el
index 4ae4859..5d056af 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -34,7 +34,9 @@
   (make-instance 'xcb:icccm:set-WM_STATE
  :window id :state xcb:icccm:WM_STATE:NormalState
  :icon xcb:Window:None))
-  (let* ((edges (or (exwm--with-current-id id exwm--floating-edges)
+  (let* ((buffer (exwm--id->buffer id))
+ (edges (or (and buffer
+ (with-current-buffer buffer exwm--floating-edges))
 (window-inside-pixel-edges window)))
  (x (elt edges 0))
  (y (elt edges 1))
diff --git a/exwm-manage.el b/exwm-manage.el
index 6c22948..9d98607 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -35,7 +35,7 @@ corresponding buffer.")
 
 (defun exwm-manage--update-geometry (id &optional force)
   "Update window geometry."
-  (exw

[elpa] externals/xelb 1cea22d 20/42: Provide a way to disable auto-padding

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 1cea22d26295f089139233907a97248451d5fe92
Author: Chris Feng 
Commit: Chris Feng 

Provide a way to disable auto-padding

The auto-padding feature need to be disabled for at least XIM. Perhaps it's
better to insert auto-padding fields with code generator directly.
---
 xcb-types.el |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/xcb-types.el b/xcb-types.el
index 3fd06bf..b3eecdb 100644
--- a/xcb-types.el
+++ b/xcb-types.el
@@ -293,7 +293,8 @@ Consider let-bind it rather than change its global value.")
 (defclass xcb:-struct ()
   ((~lsb :initarg :~lsb
  :initform (symbol-value 'xcb:lsb) ;see `eieio-default-eval-maybe'
- :type xcb:-ignore))
+ :type xcb:-ignore)
+   (~auto-padding :initarg :~auto-padding :initform t :type xcb:-ignore))
   :documentation "Struct type.")
 
 (cl-defmethod xcb:marshal ((obj xcb:-struct))
@@ -350,7 +351,7 @@ The optional POS argument indicates current byte index of 
the field (used by
 (data (slot-value obj list-name))
 implicit-padding)
(unless (integerp list-size)
- (setq implicit-padding t)
+ (when (slot-value obj '~auto-padding) (setq implicit-padding t))
  (setq list-size (eval list-size `((obj . ,obj
  (unless list-size
(setq list-size (length data ;list-size can be nil
@@ -467,7 +468,7 @@ and the second the consumed length."
(list-size (plist-get initform 'size))
implicit-padding)
(unless (integerp list-size)
- (setq implicit-padding t)
+ (when (slot-value obj '~auto-padding) (setq implicit-padding t))
  (setq list-size (eval list-size `((obj . ,obj) (ctx . ,ctx)
(cl-assert (integerp list-size))
(pcase list-type



[elpa] externals/xelb 520120a 24/42: Merge pull request #3 from pipcet/ignore-missing-values

2015-09-17 Thread Chris Feng
branch: externals/xelb
commit 520120a172e8ceae8a36464a3848a4aaeb5aacf0
Merge: e153829 f465091
Author: Chris Feng 
Commit: Chris Feng 

Merge pull request #3 from pipcet/ignore-missing-values

It's valid for WM_NORMAL_HINTS responses only to have 15 words.
---
 xcb-icccm.el |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/xcb-icccm.el b/xcb-icccm.el
index 1d178d8..feff43c 100644
--- a/xcb-icccm.el
+++ b/xcb-icccm.el
@@ -291,9 +291,8 @@ explicitly listed out."
  (slots (nthcdr (length slots-orig) slots))
  (value (slot-value obj 'value)))
 (unless value (setq value (make-vector (length slots) nil))) ;fallback
-(cl-assert (= (length value) (length slots)))
 ;; Set explicit fields from value field
-(dotimes (i (length slots))
+(dotimes (i (length value))
   (setf (slot-value obj (cl--slot-descriptor-name (elt slots i)))
 (elt value i)))
 retval))



[elpa] externals/exwm edc70eb 22/64: Remove redundant code caused by the concurrency of events

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit edc70eb6616b818463c94b5ab8c9e3f1dfd177c9
Author: Chris Feng 
Commit: Chris Feng 

Remove redundant code caused by the concurrency of events

With the introduction of ch11ng/xelb@6a7bccc, many weird behaviors should
disappear. These include by not limit to
* race conditions when managing a window (a workaround is provided in 
@14628a9)
* race conditions when unmanaging a window
This commit removes some corresponding code.
---
 exwm-manage.el |   11 +--
 1 files changed, 1 insertions(+), 10 deletions(-)

diff --git a/exwm-manage.el b/exwm-manage.el
index 8bf118e..6c22948 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -42,30 +42,21 @@ corresponding buffer.")
 (when reply ;nil when destroyed
   (setq exwm--geometry reply))
 
-(defvar exwm-manage--manage-window-queue nil
-  "List of window IDs to prevent race conditions.")
-
 (defun exwm-manage--manage-window (id)
   "Manage window ID."
   (exwm--log "Try to manage #x%x" id)
   (setq exwm-input--focus-lock t)
   (catch 'return
 ;; Ensure it's not managed
-(when (or (assoc id exwm--id-buffer-alist)
-  (memq id exwm-manage--manage-window-queue))
+(when (assoc id exwm--id-buffer-alist)
   (exwm--log "#x%x is already managed" id)
   (throw 'return 'managed))
-(push id exwm-manage--manage-window-queue) ;prevent reentering
 ;; Ensure it's alive
 (when (xcb:+request-checked+request-check exwm--connection
   (make-instance 'xcb:ChangeWindowAttributes
  :window id :value-mask xcb:CW:EventMask
  :event-mask exwm--client-event-mask))
-  (setq exwm-manage--manage-window-queue
-(delq id exwm-manage--manage-window-queue)) ;cleanup
   (throw 'return 'dead))
-(setq exwm-manage--manage-window-queue
-  (delq id exwm-manage--manage-window-queue)) ;cleanup (late enough)
 (with-current-buffer (generate-new-buffer "*EXWM*")
   (push `(,id . ,(current-buffer)) exwm--id-buffer-alist)
   (exwm-mode)



[elpa] externals/exwm b755296 26/64: Remove redundant code caused by the concurrency of events (contd, 2)

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit b755296f547938d0f97d6aa49b8cb0d726de9eb9
Author: Chris Feng 
Commit: Chris Feng 

Remove redundant code caused by the concurrency of events (contd, 2)

* Remove locks that are no longer required
* Also fix #20 (inactive workspace frame steals input focus)
---
 exwm-floating.el  |8 +
 exwm-input.el |   75 
 exwm-manage.el|5 +---
 exwm-workspace.el |   18 +
 4 files changed, 45 insertions(+), 61 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index bc7ee33..3971fa4 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -39,7 +39,6 @@
 (defun exwm-floating--set-floating (id)
   "Make window ID floating."
   (interactive)
-  (setq exwm-input--focus-lock t)
   (when (get-buffer-window (exwm--id->buffer id)) ;window in non-floating state
 (set-window-buffer (selected-window) (other-buffer))) ;hide it first
   (let* ((original-frame
@@ -167,13 +166,11 @@
   ;; FIXME: other conditions?
   (unless (memq xcb:Atom:_NET_WM_WINDOW_TYPE_UTILITY exwm-window-type)
 (x-focus-frame exwm--floating-frame)
-(exwm-input--set-focus id)))
-(setq exwm-input--focus-lock nil)))
+(exwm-input--set-focus id)
 
 (defun exwm-floating--unset-floating (id)
   "Make window ID non-floating."
   (interactive)
-  (setq exwm-input--focus-lock t)
   (let ((buffer (exwm--id->buffer id)))
 ;; Reparent to workspace frame
 (xcb:+request exwm--connection
@@ -201,8 +198,7 @@
 exwm--frame exwm-workspace--current))
 (select-frame exwm-workspace--current t)
 (set-window-buffer nil buffer)
-(exwm-input--set-focus id))
-  (setq exwm-input--focus-lock nil))
+(exwm-input--set-focus id)))
 
 (defun exwm-floating-toggle-floating ()
   "Toggle the current window between floating and non-floating states."
diff --git a/exwm-input.el b/exwm-input.el
index 293fd67..a193314 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -81,49 +81,44 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 
 (defvar exwm-input--focus-id xcb:Window:None
   "The window that is theoretically focused.")
-(defvar exwm-input--focus-lock nil
-  "Non-nil when input focus should stay unchanged.")
 
 (defun exwm-input--update-focus ()
   "Update input focus."
-  (unless exwm-input--focus-lock
-(setq exwm-input--focus-lock t)
-(when (and (frame-parameter nil 'exwm-window-id) ;e.g. emacsclient frame
-   (eq (current-buffer) (window-buffer))) ;e.g. `with-temp-buffer'
-  (if (eq major-mode 'exwm-mode)
-  (progn (exwm--log "Set focus ID to #x%x" exwm--id)
- (setq exwm-input--focus-id exwm--id)
- (when exwm--floating-frame
-   (if (eq (selected-frame) exwm--floating-frame)
-   ;; Cancel the possible input focus redirection
-   (progn
- (exwm--log "Cancel input focus redirection on %s"
-exwm--floating-frame)
- (redirect-frame-focus exwm--floating-frame nil))
- ;; Focus the floating frame
- (exwm--log "Focus on floating frame %s"
-exwm--floating-frame)
- (x-focus-frame exwm--floating-frame)))
- ;; Finally focus the window
- (when (exwm--id->buffer exwm-input--focus-id)
-   (exwm-input--set-focus exwm-input--focus-id)))
-(let ((buffer (exwm--id->buffer exwm-input--focus-id)))
-  (when buffer
-(with-current-buffer buffer
-  (exwm--log "Set focus ID to #x%x" xcb:Window:None)
-  (setq exwm-input--focus-id xcb:Window:None)
-  (let ((frame (selected-frame)))
-(if exwm--floating-frame
-(unless (or (eq frame exwm--floating-frame)
-(active-minibuffer-window))
-  ;; Redirect input focus to the workspace frame
-  (exwm--log "Redirect input focus (%s => %s)"
- exwm--floating-frame frame)
-  (redirect-frame-focus exwm--floating-frame frame))
-  ;; Focus the workspace frame
-  (exwm--log "Focus on workspace %s" frame)
-  (x-focus-frame frame
-(setq exwm-input--focus-lock nil)))
+  (when (and (frame-parameter nil 'exwm-window-id) ;e.g. emacsclient frame
+ (eq (current-buffer) (window-buffer))) ;e.g. `with-temp-buffer'
+(exwm--log "EXWM-INPUT--UPDATE-FOCUS")
+(if (eq major-mode 'exwm-mode)
+(progn (exwm--log &q

[elpa] externals/exwm 86764d2 07/64: Add basic RandR support

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 86764d27a333be53336cf2e38d237c7bfa218e7b
Author: Chris Feng 
Commit: Chris Feng 

Add basic RandR support

This implementation is analogous to that in i3-wm, which requires external
tools to properly configure RandR first.
---
 exwm-randr.el |  131 +
 exwm-workspace.el |   78 +---
 exwm.el   |3 +-
 3 files changed, 184 insertions(+), 28 deletions(-)

diff --git a/exwm-randr.el b/exwm-randr.el
new file mode 100644
index 000..c9ad1ce
--- /dev/null
+++ b/exwm-randr.el
@@ -0,0 +1,131 @@
+;;; exwm-randr.el --- RandR Module for EXWM  -*- lexical-binding: t -*-
+
+;; Copyright (C) 2015 Chris Feng
+
+;; Author: Chris Feng 
+;; Keywords: unix
+
+;; This file is not part of GNU Emacs.
+
+;; This file is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this file.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This module adds RandR support for EXWM. Currently it requires external
+;; tools such as xrandr(1) to properly configure RandR first. This dependency
+;; may be removed in the future, but more work is needed before that.
+
+;; To use this module, first set `exwm-randr-workspace-output-plist':
+;;   (setq exwm-randr-workspace-output-plist '(0 "VGA1"))
+;; Then configure RandR with 'xrandr':
+;;   $ xrandr --output VGA1 --left-of LVDS1 --auto
+;; With above lines, workspace 0 should be assigned to the output named "VGA1",
+;; staying at the left of other workspaces on the output "LVDS1".
+
+;; Todo:
+;; + Update EWMH hints.
+
+;; References:
+;; + RandR (http://www.x.org/archive/X11R7.7/doc/randrproto/randrproto.txt)
+
+;;; Code:
+
+(require 'xcb-randr)
+
+(defvar exwm-randr-workspace-output-plist nil)
+
+(defun exwm-randr--refresh ()
+  "Refresh workspaces according to the updated RandR info."
+  (let (output-plist default-geometry)
+;; Query all outputs
+(with-slots (config-timestamp outputs)
+(xcb:+request-unchecked+reply exwm--connection
+(make-instance 'xcb:randr:GetScreenResources
+   :window exwm--root))
+  (dolist (output outputs)
+(with-slots (crtc connection name)
+(xcb:+request-unchecked+reply exwm--connection
+(make-instance 'xcb:randr:GetOutputInfo
+   :output output
+   :config-timestamp config-timestamp))
+  (setq name;UTF-8 encoded
+(decode-coding-string (apply 'unibyte-string name) 'utf-8))
+  (if (or (/= connection xcb:randr:Connection:Connected)
+  (= 0 crtc))   ;FIXME
+  (plist-put output-plist name nil)
+(with-slots (x y width height)
+(xcb:+request-unchecked+reply exwm--connection
+(make-instance 'xcb:randr:GetCrtcInfo
+   :crtc crtc
+   :config-timestamp config-timestamp))
+  (setq output-plist (plist-put output-plist name
+(vector x y width height)))
+  (unless default-geometry ;assume the first output as primary
+(setq default-geometry (vector x y width height
+(cl-assert (<= 2 (length output-plist)))
+(dotimes (i exwm-workspace-number)
+  (let* ((output (plist-get exwm-randr-workspace-output-plist i))
+ (geometry (lax-plist-get output-plist output))
+ (frame (elt exwm-workspace--list i)))
+(unless geometry
+  (setq geometry default-geometry
+output nil))
+(set-frame-parameter frame 'exwm-randr-output output)
+(xcb:+request exwm--connection
+(make-instance 'xcb:ConfigureWindow
+   :window (frame-parameter frame 'exwm-outer-id)
+   :value-mask (logior xcb:ConfigWindow:X
+   xcb:ConfigWindow:Y
+   xcb:ConfigWindow:Width
+   xcb:ConfigWindow:Height)
+   :x (elt geometry 0) :y (elt geometry 1)
+   :width (elt geometry 2) :height (elt geometry 3)))

[elpa] externals/exwm 981293f 44/64: Replay KeyPress events instead of fake them in line-mode

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 981293f06af320f2929fd0d209eb97e63b4d8e3e
Author: Chris Feng 
Commit: Chris Feng 

Replay KeyPress events instead of fake them in line-mode

X windows in line-mode receive KeyPress events faked with SendEvent requests
previously. This causes many problems including:

* Some applications (e.g. xterm) ignore synthetic events completely
* KeyPress and KeyRelease evnets arrive disorderly

This commit makes EXWM exploiting AllowEvents requests (in ReplayKeyboard 
mode)
to forward KeyPress events to X windows instead.
---
 exwm-input.el |   77 +---
 1 files changed, 24 insertions(+), 53 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 760e5c9..ede635c 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -241,61 +241,27 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 (defvar exwm-input--temp-line-mode nil
   "Non-nil indicates it's in temporary line-mode for char-mode.")
 
-;; ;; This implementation has a problem that it also releases queued keys after
-;; ;; requesting AllowEvent. The client window will capture unexpected key 
events
-;; ;; in this case.
-;; ;; P.S.; to use this implementation, comment out the KeyRelease listener
-;; ;;   together with this one and make GrabKey in Sync mode.
-;; (cl-defmethod exwm-input--on-KeyPress-line-mode ((obj xcb:KeyPress))
-;;   "Parse X KeyPress event to Emacs key event and then feed the command 
loop."
-;;   (with-slots (detail state) obj
-;; (let ((keysym (xcb:keysyms:keycode->keysym exwm--connection detail 
state))
-;;   event window mode)
-;;   (when (and keysym
-;;  (setq event (xcb:keysyms:keysym->event keysym state))
-;;  (or exwm-input--during-key-sequence
-;;  (setq window (active-minibuffer-window))
-;;  (eq event ?\C-c)   ;mode-specific key
-;;  (memq event exwm-input--global-prefix-keys)
-;;  (memq event exwm-input-prefix-keys)
-;;  (memq event
-;;exwm-input--simulation-prefix-keys)))
-;; (setq mode xcb:Allow:SyncKeyboard)
-;; (unless window (setq exwm-input--during-key-sequence t))
-;; (push event unread-command-events))
-;;   (xcb:+request exwm--connection
-;;   (make-instance 'xcb:AllowEvents
-;;  :mode (or mode xcb:Allow:ReplayKeyboard)
-;;  :time xcb:Time:CurrentTime))
-;;   (xcb:flush exwm--connection
-
-;; This implementation has a drawback that some (legacy) applications
-;; (e.g. xterm) ignore the synthetic key events, making it only viable for EXWM
-;; to work in char-mode in such case.
 (cl-defmethod exwm-input--on-KeyPress-line-mode ((obj xcb:KeyPress))
   "Parse X KeyPress event to Emacs key event and then feed the command loop."
   (with-slots (detail state) obj
 (let ((keysym (xcb:keysyms:keycode->keysym exwm--connection detail state))
-  event minibuffer-window)
-  (if (and keysym
-   (setq event (xcb:keysyms:keysym->event keysym state))
-   (or exwm-input--during-key-sequence
-   (setq minibuffer-window (active-minibuffer-window))
-   (eq event ?\C-c)   ;mode-specific key
-   (memq event exwm-input--global-prefix-keys)
-   (memq event exwm-input-prefix-keys)
-   (memq event exwm-input--simulation-prefix-keys)))
-  ;; Forward key to Emacs frame
-  (progn (unless minibuffer-window
-   (setq exwm-input--during-key-sequence t))
- (push event unread-command-events))
-;; Forward key to window
-(xcb:+request exwm--connection
-(make-instance 'xcb:SendEvent
-   :propagate 0 :destination (slot-value obj 'event)
-   :event-mask xcb:EventMask:NoEvent
-   :event (xcb:marshal obj exwm--connection)))
-(xcb:flush exwm--connection)
+  event minibuffer-window mode)
+  (when (and keysym
+ (setq event (xcb:keysyms:keysym->event keysym state))
+ (or exwm-input--during-key-sequence
+ (setq minibuffer-window (active-minibuffer-window))
+ (eq event ?\C-c)   ;mode-specific key
+ (memq event exwm-input--global-prefix-keys)
+ (memq event exwm-input-prefix-keys)
+ (memq event exwm-input--simulation-prefix-keys)))
+(setq mode xcb:Allow:AsyncKeyboard)
+(unless minibuffer-window (setq exwm-input--during-key-sequence t))
+(push event unread-command-events))
+  (xcb:+request exwm--connection
+  (make-instance &#

[elpa] externals/exwm dbcabe7 60/64: Implement move/resize with keyboard

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit dbcabe7946592c0af550c31b9a47a9856fd2d501
Author: Chris Feng 
Commit: Chris Feng 

Implement move/resize with keyboard

* exwm-floating.el: Remove an invalid TODO item.
* exwm-floating.el (exwm-floating--set-floating)
  (exwm-floating-hide-mode-line, exwm-floating-show-mode-line): Set
  window-size-fixed only for fixed-size floating windows.
* exwm-floating.el (exwm-floating-move): New function for moving a floating
  window.
* exwm-layout.el (exwm-layout-enlarge-window)
  (exwm-layout-enlarge-window-horizontally, exwm-layout-shrink-window)
  (exwm-layout-shrink-window-horizontally): New commands for interactively
  resizing a floating window.
---
 exwm-floating.el |   34 ++
 exwm-layout.el   |   97 ++
 2 files changed, 123 insertions(+), 8 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index 4ea495d..0449376 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -24,9 +24,6 @@
 ;; This module deals with the conversion between floating and non-floating
 ;; states and implements moving/resizing operations on floating windows.
 
-;; Todo:
-;; + move/resize with keyboard.
-
 ;;; Code:
 
 (require 'xcb-cursor)
@@ -184,7 +181,7 @@
 (xcb:flush exwm--connection)
 ;; Set window/buffer
 (with-current-buffer (exwm--id->buffer id)
-  (setq window-size-fixed t ;make frame fixed size
+  (setq window-size-fixed exwm--fixed-size
 exwm--frame original-frame
 exwm--floating-frame frame)
   (set-window-buffer window (current-buffer)) ;this changes current buffer
@@ -242,8 +239,8 @@
 
 Default to resize `exwm--floating-frame' unless FRAME-OUTER-ID is non-nil.
 This function will issue an `xcb:GetGeometry' request unless WIDTH and HEIGHT
-are provided. You should call `xcb:flush' and assign `window-size-fixed' a
-non-nil value afterwards."
+are provided. You should call `xcb:flush' and restore the value of
+`window-size-fixed' afterwards."
   (setq window-size-fixed nil)
   (unless (and width height)
 (let ((geometry (xcb:+request-unchecked+reply exwm--connection
@@ -274,7 +271,7 @@ non-nil value afterwards."
   mode-line-format nil)
 (exwm-floating--fit-frame-to-window)
 (xcb:flush exwm--connection)
-(setq window-size-fixed t)))
+(setq window-size-fixed exwm--fixed-size)))
 
 (defun exwm-floating-show-mode-line ()
   "Show mode-line of a floating frame."
@@ -287,7 +284,7 @@ non-nil value afterwards."
 (exwm-floating--fit-frame-to-window)
 (exwm-input-grab-keyboard)   ;mode-line-format may be outdated
 (xcb:flush exwm--connection)
-(setq window-size-fixed t)))
+(setq window-size-fixed exwm--fixed-size)))
 
 (defvar exwm-floating--moveresize-calculate nil
   "Calculate move/resize parameters [frame-id event-mask x y width height].")
@@ -462,6 +459,27 @@ non-nil value afterwards."
  :width (elt result 4) :height (elt result 5)))
   (xcb:flush exwm--connection
 
+(defun exwm-floating-move (&optional delta-x delta-y)
+  "Move a floating window right by DELTA-X pixels and down by DELTA-Y pixels.
+
+Both DELTA-X and DELTA-Y default to 1.  This command should be bound locally."
+  (unless (and (eq major-mode 'exwm-mode) exwm--floating-frame)
+(user-error "[EXWM] `exwm-floating-move' is only for floating X windows"))
+  (unless delta-x (setq delta-x 1))
+  (unless delta-y (setq delta-y 1))
+  (unless (and (= 0 delta-x) (= 0 delta-y))
+(let* ((id (frame-parameter exwm--floating-frame 'exwm-outer-id))
+   (geometry (xcb:+request-unchecked+reply exwm--connection
+ (make-instance 'xcb:GetGeometry :drawable id
+  (xcb:+request exwm--connection
+  (make-instance 'xcb:ConfigureWindow
+ :window id
+ :value-mask (logior xcb:ConfigWindow:X
+ xcb:ConfigWindow:Y)
+ :x (+ (slot-value geometry 'x) delta-x)
+ :y (+ (slot-value geometry 'y) delta-y
+(xcb:flush exwm--connection)))
+
 (defun exwm-floating--init ()
   "Initialize floating module."
   ;; Initialize cursors for moving/resizing a window
diff --git a/exwm-layout.el b/exwm-layout.el
index ae1f48d..27533a5 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -263,6 +263,103 @@
   exwm--floating-frame)))
(exwm-layout--refresh)
 
+(defun exwm-layout-enlarge-window (delta &optional horizontal)
+  "Make the selected window DELTA pixels taller.
+
+If no argument is given, make the selected window one pixel taller.  If the
+optional argument HORIZONTAL is non-nil, m

[elpa] externals/exwm 04e4269 29/64: Improve input focus switch mechanism

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 04e426961736c67046fa3809fc14f1ac027dae77
Author: Chris Feng 
Commit: Chris Feng 

Improve input focus switch mechanism

This commit should fix most input focus bugs (especially those related to
floating windows). The actual settings of input focus are delayed to exclude
redundant event. Dead code since this commit is removed.

This commit also fixes a bug for non-floating windows converted form 
floating
state. The workaround for `ido-mode` is also improved to properly handle
`exwm-mode` buffers.
---
 exwm-floating.el  |   16 +++-
 exwm-input.el |   95 +++--
 exwm-manage.el|   11 +-
 exwm-workspace.el |3 --
 exwm.el   |   18 +++---
 5 files changed, 62 insertions(+), 81 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index 7888fd2..e1d8738 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -179,12 +179,7 @@
 exwm--floating-frame frame)
   (set-window-buffer window (current-buffer)) ;this changes current buffer
   (set-window-dedicated-p window t))
-(with-current-buffer (exwm--id->buffer id)
-  ;; Some window should not get input focus on creation
-  ;; FIXME: other conditions?
-  (unless (memq xcb:Atom:_NET_WM_WINDOW_TYPE_UTILITY exwm-window-type)
-(x-focus-frame exwm--floating-frame)
-(exwm-input--set-focus id)
+(select-window window)))
 
 (defun exwm-floating--unset-floating (id)
   "Make window ID non-floating."
@@ -212,11 +207,12 @@
 (set-window-dedicated-p (frame-first-window exwm--floating-frame) nil)
 (delete-frame exwm--floating-frame))) ;remove the floating frame
 (with-current-buffer buffer
-  (setq exwm--floating-frame nil
+  (setq window-size-fixed nil
+exwm--floating-frame nil
 exwm--frame exwm-workspace--current))
-(select-frame exwm-workspace--current t)
-(set-window-buffer nil buffer)
-(exwm-input--set-focus id)))
+(let ((window (frame-selected-window exwm-workspace--current)))
+  (set-window-buffer window buffer)
+  (select-window window
 
 (defun exwm-floating-toggle-floating ()
   "Toggle the current window between floating and non-floating states."
diff --git a/exwm-input.el b/exwm-input.el
index 4acacdf..454521f 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -57,8 +57,6 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 (defun exwm-input--set-focus (id)
   "Set input focus to window ID in a proper way."
   (with-current-buffer (exwm--id->buffer id)
-(exwm--log "Set focus ID to #x%x" id)
-(setq exwm-input--focus-id id)
 (if (and (not exwm--hints-input)
  (memq xcb:Atom:WM_TAKE_FOCUS exwm--protocols))
 (progn
@@ -79,45 +77,53 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
  :time xcb:Time:CurrentTime)))
 (xcb:flush exwm--connection)))
 
-(defvar exwm-input--focus-id xcb:Window:None
-  "The window that is theoretically focused.")
+(defvar exwm-input--focus-buffer nil "The buffer to be focused.")
+(defvar exwm-input--redirected nil
+  "Indicate next update on buffer list is actually a result of redirection.")
+(defvar exwm-input--timer nil "Currently running timer.")
+
+(defun exwm-input--on-buffer-list-update ()
+  "Run in buffer-list-update-hook to track input focus."
+  (let ((frame (selected-frame))
+(buffer (current-buffer)))
+(when (and (not (minibufferp buffer))
+   (frame-parameter frame 'exwm-window-id) ;e.g. emacsclient frame
+   (eq buffer (window-buffer))) ;e.g. `with-temp-buffer'
+  (unless (and exwm-input--redirected
+   exwm-input--focus-buffer
+   (with-current-buffer exwm-input--focus-buffer
+ exwm--floating-frame))
+(setq exwm-input--focus-buffer buffer)
+(when exwm-input--timer (cancel-timer exwm-input--timer))
+(setq exwm-input--timer
+  (run-with-timer 0.01 nil 'exwm-input--update-focus)))
+  (setq exwm-input--redirected nil
+
+(defun exwm-input--on-focus-in ()
+  "Run in focus-in-hook to remove redirected focus on frame."
+  (let ((frame (selected-frame)))
+(when (and (frame-parameter frame 'exwm-window-id)
+   (not (memq frame exwm-workspace--list)))
+  (setq exwm-input--redirected t
 
 (defun exwm-input--update-focus ()
   "Update input focus."
-  (when (and (frame-parameter nil 'exwm-window-id) ;e.g. emacsclient frame
- (eq (current-buffer) (window-buffer))) ;e.g. `with-temp-buffer'
-(if (eq major-mode 'exwm-mode)
-(progn (exwm--log "Set focus ID to #x%x" exwm--id)
-

[elpa] externals/exwm 5210e13 41/64: Only manage windows mapped as the direct children of root window (close #38)

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 5210e13e7c95d0d8f94c657efa13e71fad4ef818
Author: Chris Feng 
Commit: Chris Feng 

Only manage windows mapped as the direct children of root window (close #38)

Sometimes Emacs create child windows of virtual roots. This commit ensures 
EXWM
will not manage them.
---
 exwm-manage.el |   11 ---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/exwm-manage.el b/exwm-manage.el
index 3274d65..0fde4d4 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -278,7 +278,7 @@ corresponding buffer.")
 value-mask)
 obj
   (exwm--log "ConfigureRequest from #x%x (#x%x) @%dx%d%+d%+d, border: %d"
- value-mask window width height x y border-width)
+ window value-mask width height x y border-width)
   (if (setq buffer (exwm--id->buffer window))
   ;; Send client message for managed windows
   (with-current-buffer buffer
@@ -320,8 +320,13 @@ corresponding buffer.")
   "Handle MapRequest event."
   (let ((obj (make-instance 'xcb:MapRequest)))
 (xcb:unmarshal obj data)
-(exwm--log "MapRequest from #x%x" (slot-value obj 'window))
-(exwm-manage--manage-window (slot-value obj 'window
+(with-slots (parent window) obj
+  (if (/= exwm--root parent)
+  (progn (xcb:+request exwm--connection
+ (make-instance xcb:MapWindow :window window))
+ (xcb:flush exwm--connection))
+(exwm--log "MapRequest from #x%x" window)
+(exwm-manage--manage-window window)
 
 (defun exwm-manage--on-UnmapNotify (data synthetic)
   "Handle UnmapNotify event."



[elpa] externals/exwm 4255f07 64/64: On-demand update exwm-workspace--switch-history

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 4255f078a690751a20377372be1352698e041ad0
Author: Chris Feng 
Commit: Chris Feng 

On-demand update exwm-workspace--switch-history

* exwm-workspace.el (exwm-workspace--switch-history-outdated)
  (exwm-workspace--update-switch-history, exwm-workspace-switch)
  (exwm-workspace-move-window):
* exwm.el (exwm--update-hints, exwm--on-ClientMessage):
* exwm-floating.el (exwm-floating--set-floating):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window):
  Update exwm-workspace--switch-history only when it's used.
---
 exwm-floating.el  |2 +-
 exwm-manage.el|4 +-
 exwm-workspace.el |   75 +---
 exwm.el   |4 +-
 4 files changed, 47 insertions(+), 38 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index 12390b0..346f02e 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -94,7 +94,7 @@
 (let ((idx (cl-position original-frame exwm-workspace--list)))
   (when (/= idx exwm-workspace-current-index)
 (set-frame-parameter original-frame 'exwm--urgency t)
-(exwm-workspace--update-switch-history)))
+(setq exwm-workspace--switch-history-outdated t)))
 ;; Fix illegal parameters
 ;; FIXME: check normal hints restrictions
 (let* ((display-width (frame-pixel-width original-frame))
diff --git a/exwm-manage.el b/exwm-manage.el
index 2636c01..3e3c848 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -145,7 +145,7 @@ corresponding buffer.")
   (exwm-floating--set-floating id)
 (exwm-floating--unset-floating id))
   (exwm-input-grab-keyboard id)
-  (exwm-workspace--update-switch-history)
+  (setq exwm-workspace--switch-history-outdated t)
   (with-current-buffer (exwm--id->buffer id)
 (run-hooks 'exwm-manage-finish-hook)
 
@@ -161,7 +161,7 @@ corresponding buffer.")
 (xcb:flush exwm--connection)
 (when (buffer-live-p buffer)
   (with-current-buffer buffer
-(exwm-workspace--update-switch-history)
+(setq exwm-workspace--switch-history-outdated t)
 ;;
 (when withdraw-only
   ;; Reparent back to root
diff --git a/exwm-workspace.el b/exwm-workspace.el
index fcc42e2..a6f21b2 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -63,33 +63,39 @@
 
 (defvar exwm-workspace--switch-history nil
   "History for `read-from-minibuffer' to interactively switch workspace.")
+;;;###autoload
+(defvar exwm-workspace--switch-history-outdated nil
+  "Non-nil to indicate `exwm-workspace--switch-history' is outdated.")
 
 ;;;###autoload
 (defun exwm-workspace--update-switch-history ()
   "Update the history for switching workspace to reflect the latest status."
-  (let ((sequence (number-sequence 0 (1- exwm-workspace-number)))
-(not-empty (make-vector exwm-workspace-number nil)))
-(dolist (i exwm--id-buffer-alist)
-  (with-current-buffer (cdr i)
-(when exwm--frame
-  (setf (aref not-empty (cl-position exwm--frame exwm-workspace--list))
-t
-(setq exwm-workspace--switch-history
-  (mapcar
-   (lambda (i)
- (mapconcat
-  (lambda (j)
-(format (if (= i j) "[%s]" " %s ")
-(propertize
- (int-to-string j)
- 'face
- (cond ((frame-parameter (elt exwm-workspace--list j)
- 'exwm--urgency)
-'(:foreground "orange"))
-   ((aref not-empty j) '(:foreground "green"))
-   (t nil)
-  sequence ""))
-   sequence
+  (when exwm-workspace--switch-history-outdated
+(setq exwm-workspace--switch-history-outdated nil)
+(let ((sequence (number-sequence 0 (1- exwm-workspace-number)))
+  (not-empty (make-vector exwm-workspace-number nil)))
+  (dolist (i exwm--id-buffer-alist)
+(with-current-buffer (cdr i)
+  (when exwm--frame
+(setf (aref not-empty
+(cl-position exwm--frame exwm-workspace--list))
+  t
+  (setq exwm-workspace--switch-history
+(mapcar
+ (lambda (i)
+   (mapconcat
+(lambda (j)
+  (format (if (= i j) "[%s]" " %s ")
+  (propertize
+   (int-to-string j)
+   'face
+   (cond ((frame-parameter (elt exwm-workspace--list j)
+   'exwm--urgency)
+  '(:foreground "orange"))
+ 

[elpa] externals/exwm b50a6e6 45/64: Correct several EWMH properties

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit b50a6e6dd9f5a34e91fd544e3ead0c81a721
Author: Chris Feng 
Commit: Chris Feng 

Correct several EWMH properties

The following EWMH properties on the root window are corrected in this 
commit:
_NET_VIRTUAL_ROOTS, _NET_WORKAREA and _NET_DESKTOP_VIEWPORT.
---
 exwm-floating.el  |8 ++--
 exwm-layout.el|   33 -
 exwm-randr.el |   51 +++
 exwm-workspace.el |8 
 exwm.el   |   10 +-
 5 files changed, 58 insertions(+), 52 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index bc6b1a2..8c2a8f49 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -381,9 +381,13 @@
   "Perform move/resize."
   (when exwm-floating--moveresize-calculate
 (let ((obj (make-instance 'xcb:MotionNotify))
-  (frame-x (or (frame-parameter exwm-workspace--current 'exwm-x) 0))
-  (frame-y (or (frame-parameter exwm-workspace--current 'exwm-y) 0))
+  (geometry (frame-parameter exwm-workspace--current 'exwm-geometry))
+  (frame-x 0)
+  (frame-y 0)
   result)
+  (when geometry
+(setq frame-x (slot-value geometry 'x)
+  frame-y (slot-value geometry 'y)))
   (xcb:unmarshal obj data)
   (setq result (funcall exwm-floating--moveresize-calculate
 (slot-value obj 'root-x) (slot-value obj 'root-y)))
diff --git a/exwm-layout.el b/exwm-layout.el
index 735b156..fe1645f 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -167,28 +167,27 @@
 ;; frame to the actual monitor size, `exwm-layout-set-fullscreen' resizes an X
 ;; window to the frame size.
 (defun exwm-layout--set-frame-fullscreen (frame)
-  "Make frame FRAME fullscreen, with regard to its XRandR output if 
applicable."
+  "Make frame FRAME fullscreen, with regard to its RandR output if applicable."
   (let ((geometry (or (frame-parameter frame 'exwm-geometry)
-  (xcb:+request-unchecked+reply
-  exwm--connection
+  (xcb:+request-unchecked+reply exwm--connection
   (make-instance 'xcb:GetGeometry
  :drawable exwm--root))
   (make-instance 'xcb:RECTANGLE :x 0 :y 0
- :width (x-display-width)
- :height (x-display-height
- (id (frame-parameter frame 'exwm-outer-id)))
+ :width (x-display-pixel-width)
+ :height (x-display-pixel-height
+(id (frame-parameter frame 'exwm-outer-id)))
 (with-slots (x y width height) geometry
-(xcb:+request exwm--connection
-(make-instance 'xcb:ConfigureWindow
-   :window id
-   :value-mask (logior xcb:ConfigWindow:X
-   xcb:ConfigWindow:Y
-   xcb:ConfigWindow:Width
-   xcb:ConfigWindow:Height)
-   :x x :y y
-   :width width
-   :height height))
-(xcb:flush exwm--connection
+  (xcb:+request exwm--connection
+  (make-instance 'xcb:ConfigureWindow
+ :window id
+ :value-mask (logior xcb:ConfigWindow:X
+ xcb:ConfigWindow:Y
+ xcb:ConfigWindow:Width
+ xcb:ConfigWindow:Height)
+ :x x :y y
+ :width width
+ :height height))
+  (xcb:flush exwm--connection
 
 (defun exwm-layout--refresh ()
   "Refresh layout."
diff --git a/exwm-randr.el b/exwm-randr.el
index 6bddb00..57ad569 100644
--- a/exwm-randr.el
+++ b/exwm-randr.el
@@ -36,9 +36,6 @@
 ;; With above lines, workspace 0 should be assigned to the output named "VGA1",
 ;; staying at the left of other workspaces on the output "LVDS1".
 
-;; Todo:
-;; + Update EWMH hints.
-
 ;; References:
 ;; + RandR (http://www.x.org/archive/X11R7.7/doc/randrproto/randrproto.txt)
 
@@ -50,7 +47,7 @@
 
 (defun exwm-randr--refresh ()
   "Refresh workspaces according to the updated RandR info."
-  (let (output-plist default-geometry)
+  (let (geometry output-plist default-geometry workareas viewports)
 ;; Query all outputs
 (with-slots (config-timestamp outputs)
 (xcb:+request-unchecked+reply exwm--connection
@@ -72,10 +69,12 @@
 (make

[elpa] externals/exwm 6d63c71 54/64: Prepare for GNU ELPA release

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 6d63c712808bcb12ce7190999d17c4a0d6959cdb
Author: Chris Feng 
Commit: Chris Feng 

Prepare for GNU ELPA release

* Transfer copyright to Free Software Foundation
* Add packaging components (e.g. headers)
* Coding style fixes:
  + Quote functions with "#'"
  + Wrap long lines
  + Fix doc strings / comments
* Replace `string-to-int' with `string-to-number'
* Fix compiling errors / eliminate compiling warnings
  + Add exwm-core.el to hold common variables, functions and macros
* Remove the redundant COPYING file
* Add .gitignore
* Rename README to README.md
---
 .gitignore|1 +
 COPYING   |  674 -
 README|8 -
 README.md |   13 +
 exwm-core.el  |  155 
 exwm-floating.el  |   51 +++--
 exwm-input.el |   94 
 exwm-layout.el|   21 +-
 exwm-manage.el|   27 ++-
 exwm-randr.el |   27 ++-
 exwm-workspace.el |   58 +++--
 exwm.el   |  298 +---
 12 files changed, 382 insertions(+), 1045 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000..c531d98
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.elc
diff --git a/COPYING b/COPYING
deleted file mode 100644
index 94a9ed0..000
--- a/COPYING
+++ /dev/null
@@ -1,674 +0,0 @@
-GNU GENERAL PUBLIC LICENSE
-   Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, th

[elpa] externals/exwm 576a676 62/64: Fix with-slots

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 576a676f1f0895bd473d54c2713ee9e2423023e6
Author: Chris Feng 
Commit: Chris Feng 

Fix with-slots

* exwm-randr.el (exwm-randr--refresh): Could not set the name slot in
  xcb:randr:GetOutputInfo~reply, turn to another variable.
---
 exwm-randr.el |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/exwm-randr.el b/exwm-randr.el
index d14e097..fc8477d 100644
--- a/exwm-randr.el
+++ b/exwm-randr.el
@@ -48,7 +48,7 @@
 
 (defun exwm-randr--refresh ()
   "Refresh workspaces according to the updated RandR info."
-  (let (geometry output-plist default-geometry workareas viewports)
+  (let (output-name geometry output-plist default-geometry workareas viewports)
 ;; Query all outputs
 (with-slots (config-timestamp outputs)
 (xcb:+request-unchecked+reply exwm--connection
@@ -60,11 +60,11 @@
 (make-instance 'xcb:randr:GetOutputInfo
:output output
:config-timestamp config-timestamp))
-  (setq name;UTF-8 encoded
+  (setf output-name ;UTF-8 encoded
 (decode-coding-string (apply #'unibyte-string name) 'utf-8))
   (if (or (/= connection xcb:randr:Connection:Connected)
   (= 0 crtc))   ;FIXME
-  (plist-put output-plist name nil)
+  (plist-put output-plist output-name nil)
 (with-slots (x y width height)
 (xcb:+request-unchecked+reply exwm--connection
 (make-instance 'xcb:randr:GetCrtcInfo
@@ -73,7 +73,7 @@
   (setq geometry (make-instance 'xcb:RECTANGLE
 :x x :y y
 :width width :height height)
-output-plist (plist-put output-plist name geometry))
+output-plist (plist-put output-plist output-name geometry))
   (unless default-geometry ;assume the first output as primary
 (setq default-geometry geometry)))
 (cl-assert (<= 2 (length output-plist)))



[elpa] externals/exwm 43b00d2 36/64: fix buffer renaming

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 43b00d2f0fefd39ceddb62be792634aabc9e23ca
Author: Philip 
Commit: Philip 

fix buffer renaming

per https://github.com/ch11ng/exwm/pull/30
---
 exwm-workspace.el |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index 00f7326..7ac1fec 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -171,9 +171,11 @@ The optional FORCE option is for internal use only."
   (with-current-buffer (exwm--id->buffer id)
 (let ((frame (elt exwm-workspace--list index)))
   (when (not (equal exwm--frame frame))
+(let ((name (replace-regexp-in-string "^\\s-*" "" (buffer-name
+  (exwm-workspace-rename-buffer (if (= index 
exwm-workspace-current-index)
+name
+  (concat " " name
 (setq exwm--frame frame)
-(exwm-workspace-rename-buffer
- (concat " " (replace-regexp-in-string "^\\s-*" "" (buffer-name
 (if exwm--floating-frame
 ;; Move the floating frame is enough
 (progn



[elpa] externals/exwm 3f2f844 58/64: Add a command to interactively move X window to the current workspace

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 3f2f84456997a46e047adbf45c4c44b628ae1377
Author: Chris Feng 
Commit: Chris Feng 

Add a command to interactively move X window to the current workspace

* exwm-workspace.el (exwm-workspace-move-window): Hide buffer on the 
original
  Emacs window when moving an X window to the current workspace.
* exwm-workspace.el: New function exwm-workspace-switch-to-window for
  interactively moving an X window on another workspace to the current one.
---
 exwm-workspace.el |   31 +--
 1 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index 2ea8d1f..5fae713 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -174,7 +174,7 @@ The optional FORCE option is for internal use only."
 (user-error "[EXWM] Workspace index out of range: %d" index))
   (with-current-buffer (exwm--id->buffer id)
 (let ((frame (elt exwm-workspace--list index)))
-  (when (not (equal exwm--frame frame))
+  (unless (eq exwm--frame frame)
 (let ((name (replace-regexp-in-string "^\\s-*" "" (buffer-name
   (exwm-workspace-rename-buffer
(if (= index exwm-workspace-current-index) name (concat " " name
@@ -191,7 +191,12 @@ The optional FORCE option is for internal use only."
  :x 0 :y 0))
   (xcb:flush exwm--connection))
   ;; Move the window itself
-  (bury-buffer)
+  (if (/= index exwm-workspace-current-index)
+  (bury-buffer)
+(set-window-buffer (get-buffer-window (current-buffer) t)
+   (or (get-buffer "*scratch*")
+   (prog1 (get-buffer-create "*scratch*")
+ (set-buffer-major-mode "*scratch*")
   (exwm-layout--hide id)
   (xcb:+request exwm--connection
   (make-instance 'xcb:ReparentWindow
@@ -203,6 +208,28 @@ The optional FORCE option is for internal use only."
  (exwm--id->buffer id)
 (exwm-workspace--update-switch-history)))
 
+(defun exwm-workspace-switch-to-window ()
+  "Make the current Emacs window display another X window."
+  (interactive)
+  ;; Show all buffers
+  (dolist (pair exwm--id-buffer-alist)
+(with-current-buffer (cdr pair)
+  (when (= ?\s (aref (buffer-name) 0))
+(rename-buffer (substring (buffer-name) 1)
+  (let ((buffer (read-buffer "Switch to window: " nil t)))
+(when buffer
+  (with-current-buffer buffer
+(when (and (eq major-mode 'exwm-mode)
+   (not (eq exwm--frame exwm-workspace--current)))
+  (exwm-workspace-move-window exwm-workspace-current-index
+  exwm--id)
+  ;; Hide buffers on other workspaces
+  (dolist (pair exwm--id-buffer-alist)
+(with-current-buffer (cdr pair)
+  (unless (or (eq exwm--frame exwm-workspace--current)
+  (= ?\s (aref (buffer-name) 0)))
+(rename-buffer (concat " " (buffer-name)))
+
 (defun exwm-workspace-rename-buffer (newname)
   "Rename a buffer."
   (let ((hidden (= ?\s (aref newname 0)))



[elpa] externals/exwm d998b42 34/64: Provide hooks run when the floating state of a window changes (close #28)

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit d998b42b89bc9e248b6d2250c56ddd17ec4b17cf
Author: Chris Feng 
Commit: Chris Feng 

Provide hooks run when the floating state of a window changes (close #28)
---
 exwm-floating.el |   11 +--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index 06d6fa5..bc6b1a2 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -36,6 +36,11 @@
 (defvar exwm-floating-border-color "blue"
   "Border color of the floating window.")
 
+(defvar exwm-floating-setup-hook nil
+  "Normal hook run when a window has been made floating.")
+(defvar exwm-floating-exit-hook nil
+  "Normal hook run when a window has exited floating state.")
+
 (defun exwm-floating--set-floating (id)
   "Make window ID floating."
   (interactive)
@@ -180,7 +185,8 @@
 exwm--floating-frame frame)
   (set-window-buffer window (current-buffer)) ;this changes current buffer
   (set-window-dedicated-p window t))
-(select-window window)))
+(select-window window))
+  (run-hooks 'exwm-floating-setup-hook))
 
 (defun exwm-floating--unset-floating (id)
   "Make window ID non-floating."
@@ -213,7 +219,8 @@
 exwm--frame exwm-workspace--current))
 (let ((window (frame-selected-window exwm-workspace--current)))
   (set-window-buffer window buffer)
-  (select-window window
+  (select-window window)))
+  (run-hooks 'exwm-floating-exit-hook))
 
 (defun exwm-floating-toggle-floating ()
   "Toggle the current window between floating and non-floating states."



[elpa] externals/exwm 801185c 27/64: Fix buffer switch problems

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 801185c7cc2c257ac2e8ed9a3aa8e8119c56ad1f
Author: Chris Feng 
Commit: Chris Feng 

Fix buffer switch problems

* Prevent switching to floating windows or windows on other workspaces
* Provide a workaround for `ido-mode` (can be enabled with
  `(exwm-enable-ido-workaround)`)
---
 exwm-layout.el |8 +++-
 exwm.el|   24 
 2 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/exwm-layout.el b/exwm-layout.el
index 5d056af..f2d4eb0 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -198,7 +198,13 @@
 (exwm-layout--hide exwm--id)
   (exwm-layout--show exwm--id (car windows))
   (dolist (i (cdr windows))
-(set-window-buffer i placeholder)
+(set-window-buffer i placeholder))
+  ;; Make sure windows floating / on other workspaces are excluded
+  (dolist (window (window-list frame 0))
+(with-current-buffer (window-buffer window)
+  (when (and (eq major-mode 'exwm-mode)
+ (or exwm--floating-frame (not (eq frame exwm--frame
+(set-window-buffer window placeholder)))
 
 (defun exwm-layout--on-minibuffer-setup ()
   "Refresh layout when minibuffer grows."
diff --git a/exwm.el b/exwm.el
index 95b6742..7e909cd 100644
--- a/exwm.el
+++ b/exwm.el
@@ -707,6 +707,30 @@
 (add-hook 'window-setup-hook 'exwm-init t);for Emacs
 (add-hook 'after-make-frame-functions 'exwm-init t))) ;for Emacs Client
 
+(defun exwm--ido-buffer-window-other-frame (orig-fun buffer)
+  "Wrapper for `ido-buffer-window-other-frame' to exclude invisible windows."
+  (let* ((window (funcall orig-fun buffer))
+ (frame (window-frame window)))
+;; Exclude windows on other workspaces
+(unless (and (memq frame exwm-workspace--list)
+ (not (eq frame exwm-workspace--current)))
+  window)))
+
+(defun exwm--fix-ido-buffer-window-other-frame ()
+  "Fix `ido-buffer-window-other-frame'."
+  (advice-add 'ido-buffer-window-other-frame :around
+  'exwm--ido-buffer-window-other-frame))
+
+(defun exwm-enable-ido-workaround ()
+  "Enable workarounds for `ido-mode'."
+  (add-hook 'exwm-init-hook 'exwm--fix-ido-buffer-window-other-frame))
+
+(defun exwm-disable-ido-workaround ()
+  "Disable workarounds for `ido-mode'."
+  (remove-hook 'exwm-init-hook 'exwm--fix-ido-buffer-window-other-frame)
+  (advice-remove 'ido-buffer-window-other-frame
+ 'exwm--ido-buffer-window-other-frame))
+
 
 
 (provide 'exwm)



[elpa] externals/exwm 07e59e0 31/64: Fix multi-screen bugs

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 07e59e0429c4b13a5036e9a207e37fc02135f599
Author: Chris Feng 
Commit: Chris Feng 

Fix multi-screen bugs

* RandR module is now made optional; users can enable it with
  `exwm-randr-enable`.
* Correct the calculation of sizes/coordinates at various places.
* Input focus is now tracked with (Emacs) window instead of buffer since the
  latter can be ambiguous in multi-screen settings.
---
 exwm-floating.el |   14 +-
 exwm-input.el|   23 +--
 exwm-layout.el   |   19 ++-
 exwm-manage.el   |   13 ++---
 exwm-randr.el|   13 -
 exwm.el  |2 --
 6 files changed, 54 insertions(+), 30 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index e1d8738..06d6fa5 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -39,8 +39,9 @@
 (defun exwm-floating--set-floating (id)
   "Make window ID floating."
   (interactive)
-  (when (get-buffer-window (exwm--id->buffer id)) ;window in non-floating state
-(set-window-buffer (selected-window) (other-buffer))) ;hide it first
+  (let ((window (get-buffer-window (exwm--id->buffer id
+(when window;window in non-floating state
+  (set-window-buffer window (other-buffer ;hide it first
   (let* ((original-frame
   (with-current-buffer (exwm--id->buffer id)
 (if (and exwm-transient-for (exwm--id->buffer exwm-transient-for))
@@ -78,8 +79,8 @@
 (exwm-workspace--update-switch-history)))
 ;; Fix illegal parameters
 ;; FIXME: check normal hints restrictions
-(let* ((display-width (x-display-pixel-width))
-   (display-height (- (x-display-pixel-height)
+(let* ((display-width (frame-pixel-width original-frame))
+   (display-height (- (frame-pixel-height original-frame)
   (window-pixel-height (minibuffer-window
 original-frame))
   (* 2 (window-mode-line-height))
@@ -373,6 +374,8 @@
   "Perform move/resize."
   (when exwm-floating--moveresize-calculate
 (let ((obj (make-instance 'xcb:MotionNotify))
+  (frame-x (or (frame-parameter exwm-workspace--current 'exwm-x) 0))
+  (frame-y (or (frame-parameter exwm-workspace--current 'exwm-y) 0))
   result)
   (xcb:unmarshal obj data)
   (setq result (funcall exwm-floating--moveresize-calculate
@@ -380,7 +383,8 @@
   (xcb:+request exwm--connection
   (make-instance 'xcb:ConfigureWindow
  :window (elt result 0) :value-mask (elt result 1)
- :x (elt result 2) :y (elt result 3)
+ :x (- (elt result 2) frame-x)
+ :y (-  (elt result 3) frame-y)
  :width (elt result 4) :height (elt result 5)))
   (xcb:flush exwm--connection
 
diff --git a/exwm-input.el b/exwm-input.el
index b9a5f20..0ef7232 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -77,7 +77,7 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
  :time xcb:Time:CurrentTime)))
 (xcb:flush exwm--connection)))
 
-(defvar exwm-input--focus-buffer nil "The buffer to be focused.")
+(defvar exwm-input--focus-window nil "The (Emacs) window to be focused.")
 (defvar exwm-input--redirected nil
   "Indicate next update on buffer list is actually a result of redirection.")
 (defvar exwm-input--timer nil "Currently running timer.")
@@ -85,15 +85,17 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 (defun exwm-input--on-buffer-list-update ()
   "Run in buffer-list-update-hook to track input focus."
   (let ((frame (selected-frame))
+(window (selected-window))
 (buffer (current-buffer)))
 (when (and (not (minibufferp buffer))
(frame-parameter frame 'exwm-window-id) ;e.g. emacsclient frame
(eq buffer (window-buffer))) ;e.g. `with-temp-buffer'
   (unless (and exwm-input--redirected
-   exwm-input--focus-buffer
-   (with-current-buffer exwm-input--focus-buffer
+   exwm-input--focus-window
+   (with-current-buffer (window-buffer
+ exwm-input--focus-window)
  exwm--floating-frame))
-(setq exwm-input--focus-buffer buffer)
+(setq exwm-input--focus-window window)
 (when exwm-input--timer (cancel-timer exwm-input--timer))
 (setq exwm-input--timer
   (run-with-timer 0.01 nil 'exwm-input--update-focus)))
@@ -108,22 +110,23 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 
 (defun exwm-input

[elpa] externals/exwm 84f0f03 15/64: Fix input focus lost after closing window

2015-09-17 Thread Chris Feng
branch: externals/exwm
commit 84f0f0328b173af82c873e395353bd9a6c3bf1f6
Author: Chris Feng 
Commit: Chris Feng 

Fix input focus lost after closing window

Also insert some debug messages.
---
 exwm-input.el |   35 +--
 exwm-layout.el|3 +++
 exwm-manage.el|6 --
 exwm-workspace.el |2 ++
 4 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index f94cf50..c312ff7 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -57,17 +57,22 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 (defun exwm-input--set-focus (id)
   "Set input focus to window ID in a proper way."
   (exwm--with-current-id id
+(exwm--log "Set focus ID to #x%x" id)
 (setq exwm-input--focus-id id)
 (if (and (not exwm--hints-input)
  (memq xcb:Atom:WM_TAKE_FOCUS exwm--protocols))
-(xcb:+request exwm--connection
-(make-instance 'xcb:icccm:SendEvent
-   :destination id
-   :event (xcb:marshal
-   (make-instance 'xcb:icccm:WM_TAKE_FOCUS
-  :window id
-  :time exwm-input--timestamp)
-   exwm--connection)))
+(progn
+  (exwm--log "Focus on #x%x with WM_TAKE_FOCUS" id)
+  (xcb:+request exwm--connection
+  (make-instance 'xcb:icccm:SendEvent
+ :destination id
+ :event (xcb:marshal
+ (make-instance 'xcb:icccm:WM_TAKE_FOCUS
+:window id
+:time
+exwm-input--timestamp)
+ exwm--connection
+  (exwm--log "Focus on #x%x with SetInputFocus" id)
   (xcb:+request exwm--connection
   (make-instance 'xcb:SetInputFocus
  :revert-to xcb:InputFocus:Parent :focus id
@@ -85,24 +90,34 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 (setq exwm-input--focus-lock t)
 (when (eq (current-buffer) (window-buffer)) ;e.g. with-temp-buffer
   (if (eq major-mode 'exwm-mode)
-  (progn (setq exwm-input--focus-id exwm--id)
+  (progn (exwm--log "Set focus ID to #x%x" exwm--id)
+ (setq exwm-input--focus-id exwm--id)
  (when exwm--floating-frame
(if (eq (selected-frame) exwm--floating-frame)
;; Cancel the possible input focus redirection
-   (redirect-frame-focus exwm--floating-frame nil)
+   (progn
+ (exwm--log "Cancel input focus redirection on %s"
+exwm--floating-frame)
+ (redirect-frame-focus exwm--floating-frame nil))
  ;; Focus the floating frame
+ (exwm--log "Focus on floating frame %s"
+exwm--floating-frame)
  (x-focus-frame exwm--floating-frame)))
  ;; Finally focus the window
  (exwm-input--set-focus exwm-input--focus-id))
 (exwm--with-current-id exwm-input--focus-id
+  (exwm--log "Set focus ID to #x%x" xcb:Window:None)
   (setq exwm-input--focus-id xcb:Window:None)
   (let ((frame (selected-frame)))
 (if exwm--floating-frame
 (unless (or (eq frame exwm--floating-frame)
 (active-minibuffer-window))
   ;; Redirect input focus to the workspace frame
+  (exwm--log "Redirect input focus (%s => %s)"
+ exwm--floating-frame frame)
   (redirect-frame-focus exwm--floating-frame frame))
   ;; Focus the workspace frame
+  (exwm--log "Focus on workspace %s" frame)
   (x-focus-frame frame))
 (setq exwm-input--focus-lock nil)))
 
diff --git a/exwm-layout.el b/exwm-layout.el
index 7630b68..1dd8333 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -28,6 +28,7 @@
 
 (defun exwm-layout--show (id &optional window)
   "Show window ID exactly fit in the Emacs window WINDOW."
+  (exwm--log "Show #x%x in %s" id window)
   (xcb:+request exwm--connection (make-instance 'xcb:MapWindow :window id))
   (xcb:+request exwm--connection
   (make-instance 'xcb:icccm:set-WM_STATE
@@ -69,6 +70,7 @@
   "Hide window ID."
   (unless (eq xcb:icccm:WM_STATE:IconicState

  1   2   3   4   5   6   7   8   >