[elpa] externals/exwm bc4aafe: Minor fixes for layout and workspace

2016-02-25 Thread Chris Feng
branch: externals/exwm
commit bc4aafec1683a27209aec33f44c3947e169860c6
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Minor fixes for layout and workspace

* exwm-layout.el (exwm-layout-show-mode-line): Force update mode-line.

* exwm-workspace.el (exwm-workspace--update-minibuffer): Treat nil as empty
string.
---
 exwm-layout.el|3 ++-
 exwm-workspace.el |2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/exwm-layout.el b/exwm-layout.el
index c9146de..09428da 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -455,7 +455,8 @@ See also `exwm-layout-enlarge-window'."
(window-mode-line-height (frame-root-window
  exwm--floating-frame)))
 nil t)
-  (exwm-input-grab-keyboard
+  (exwm-input-grab-keyboard))
+(force-mode-line-update)))
 
 ;;;###autoload
 (defun exwm-layout-toggle-mode-line ()
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 8230bd7..283b384 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -453,7 +453,7 @@ The optional FORCE option is for internal use only."
   (setq result
 (+ result
(ceiling (1+ (length i)) width
-(split-string (current-message) "\n"))
+(split-string (or (current-message) "") "\n"))
   result)
   (count-screen-lines))
 (when (and (integerp max-mini-window-height)



[elpa] externals/exwm 3f77220: Fix floating X window bugs introduced by 9c95c03e

2016-02-18 Thread Chris Feng
branch: externals/exwm
commit 3f7722079cebd0d998239ce40457899135250a15
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Fix floating X window bugs introduced by 9c95c03e

* exwm-floating.el (exwm-floating--set-floating): Make floating frames
invisible before resizing them.
(exwm-floating--fit-frame-to-window): Removed since unused.
* exwm-layout.el (exwm-layout-hide-mode-line, exwm-layout-show-mode-line):
Use set frame height instead of exwm-floating--fit-frame-to-window.

* exwm-core.el (exwm-mode): Replace `exwm-manage--close-window' with
`exwm-manage--kill-buffer-query-function'.
* exwm-floating.el (exwm-floating--unset-floating): Reparent out floating
frames.
* exwm-manage.el (exwm-manage--unmanage-window): Reparent out floating
frames.  Hide floating frames.
(exwm-manage--close-window, exwm-manage--kill-buffer-query-function):
Rename `exwm-manage--close-window' since it's only used in
`kill-buffer-query-functions'.  Reparent out floating frames.
---
 exwm-core.el |4 +-
 exwm-floating.el |   60 ++--
 exwm-layout.el   |   29 ++
 exwm-manage.el   |  158 ++
 4 files changed, 137 insertions(+), 114 deletions(-)

diff --git a/exwm-core.el b/exwm-core.el
index 9430b43..b09ca52 100644
--- a/exwm-core.el
+++ b/exwm-core.el
@@ -142,9 +142,7 @@
   (add-hook 'change-major-mode-hook #'kill-buffer nil t)
   ;; Kill buffer -> close window
   (add-hook 'kill-buffer-query-functions
-(lambda ()
-  (exwm-manage--close-window exwm--id (current-buffer)))
-nil t)
+#'exwm-manage--kill-buffer-query-function nil t)
   (setq buffer-read-only t
 left-margin-width nil
 right-margin-width nil
diff --git a/exwm-floating.el b/exwm-floating.el
index b5ab8a8..82b4487 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -50,6 +50,8 @@
 (defvar exwm-floating--cursor-bottom-left nil)
 (defvar exwm-floating--cursor-left nil)
 
+(declare-function exwm-layout--refresh "exwm-layout.el")
+
 ;;;###autoload
 (defun exwm-floating--set-floating (id)
   "Make window ID floating."
@@ -78,6 +80,8 @@
  (internal-border-width . ,exwm-floating-border-width)
  (left . 1)
  (top . 1)
+ (width . ,window-min-width)
+ (height . ,window-min-height)
  (unsplittable . t) ;and fix the size later
  (outer-id (string-to-number (frame-parameter frame 'outer-window-id)))
  (container (with-current-buffer (exwm--id->buffer id)
@@ -151,7 +155,17 @@
   y (/ (- display-height height) 2))
 (exwm--log "Floating geometry (corrected): %dx%d%+d%+d" width height x y)
 ;; Fit frame to client
-(exwm-floating--fit-frame-to-window outer-id width height)
+;; It seems we have to make the frame invisible in order to resize it
+;; timely.
+;; The frame will be made visible by `select-frame-set-input-focus'.
+(make-frame-invisible frame)
+(let ((edges (window-inside-pixel-edges window)))
+  (set-frame-size frame
+  (+ width (- (frame-pixel-width frame)
+  (- (elt edges 2) (elt edges 0
+  (+ height (- (frame-pixel-height frame)
+   (- (elt edges 3) (elt edges 1
+  t))
 ;; Reparent this frame to the container
 (xcb:+request exwm--connection
 (make-instance 'xcb:ReparentWindow
@@ -171,8 +185,12 @@
   (setq window-size-fixed exwm--fixed-size
 exwm--frame original-frame
 exwm--floating-frame frame)
+  ;; Do the refresh manually.
+  (remove-hook 'window-configuration-change-hook #'exwm-layout--refresh)
   (set-window-buffer window (current-buffer)) ;this changes current buffer
-  (set-window-dedicated-p window t))
+  (add-hook 'window-configuration-change-hook #'exwm-layout--refresh)
+  (set-window-dedicated-p window t)
+  (exwm-layout--show id window))
 (select-frame-set-input-focus frame))
   (run-hooks 'exwm-floating-setup-hook))
 
@@ -182,6 +200,16 @@
   (interactive)
   (let ((buffer (exwm--id->buffer id)))
 (with-current-buffer buffer
+  ;; Reparent the frame back to the root window.
+  (when exwm--floating-frame
+(let ((frame-id (frame-parameter exwm--floating-frame 'exwm-outer-id)))
+  (xcb:+request exwm--connection
+  (make-instance 'xcb:UnmapWindow :window frame-id))
+  (xcb:+request exwm--connection
+  (make-instance 'xcb:ReparentWindow
+ :window frame-id
+ :parent exwm--root
+ :x 0 :y 0
   ;; Reparent the container to 

[elpa] externals/exwm updated (3f77220 -> fdfdabf)

2016-02-19 Thread Chris Feng
ch11ng pushed a change to branch externals/exwm.

  from  3f77220   Fix floating X window bugs introduced by 9c95c03e
   new  bfd43fe   Add system tray support
   new  fc589b8   Fix system tray issues after updating workspaces
   new  08bf970   Minor fixes for system tray
   new  fdfdabf   Merge branch 'feat/systemtray' into externals/exwm


Summary of changes:
 README.md  |5 +-
 exwm-core.el   |7 +-
 exwm-floating.el   |   17 +--
 exwm-input.el  |   21 +++-
 exwm-layout.el |   24 +++-
 exwm-manage.el |   29 +++--
 exwm-randr.el  |   25 ++--
 exwm-systemtray.el |  388 
 exwm-workspace.el  |   55 ++--
 exwm.el|   16 +--
 10 files changed, 516 insertions(+), 71 deletions(-)
 create mode 100644 exwm-systemtray.el



[elpa] externals/exwm bfd43fe 1/4: Add system tray support

2016-02-19 Thread Chris Feng
branch: externals/exwm
commit bfd43feb494a8a7675f3a882ea5ebeaa91fb3f82
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Add system tray support

* exwm-systemtray.el: New module adds a simple system tray (using the X11
System Tray protocol).

* exwm-workspace.el (exwm-workspace-switch-hook, exwm-workspace-switch):
New hook run after switching workspace.
---
 exwm-systemtray.el |  372 
 exwm-workspace.el  |9 +-
 2 files changed, 377 insertions(+), 4 deletions(-)

diff --git a/exwm-systemtray.el b/exwm-systemtray.el
new file mode 100644
index 000..c892fcc
--- /dev/null
+++ b/exwm-systemtray.el
@@ -0,0 +1,372 @@
+;;; exwm-systemtray.el --- System Tray Module for  -*- lexical-binding: t -*-
+;;;EXWM
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Chris Feng <chris.w.f...@gmail.com>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs 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.
+
+;; GNU Emacs 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 GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This module adds system tray support for EXWM.
+
+;; To use this module, load and enable it as follows:
+;;   (require 'exwm-systemtray)
+;;   (exwm-systemtray-enable)
+
+;;; Code:
+
+(require 'xcb-xembed)
+(require 'xcb-systemtray)
+(require 'exwm-core)
+(require 'exwm-workspace)
+
+(defclass exwm-systemtray--icon ()
+  ((width :initarg :width)
+   (height :initarg :height)
+   (visible :initarg :visible))
+  :documentation "Attributes of a system tray icon.")
+
+;; GTK icons require at least 16 pixels to show normally.
+(defconst exwm-systemtray--icon-min-size 16 "Minimum icon size.")
+
+(defvar exwm-systemtray-height (max exwm-systemtray--icon-min-size
+(line-pixel-height))
+  "System tray height.
+
+You shall use the default value if using auto-hide minibuffer.")
+
+(defvar exwm-systemtray-icon-gap 2 "Gap between icons.")
+
+(defvar exwm-systemtray--connection nil "The X connection.")
+(defvar exwm-systemtray--list nil "The icon list.")
+(defvar exwm-systemtray--selection-owner-window nil
+  "The selection owner window.")
+(defvar exwm-systemtray--embedder nil "The embedder window.")
+
+(defun exwm-systemtray--embed (icon)
+  "Embed an icon."
+  (exwm--log "(System Tray) Try to embed #x%x" icon)
+  (let ((info (xcb:+request-unchecked+reply exwm-systemtray--connection
+  (make-instance 'xcb:xembed:get-_XEMBED_INFO
+ :window icon)))
+width* height* visible)
+(when info
+  (exwm--log "(System Tray) Embed #x%x" icon)
+  (with-slots (width height)
+  (xcb:+request-unchecked+reply exwm-systemtray--connection
+  (make-instance 'xcb:GetGeometry :drawable icon))
+(setq height* exwm-systemtray-height
+  width* (round (* width (/ (float height*) height
+(when (< width* exwm-systemtray--icon-min-size)
+  (setq width* exwm-systemtray--icon-min-size
+height* (round (* height (/ (float width*) width)
+(exwm--log "(System Tray) Resize from %dx%d to %dx%d"
+   width height width* height*))
+  ;; Reparent to the embedder.
+  (xcb:+request exwm-systemtray--connection
+  (make-instance 'xcb:ReparentWindow
+ :window icon
+ :parent exwm-systemtray--embedder
+ :x 0
+ ;; Vertically centered.
+ :y (/ (- exwm-systemtray-height height*) 2)))
+  ;; Resize the icon.
+  (xcb:+request exwm-systemtray--connection
+  (make-instance 'xcb:ConfigureWindow
+ :window icon
+ :value-mask (logior xcb:ConfigWindow:Width
+ xcb:ConfigWindow:Height
+ xcb:ConfigWindow:BorderWidth)
+ :width width*
+ :height height*
+ :border-width 0))
+  ;; Set event mask.
+  (xcb:+request exwm-systemtray--connection
+  (make-instance 'xcb:ChangeWindowAttributes
+

[elpa] externals/exwm 08bf970 3/4: Minor fixes for system tray

2016-02-19 Thread Chris Feng
branch: externals/exwm
commit 08bf970b16405d4f6b48559e517ab61339a956bd
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Minor fixes for system tray

* exwm-systemtray.el (exwm-systemtray--embed): Default to visible if the
XEMBED_MAPPED flag is not set.
(exwm-systemtray--on-ClientMessage): Only embed new icons.  Ignore balloon
messages.
---
 exwm-systemtray.el |   21 -
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/exwm-systemtray.el b/exwm-systemtray.el
index 11d9be6..e9a9745 100644
--- a/exwm-systemtray.el
+++ b/exwm-systemtray.el
@@ -101,8 +101,13 @@ You shall use the default value if using auto-hide 
minibuffer.")
  :value-mask xcb:CW:EventMask
  :event-mask (logior xcb:EventMask:ResizeRedirect
  xcb:EventMask:PropertyChange)))
-  (when (setq visible
-  (/= 0 (logand (slot-value info 'flags) xcb:xembed:MAPPED)))
+  (setq visible (slot-value info 'flags))
+  (if visible
+  (setq visible
+(/= 0 (logand (slot-value info 'flags) xcb:xembed:MAPPED)))
+;; Default to visible.
+(setq visible t))
+  (when visible
 (exwm--log "(System Tray) Map the window")
 (xcb:+request exwm-systemtray--connection
 (make-instance 'xcb:MapWindow :window icon)))
@@ -245,13 +250,11 @@ You shall use the default value if using auto-hide 
minibuffer.")
 (setq data32 (slot-value data 'data32)
   opcode (elt data32 1))
 (cond ((= opcode xcb:systemtray:opcode:REQUEST-DOCK)
-   (exwm-systemtray--embed (elt data32 2)))
-  ((= opcode xcb:systemtray:opcode:BEGIN-MESSAGE)
-   ;; FIXME
-   )
-  ((= opcode xcb:systemtray:opcode:CANCEL-MESSAGE)
-   ;; FIXME
-   )
+   (unless (assoc (elt data32 2) exwm-systemtray--list)
+ (exwm-systemtray--embed (elt data32 2
+  ;; Not implemented (rarely used nowadays).
+  ((or (= opcode xcb:systemtray:opcode:BEGIN-MESSAGE)
+   (= opcode xcb:systemtray:opcode:CANCEL-MESSAGE)))
   (t
(exwm--log "(System Tray) Unknown opcode message: %s" obj)))
 



[elpa] externals/exwm fc589b8 2/4: Fix system tray issues after updating workspaces

2016-02-19 Thread Chris Feng
branch: externals/exwm
commit fc589b899b71e88e48931de41ea1df760f9c1edd
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Fix system tray issues after updating workspaces

* exwm-workspace.el (exwm-workspace-switch-hook): New hook run by
`exwm-workspace-switch'.
* exwm-randr.el (exwm-randr-refresh-hook): New hook run by
`exwm-randr--refresh'.
* exwm-systemtray.el (exwm-systemtray--on-randr-refresh)
(exwm-systemtray--on-workspace-switch, exwm-systemtray--init): Update the
system tray in `exwm-randr-refresh-hook' and `exwm-workspace-switch-hook'.

* exwm-layout.el (exwm-layout--set-frame-fullscreen):
* exwm-workspace.el (exwm-workspace--post-init): Wait until all workspace
frames are set fullscreen.

* exwm-workspace.el (exwm-workspace--current-width)
(exwm-workspace--current-height): New functions for retrieving the width
and height of the current workspace.
* exwm-layout.el (exwm-layout-set-fullscreen):
* exwm-manage.el (exwm-manage--manage-window)
(exwm-manage--on-ConfigureRequest):
* exwm-systemtray.el (exwm-systemtray--refresh, exwm-systemtray--init):
* exwm-workspace.le (exwm-workspace--resize-minibuffer-frame)
(exwm-workspace--on-ConfigureNotify): Switch to
`exwm-workspace--current-width' and `exwm-workspace--current-height'.

* exwm-core.el:
* exwm-floating.el:
* exwm-floating.el:
* exwm-input.el:
* exwm-layout.el:
* exwm-manage.el:
* exwm-randr.el:
* exwm-systemtray.el:
* exwm-workspace.el:
* exwm.el:
Clean up loading file.  Set/Unset some functions as commands.

* README.md: Add intro to system tray.
---
 README.md  |5 ++-
 exwm-core.el   |7 +-
 exwm-floating.el   |   17 +++
 exwm-input.el  |   21 +++--
 exwm-layout.el |   24 +++--
 exwm-manage.el |   29 +++-
 exwm-randr.el  |   25 -
 exwm-systemtray.el |   59 +++
 exwm-workspace.el  |   46 ++-
 exwm.el|   16 +++--
 10 files changed, 159 insertions(+), 90 deletions(-)

diff --git a/README.md b/README.md
index 09fe470..7f918bd 100644
--- a/README.md
+++ b/README.md
@@ -3,11 +3,12 @@
 EXWM (Emacs X Window Manager) is a full-featured tiling X window manager for
 Emacs built on top of [XELB](https://github.com/ch11ng/xelb).
 It features:
-+ Fully keyboard-driven operation
++ Fully keyboard-driven operations
 + Hybrid layout modes (tiling & stacking)
 + Workspace support
 + ICCCM/EWMH compliance
-+ Basic RandR support (optional)
++ (Optional) RandR (multi-monitor) support
++ (Optional) system tray
 
 Please check the [User Guide](https://github.com/ch11ng/exwm/wiki)
 for more details.
diff --git a/exwm-core.el b/exwm-core.el
index b09ca52..4d936ed 100644
--- a/exwm-core.el
+++ b/exwm-core.el
@@ -78,6 +78,9 @@
 (logior xcb:EventMask:StructureNotify xcb:EventMask:PropertyChange))
   "Event mask set on all managed windows.")
 
+(declare-function exwm-input--on-KeyPress-line-mode "exwm-input.el"
+  (key-press))
+
 ;; Internal variables
 (defvar-local exwm--id nil)   ;window ID
 (defvar-local exwm--container nil);container
@@ -110,7 +113,7 @@
 (defvar-local exwm--normal-hints-max-height nil)
 ;; (defvar-local exwm--normal-hints-win-gravity nil)
 ;; WM_HINTS
-(defvar-local exwm--hints-input nil);FIXME
+(defvar-local exwm--hints-input nil)
 (defvar-local exwm--hints-urgency nil)
 ;; _MOTIF_WM_HINTS
 (defvar-local exwm--mwm-hints nil)
@@ -126,6 +129,8 @@
 map)
   "Keymap for `exwm-mode'.")
 
+(declare-function exwm-manage--kill-buffer-query-function "exwm-manage.el")
+
 (define-derived-mode exwm-mode nil "EXWM"
   "Major mode for managing X windows.
 
diff --git a/exwm-floating.el b/exwm-floating.el
index 82b4487..209539e 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -28,7 +28,6 @@
 
 (require 'xcb-cursor)
 (require 'exwm-core)
-(eval-when-compile (require 'exwm-workspace))
 
 (defvar exwm-floating-border-width 1 "Border width of the floating window.")
 (defvar exwm-floating-border-color "navy"
@@ -50,12 +49,17 @@
 (defvar exwm-floating--cursor-bottom-left nil)
 (defvar exwm-floating--cursor-left nil)
 
+(defvar exwm-workspace--current)
+(defvar exwm-workspace--list)
+(defvar exwm-workspace-current-index)
+(defvar exwm-workspace--switch-history-outdated)
+(defvar exwm-workspace-minibuffer-position)
+
 (declare-function exwm-layout--refresh "exwm-layout.el")
+(declare-function exwm-layout--show "exwm-layout.el")
 
-;;;###autoload
 (defun exwm-floating--set-floating (id)
   "Make window ID floating."
-  (interactive)
   (let ((window (get-buffer-window (exwm--id->buffer 

[elpa] externals/exwm fdfdabf 4/4: Merge branch 'feat/systemtray' into externals/exwm

2016-02-19 Thread Chris Feng
branch: externals/exwm
commit fdfdabf95ae75a2f7af2758594b5d0246882f5a0
Merge: 3f77220 08bf970
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Merge branch 'feat/systemtray' into externals/exwm

A simple system tray based on the X11 'System Tray' and XEmbed protocol.
---
 README.md  |5 +-
 exwm-core.el   |7 +-
 exwm-floating.el   |   17 +--
 exwm-input.el  |   21 +++-
 exwm-layout.el |   24 +++-
 exwm-manage.el |   29 +++--
 exwm-randr.el  |   25 ++--
 exwm-systemtray.el |  388 
 exwm-workspace.el  |   55 ++--
 exwm.el|   16 +--
 10 files changed, 516 insertions(+), 71 deletions(-)

diff --git a/README.md b/README.md
index 09fe470..7f918bd 100644
--- a/README.md
+++ b/README.md
@@ -3,11 +3,12 @@
 EXWM (Emacs X Window Manager) is a full-featured tiling X window manager for
 Emacs built on top of [XELB](https://github.com/ch11ng/xelb).
 It features:
-+ Fully keyboard-driven operation
++ Fully keyboard-driven operations
 + Hybrid layout modes (tiling & stacking)
 + Workspace support
 + ICCCM/EWMH compliance
-+ Basic RandR support (optional)
++ (Optional) RandR (multi-monitor) support
++ (Optional) system tray
 
 Please check the [User Guide](https://github.com/ch11ng/exwm/wiki)
 for more details.
diff --git a/exwm-core.el b/exwm-core.el
index b09ca52..4d936ed 100644
--- a/exwm-core.el
+++ b/exwm-core.el
@@ -78,6 +78,9 @@
 (logior xcb:EventMask:StructureNotify xcb:EventMask:PropertyChange))
   "Event mask set on all managed windows.")
 
+(declare-function exwm-input--on-KeyPress-line-mode "exwm-input.el"
+  (key-press))
+
 ;; Internal variables
 (defvar-local exwm--id nil)   ;window ID
 (defvar-local exwm--container nil);container
@@ -110,7 +113,7 @@
 (defvar-local exwm--normal-hints-max-height nil)
 ;; (defvar-local exwm--normal-hints-win-gravity nil)
 ;; WM_HINTS
-(defvar-local exwm--hints-input nil);FIXME
+(defvar-local exwm--hints-input nil)
 (defvar-local exwm--hints-urgency nil)
 ;; _MOTIF_WM_HINTS
 (defvar-local exwm--mwm-hints nil)
@@ -126,6 +129,8 @@
 map)
   "Keymap for `exwm-mode'.")
 
+(declare-function exwm-manage--kill-buffer-query-function "exwm-manage.el")
+
 (define-derived-mode exwm-mode nil "EXWM"
   "Major mode for managing X windows.
 
diff --git a/exwm-floating.el b/exwm-floating.el
index 82b4487..209539e 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -28,7 +28,6 @@
 
 (require 'xcb-cursor)
 (require 'exwm-core)
-(eval-when-compile (require 'exwm-workspace))
 
 (defvar exwm-floating-border-width 1 "Border width of the floating window.")
 (defvar exwm-floating-border-color "navy"
@@ -50,12 +49,17 @@
 (defvar exwm-floating--cursor-bottom-left nil)
 (defvar exwm-floating--cursor-left nil)
 
+(defvar exwm-workspace--current)
+(defvar exwm-workspace--list)
+(defvar exwm-workspace-current-index)
+(defvar exwm-workspace--switch-history-outdated)
+(defvar exwm-workspace-minibuffer-position)
+
 (declare-function exwm-layout--refresh "exwm-layout.el")
+(declare-function exwm-layout--show "exwm-layout.el")
 
-;;;###autoload
 (defun exwm-floating--set-floating (id)
   "Make window ID floating."
-  (interactive)
   (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
@@ -85,7 +89,7 @@
  (unsplittable . t) ;and fix the size later
  (outer-id (string-to-number (frame-parameter frame 'outer-window-id)))
  (container (with-current-buffer (exwm--id->buffer id)
-  exwm--container))
+  exwm--container))
  (window (frame-first-window frame)) ;and it's the only window
  (x (slot-value exwm--geometry 'x))
  (y (slot-value exwm--geometry 'y))
@@ -194,10 +198,8 @@
 (select-frame-set-input-focus frame))
   (run-hooks 'exwm-floating-setup-hook))
 
-;;;###autoload
 (defun exwm-floating--unset-floating (id)
   "Make window ID non-floating."
-  (interactive)
   (let ((buffer (exwm--id->buffer id)))
 (with-current-buffer buffer
   ;; Reparent the frame back to the root window.
@@ -257,7 +259,6 @@
 (defvar exwm-floating--moveresize-calculate nil
   "Calculate move/resize parameters [buffer event-mask x y width height].")
 
-;;;###autoload
 (defun exwm-floating--start-moveresize (id  type)
   "Start move/resize."
   (let ((buffer (exwm--id->buffer id))
@@ -404,7 +405,6 @@
  :cursor cursor
  :time xcb:Time:CurrentTime)))
 
-;;;###autoload
 (defun exwm-floating--stop-moveresize ( _args)
   "Stop move/resize."
   (xcb:+request e

[elpa] externals/exwm updated (fdfdabf -> 1c79e1c)

2016-02-19 Thread Chris Feng
ch11ng pushed a change to branch externals/exwm.

  from  fdfdabf   Merge branch 'feat/systemtray' into externals/exwm
   new  33254c3   Redefine mode-specific keys
   new  1c79e1c   Prevent/Reduce flickering issues with floating X windows


Summary of changes:
 exwm-core.el |   12 ++--
 exwm-floating.el |   35 ++-
 exwm-layout.el   |   19 ++-
 exwm-manage.el   |   53 ++---
 4 files changed, 84 insertions(+), 35 deletions(-)



[elpa] externals/exwm 1c79e1c 2/2: Prevent/Reduce flickering issues with floating X windows

2016-02-19 Thread Chris Feng
branch: externals/exwm
commit 1c79e1c2384128915357ea629fc2a0503bd36733
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Prevent/Reduce flickering issues with floating X windows

* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating): Prevent flickering when creating/removing
a floating X window.
* exwm-layout.el (exwm-layout--show): Show X windows after resizing to
prevent flickering.
* exwm-manage.el (exwm-manage--unmanage-window): Reduce flickering by
hiding the container.
(exwm-manage--kill-buffer-query-function): Prevent flickering by hiding the
container (except that the X window destroys itself after receiving the
WM_DELETE_WINDOW client message).
---
 exwm-floating.el |   35 ++-
 exwm-layout.el   |   19 ++-
 exwm-manage.el   |   53 ++---
 3 files changed, 78 insertions(+), 29 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index 209539e..2769488 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -193,17 +193,42 @@
   (remove-hook 'window-configuration-change-hook #'exwm-layout--refresh)
   (set-window-buffer window (current-buffer)) ;this changes current buffer
   (add-hook 'window-configuration-change-hook #'exwm-layout--refresh)
-  (set-window-dedicated-p window t)
-  (exwm-layout--show id window))
-(select-frame-set-input-focus frame))
-  (run-hooks 'exwm-floating-setup-hook))
+  (set-window-dedicated-p window t))
+(select-frame-set-input-focus frame)
+;; `x_make_frame_visible' autoraises the frame.  Force lowering it.
+(xcb:+request exwm--connection
+(make-instance 'xcb:ConfigureWindow
+   :window outer-id
+   :value-mask xcb:ConfigWindow:StackMode
+   :stack-mode xcb:StackMode:Below))
+;; Show the X window with its container (and flush).
+(exwm-layout--show id window))
+  (run-hooks 'exwm-floating-setup-hook)
+  ;; Redraw the frame.
+  (redisplay))
 
 (defun exwm-floating--unset-floating (id)
   "Make window ID non-floating."
   (let ((buffer (exwm--id->buffer id)))
 (with-current-buffer buffer
-  ;; Reparent the frame back to the root window.
   (when exwm--floating-frame
+;; The X window is already mapped.
+;; Unmap the container to prevent flickering.
+(xcb:+request exwm--connection
+(make-instance 'xcb:UnmapWindow :window exwm--container))
+(xcb:flush exwm--connection)
+;; Unmap the X window.
+(xcb:+request exwm--connection
+(make-instance 'xcb:ChangeWindowAttributes
+   :window id :value-mask xcb:CW:EventMask
+   :event-mask xcb:EventMask:NoEvent))
+(xcb:+request exwm--connection
+(make-instance 'xcb:UnmapWindow :window id))
+(xcb:+request exwm--connection
+(make-instance 'xcb:ChangeWindowAttributes
+   :window id :value-mask xcb:CW:EventMask
+   :event-mask exwm--client-event-mask))
+;; Reparent the floating frame back to the root window.
 (let ((frame-id (frame-parameter exwm--floating-frame 'exwm-outer-id)))
   (xcb:+request exwm--connection
   (make-instance 'xcb:UnmapWindow :window frame-id))
diff --git a/exwm-layout.el b/exwm-layout.el
index c0f3c61..e3c1feb 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -53,14 +53,6 @@
 (defun exwm-layout--show (id  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))
-  (with-current-buffer (exwm--id->buffer id)
-(xcb:+request exwm--connection
-(make-instance 'xcb:MapWindow :window exwm--container)))
-  (xcb:+request exwm--connection
-  (make-instance 'xcb:icccm:set-WM_STATE
- :window id :state xcb:icccm:WM_STATE:NormalState
- :icon xcb:Window:None))
   (let* ((edges (window-inside-absolute-pixel-edges window))
  (width (- (elt edges 2) (elt edges 0)))
  (height (- (elt edges 3) (elt edges 1
@@ -93,7 +85,16 @@
  (elt relative-edges 0)
  (elt relative-edges 1)
  width height
- (active-minibuffer-window)
+ (active-minibuffer-window
+  ;; Make the resizing take effect.
+  (xcb:flush exwm--connection)
+  (xcb:+request exwm--connection (make-instance 'xcb:MapWindow :window id))
+  (xcb:+request exwm--connection
+  (make-instance 'xcb:MapWindow :window exwm--container))
+ 

[elpa] externals/exwm 33254c3 1/2: Redefine mode-specific keys

2016-02-19 Thread Chris Feng
branch: externals/exwm
commit 33254c37df052996d63ff2a55efeb2b6e8799694
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Redefine mode-specific keys

* exwm-core.el (exwm-mode-map): Redefine mode-specific keys to comply with
the key binding conventions.
---
 exwm-core.el |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/exwm-core.el b/exwm-core.el
index 4d936ed..5377c67 100644
--- a/exwm-core.el
+++ b/exwm-core.el
@@ -120,12 +120,12 @@
 
 (defvar exwm-mode-map
   (let ((map (make-sparse-keymap)))
-(define-key map "\C-ck" #'exwm-input-release-keyboard)
-(define-key map "\C-cf" #'exwm-layout-set-fullscreen)
-(define-key map "\C-cm" #'exwm-floating-toggle-floating)
-(define-key map "\C-cq" #'exwm-input-send-next-key)
-(define-key map "\C-cv" #'exwm-workspace-move-window)
-(define-key map "\C-cM" #'exwm-layout-toggle-mode-line)
+(define-key map "\C-c\C-f" #'exwm-layout-set-fullscreen)
+(define-key map "\C-c\C-k" #'exwm-input-release-keyboard)
+(define-key map "\C-c\C-m" #'exwm-workspace-move-window)
+(define-key map "\C-c\C-q" #'exwm-input-send-next-key)
+(define-key map "\C-c\C-t\C-f" #'exwm-floating-toggle-floating)
+(define-key map "\C-c\C-t\C-m" #'exwm-layout-toggle-mode-line)
 map)
   "Keymap for `exwm-mode'.")
 



[elpa] externals/exwm e3d33a4: Prevent Emacs frames from restacking themselves

2016-02-20 Thread Chris Feng
branch: externals/exwm
commit e3d33a4aad6b5748e9352501b2c6cb058379025f
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Prevent Emacs frames from restacking themselves

Putting Emacs frames (workspace frames, floating frames) into dedicated
containers greatly simplifies the stacking order management and totally
fixes relevant issues.

* exwm-floating.el (exwm-floating--set-floating): Create floating frame
container.  Remove redundant stacking order modification code.
(exwm-floating--unset-floating): Destroy the floating frame container.
No need to reparent the X window container.
(exwm-floating--do-moveresize): Resize the floating frame container.
* exwm-input.el (exwm-input--update-focus): No need to restack frames.
* exwm-layout.el (exwm-layout--show, exwm-layout--set-frame-fullscreen)
(exwm-layout-enlarge-window): Resize the floating frame container.
* exwm-manage.el (exwm-manage--on-ConfigureRequest): Re-enable stacking
order modification on ConfigureRequest.

* exwm-workspace.el (exwm-workspace--confirm-kill-emacs): Reparent out all
frames on exit.  No need to remove selected events or created resources.
(exwm-workspace--init): Create workspace frame containers.

* exwm-layout.el (exwm-layout-set-fullscreen):
* exwm-manage.el (exwm-manage--unmanage-window): Remove a redundant call to
`xcb:flush'.

* exwm-manage.el (exwm-manage--unmanage-window): Force unmap the X window.
Unmap the floating frame before reparent it.
---
 exwm-floating.el  |  109 +---
 exwm-input.el |   14 +-
 exwm-layout.el|   88 +++
 exwm-manage.el|   42 -
 exwm-workspace.el |   60 -
 5 files changed, 192 insertions(+), 121 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index 2769488..1ec54d1 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -90,6 +90,7 @@
  (outer-id (string-to-number (frame-parameter frame 'outer-window-id)))
  (container (with-current-buffer (exwm--id->buffer id)
   exwm--container))
+ (frame-container (xcb:generate-id exwm--connection))
  (window (frame-first-window frame)) ;and it's the only window
  (x (slot-value exwm--geometry 'x))
  (y (slot-value exwm--geometry 'y))
@@ -103,8 +104,9 @@
 y (- y (slot-value frame-geometry 'y
 (exwm--log "Floating geometry (original, relative): %dx%d%+d%+d"
width height x y)
-;; Save window IDs
+;; Save frame parameters.
 (set-frame-parameter frame 'exwm-outer-id outer-id)
+(set-frame-parameter frame 'exwm-container frame-container)
 ;; Set urgency flag if it's not appear in the active workspace
 (let ((idx (cl-position original-frame exwm-workspace--list)))
   (when (/= idx exwm-workspace-current-index)
@@ -163,18 +165,43 @@
 ;; timely.
 ;; The frame will be made visible by `select-frame-set-input-focus'.
 (make-frame-invisible frame)
-(let ((edges (window-inside-pixel-edges window)))
-  (set-frame-size frame
-  (+ width (- (frame-pixel-width frame)
-  (- (elt edges 2) (elt edges 0
-  (+ height (- (frame-pixel-height frame)
-   (- (elt edges 3) (elt edges 1
-  t))
-;; Reparent this frame to the container
+(let* ((edges (window-inside-pixel-edges window))
+   (frame-width (+ width (- (frame-pixel-width frame)
+(- (elt edges 2) (elt edges 0)
+   (frame-height (+ height (- (frame-pixel-height frame)
+  (- (elt edges 3) (elt edges 1))
+  (set-frame-size frame frame-width frame-height t)
+  ;; Create the frame container as the parent of the frame and
+  ;; a child of the X window container.
+  (xcb:+request exwm--connection
+  (make-instance 'xcb:CreateWindow
+ :depth 0 :wid frame-container
+ :parent container
+ :x 0 :y 0 :width width :height height :border-width 0
+ :class xcb:WindowClass:CopyFromParent
+ :visual 0  ;CopyFromParent
+ :value-mask xcb:CW:OverrideRedirect
+ :override-redirect 1))
+  ;; Put it at bottom.
+  (xcb:+request exwm--connection
+  (make-instance 'xcb:ConfigureWindow
+ :window frame-container
+ :value-mask xcb:ConfigWindow:StackMode
+ :stack-mode xcb:StackMode:Below))
+  ;; Map it.
+  (xcb:+request exwm--connection
+  (make-instance 'xc

[elpa] externals/exwm updated (e3d33a4 -> 7116b01)

2016-02-21 Thread Chris Feng
ch11ng pushed a change to branch externals/exwm.

  from  e3d33a4   Prevent Emacs frames from restacking themselves
   new  734b401   Fix the advice function for ido-buffer-window-other-frame
   new  7116b01   Various fixes for floating X windows


Summary of changes:
 exwm-config.el|   43 ---
 exwm-floating.el  |   16 +---
 exwm-workspace.el |  100 +++--
 3 files changed, 121 insertions(+), 38 deletions(-)



[elpa] externals/exwm 734b401 1/2: Fix the advice function for ido-buffer-window-other-frame

2016-02-21 Thread Chris Feng
branch: externals/exwm
commit 734b4013063d1bf3c6e34e0aa66e39a92ba49ace
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Fix the advice function for ido-buffer-window-other-frame

* exwm-config.el (exwm-config--ido-buffer-window-other-frame)
(exwm-config--fix/ido-buffer-window-other-frame): Do not use advice.
Fix issues when switching form/to floating frames.
---
 exwm-config.el |   43 ++-
 1 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/exwm-config.el b/exwm-config.el
index db8c68f..d6e10f2 100644
--- a/exwm-config.el
+++ b/exwm-config.el
@@ -26,6 +26,7 @@
 ;;; Code:
 
 (require 'exwm)
+(require 'ido)
 
 (defun exwm-config-default ()
   "Default configuration of EXWM."
@@ -65,21 +66,37 @@
   ;; Other configurations
   (exwm-config-misc))
 
-(defun exwm-config--ido-buffer-window-other-frame (orig-fun buffer)
-  "Wrapper for `ido-buffer-window-other-frame' to exclude invisible windows."
-  (with-current-buffer buffer
-(if (and (eq major-mode 'exwm-mode)
- (or exwm--floating-frame
- (not exwm-layout-show-all-buffers)))
-;; `ido-mode' works well with `exwm-mode' buffers
-(funcall orig-fun buffer)
-  ;; Other buffers should be selected within the same workspace
-  (get-buffer-window buffer exwm-workspace--current
-
 (defun exwm-config--fix/ido-buffer-window-other-frame ()
   "Fix `ido-buffer-window-other-frame'."
-  (advice-add 'ido-buffer-window-other-frame :around
-  #'exwm-config--ido-buffer-window-other-frame))
+  (defalias 'exwm-config-ido-buffer-window-other-frame
+(symbol-function #'ido-buffer-window-other-frame))
+  (defun ido-buffer-window-other-frame (buffer)
+"This is a version redefined by EXWM.
+
+You can find the original one at `exwm-config-ido-buffer-window-other-frame'."
+(with-current-buffer (window-buffer (selected-window))
+  (if (and (eq major-mode 'exwm-mode)
+   exwm--floating-frame)
+  ;; Switch from a floating frame.
+  (with-current-buffer buffer
+(if (and (eq major-mode 'exwm-mode)
+ exwm--floating-frame
+ (eq exwm--frame exwm-workspace--current))
+;; Switch to another floating frame.
+(frame-root-window exwm--floating-frame)
+  ;; Do not switch if the buffer is not on the current workspace.
+  (or (get-buffer-window buffer exwm-workspace--current)
+  (selected-window
+(with-current-buffer buffer
+  (when (eq major-mode 'exwm-mode)
+(if (eq exwm--frame exwm-workspace--current)
+(when exwm--floating-frame
+  ;; Switch to a floating frame on the current workspace.
+  (frame-selected-window exwm--floating-frame))
+  ;; Do not switch to exwm-mode buffers on other workspace (which
+  ;; won't work unless `exwm-layout-show-all-buffers' is set)
+  (unless exwm-layout-show-all-buffers
+(selected-window)
 
 (defun exwm-config-ido ()
   "Configure Ido to work with EXWM."



[elpa] externals/exwm 7116b01 2/2: Various fixes for floating X windows

2016-02-21 Thread Chris Feng
branch: externals/exwm
commit 7116b01b0c9b7efda105487a17192470c466b9c4
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Various fixes for floating X windows

* exwm-floating.el (exwm-floating--set-floating): Always create floating X
windows on current workspace.

* exwm-workspace.el (exwm-workspace-switch): Restore selected floating
frames.

* exwm-workspace.el (exwm-workspace-move-window): Restore the position of
floating X windows.  Recreate floating frames when using fixed minibuffer.
Restack tiling X windows.
---
 exwm-floating.el  |   16 +---
 exwm-workspace.el |  100 +++--
 2 files changed, 91 insertions(+), 25 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index 1ec54d1..97d673c 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -63,14 +63,7 @@
   (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))
-;; Place a modal in the same workspace with its leading window
-(with-current-buffer (exwm--id->buffer exwm-transient-for)
-  exwm--frame)
-  ;; Fallback to current workspace
-  exwm-workspace--current)))
+  (let* ((original-frame exwm-workspace--current)
  ;; Create new frame
  (frame (with-current-buffer
 (or (get-buffer "*scratch*")
@@ -79,7 +72,7 @@
(get-buffer-create "*scratch*"))
   (get-buffer "*scratch*")))
   (make-frame
-   `((minibuffer . nil) ;use the one on workspace
+   `((minibuffer . nil) ;use the default minibuffer.
  (background-color . ,exwm-floating-border-color)
  (internal-border-width . ,exwm-floating-border-width)
  (left . 1)
@@ -107,11 +100,6 @@
 ;; Save frame parameters.
 (set-frame-parameter frame 'exwm-outer-id outer-id)
 (set-frame-parameter frame 'exwm-container frame-container)
-;; Set urgency flag if it's not appear in the active workspace
-(let ((idx (cl-position original-frame exwm-workspace--list)))
-  (when (/= idx exwm-workspace-current-index)
-(set-frame-parameter original-frame 'exwm--urgency t)
-(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-workspace.el b/exwm-workspace.el
index 42c0818..99bc605 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -186,7 +186,14 @@ The optional FORCE option is for internal use only."
:stack-mode xcb:StackMode:Above))
 (setq exwm-workspace--current frame
   exwm-workspace-current-index index)
-(select-window (frame-selected-window frame))
+(unless (memq (selected-frame) exwm-workspace--list)
+  ;; Save the floating frame window selected on the previous workspace.
+  (set-frame-parameter (with-current-buffer (window-buffer)
+ exwm--frame)
+   'exwm-selected-window (selected-window)))
+(select-window (or (frame-parameter frame 'exwm-selected-window)
+   (frame-selected-window frame)))
+(set-frame-parameter frame 'exwm-selected-window nil)
 ;; Close the (possible) active minibuffer
 (when (active-minibuffer-window)
   (run-with-idle-timer 0 nil (lambda () (abort-recursive-edit
@@ -221,7 +228,11 @@ The optional FORCE option is for internal use only."
 (xcb:flush exwm--connection))
   (run-hooks 'exwm-workspace-switch-hook
 
+(defvar exwm-floating-border-width)
+(defvar exwm-floating-border-color)
+
 (declare-function exwm-layout--hide "exwm-layout.el" (id))
+(declare-function exwm-layout--refresh "exwm-layout.el")
 
 ;;;###autoload
 (defun exwm-workspace-move-window (index  id)
@@ -253,14 +264,72 @@ The optional FORCE option is for internal use only."
 (setq exwm--frame frame)
 (if exwm--floating-frame
 ;; Move the floating container.
-(progn
+(with-slots (x y)
+(xcb:+request-unchecked+reply exwm--connection
+(make-instance 'xcb:GetGeometry :drawable exwm--container))
   (xcb:+request exwm--connection
   (make-instance 'xcb:ReparentWindow
  :window exwm--con

[elpa] externals/exwm 35493fa 2/2: Bump version to 0.3

2016-02-21 Thread Chris Feng
branch: externals/exwm
commit 35493faca670738f6078009ec6d9b862721d7ea0
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Bump version to 0.3
---
 exwm.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/exwm.el b/exwm.el
index d3d2c10..d967c7e 100644
--- a/exwm.el
+++ b/exwm.el
@@ -4,8 +4,8 @@
 
 ;; Author: Chris Feng <chris.w.f...@gmail.com>
 ;; Maintainer: Chris Feng <chris.w.f...@gmail.com>
-;; Version: 0.2
-;; Package-Requires: ((xelb "0.5"))
+;; Version: 0.3
+;; Package-Requires: ((xelb "0.6"))
 ;; Keywords: unix
 ;; URL: https://github.com/ch11ng/exwm
 



[elpa] externals/exwm updated (7116b01 -> 35493fa)

2016-02-21 Thread Chris Feng
ch11ng pushed a change to branch externals/exwm.

  from  7116b01   Various fixes for floating X windows
   new  55cec76   Fix emacsclient related issues
   new  35493fa   Bump version to 0.3


Summary of changes:
 exwm-floating.el   |3 +--
 exwm-randr.el  |3 +--
 exwm-systemtray.el |   14 +++---
 exwm-workspace.el  |9 +
 exwm.el|6 +++---
 5 files changed, 17 insertions(+), 18 deletions(-)



[elpa] externals/exwm 55cec76 1/2: Fix emacsclient related issues

2016-02-21 Thread Chris Feng
branch: externals/exwm
commit 55cec760ca3cee21e735bff9a9a5229b222b97ff
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Fix emacsclient related issues

* exwm-systemtray.el (exwm-systemtray-height): The value is not available
when emacsclient has just loaded the library (and it crashes emacsclient).

* exwm-workspace.el (exwm-workspace--init): Set `default-minibuffer-frame'
later to prevent it from being modified when using emacsclient.

* exwm-floating.el:
* exwm-randr.el:
* exwm-systemtray.el:
* exwm-workspace.el:
* exwm.el: Use `exwm-workspace--minibuffer-own-frame-p' instead of the raw
variable.
---
 exwm-floating.el   |3 +--
 exwm-randr.el  |3 +--
 exwm-systemtray.el |   14 +++---
 exwm-workspace.el  |9 +
 exwm.el|2 +-
 5 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index 97d673c..b562019 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -53,7 +53,6 @@
 (defvar exwm-workspace--list)
 (defvar exwm-workspace-current-index)
 (defvar exwm-workspace--switch-history-outdated)
-(defvar exwm-workspace-minibuffer-position)
 
 (declare-function exwm-layout--refresh "exwm-layout.el")
 (declare-function exwm-layout--show "exwm-layout.el")
@@ -104,7 +103,7 @@
 ;; FIXME: check normal hints restrictions
 (let* ((display-width (frame-pixel-width original-frame))
(display-height (- (frame-pixel-height original-frame)
-  (if exwm-workspace-minibuffer-position
+  (if (exwm-workspace--minibuffer-own-frame-p)
   0
 (window-pixel-height (minibuffer-window
   original-frame)))
diff --git a/exwm-randr.el b/exwm-randr.el
index 7f9b443..e761d8f 100644
--- a/exwm-randr.el
+++ b/exwm-randr.el
@@ -54,7 +54,6 @@
 (defvar exwm-randr-refresh-hook nil
   "Normal hook run when the RandR module just refreshed.")
 
-(defvar exwm-workspace-minibuffer-position)
 (defvar exwm-layout--fullscreen-frame-count)
 (defvar exwm-workspace-number)
 (defvar exwm-workspace--list)
@@ -94,7 +93,7 @@
 (setq default-geometry geometry)))
 (exwm--log "(randr) outputs: %s" output-plist)
 (when output-plist
-  (setq workarea-offset (if exwm-workspace-minibuffer-position
+  (setq workarea-offset (if (exwm-workspace--minibuffer-own-frame-p)
 0
   (window-pixel-height (minibuffer-window
   (setq exwm-layout--fullscreen-frame-count 0)
diff --git a/exwm-systemtray.el b/exwm-systemtray.el
index e9a9745..861304a 100644
--- a/exwm-systemtray.el
+++ b/exwm-systemtray.el
@@ -43,9 +43,7 @@
 ;; GTK icons require at least 16 pixels to show normally.
 (defconst exwm-systemtray--icon-min-size 16 "Minimum icon size.")
 
-(defvar exwm-systemtray-height (max exwm-systemtray--icon-min-size
-(line-pixel-height))
-  "System tray height.
+(defvar exwm-systemtray-height nil "System tray height.
 
 You shall use the default value if using auto-hide minibuffer.")
 
@@ -258,12 +256,11 @@ You shall use the default value if using auto-hide 
minibuffer.")
   (t
(exwm--log "(System Tray) Unknown opcode message: %s" obj)))
 
-(defvar exwm-workspace-minibuffer-position)
 (defvar exwm-workspace--current)
 
 (defun exwm-systemtray--on-workspace-switch ()
   "Reparent/Refresh the system tray in `exwm-workspace-switch-hook'."
-  (unless exwm-workspace-minibuffer-position
+  (unless (exwm-workspace--minibuffer-own-frame-p)
 (xcb:+request exwm-systemtray--connection
 (make-instance 'xcb:ReparentWindow
:window exwm-systemtray--embedder
@@ -277,7 +274,7 @@ You shall use the default value if using auto-hide 
minibuffer.")
 
 (defun exwm-systemtray--on-randr-refresh ()
   "Reposition/Refresh the system tray in `exwm-randr-refresh-hook'."
-  (unless exwm-workspace-minibuffer-position
+  (unless (exwm-workspace--minibuffer-own-frame-p)
 (xcb:+request exwm-systemtray--connection
 (make-instance 'xcb:ConfigureWindow
:window exwm-systemtray--embedder
@@ -295,6 +292,9 @@ You shall use the default value if using auto-hide 
minibuffer.")
   (cl-assert (not exwm-systemtray--list))
   (cl-assert (not exwm-systemtray--selection-owner-window))
   (cl-assert (not exwm-systemtray--embedder))
+  (unless exwm-systemtray-height
+(setq exwm-systemtray-height (max exwm-systemtray--icon-min-size
+  (line-pixel-height
   ;; Create a new connection.
   (setq exwm-systemtray--connection (xcb:connect-to-socket))
   (set-process-qu

[elpa] externals/xelb 447f14d: Bump version to 0.6

2016-02-21 Thread Chris Feng
branch: externals/xelb
commit 447f14da095e5dfe262b0146ed4e078da1ac2ccb
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Bump version to 0.6
---
 xelb.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/xelb.el b/xelb.el
index 1b938f7..1fc3b4f 100644
--- a/xelb.el
+++ b/xelb.el
@@ -4,7 +4,7 @@
 
 ;; Author: Chris Feng <chris.w.f...@gmail.com>
 ;; Maintainer: Chris Feng <chris.w.f...@gmail.com>
-;; Version: 0.5
+;; Version: 0.6
 ;; Package-Requires: ((emacs "24.4") (cl-generic "0.2"))
 ;; Keywords: unix
 ;; URL: https://github.com/ch11ng/xelb



[elpa] externals/exwm 3cef44a: Exclude unmanaged floating X windows when refreshing

2016-03-15 Thread Chris Feng
branch: externals/exwm
commit 3cef44a6ca2093500b092f99dc588fb8bf9c184d
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Exclude unmanaged floating X windows when refreshing

* exwm-layout.el (exwm-layout--refresh): Do not show unmanaged
floating X windows.
---
 exwm-layout.el |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/exwm-layout.el b/exwm-layout.el
index 309bfb6..6825cb5 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -258,8 +258,10 @@
 (when (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
+  ;; It may be a buffer waiting to be killed.
+  (when (exwm--id->buffer exwm--id)
+(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
   (setq windows (window-list frame 0)) ;exclude minibuffer



[elpa] externals/exwm c8c0bc7: Neglect trivial resizing requests

2016-03-10 Thread Chris Feng
branch: externals/exwm
commit c8c0bc7b60c043d47e153e40c2ae139f513e9358
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Neglect trivial resizing requests

* exwm-manage.el (exwm-manage--on-ConfigureRequest): Neglect trivial
resizing requests since that cannot be done precisely.
---
 exwm-manage.el |   52 
 1 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/exwm-manage.el b/exwm-manage.el
index bb6d5ff..b0657b9 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -407,10 +407,14 @@ Would you like to kill it? "
  (xcb:+request exwm--connection ,request
 (xcb:flush exwm--connection)))
 
+;; FIXME: Make the following values as small as possible.
+(defconst exwm-manage--width-delta-min 5)
+(defconst exwm-manage--height-delta-min 5)
+
 (defun exwm-manage--on-ConfigureRequest (data _synthetic)
   "Handle ConfigureRequest event."
   (let ((obj (make-instance 'xcb:ConfigureRequest))
-buffer edges)
+buffer edges width-delta height-delta)
 (xcb:unmarshal obj data)
 (with-slots (window x y width height
 border-width sibling stack-mode value-mask)
@@ -421,7 +425,29 @@ border-width: %d; sibling: #x%x; stack-mode: %d"
  border-width sibling stack-mode)
   (if (and (setq buffer (exwm--id->buffer window))
(with-current-buffer buffer
- (or exwm--fullscreen (not exwm--floating-frame
+ (or exwm--fullscreen
+ ;; Make sure it's a floating X window wanting to resize
+ ;; itself.
+ (or (not exwm--floating-frame)
+ (progn
+   (setq edges
+ (window-inside-pixel-edges
+  (get-buffer-window buffer t))
+ width-delta (- width (- (elt edges 2)
+ (elt edges 0)))
+ height-delta (- height (- (elt edges 3)
+   (elt edges 1
+   ;; We cannot do resizing precisely for now.
+   (and (if (= 0 (logand value-mask
+ xcb:ConfigWindow:Width))
+t
+  (< (abs width-delta)
+ exwm-manage--width-delta-min))
+(if (= 0 (logand value-mask
+  xcb:ConfigWindow:Height))
+t
+  (< (abs height-delta)
+ exwm-manage--height-delta-min
   ;; Send client message for managed windows
   (with-current-buffer buffer
 (setq edges
@@ -449,16 +475,18 @@ border-width: %d; sibling: #x%x; stack-mode: %d"
 (if buffer
 (with-current-buffer buffer
   (exwm--log "ConfigureWindow (resize floating X window)")
-  (setq edges
-(window-inside-pixel-edges (get-buffer-window buffer t)))
-  (set-frame-size exwm--floating-frame
-  (+ width
- (- (frame-pixel-width exwm--floating-frame)
-(- (elt edges 2) (elt edges 0
-  (+ height
- (- (frame-pixel-height exwm--floating-frame)
-(- (elt edges 3) (elt edges 1
-  t))
+  (when (and (/= 0 (logand value-mask xcb:ConfigWindow:Width))
+ (>= (abs width-delta) exwm-manage--width-delta-min))
+(set-frame-width exwm--floating-frame
+ (+ (frame-pixel-width exwm--floating-frame)
+width-delta)
+ nil t))
+  (when (and (/= 0 (logand value-mask xcb:ConfigWindow:Height))
+ (>= (abs height-delta) exwm-manage--height-delta-min))
+(set-frame-height exwm--floating-frame
+  (+ (frame-pixel-height exwm--floating-frame)
+ height-delta)
+  nil t)))
   (exwm--log "ConfigureWindow (preserve geometry)")
   ;; Configure the unmanaged window.
   (xcb:+request exwm--connection



[elpa] externals/exwm ddbbeda: Fix 2 multi-monitor issues

2016-04-07 Thread Chris Feng
branch: externals/exwm
commit ddbbeda285b3b671ace99f1688e6bd3c3f84c742
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Fix 2 multi-monitor issues

* exwm-workspace.el (exwm-workspace--on-focus-in, exwm-workspace--init):
Handle unexpected frame switch in `focus-in-hook'.

* exwm-floating.el (exwm-floating--set-floating): If the absolute position
is (0, 0) then the relative position is also the same.
---
 exwm-floating.el  |4 +++-
 exwm-workspace.el |   12 
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index a67bc19..770976d 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -91,7 +91,9 @@
  (frame-geometry (frame-parameter original-frame 'exwm-geometry)))
 (exwm--log "Floating geometry (original, absolute): %dx%d%+d%+d"
width height x y)
-(when frame-geometry
+(when (and frame-geometry
+   (/= x 0)
+   (/= y 0))
   (setq x (- x (slot-value frame-geometry 'x))
 y (- y (slot-value frame-geometry 'y
 (exwm--log "Floating geometry (original, relative): %dx%d%+d%+d"
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 8dd6284..60cf9dd 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -229,6 +229,16 @@ The optional FORCE option is for internal use only."
 (xcb:flush exwm--connection))
   (run-hooks 'exwm-workspace-switch-hook
 
+(defun exwm-workspace--on-focus-in ()
+  "Handle unexpected frame switch."
+  ;; `focus-in-hook' is run by `handle-switch-frame'.
+  (unless (eq this-command #'handle-switch-frame)
+(let ((index (cl-position (selected-frame) exwm-workspace--list)))
+  (exwm--log "Focus on workspace %s" index)
+  (when (and index (/= index exwm-workspace-current-index))
+(exwm--log "Workspace was switched unexpectedly")
+(exwm-workspace-switch index)
+
 (defvar exwm-floating-border-width)
 (defvar exwm-floating-border-color)
 
@@ -679,6 +689,8 @@ The optional FORCE option is for internal use only."
 (add-hook 'minibuffer-exit-hook #'exwm-workspace--on-minibuffer-exit)
 (run-with-idle-timer 0 t #'exwm-workspace--on-echo-area-dirty)
 (add-hook 'echo-area-clear-hook #'exwm-workspace--on-echo-area-clear)
+;; Handle unexpected frame switch.
+(add-hook 'focus-in-hook #'exwm-workspace--on-focus-in)
 ;; Create workspace frames.
 (dotimes (_ exwm-workspace-number)
   (push (make-frame `((window-system . x)



[elpa] externals/exwm 44d05d2 6/6: Merge branch 'medranocalvo/remember-last-buffer' into externals/exwm

2016-03-19 Thread Chris Feng
branch: externals/exwm
commit 44d05d2dd3e8214ef8815f7433758e9e155db3c9
Merge: 3cef44a 4d6b19a
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Merge branch 'medranocalvo/remember-last-buffer' into externals/exwm
---
 exwm-layout.el|   98 +
 exwm-workspace.el |   10 +++---
 2 files changed, 74 insertions(+), 34 deletions(-)

diff --git a/exwm-layout.el b/exwm-layout.el
index 6825cb5..095e461 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -240,35 +240,60 @@
   (xcb:flush exwm--connection)))
   (cl-incf exwm-layout--fullscreen-frame-count))
 
+(defvar exwm-layout--other-buffer-exclude-exwm-mode-buffers nil
+  "When non-nil, prevent EXWM buffers from being selected by `other-buffer'.")
+
+(defvar exwm-layout--other-buffer-exclude-buffers nil
+  "List of buffers that should not be selected by `other-buffer'.")
+
+(defun exwm-layout--other-buffer-predicate (buffer)
+  "Return non-nil when the BUFFER may be displayed in selected frame.
+
+Prevents EXWM-mode buffers already being displayed on some other window from
+being selected.
+
+Should be set as `buffer-predicate' frame parameter for all
+frames.  Used by `other-buffer'.
+
+When variable `exwm-layout--other-buffer-exclude-exwm-mode-buffers'
+is t EXWM buffers are never selected by `other-buffer'.
+
+When variable `exwm-layout--other-buffer-exclude-buffers' is a
+list of buffers, EXWM buffers belonging to that list are never
+selected by `other-buffer'."
+  (or (not (eq 'exwm-mode (buffer-local-value 'major-mode buffer)))
+  (and (not exwm-layout--other-buffer-exclude-exwm-mode-buffers)
+   (not (memq buffer exwm-layout--other-buffer-exclude-buffers))
+   ;; Do not select if already shown in some window.
+   (not (get-buffer-window buffer t)
+
 (defvar exwm-layout-show-all-buffers nil
   "Non-nil to allow switching to buffers on other workspaces.")
 
 (defun exwm-layout--refresh ()
   "Refresh layout."
   (let ((frame (selected-frame))
-(placeholder (or (get-buffer "*scratch*")
- (progn
-   (set-buffer-major-mode
-(get-buffer-create "*scratch*"))
-   (get-buffer "*scratch*"
+covered-buffers ;EXWM-buffers covered by a new X window.
+vacated-windows ;Windows previously displaying 
EXWM-buffers.
 windows)
 (if (not (memq frame exwm-workspace--list))
 (if (frame-parameter frame 'exwm-outer-id)
 ;; Refresh a floating frame
-(when (eq major-mode 'exwm-mode)
-  (let ((window (frame-first-window frame)))
-(with-current-buffer (window-buffer window)
-  ;; It may be a buffer waiting to be killed.
-  (when (exwm--id->buffer exwm--id)
-(exwm--log "Refresh floating window #x%x" exwm--id)
-(exwm-layout--show exwm--id window)
+(let ((window (frame-first-window frame)))
+  (with-current-buffer (window-buffer window)
+(when (and (eq major-mode 'exwm-mode)
+   ;; It may be a buffer waiting to be killed.
+   (exwm--id->buffer exwm--id))
+  (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
   (setq windows (window-list frame 0)) ;exclude minibuffer
-  (dolist (window windows)
-(with-current-buffer (window-buffer window)
-  (when (eq major-mode 'exwm-mode)
-(set-window-buffer window placeholder)
+  (let ((exwm-layout--other-buffer-exclude-exwm-mode-buffers t))
+(dolist (window windows)
+  (with-current-buffer (window-buffer window)
+(when (eq major-mode 'exwm-mode)
+  (switch-to-prev-buffer window))
   ;; Refresh the whole workspace
   ;; Workspaces other than the active one can also be refreshed (RandR)
   (exwm--log "Refresh workspace %s" frame)
@@ -282,21 +307,36 @@
 (if (not windows)
 (when (eq frame exwm--frame) ;for exwm-layout-show-all-buffers
   (exwm-layout--hide exwm--id))
-  (if (eq frame exwm--frame)
-  (exwm-layout--show exwm--id (car windows))
-(exwm-workspace-move-window
- (cl-position frame exwm-workspace--list) exwm--id))
   (let ((window (car windows)))
-;; Make sure this buffer is not displayed elsewhere
-(dolist (i (

[elpa] externals/exwm 4d6b19a 5/6: Restore a sensible buffer when replacing EXWM buffers

2016-03-19 Thread Chris Feng
branch: externals/exwm
commit 4d6b19aece7de841226b65d1945a7ac4c146c807
Author: Adrián Medraño Calvo 
Commit: Adrián Medraño Calvo 

Restore a sensible buffer when replacing EXWM buffers

* exwm-layout.el (exwm-layout--other-buffer-exclude-exwm-mode-buffers)
(exwm-layout--other-buffer-exclude-buffers): New variables.
(exwm-layout--other-buffer-predicate): Allow excluding EXWM
buffers or buffers from a given set.
(exwm-layout--refresh): Replace EXWM buffers with sensible buffers
depending on the situation.  When in non-workspace/non-floating
frames, with some non-EXWM buffer; when the EXWM buffer is
displayed elsewhere, some buffer previously displayed in that
window (making sure it has been recently covered).
---
 exwm-layout.el |   71 +++
 1 files changed, 50 insertions(+), 21 deletions(-)

diff --git a/exwm-layout.el b/exwm-layout.el
index b0b9467..095e461 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -240,6 +240,12 @@
   (xcb:flush exwm--connection)))
   (cl-incf exwm-layout--fullscreen-frame-count))
 
+(defvar exwm-layout--other-buffer-exclude-exwm-mode-buffers nil
+  "When non-nil, prevent EXWM buffers from being selected by `other-buffer'.")
+
+(defvar exwm-layout--other-buffer-exclude-buffers nil
+  "List of buffers that should not be selected by `other-buffer'.")
+
 (defun exwm-layout--other-buffer-predicate (buffer)
   "Return non-nil when the BUFFER may be displayed in selected frame.
 
@@ -247,9 +253,19 @@ Prevents EXWM-mode buffers already being displayed on some 
other window from
 being selected.
 
 Should be set as `buffer-predicate' frame parameter for all
-frames.  Used by `other-buffer'."
-  (not (and (eq 'exwm-mode (buffer-local-value 'major-mode buffer))
-(get-buffer-window buffer t
+frames.  Used by `other-buffer'.
+
+When variable `exwm-layout--other-buffer-exclude-exwm-mode-buffers'
+is t EXWM buffers are never selected by `other-buffer'.
+
+When variable `exwm-layout--other-buffer-exclude-buffers' is a
+list of buffers, EXWM buffers belonging to that list are never
+selected by `other-buffer'."
+  (or (not (eq 'exwm-mode (buffer-local-value 'major-mode buffer)))
+  (and (not exwm-layout--other-buffer-exclude-exwm-mode-buffers)
+   (not (memq buffer exwm-layout--other-buffer-exclude-buffers))
+   ;; Do not select if already shown in some window.
+   (not (get-buffer-window buffer t)
 
 (defvar exwm-layout-show-all-buffers nil
   "Non-nil to allow switching to buffers on other workspaces.")
@@ -257,11 +273,8 @@ frames.  Used by `other-buffer'."
 (defun exwm-layout--refresh ()
   "Refresh layout."
   (let ((frame (selected-frame))
-(placeholder (or (get-buffer "*scratch*")
- (progn
-   (set-buffer-major-mode
-(get-buffer-create "*scratch*"))
-   (get-buffer "*scratch*"
+covered-buffers ;EXWM-buffers covered by a new X window.
+vacated-windows ;Windows previously displaying 
EXWM-buffers.
 windows)
 (if (not (memq frame exwm-workspace--list))
 (if (frame-parameter frame 'exwm-outer-id)
@@ -276,10 +289,11 @@ frames.  Used by `other-buffer'."
   ;; Other frames (e.g. terminal/graphical frame of emacsclient)
   ;; We shall bury all `exwm-mode' buffers in this case
   (setq windows (window-list frame 0)) ;exclude minibuffer
-  (dolist (window windows)
-(with-current-buffer (window-buffer window)
-  (when (eq major-mode 'exwm-mode)
-(set-window-buffer window placeholder)
+  (let ((exwm-layout--other-buffer-exclude-exwm-mode-buffers t))
+(dolist (window windows)
+  (with-current-buffer (window-buffer window)
+(when (eq major-mode 'exwm-mode)
+  (switch-to-prev-buffer window))
   ;; Refresh the whole workspace
   ;; Workspaces other than the active one can also be refreshed (RandR)
   (exwm--log "Refresh workspace %s" frame)
@@ -298,16 +312,31 @@ frames.  Used by `other-buffer'."
 (exwm-layout--show exwm--id window)
   (exwm-workspace-move-window
(cl-position frame exwm-workspace--list) exwm--id))
-;; Make sure this buffer is not displayed elsewhere
-(dolist (i (get-buffer-window-list (current-buffer) 0 t))
-  (unless (eq i window)
-(set-window-buffer i placeholder
+;; Make sure this buffer is not displayed elsewhere.  Note down
+;; windows displaying an EXWM-buffer now displayed elsewhere; 
we
+;; need to display with some other buffer there.
+(setq vacated-windows
+ 

[elpa] externals/exwm f6cd950 1/6: Minor cleanup

2016-03-19 Thread Chris Feng
branch: externals/exwm
commit f6cd9503e62164f9e2513755f95f7c61eeddf51e
Author: Adrián Medraño Calvo 
Commit: Adrián Medraño Calvo 

Minor cleanup

* exwm-layout.el (exwm-layout--refresh): Reuse car.
---
 exwm-layout.el |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/exwm-layout.el b/exwm-layout.el
index 6825cb5..fd8c164 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -282,11 +282,11 @@
 (if (not windows)
 (when (eq frame exwm--frame) ;for exwm-layout-show-all-buffers
   (exwm-layout--hide exwm--id))
-  (if (eq frame exwm--frame)
-  (exwm-layout--show exwm--id (car windows))
-(exwm-workspace-move-window
- (cl-position frame exwm-workspace--list) exwm--id))
   (let ((window (car windows)))
+(if (eq frame exwm--frame)
+(exwm-layout--show exwm--id window)
+  (exwm-workspace-move-window
+   (cl-position frame exwm-workspace--list) exwm--id))
 ;; Make sure this buffer is not displayed elsewhere
 (dolist (i (get-buffer-window-list (current-buffer) 0 t))
   (unless (eq i window)



[elpa] externals/exwm 3763195 3/6: Use `buffer-predicate' frame parameter to prevent switching to visible EXWM buffers

2016-03-19 Thread Chris Feng
branch: externals/exwm
commit 3763195fe3205090e1f405970421662523b7df7e
Author: Adrián Medraño Calvo 
Commit: Adrián Medraño Calvo 

Use `buffer-predicate' frame parameter to prevent switching to visible EXWM 
buffers

* exwm-layout.el (exwm-layout--other-buffer-predicate): New
function to be set as `buffer-predicate' frame parameter.
* exwm-workspace.el (exwm-workspace--init): Use above function on
workspace frames.
---
 exwm-layout.el|   11 +++
 exwm-workspace.el |4 
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/exwm-layout.el b/exwm-layout.el
index d084c96..b0b9467 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -240,6 +240,17 @@
   (xcb:flush exwm--connection)))
   (cl-incf exwm-layout--fullscreen-frame-count))
 
+(defun exwm-layout--other-buffer-predicate (buffer)
+  "Return non-nil when the BUFFER may be displayed in selected frame.
+
+Prevents EXWM-mode buffers already being displayed on some other window from
+being selected.
+
+Should be set as `buffer-predicate' frame parameter for all
+frames.  Used by `other-buffer'."
+  (not (and (eq 'exwm-mode (buffer-local-value 'major-mode buffer))
+(get-buffer-window buffer t
+
 (defvar exwm-layout-show-all-buffers nil
   "Non-nil to allow switching to buffers on other workspaces.")
 
diff --git a/exwm-workspace.el b/exwm-workspace.el
index b2fb648..c9a57f5 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -235,6 +235,7 @@ The optional FORCE option is for internal use only."
 (declare-function exwm-layout--show "exwm-layout.el" (id  window))
 (declare-function exwm-layout--hide "exwm-layout.el" (id))
 (declare-function exwm-layout--refresh "exwm-layout.el")
+(declare-function exwm-layout--other-buffer-predicate "exwm-layout.el" 
(buffer))
 
 ;;;###autoload
 (defun exwm-workspace-move-window (index  id)
@@ -684,6 +685,9 @@ The optional FORCE option is for internal use only."
 ;; The default behavior of `display-buffer' (indirectly called by
 ;; `minibuffer-completion-help') is not correct here.
 (cl-pushnew '(exwm-workspace--display-buffer) display-buffer-alist))
+  ;; Prevent `other-buffer' from selecting already displayed EXWM buffers.
+  (modify-all-frames-parameters
+   '((buffer-predicate . exwm-layout--other-buffer-predicate)))
   ;; Configure workspaces
   (dolist (i exwm-workspace--list)
 (let ((outer-id (string-to-number (frame-parameter i 'outer-window-id)))



[elpa] externals/exwm 8a1c376 2/6: Set the correct buffer before checking the `major-mode'

2016-03-19 Thread Chris Feng
branch: externals/exwm
commit 8a1c3761e4eab018a001dcc522112269f83ba279
Author: Adrián Medraño Calvo 
Commit: Adrián Medraño Calvo 

Set the correct buffer before checking the `major-mode'

* exwm-layout.el (exwm-layout--refresh): Make sure we test the
`major-mode' of the first buffer of the floating frame.
---
 exwm-layout.el |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/exwm-layout.el b/exwm-layout.el
index fd8c164..d084c96 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -255,13 +255,13 @@
 (if (not (memq frame exwm-workspace--list))
 (if (frame-parameter frame 'exwm-outer-id)
 ;; Refresh a floating frame
-(when (eq major-mode 'exwm-mode)
-  (let ((window (frame-first-window frame)))
-(with-current-buffer (window-buffer window)
-  ;; It may be a buffer waiting to be killed.
-  (when (exwm--id->buffer exwm--id)
-(exwm--log "Refresh floating window #x%x" exwm--id)
-(exwm-layout--show exwm--id window)
+(let ((window (frame-first-window frame)))
+  (with-current-buffer (window-buffer window)
+(when (and (eq major-mode 'exwm-mode)
+   ;; It may be a buffer waiting to be killed.
+   (exwm--id->buffer exwm--id))
+  (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
   (setq windows (window-list frame 0)) ;exclude minibuffer



[elpa] externals/xelb 28c0579: Avoid using the global value `x-display-name'

2016-03-25 Thread Chris Feng
branch: externals/xelb
commit 28c0579ff4f74a256f3fe8e6462b6c507848cec6
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Avoid using the global value `x-display-name'

* xcb.el (xcb:connect-to-display-with-auth-info, xcb:connect-to-socket):
Use the frame parameter 'display' instead of `x-display-name' since the
latter can be cleared by e.g. launching an emacsclient.
---
 xcb.el |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/xcb.el b/xcb.el
index 3fd6a99..941d248 100644
--- a/xcb.el
+++ b/xcb.el
@@ -122,7 +122,7 @@ equal.  Otherwise a negative value would be returned."
 
 (defun xcb:connect-to-display-with-auth-info ( display auth _screen)
   "Connect to X server with display DISPLAY, auth info AUTH on screen _SCREEN."
-  (unless display (setq display x-display-name))
+  (unless display (setq display (frame-parameter nil 'display)))
   (unless display (error "[XELB] No X display available"))
   (let* ((tmp (xcb:parse-display display))
  (host (cdr (assoc 'host tmp)))
@@ -152,7 +152,8 @@ equal.  Otherwise a negative value would be returned."
 
 (defun xcb:connect-to-socket ( 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 (or socket (frame-parameter nil 'display))
+(error "[XELB] No X display available"))
   (let (display)
 (if socket
 ;; As there is no general way to deduce the display name from an X11
@@ -161,11 +162,11 @@ equal.  Otherwise a negative value would be returned."
   (concat ":"   ;local
   (replace-regexp-in-string "^.*?\\([0-9.]+\\)$" "\\1"
 socket)))
-  (setq display x-display-name
+  (setq display (frame-parameter nil 'display)
 socket (concat "/tmp/.X11-unix/X"
(replace-regexp-in-string
 ".*:\\([^\\.]+\\)\\(\\..*\\)?" "\\1"
-x-display-name
+display
 (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



[elpa] externals/exwm a50e6bd: Restack fullscreen X windows

2016-03-07 Thread Chris Feng
branch: externals/exwm
commit a50e6bd384d2157cb5070f138eb64d23496cf7ac
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Restack fullscreen X windows

* exwm-layout.el (exwm-layout-set-fullscreen)
(exwm-layout-unset-fullscreen): Raise and lower fullscreen X windows
respectively.
---
 exwm-layout.el |   29 ++---
 1 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/exwm-layout.el b/exwm-layout.el
index 76721a0..309bfb6 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -165,6 +165,12 @@
 (exwm-layout--resize-container exwm--id exwm--container 0 0
(exwm-workspace--current-width)
(exwm-workspace--current-height))
+;; Raise the X window.
+(xcb:+request exwm--connection
+(make-instance 'xcb:ConfigureWindow
+   :window exwm--container
+   :value-mask xcb:ConfigWindow:StackMode
+   :stack-mode xcb:StackMode:Above))
 (xcb:+request exwm--connection
 (make-instance 'xcb:ewmh:set-_NET_WM_STATE
:window exwm--id
@@ -180,16 +186,25 @@
   (with-current-buffer (if id (exwm--id->buffer id) (window-buffer))
 (unless exwm--fullscreen
   (user-error "Not in full-screen mode."))
-;; Restore the floating frame if the client is floating
-(when exwm--floating-frame
+(if exwm--floating-frame
+;; Restore the floating frame.
+(xcb:+request exwm--connection
+(make-instance 'xcb:ConfigureWindow
+   :window exwm--container
+   :value-mask (eval-when-compile
+ (logior xcb:ConfigWindow:X
+ xcb:ConfigWindow:Y))
+   :x (elt exwm--floating-frame-position 0)
+   :y (elt exwm--floating-frame-position 1)))
+  ;; Put the X window just above the Emacs frame.
   (xcb:+request exwm--connection
   (make-instance 'xcb:ConfigureWindow
  :window exwm--container
- :value-mask (eval-when-compile
-   (logior xcb:ConfigWindow:X
-   xcb:ConfigWindow:Y))
- :x (elt exwm--floating-frame-position 0)
- :y (elt exwm--floating-frame-position 1
+ :value-mask (logior xcb:ConfigWindow:Sibling
+ xcb:ConfigWindow:StackMode)
+ :sibling (frame-parameter exwm-workspace--current
+   'exwm-container)
+ :stack-mode xcb:StackMode:Above)))
 (exwm-layout--show exwm--id)
 (xcb:+request exwm--connection
 (make-instance 'xcb:ewmh:set-_NET_WM_STATE :window exwm--id :data []))



[elpa] externals/exwm 1342fe1 1/3: Change input mode of window being clicked

2016-03-07 Thread Chris Feng
branch: externals/exwm
commit 1342fe1789184bb6b732d62bdb673139d44b83f0
Author: Adrián Medraño Calvo 
Commit: Adrián Medraño Calvo 

Change input mode of window being clicked

When clicking a mode-line of other window to switch the EXWM input
mode, `window-buffer' does not return the window whose mode-line has
been clicked, but the current one.  This change ensures that the right
window has its input mode and mode-line updated.

* exwm-input.el (exwm-input--update-mode-line): Factor out setting
`mode-line-process'.
(exwm-input--grab-keyboard, exwm-input--release-keyboard)
(exwm-input-grab-keyboard, exwm-input-release-keyboard): Make sure
the buffer of the window being clicked has its input mode updated.
---
 exwm-input.el |   72 ++--
 1 files changed, 44 insertions(+), 28 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 31125a2..50ca3ae 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -318,6 +318,34 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
  :time xcb:Time:CurrentTime))
   (xcb:flush exwm--connection))
 
+(defun exwm-input--update-mode-line (id)
+  "Update the propertized `mode-line-process' for window ID."
+  (let (help-echo cmd mode)
+(case exwm--on-KeyPress
+  ((exwm-input--on-KeyPress-line-mode)
+   (setq mode "line"
+ help-echo "mouse-1: Switch to char-mode"
+ cmd `(lambda ()
+(interactive)
+(exwm-input-release-keyboard ,id
+  ((exwm-input--on-KeyPress-char-mode)
+   (setq mode "char"
+ help-echo "mouse-1: Switch to line-mode"
+ cmd `(lambda ()
+(interactive)
+(exwm-input-grab-keyboard ,id)
+(with-current-buffer (exwm--id->buffer id)
+  (setq mode-line-process
+`(": "
+  (:propertize ,mode
+   help-echo ,help-echo
+   mouse-face mode-line-highlight
+   local-map
+   (keymap
+(mode-line
+ keymap
+ (down-mouse-1 . ,cmd)
+
 (defun exwm-input--grab-keyboard ( id)
   "Grab all key events on window ID."
   (unless id (setq id (exwm--buffer->id (window-buffer
@@ -331,7 +359,8 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
  :pointer-mode xcb:GrabMode:Async
  :keyboard-mode xcb:GrabMode:Sync))
   (exwm--log "Failed to grab keyboard for #x%x" id))
-(setq exwm--on-KeyPress #'exwm-input--on-KeyPress-line-mode)))
+(with-current-buffer (exwm--id->buffer id)
+  (setq exwm--on-KeyPress #'exwm-input--on-KeyPress-line-mode
 
 (defun exwm-input--release-keyboard ( id)
   "Ungrab all key events on window ID."
@@ -343,41 +372,28 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
  :grab-window id
  :modifiers xcb:ModMask:Any))
   (exwm--log "Failed to release keyboard for #x%x" id))
-(setq exwm--on-KeyPress #'exwm-input--on-KeyPress-char-mode)))
+(with-current-buffer (exwm--id->buffer id)
+  (setq exwm--on-KeyPress #'exwm-input--on-KeyPress-char-mode
 
 ;;;###autoload
 (defun exwm-input-grab-keyboard ( id)
   "Switch to line-mode."
-  (interactive)
-  (exwm-input--grab-keyboard id)
-  (setq mode-line-process
-'(": "
-  (:propertize "line"
-   help-echo "mouse-1: Switch to char-mode"
-   mouse-face mode-line-highlight
-   local-map
-   (keymap
-(mode-line
- keymap
- (down-mouse-1 . exwm-input-release-keyboard))
-  (force-mode-line-update))
+  (interactive (list (exwm--buffer->id (window-buffer
+  (when id
+(with-current-buffer (exwm--id->buffer id)
+  (exwm-input--grab-keyboard id)
+  (exwm-input--update-mode-line id)
+  (force-mode-line-update
 
 ;;;###autoload
 (defun exwm-input-release-keyboard ( id)
   "Switch to char-mode."
-  (interactive)
-  (exwm-input--release-keyboard id)
-  (setq mode-line-process
-'(": "
-  (:propertize "char"
-   help-echo "mouse-1: Switch to line-mode"
-   mouse-face mode-line-highlight
-   local-map
-   (keymap
-(mode-line
- keymap
- (down-mouse-1 . exwm-input-grab-keyboard))
-  (force-mode-line-update))
+  (interactive (list (exwm--buffer->id (window-buffer
+  (when id
+(with-current-buffer (exwm--id->buffer 

[elpa] externals/exwm ac3f809 2/3: Use `cl-case' instead of `case'

2016-03-07 Thread Chris Feng
branch: externals/exwm
commit ac3f8098c7b8d87225a34e85fcac8996404d1d8d
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Use `cl-case' instead of `case'
---
 exwm-input.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 50ca3ae..dc7f2b5 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -321,7 +321,7 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 (defun exwm-input--update-mode-line (id)
   "Update the propertized `mode-line-process' for window ID."
   (let (help-echo cmd mode)
-(case exwm--on-KeyPress
+(cl-case exwm--on-KeyPress
   ((exwm-input--on-KeyPress-line-mode)
(setq mode "line"
  help-echo "mouse-1: Switch to char-mode"



[elpa] externals/exwm updated (a50e6bd -> e217533)

2016-03-07 Thread Chris Feng
ch11ng pushed a change to branch externals/exwm.

  from  a50e6bd   Restack fullscreen X windows
   new  1342fe1   Change input mode of window being clicked
   new  ac3f809   Use `cl-case' instead of `case'
   new  e217533   Merge branch 'medranocalvo/fix-input-target' into 
externals/exwm


Summary of changes:
 exwm-input.el |   72 ++--
 1 files changed, 44 insertions(+), 28 deletions(-)



[elpa] externals/exwm e217533 3/3: Merge branch 'medranocalvo/fix-input-target' into externals/exwm

2016-03-07 Thread Chris Feng
branch: externals/exwm
commit e217533642c864053a2e8add7c48dc2668edf17a
Merge: a50e6bd ac3f809
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Merge branch 'medranocalvo/fix-input-target' into externals/exwm
---
 exwm-input.el |   72 ++--
 1 files changed, 44 insertions(+), 28 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 31125a2..dc7f2b5 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -318,6 +318,34 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
  :time xcb:Time:CurrentTime))
   (xcb:flush exwm--connection))
 
+(defun exwm-input--update-mode-line (id)
+  "Update the propertized `mode-line-process' for window ID."
+  (let (help-echo cmd mode)
+(cl-case exwm--on-KeyPress
+  ((exwm-input--on-KeyPress-line-mode)
+   (setq mode "line"
+ help-echo "mouse-1: Switch to char-mode"
+ cmd `(lambda ()
+(interactive)
+(exwm-input-release-keyboard ,id
+  ((exwm-input--on-KeyPress-char-mode)
+   (setq mode "char"
+ help-echo "mouse-1: Switch to line-mode"
+ cmd `(lambda ()
+(interactive)
+(exwm-input-grab-keyboard ,id)
+(with-current-buffer (exwm--id->buffer id)
+  (setq mode-line-process
+`(": "
+  (:propertize ,mode
+   help-echo ,help-echo
+   mouse-face mode-line-highlight
+   local-map
+   (keymap
+(mode-line
+ keymap
+ (down-mouse-1 . ,cmd)
+
 (defun exwm-input--grab-keyboard ( id)
   "Grab all key events on window ID."
   (unless id (setq id (exwm--buffer->id (window-buffer
@@ -331,7 +359,8 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
  :pointer-mode xcb:GrabMode:Async
  :keyboard-mode xcb:GrabMode:Sync))
   (exwm--log "Failed to grab keyboard for #x%x" id))
-(setq exwm--on-KeyPress #'exwm-input--on-KeyPress-line-mode)))
+(with-current-buffer (exwm--id->buffer id)
+  (setq exwm--on-KeyPress #'exwm-input--on-KeyPress-line-mode
 
 (defun exwm-input--release-keyboard ( id)
   "Ungrab all key events on window ID."
@@ -343,41 +372,28 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
  :grab-window id
  :modifiers xcb:ModMask:Any))
   (exwm--log "Failed to release keyboard for #x%x" id))
-(setq exwm--on-KeyPress #'exwm-input--on-KeyPress-char-mode)))
+(with-current-buffer (exwm--id->buffer id)
+  (setq exwm--on-KeyPress #'exwm-input--on-KeyPress-char-mode
 
 ;;;###autoload
 (defun exwm-input-grab-keyboard ( id)
   "Switch to line-mode."
-  (interactive)
-  (exwm-input--grab-keyboard id)
-  (setq mode-line-process
-'(": "
-  (:propertize "line"
-   help-echo "mouse-1: Switch to char-mode"
-   mouse-face mode-line-highlight
-   local-map
-   (keymap
-(mode-line
- keymap
- (down-mouse-1 . exwm-input-release-keyboard))
-  (force-mode-line-update))
+  (interactive (list (exwm--buffer->id (window-buffer
+  (when id
+(with-current-buffer (exwm--id->buffer id)
+  (exwm-input--grab-keyboard id)
+  (exwm-input--update-mode-line id)
+  (force-mode-line-update
 
 ;;;###autoload
 (defun exwm-input-release-keyboard ( id)
   "Switch to char-mode."
-  (interactive)
-  (exwm-input--release-keyboard id)
-  (setq mode-line-process
-'(": "
-  (:propertize "char"
-   help-echo "mouse-1: Switch to line-mode"
-   mouse-face mode-line-highlight
-   local-map
-   (keymap
-(mode-line
- keymap
- (down-mouse-1 . exwm-input-grab-keyboard))
-  (force-mode-line-update))
+  (interactive (list (exwm--buffer->id (window-buffer
+  (when id
+(with-current-buffer (exwm--id->buffer id)
+  (exwm-input--release-keyboard id)
+  (exwm-input--update-mode-line id)
+  (force-mode-line-update
 
 (defun exwm-input--fake-key (event)
   "Fake a key event equivalent to Emacs event EVENT."



[elpa] externals/exwm 8706e49: Allow moving/resizing undecorated X windows

2016-03-04 Thread Chris Feng
branch: externals/exwm
commit 8706e490fb07617145a32ba9eaffd4ee37f67d87
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Allow moving/resizing undecorated X windows

* exwm-manage.el (exwm-manage--manage-window): Do not manage
undecorated floating X windows (set in _MOTIF_WM_HINTS).

* exwm-floating.el (exwm-floating--start-moveresize)
(exwm-floating--stop-moveresize, exwm-floating--do-moveresize):
Allow moving/resizing undecorated X windows with _NET_WM_MOVERESIZE
client message.
---
 exwm-floating.el |  152 +++--
 exwm-manage.el   |7 +--
 2 files changed, 91 insertions(+), 68 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index ba162f6..cce6de0 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -310,18 +310,23 @@
 
 (defun exwm-floating--start-moveresize (id  type)
   "Start move/resize."
-  (let ((buffer (exwm--id->buffer id))
-frame container x y width height cursor)
-(when (and buffer
-   (with-current-buffer buffer
- (setq frame exwm--floating-frame
-   container exwm--container))
+  (let ((buffer-or-id (or (exwm--id->buffer id) id))
+frame container-or-id x y width height cursor)
+(if (bufferp buffer-or-id)
+   ;; Managed.
+   (with-current-buffer buffer-or-id
+ (setq frame exwm--floating-frame
+   container-or-id exwm--container))
+  ;; Unmanaged.
+  (setq container-or-id id))
+(when (and container-or-id
;; Test if the pointer can be grabbed
(= xcb:GrabStatus:Success
   (slot-value
(xcb:+request-unchecked+reply exwm--connection
(make-instance 'xcb:GrabPointer
-  :owner-events 0 :grab-window container
+  :owner-events 0
+ :grab-window container-or-id
   :event-mask xcb:EventMask:NoEvent
   :pointer-mode xcb:GrabMode:Async
   :keyboard-mode xcb:GrabMode:Async
@@ -332,33 +337,43 @@
   (with-slots (root-x root-y win-x win-y)
   (xcb:+request-unchecked+reply exwm--connection
   (make-instance 'xcb:QueryPointer :window id))
-(select-window (frame-first-window frame)) ;transfer input focus
-(setq width (frame-pixel-width frame)
-  height (frame-pixel-height frame))
-(unless type
-  ;; Determine the resize type according to the pointer position
-  ;; Clicking the center 1/3 part to resize has not effect
-  (setq x (/ (* 3 win-x) (float width))
-y (/ (* 3 win-y) (float height))
-type (cond ((and (< x 1) (< y 1))
-xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOPLEFT)
-   ((and (> x 2) (< y 1))
-xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOPRIGHT)
-   ((and (> x 2) (> y 2))
-xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT)
-   ((and (< x 1) (> y 2))
-xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT)
-   ((< y 1) xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOP)
-   ((> 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
+   (if (not (bufferp buffer-or-id))
+   ;; Unmanaged.
+   (unless (eq type xcb:ewmh:_NET_WM_MOVERESIZE_MOVE)
+ (with-slots ((width* width)
+  (height* height))
+ (xcb:+request-unchecked+reply exwm--connection
+ (make-instance 'xcb:GetGeometry :drawable id))
+   (setq width width*
+ height height*)))
+ ;; Managed.
+ (select-window (frame-first-window frame)) ;transfer input focus
+ (setq width (frame-pixel-width frame)
+   height (frame-pixel-height frame))
+ (unless type
+   ;; Determine the resize type according to the pointer position
+   ;; Clicking the center 1/3 part to resize has not effect
+   (setq x (/ (* 3 win-x) (float width))
+ y (/ (* 3 win-y) (float height))
+ type (cond ((and (< x 1) (< y 1))
+ xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOPLEFT)
+((and (> x 2) (< y 1))
+ xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOPRIGHT)
+((and (> x 2) (> y 2))
+ xcb:e

[elpa] externals/exwm 6fe6fe5 1/2: Untabify

2016-03-05 Thread Chris Feng
branch: externals/exwm
commit 6fe6fe52f619bc2e4648cebf137266363f0e19d4
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Untabify
---
 exwm-floating.el |  132 +++---
 exwm-manage.el   |   80 
 exwm.el  |6 +-
 3 files changed, 109 insertions(+), 109 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index cce6de0..a67bc19 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -313,10 +313,10 @@
   (let ((buffer-or-id (or (exwm--id->buffer id) id))
 frame container-or-id x y width height cursor)
 (if (bufferp buffer-or-id)
-   ;; Managed.
-   (with-current-buffer buffer-or-id
- (setq frame exwm--floating-frame
-   container-or-id exwm--container))
+;; Managed.
+(with-current-buffer buffer-or-id
+  (setq frame exwm--floating-frame
+container-or-id exwm--container))
   ;; Unmanaged.
   (setq container-or-id id))
 (when (and container-or-id
@@ -326,7 +326,7 @@
(xcb:+request-unchecked+reply exwm--connection
(make-instance 'xcb:GrabPointer
   :owner-events 0
- :grab-window container-or-id
+  :grab-window container-or-id
   :event-mask xcb:EventMask:NoEvent
   :pointer-mode xcb:GrabMode:Async
   :keyboard-mode xcb:GrabMode:Async
@@ -337,36 +337,36 @@
   (with-slots (root-x root-y win-x win-y)
   (xcb:+request-unchecked+reply exwm--connection
   (make-instance 'xcb:QueryPointer :window id))
-   (if (not (bufferp buffer-or-id))
-   ;; Unmanaged.
-   (unless (eq type xcb:ewmh:_NET_WM_MOVERESIZE_MOVE)
- (with-slots ((width* width)
-  (height* height))
- (xcb:+request-unchecked+reply exwm--connection
- (make-instance 'xcb:GetGeometry :drawable id))
-   (setq width width*
- height height*)))
- ;; Managed.
- (select-window (frame-first-window frame)) ;transfer input focus
- (setq width (frame-pixel-width frame)
-   height (frame-pixel-height frame))
- (unless type
-   ;; Determine the resize type according to the pointer position
-   ;; Clicking the center 1/3 part to resize has not effect
-   (setq x (/ (* 3 win-x) (float width))
- y (/ (* 3 win-y) (float height))
- type (cond ((and (< x 1) (< y 1))
- xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOPLEFT)
-((and (> x 2) (< y 1))
- xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOPRIGHT)
-((and (> x 2) (> y 2))
- xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT)
-((and (< x 1) (> y 2))
- xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT)
-((> 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)
-((< y 1) xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOP)
+(if (not (bufferp buffer-or-id))
+;; Unmanaged.
+(unless (eq type xcb:ewmh:_NET_WM_MOVERESIZE_MOVE)
+  (with-slots ((width* width)
+   (height* height))
+  (xcb:+request-unchecked+reply exwm--connection
+  (make-instance 'xcb:GetGeometry :drawable id))
+(setq width width*
+  height height*)))
+  ;; Managed.
+  (select-window (frame-first-window frame)) ;transfer input focus
+  (setq width (frame-pixel-width frame)
+height (frame-pixel-height frame))
+  (unless type
+;; Determine the resize type according to the pointer position
+;; Clicking the center 1/3 part to resize has not effect
+(setq x (/ (* 3 win-x) (float width))
+  y (/ (* 3 win-y) (float height))
+  type (cond ((and (< x 1) (< y 1))
+  xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOPLEFT)
+ ((and (> x 2) (< y 1))
+  xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOPRIGHT)
+ ((and (> x 2) (> y 2))
+  xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT)
+ ((and (< x 1) (> y 2))
+  xcb:ewm

[elpa] externals/xelb 5b969ed: Detect implicit list length

2016-03-05 Thread Chris Feng
branch: externals/xelb
commit 5b969ed9aac902766a3d76f4ed2fd6788d49b86b
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Detect implicit list length

* el_client.el (xelb-request-fields): New variable holding fields in the
current request.
(xelb-parse-request): Set/Clear the variable accordingly.
(xelb-parse-fieldref): Detect implicit list length.

* el_client.el (xelb-parse-request): Remove the extra argument.
(xelb-parse-exprfield): Remove the extra quote.
---
 el_client.el  |   26 ++
 xcb-types.el  |1 -
 xcb-xim.el|   12 
 xcb-xproto.el |   12 ++--
 4 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/el_client.el b/el_client.el
index 820f7c7..02d78ad 100644
--- a/el_client.el
+++ b/el_client.el
@@ -60,6 +60,9 @@
 (defvar xelb-pad-count -1 " node counter.")
 (make-variable-buffer-local 'xelb-pad-count)
 
+(defvar xelb-request-fields nil "Fields in the current request.")
+(make-variable-buffer-local 'xelb-request-fields)
+
  Helper functions
 
 (defsubst xelb-node-name (node)
@@ -324,6 +327,13 @@ The `combine-adjacent' attribute is simply ignored."
  (subnodes (xelb-node-subnodes node t))
  expressions
  result reply-name reply-contents)
+;; Fill `xelb-request-fields'.
+(setq xelb-request-fields nil)
+(dolist (i subnodes)
+  (unless (eq (xelb-node-name i) 'reply)
+(let ((name (xelb-node-attr i 'name)))
+  (when name
+(push (intern (xelb-escape-name name)) xelb-request-fields)
 (dolist (i subnodes)
   (if (not (eq (xelb-node-name i) 'reply))
   (progn
@@ -335,6 +345,7 @@ The `combine-adjacent' attribute is simply ignored."
   (setq contents (nconc contents result
 ;; Parse 
 (setq xelb-pad-count -1);reset padding counter
+(setq xelb-request-fields nil)  ;Clear `xelb-request-fields'.
 (setq reply-name
   (intern (concat xelb-prefix (xelb-node-attr node 'name)
   "~reply")))
@@ -342,14 +353,15 @@ The `combine-adjacent' attribute is simply ignored."
 (setq reply-contents
   (apply #'nconc
  (mapcar #'xelb-parse-structure-content reply-contents)
+(setq xelb-request-fields nil)  ;Clear `xelb-request-fields'.
 (delq nil contents)
 (delq nil
   `((defclass ,name (xcb:-request) ,contents)
 ;; The optional expressions
 ,(when expressions
-   `(cl-defmethod xcb:marshal ((obj ,name) connection) nil
+   `(cl-defmethod xcb:marshal ((obj ,name)) nil
   ,@expressions
-  (cl-call-next-method obj connection)))
+  (cl-call-next-method obj)))
 ;; The optional reply body
 ,(when reply-name
(delq nil reply-contents)
@@ -468,7 +480,7 @@ KeymapNotify event; instead, we handle this case in 
`xcb:unmarshal'."
  (type (xelb-node-type node))
  (value (xelb-parse-expression (xelb-node-subnode node
 `((,name :type ,type)
-  (setf (slot-value obj ',name) ',value
+  (setf (slot-value obj ',name) ,value
 
 ;; The only difference between  and  is whether the `condition'
 ;; is a list
@@ -559,7 +571,13 @@ KeymapNotify event; instead, we handle this case in 
`xcb:unmarshal'."
 
 (defun xelb-parse-fieldref (node)
   "Parse ."
-  `(xcb:-fieldref ',(intern (xelb-escape-name (xelb-node-subnode node)
+  (let ((name (intern (xelb-escape-name (xelb-node-subnode node)
+(if (or (not xelb-request-fields)   ;Probably not a request.
+(memq name xelb-request-fields)
+(not (string-suffix-p "-len" (symbol-name name
+`(xcb:-fieldref ',name)
+  `(length
+(xcb:-fieldref ',(intern (substring (symbol-name name) 0 -4)))
 
 (defun xelb-parse-paramref (node)
   "Parse ."
diff --git a/xcb-types.el b/xcb-types.el
index 5bc8908..f4e41f0 100644
--- a/xcb-types.el
+++ b/xcb-types.el
@@ -41,7 +41,6 @@
 ;; + The current implementation of `eieio-default-eval-maybe' only `eval's a
 ;;   certain type of forms.  If this is changed in the future, we will have to
 ;;   adapt our codes accordingly.
-;; + STRING16 and CHAR2B should always be big-endian.
 ;; +  for `xcb:-marshal-field'?
 
 ;; References:
diff --git a/xcb-xim.el b/xcb-xim.el
index 01229f3..db46f84 100644
--- a/xcb-xim.el
+++ b/xcb-xim.el
@@ -145,8 +145,7 @@ Consider let-bind it rather than change its global value."))
 (defclass xim:STRING (xim:-struct)
   ((length :initarg :length :type xcb:-u2)
(string :initarg :string :type xcb:-ignore)
-   (string~ :initform '(name string type xim:LPCE
- size (xcb:-fieldref 'length))
+

[elpa] externals/exwm updated (8706e49 -> f0a5425)

2016-03-05 Thread Chris Feng
ch11ng pushed a change to branch externals/exwm.

  from  8706e49   Allow moving/resizing undecorated X windows
   new  6fe6fe5   Untabify
   new  f0a5425   Allow floating X windows to resize themselves


Summary of changes:
 exwm-floating.el |  132 +++---
 exwm-manage.el   |  117 +++-
 exwm.el  |6 +-
 3 files changed, 135 insertions(+), 120 deletions(-)



[elpa] externals/exwm f0a5425 2/2: Allow floating X windows to resize themselves

2016-03-05 Thread Chris Feng
branch: externals/exwm
commit f0a5425f4c176c487a5c3e94319f0c2b3d3cc22a
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Allow floating X windows to resize themselves

* exwm-manage.el (exwm-manage--on-ConfigureRequest):
Allow (non-fullscreen) floating X windows to resize themselves.
---
 exwm-manage.el |   37 ++---
 1 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/exwm-manage.el b/exwm-manage.el
index adc8519..bb6d5ff 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -419,7 +419,9 @@ Would you like to kill it? "
 border-width: %d; sibling: #x%x; stack-mode: %d"
  window value-mask width height x y
  border-width sibling stack-mode)
-  (if (setq buffer (exwm--id->buffer window))
+  (if (and (setq buffer (exwm--id->buffer window))
+   (with-current-buffer buffer
+ (or exwm--fullscreen (not exwm--floating-frame
   ;; Send client message for managed windows
   (with-current-buffer buffer
 (setq edges
@@ -444,16 +446,29 @@ border-width: %d; sibling: #x%x; stack-mode: %d"
 :height (- (elt edges 3) (elt edges 1))
 :border-width 0 :override-redirect 0)
exwm--connection
-(exwm--log "ConfigureWindow (preserve geometry)")
-;; Configure the unmanaged window.
-(xcb:+request exwm--connection
-(make-instance 'xcb:ConfigureWindow
-   :window window
-   :value-mask value-mask
-   :x x :y y :width width :height height
-   :border-width border-width
-   :sibling sibling
-   :stack-mode stack-mode)
+(if buffer
+(with-current-buffer buffer
+  (exwm--log "ConfigureWindow (resize floating X window)")
+  (setq edges
+(window-inside-pixel-edges (get-buffer-window buffer t)))
+  (set-frame-size exwm--floating-frame
+  (+ width
+ (- (frame-pixel-width exwm--floating-frame)
+(- (elt edges 2) (elt edges 0
+  (+ height
+ (- (frame-pixel-height exwm--floating-frame)
+(- (elt edges 3) (elt edges 1
+  t))
+  (exwm--log "ConfigureWindow (preserve geometry)")
+  ;; Configure the unmanaged window.
+  (xcb:+request exwm--connection
+  (make-instance 'xcb:ConfigureWindow
+ :window window
+ :value-mask value-mask
+ :x x :y y :width width :height height
+ :border-width border-width
+ :sibling sibling
+ :stack-mode stack-mode))
   (xcb:flush exwm--connection))
 
 (defun exwm-manage--on-MapRequest (data _synthetic)



[elpa] externals/exwm 93e4213: Avoid unnecessary input focus changes in line-mode

2016-03-01 Thread Chris Feng
branch: externals/exwm
commit 93e42136e3eba95c129c92a928b0c27517f2af7e
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Avoid unnecessary input focus changes in line-mode

* exwm-input.el (exwm-input--grab-keyboard, exwm-input--release-keyboard):
Grab keys on X windows instead to prevent unexpected input focus changes.

* exwm-workspace.el (exwm-workspace--show-minibuffer): The workaround for
cursor flickering issue is no more needed.
---
 exwm-input.el |8 ++--
 exwm-workspace.el |9 +
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 943dd7d..31125a2 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -325,9 +325,7 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 (when (xcb:+request-checked+request-check exwm--connection
   (make-instance 'xcb:GrabKey
  :owner-events 0
- :grab-window
- (with-current-buffer (exwm--id->buffer id)
-   exwm--container)
+ :grab-window id
  :modifiers xcb:ModMask:Any
  :key xcb:Grab:Any
  :pointer-mode xcb:GrabMode:Async
@@ -342,9 +340,7 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 (when (xcb:+request-checked+request-check exwm--connection
   (make-instance 'xcb:UngrabKey
  :key xcb:Grab:Any
- :grab-window
- (with-current-buffer (exwm--id->buffer id)
-   exwm--container)
+ :grab-window id
  :modifiers xcb:ModMask:Any))
   (exwm--log "Failed to release keyboard for #x%x" id))
 (setq exwm--on-KeyPress #'exwm-input--on-KeyPress-char-mode)))
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 89bb694..6fc38d4 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -513,14 +513,7 @@ The optional FORCE option is for internal use only."
   (make-instance 'xcb:MapWindow
  :window (frame-parameter exwm-workspace--minibuffer
   'exwm-container)))
-  (xcb:flush exwm--connection)
-  ;; Unfortunately we need the following lines to workaround a cursor
-  ;; flickering issue for line-mode floating X windows.  They just make the
-  ;; minibuffer appear to be focused.
-  (with-current-buffer (window-buffer (minibuffer-window
-   exwm-workspace--minibuffer))
-(setq cursor-in-non-selected-windows
-  (frame-parameter exwm-workspace--minibuffer 'cursor-type
+  (xcb:flush exwm--connection))
 
 (defun exwm-workspace--hide-minibuffer ()
   "Hide the minibuffer frame."



[elpa] externals/exwm fe9be0b: Handle buffer change after a buffer is killed

2016-03-03 Thread Chris Feng
branch: externals/exwm
commit fe9be0b3efab284dae9eb1de37e97a70a9e08bd2
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Handle buffer change after a buffer is killed

* exwm-manage.el (exwm-manage--kill-buffer-query-function): Handle buffer
change.

* exwm-workspace.el (exwm-workspace--show-minibuffer): Revert the change
made in 93e42136 (the problem has not been fully resolved).
---
 exwm-manage.el|   95 +++--
 exwm-workspace.el |   10 +-
 2 files changed, 57 insertions(+), 48 deletions(-)

diff --git a/exwm-manage.el b/exwm-manage.el
index fd1d64b..659e426 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -334,56 +334,57 @@ corresponding buffer.")
   (xcb:flush exwm--connection)
   ;; Wait for DestroyNotify event.
   (throw 'return nil))
-;; Try to close the X window with WM_DELETE_WINDOW client message.
-(xcb:+request exwm--connection
-(make-instance 'xcb:icccm:SendEvent
-   :destination exwm--id
-   :event (xcb:marshal
-   (make-instance 'xcb:icccm:WM_DELETE_WINDOW
-  :window exwm--id)
-   exwm--connection)))
-(xcb:flush exwm--connection)
-;;
-(unless (memq xcb:Atom:_NET_WM_PING exwm--protocols)
-  ;; The window does not support _NET_WM_PING.  To make sure it'll die,
-  ;; kill it after the time runs out.
-  ;; Hide the container to prevent flickering.
+(let ((id exwm--id))
+  ;; Try to close the X window with WM_DELETE_WINDOW client message.
   (xcb:+request exwm--connection
-  (make-instance 'xcb:UnmapWindow :window exwm--container))
+ (make-instance 'xcb:icccm:SendEvent
+:destination id
+:event (xcb:marshal
+(make-instance 'xcb:icccm:WM_DELETE_WINDOW
+   :window id)
+exwm--connection)))
   (xcb:flush exwm--connection)
-  (run-with-timer exwm-manage-ping-timeout nil
-  `(lambda () (exwm-manage--kill-client ,exwm--id)))
-  ;; Wait for DestroyNotify event.
-  (throw 'return nil))
-;; Try to determine if the X window is dead with _NET_WM_PING.
-(setq exwm-manage--ping-lock t)
-(xcb:+request exwm--connection
-(make-instance 'xcb:SendEvent
-   :propagate 0
-   :destination exwm--id
-   :event-mask xcb:EventMask:NoEvent
-   :event (xcb:marshal
-   (make-instance 'xcb:ewmh:_NET_WM_PING
-  :window exwm--id
-  :timestamp 0
-  :client-window exwm--id)
-   exwm--connection)))
-(xcb:flush exwm--connection)
-(with-timeout (exwm-manage-ping-timeout
-   (if (yes-or-no-p (format "'%s' is not responding. \
+  ;;
+  (unless (memq xcb:Atom:_NET_WM_PING exwm--protocols)
+   ;; The window does not support _NET_WM_PING.  To make sure it'll die,
+   ;; kill it after the time runs out.
+   ;; Hide the container to prevent flickering.
+   (xcb:+request exwm--connection
+   (make-instance 'xcb:UnmapWindow :window exwm--container))
+   (xcb:flush exwm--connection)
+   (run-with-timer exwm-manage-ping-timeout nil
+   `(lambda () (exwm-manage--kill-client ,id)))
+   ;; Wait for DestroyNotify event.
+   (throw 'return nil))
+  ;; Try to determine if the X window is dead with _NET_WM_PING.
+  (setq exwm-manage--ping-lock t)
+  (xcb:+request exwm--connection
+ (make-instance 'xcb:SendEvent
+:propagate 0
+:destination id
+:event-mask xcb:EventMask:NoEvent
+:event (xcb:marshal
+(make-instance 'xcb:ewmh:_NET_WM_PING
+   :window id
+   :timestamp 0
+   :client-window id)
+exwm--connection)))
+  (xcb:flush exwm--connection)
+  (with-timeout (exwm-manage-ping-timeout
+(if (yes-or-no-p (format "'%s' is not responding. \
 Would you like to kill it? "
-(buffer-name)))
-   (progn (exwm-manage--kill-client exwm--id)
-  ;; Kill the unresponsive X window and
-  ;; wait for DestroyNotify event.
-  (throw 'return nil))

[elpa] externals/exwm c7c233b: Some commands should be called interactively

2016-04-02 Thread Chris Feng
branch: externals/exwm
commit c7c233bc356fc6a846a09aa5fb13710e6706fce1
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Some commands should be called interactively

* exwm-layout.el (exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen)
(exwm-layout-show-mode-line):
* exwm.el (exwm-reset):
Call `exwm-input-grab-keyboard' and `exwm-input-release-keyboard'
interactively.
---
 exwm-layout.el |6 +++---
 exwm.el|2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/exwm-layout.el b/exwm-layout.el
index c392ff9..9cbdd2b 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -177,7 +177,7 @@
:data (vector xcb:Atom:_NET_WM_STATE_FULLSCREEN)))
 (xcb:flush exwm--connection)
 (setq exwm--fullscreen t)
-(exwm-input-release-keyboard)))
+(call-interactively #'exwm-input-release-keyboard)))
 
 ;;;###autoload
 (defun exwm-layout-unset-fullscreen ( id)
@@ -210,7 +210,7 @@
 (make-instance 'xcb:ewmh:set-_NET_WM_STATE :window exwm--id :data []))
 (xcb:flush exwm--connection)
 (setq exwm--fullscreen nil)
-(exwm-input-grab-keyboard)))
+(call-interactively #'exwm-input-grab-keyboard)))
 
 (defvar exwm-layout--fullscreen-frame-count 0
   "Count the fullscreen workspace frames.")
@@ -516,7 +516,7 @@ See also `exwm-layout-enlarge-window'."
(window-mode-line-height (frame-root-window
  exwm--floating-frame)))
 nil t)
-  (exwm-input-grab-keyboard))
+  (call-interactively #'exwm-input-grab-keyboard))
 (force-mode-line-update)))
 
 ;;;###autoload
diff --git a/exwm.el b/exwm.el
index ac10247..f8a3fc7 100644
--- a/exwm.el
+++ b/exwm.el
@@ -80,7 +80,7 @@
   (when exwm--fullscreen (exwm-layout-unset-fullscreen))
   ;; Force refresh
   (exwm-layout--refresh)
-  (exwm-input-grab-keyboard
+  (call-interactively #'exwm-input-grab-keyboard
 
 (defun exwm--update-window-type (id  force)
   "Update _NET_WM_WINDOW_TYPE."



[elpa] externals/exwm dc0c0f5: Always add `exwm-workspace--on-focus-in'

2016-05-20 Thread Chris Feng
branch: externals/exwm
commit dc0c0f5131296f31b02019d1d928a0a17f085818
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Always add `exwm-workspace--on-focus-in'

* exwm-workspace.el (exwm-workspace--init):
`exwm-workspace--on-focus-in' should always be added to `focus-in-hook'.
---
 exwm-workspace.el |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index 60cf9dd..124c681 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -689,8 +689,6 @@ The optional FORCE option is for internal use only."
 (add-hook 'minibuffer-exit-hook #'exwm-workspace--on-minibuffer-exit)
 (run-with-idle-timer 0 t #'exwm-workspace--on-echo-area-dirty)
 (add-hook 'echo-area-clear-hook #'exwm-workspace--on-echo-area-clear)
-;; Handle unexpected frame switch.
-(add-hook 'focus-in-hook #'exwm-workspace--on-focus-in)
 ;; Create workspace frames.
 (dotimes (_ exwm-workspace-number)
   (push (make-frame `((window-system . x)
@@ -700,6 +698,8 @@ The optional FORCE option is for internal use only."
 ;; The default behavior of `display-buffer' (indirectly called by
 ;; `minibuffer-completion-help') is not correct here.
 (cl-pushnew '(exwm-workspace--display-buffer) display-buffer-alist))
+  ;; Handle unexpected frame switch.
+  (add-hook 'focus-in-hook #'exwm-workspace--on-focus-in)
   ;; Prevent `other-buffer' from selecting already displayed EXWM buffers.
   (modify-all-frames-parameters
'((buffer-predicate . exwm-layout--other-buffer-predicate)))



[elpa] externals/xelb 380845e: Bump version to 0.7

2016-05-20 Thread Chris Feng
branch: externals/xelb
commit 380845e1064481208f55aa2b554880190a02eee6
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Bump version to 0.7
---
 xelb.el |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xelb.el b/xelb.el
index 27cbfc2..77ba69c 100644
--- a/xelb.el
+++ b/xelb.el
@@ -4,7 +4,7 @@
 
 ;; Author: Chris Feng <chris.w.f...@gmail.com>
 ;; Maintainer: Chris Feng <chris.w.f...@gmail.com>
-;; Version: 0.6
+;; Version: 0.7
 ;; Package-Requires: ((emacs "24.4") (cl-generic "0.2"))
 ;; Keywords: unix
 ;; URL: https://github.com/ch11ng/xelb



[elpa] externals/xelb 7f44908: Add optional arguments to force refreshing atoms

2016-05-23 Thread Chris Feng
branch: externals/xelb
commit 7f44908270589efe712b9cadd4be36de3216d4ce
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Add optional arguments to force refreshing atoms

* xcb-ewmh.el (xcb:ewmh:init)
* xcb-icccm.el (xcb:icccm:init, xcb:icccm:intern-atoms):
* xcb-systemtray.el (xcb:systemtray:init):
* xcb-xembed.el (xcb:xembed:init):
Add optional arguments to force refreshing atoms.
---
 xcb-ewmh.el   |6 +++---
 xcb-icccm.el  |   11 ++-
 xcb-systemtray.el |6 +++---
 xcb-xembed.el |6 +++---
 4 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/xcb-ewmh.el b/xcb-ewmh.el
index a600a7f..c1c3513 100644
--- a/xcb-ewmh.el
+++ b/xcb-ewmh.el
@@ -138,18 +138,18 @@
   (dolist (atom xcb:ewmh:-atoms)
 (eval `(defvar ,(intern (concat "xcb:Atom:" (symbol-name atom))) nil
 
-(cl-defmethod xcb:ewmh:init ((obj xcb:connection))
+(cl-defmethod xcb:ewmh:init ((obj xcb:connection)  force)
   "Initialize EWMH module.
 
 This method must be called before using any other method in this module.
 
 This method also initializes ICCCM module automatically."
-  (unless xcb:Atom:_NET_SUPPORTED
+  (when (or force (not xcb:Atom:_NET_SUPPORTED))
 (xcb:icccm:init obj);required
 (let ((atoms xcb:ewmh:-atoms))
   (dotimes (i (x-display-screens))
 (push (intern (format "_NET_WM_CM_S%d" i)) atoms))
-  (xcb:icccm:intern-atoms obj atoms
+  (xcb:icccm:intern-atoms obj atoms force
 
  Client message
 
diff --git a/xcb-icccm.el b/xcb-icccm.el
index c787161..8532d91 100644
--- a/xcb-icccm.el
+++ b/xcb-icccm.el
@@ -54,21 +54,22 @@
   (dolist (atom xcb:icccm:-atoms)
 (eval `(defvar ,(intern (concat "xcb:Atom:" (symbol-name atom))) nil
 
-(cl-defmethod xcb:icccm:init ((obj xcb:connection))
+(cl-defmethod xcb:icccm:init ((obj xcb:connection)  force)
   "Initialize ICCCM module.
 
 This method must be called before using any other method in this module."
-  (unless xcb:Atom:WM_PROTOCOLS
-(xcb:icccm:intern-atoms obj xcb:icccm:-atoms)))
+  (when (or force (not xcb:Atom:WM_PROTOCOLS))
+(xcb:icccm:intern-atoms obj xcb:icccm:-atoms force)))
 
-(cl-defmethod xcb:icccm:intern-atoms ((obj xcb:connection) atoms)
+(cl-defmethod xcb:icccm:intern-atoms ((obj xcb:connection) atoms
+   force)
   "Intern the X atoms listed in the list AOTMS.
 
 The value of these atoms will be available in `xcb:Atom' namespace."
   (dolist (atom atoms)
 (let* ((name (symbol-name atom))
(var-name (intern (concat "xcb:Atom:" name
-  (unless (and (boundp var-name) (symbol-value var-name))
+  (when (or force (not (and (boundp var-name) (symbol-value var-name
 (set var-name
  (slot-value (xcb:+request-unchecked+reply obj
  (make-instance 'xcb:InternAtom
diff --git a/xcb-systemtray.el b/xcb-systemtray.el
index fa45188..9abdaf2 100644
--- a/xcb-systemtray.el
+++ b/xcb-systemtray.el
@@ -55,16 +55,16 @@
 (defconst xcb:systemtray:opcode:BEGIN-MESSAGE 1)
 (defconst xcb:systemtray:opcode:CANCEL-MESSAGE 2)
 
-(cl-defmethod xcb:systemtray:init ((obj xcb:connection))
+(cl-defmethod xcb:systemtray:init ((obj xcb:connection)  force)
   "Initialize the system tray module.
 
 This method must be called before using any other method in this module."
-  (unless xcb:Atom:_NET_SYSTEM_TRAY_OPCODE
+  (when (or force (not xcb:Atom:_NET_SYSTEM_TRAY_OPCODE))
 (xcb:ewmh:init obj) ;required.
 (let ((atoms xcb:systemtray:-atoms))
   (dotimes (i (x-display-screens))
 (push (intern (format "_NET_SYSTEM_TRAY_S%d" i)) atoms))
-  (xcb:icccm:intern-atoms obj atoms
+  (xcb:icccm:intern-atoms obj atoms force
 
 (defclass xcb:systemtray:SendEvent (xcb:SendEvent)
   ((propagate :initform 0)
diff --git a/xcb-xembed.el b/xcb-xembed.el
index ab94e6d..bde5e18 100644
--- a/xcb-xembed.el
+++ b/xcb-xembed.el
@@ -61,12 +61,12 @@
 (defconst xcb:xembed:opcode:UNREGISTER-ACCELERATOR 13)
 (defconst xcb:xembed:opcode:ACTIVATE-ACCELERATOR   14)
 
-(cl-defmethod xcb:xembed:init ((obj xcb:connection))
+(cl-defmethod xcb:xembed:init ((obj xcb:connection)  force)
   "Initialize the XEmbed module.
 
 This method must be called before using any other method in this module."
-  (unless xcb:Atom:_XEMBED_INFO
-(xcb:icccm:intern-atoms obj xcb:xembed:-atoms)))
+  (when (or force (not xcb:Atom:_XEMBED_INFO))
+(xcb:icccm:intern-atoms obj xcb:xembed:-atoms force)))
 
 ;; Flags for _XEMBED_INFO.
 (defconst xcb:xembed:MAPPED 1)



[elpa] externals/exwm 1b2ae37: Add cleanup codes for Emacs daemon

2016-05-23 Thread Chris Feng
branch: externals/exwm
commit 1b2ae3749e98b83f94cc19cef8830ce823c63367
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Add cleanup codes for Emacs daemon

* exwm-floating.el (exwm-floating--exit):
* exwm-input.el (exwm-input--exit):
* exwm-layout.el (exwm-layout--exit):
* exwm-manage.el (exwm-manage--exit):
* exwm-randr.el (exwm-randr--exit):
* exwm-systemtray.el (exwm-systemtray--exit):
* exwm-workspace.el (exwm-workspace--exit):
New functions for cleanup each module.

* exwm-input.el (exwm-input--on-pre-command, exwm-input--on-post-command)
(exwm-input--init): Name lambda functions.

* exwm-layout.el (exwm-layout--timer, exwm-layout--init): Save timer.

* exwm-randr.el (exwm-randr-enable): Register the cleanup function.

* exwm-systemtray.el (exwm-systemtray--init): Force refresh atoms in XEMBED
and system tray protocols.
(exwm-systemtray-enable): Register the cleanup function.

* exwm-workspace.el (exwm-workspace--client): Save the server process.
(exwm-workspace--confirm-kill-emacs): Add emacsclient-specific
cleanup codes.
(exwm-workspace--timer): Save the timer.
(exwm-workspace--init): Save the server process and timer;
fix problems with emacsclient frames.

* exwm.el (exwm-init): Always select the newly created frame;
force refresh ICCCM & EWMH atoms.
(exwm-exit-hook): New hook for holding cleanup codes.
(exwm--exit): Run `exwm-exit-hook', execute cleanup codes for
each module and reset the environment.
---
 exwm-floating.el   |3 +++
 exwm-input.el  |   20 ---
 exwm-layout.el |   14 ++-
 exwm-manage.el |4 +++
 exwm-randr.el  |6 -
 exwm-systemtray.el |   24 +++---
 exwm-workspace.el  |   70 
 exwm.el|   30 +++---
 8 files changed, 149 insertions(+), 22 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index 770976d..b3a5b18 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -622,6 +622,9 @@ Both DELTA-X and DELTA-Y default to 1.  This command should 
be bound locally."
 exwm-floating--cursor-left
 (xcb:cursor:load-cursor exwm--connection "left_side")))
 
+(defun exwm-floating--exit ()
+  "Exit the floating module.")
+
 
 
 (provide 'exwm-floating)
diff --git a/exwm-input.el b/exwm-input.el
index dc7f2b5..4bf2cd1 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -476,6 +476,14 @@ SIMULATION-KEYS is an alist of the form (original-key . 
simulated-key)."
 (dolist (j pair)
   (exwm-input--fake-key j))
 
+(defun exwm-input--on-pre-command ()
+  "Run in `pre-command-hook'."
+  (setq exwm-input--during-command t))
+
+(defun exwm-input--on-post-command ()
+  "Run in `post-command-hook'."
+  (setq exwm-input--during-command nil))
+
 (declare-function exwm-floating--stop-moveresize "exwm-floating.el"
   ( _args))
 (declare-function exwm-floating--do-moveresize "exwm-floating.el"
@@ -510,14 +518,20 @@ SIMULATION-KEYS is an alist of the form (original-key . 
simulated-key)."
   ;; `pre-command-hook' marks the end of a key sequence (existing or not)
   (add-hook 'pre-command-hook #'exwm-input--finish-key-sequence)
   ;; Control `exwm-input--during-command'
-  (add-hook 'pre-command-hook (lambda () (setq exwm-input--during-command t)))
-  (add-hook 'post-command-hook
-(lambda () (setq exwm-input--during-command nil)))
+  (add-hook 'pre-command-hook #'exwm-input--on-pre-command)
+  (add-hook 'post-command-hook #'exwm-input--on-post-command)
   ;; Update focus when buffer list updates
   (add-hook 'buffer-list-update-hook #'exwm-input--on-buffer-list-update)
   ;; Update prefix keys for global keys
   (exwm-input--update-global-prefix-keys))
 
+(defun exwm-input--exit ()
+  "Exit the input module."
+  (remove-hook 'pre-command-hook #'exwm-input--finish-key-sequence)
+  (remove-hook 'pre-command-hook #'exwm-input--on-pre-command)
+  (remove-hook 'post-command-hook #'exwm-input--on-post-command)
+  (remove-hook 'buffer-list-update-hook #'exwm-input--on-buffer-list-update))
+
 
 
 (provide 'exwm-input)
diff --git a/exwm-layout.el b/exwm-layout.el
index 9cbdd2b..0069767 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -528,6 +528,8 @@ See also `exwm-layout-enlarge-window'."
 (exwm-layout-hide-mode-line)
   (exwm-layout-show-mode-line
 
+(defvar exwm-layout--timer nil "Timer used to track echo area changes.")
+
 (defun exwm-layout--init ()
   "Initialize layout module."
   ;; Auto refresh layout
@@ -535,9 +537,19 @@ See also `exwm-layout-enlarge-window'."
   (unless (exwm-workspace--minibuffer-own-frame-p)
 ;; Refresh when minibuffer grows
 (add-hook 'minibuffer-s

[elpa] externals/exwm 2ec88bd: * exwm-input.el (exwm-input--update-focus): Do not update input focus

2016-05-24 Thread Chris Feng
branch: externals/exwm
commit 2ec88bd32d0409f182e2532e0763ddb9bc8b21fc
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

* exwm-input.el (exwm-input--update-focus): Do not update input focus
when there's an active minibjffer
---
 exwm-input.el |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/exwm-input.el b/exwm-input.el
index 4bf2cd1..4307a18 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -101,7 +101,9 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 
 (defun exwm-input--update-focus ()
   "Update input focus."
-  (when (window-live-p exwm-input--focus-window)
+  (when (and (window-live-p exwm-input--focus-window)
+ ;; Do not update input focus when there's an active minibuffer.
+ (not (active-minibuffer-window)))
 (with-current-buffer (window-buffer exwm-input--focus-window)
   (if (eq major-mode 'exwm-mode)
   (if (not (eq exwm--frame exwm-workspace--current))
@@ -308,6 +310,10 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
  (setq event (xcb:keysyms:keysym->event exwm--connection
 keysym state)))
 (when (eq major-mode 'exwm-mode)
+  ;; FIXME: This functionality seems not working, e.g. when this
+  ;;command would activate the minibuffer, the temporary
+  ;;line-mode would actually quit before the minibuffer
+  ;;becomes active.
   (setq exwm-input--temp-line-mode t
 exwm-input--during-key-sequence t)
   (exwm-input--grab-keyboard))  ;grab keyboard temporarily



[elpa] externals/exwm 367bdf2 1/3: Properly place undecorated X windows

2016-05-12 Thread Chris Feng
branch: externals/exwm
commit 367bdf2e1918dd61780e2284a4c89d5ef8cd1254
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Properly place undecorated X windows

* exwm-manage.el (exwm-manage--manage-window): Convert absolute position
of undecorated X windows.
---
 exwm-manage.el |   20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/exwm-manage.el b/exwm-manage.el
index b0657b9..1877033 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -126,12 +126,20 @@ corresponding buffer.")
 exwm-window-type)
   (memq xcb:Atom:_NET_WM_WINDOW_TYPE_DOCK
 exwm-window-type))
-(xcb:+request exwm--connection
-(make-instance 'xcb:ReparentWindow
-   :window id
-   :parent (frame-parameter exwm-workspace--current
-'exwm-workspace)
-   :x x :y y)))
+(let ((frame-geometry (frame-parameter exwm-workspace--current
+   'exwm-geometry))
+  (workspace (frame-parameter exwm-workspace--current
+  'exwm-workspace)))
+  (when (and frame-geometry
+ (/= x 0)
+ (/= y 0))
+(setq x (- x (slot-value frame-geometry 'x))
+  y (- y (slot-value frame-geometry 'y
+  (xcb:+request exwm--connection
+  (make-instance 'xcb:ReparentWindow
+ :window id
+ :parent workspace
+ :x x :y y
   ;; Center window of type _NET_WM_WINDOW_TYPE_SPLASH
   (when (memq xcb:Atom:_NET_WM_WINDOW_TYPE_SPLASH exwm-window-type)
 (xcb:+request exwm--connection



[elpa] externals/xelb updated (28c0579 -> ddca322)

2016-05-12 Thread Chris Feng
ch11ng pushed a change to branch externals/xelb.

  from  28c0579   Avoid using the global value `x-display-name'
   new  ecd68de   Add 'MANAGER' atom
   new  ddca322   Implement basic authentication during connection setup


Summary of changes:
 xcb-icccm.el |2 +-
 xcb.el   |   60 ++
 2 files changed, 45 insertions(+), 17 deletions(-)



[elpa] externals/exwm updated (ddbbeda -> 2dcb26c)

2016-05-12 Thread Chris Feng
ch11ng pushed a change to branch externals/exwm.

  from  ddbbeda   Fix 2 multi-monitor issues
   new  367bdf2   Properly place undecorated X windows
   new  009854e   Announce manager selection with client message
   new  2dcb26c   Use `xcb:connect' instead of `xcb:connect-to-socket'


Summary of changes:
 exwm-manage.el |   20 ++--
 exwm-systemtray.el |   26 +-
 exwm.el|2 +-
 3 files changed, 40 insertions(+), 8 deletions(-)



[elpa] externals/xelb ecd68de 1/2: Add 'MANAGER' atom

2016-05-12 Thread Chris Feng
branch: externals/xelb
commit ecd68de3176291afcf377ab9465491947f1aacac
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Add 'MANAGER' atom

* xcb-icccm.el (xcb:icccm:-atoms): Add 'MANAGER' atom.
---
 xcb-icccm.el |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xcb-icccm.el b/xcb-icccm.el
index c333f3c..c7f3c12 100644
--- a/xcb-icccm.el
+++ b/xcb-icccm.el
@@ -47,7 +47,7 @@
 
 (eval-and-compile
   (defconst xcb:icccm:-atoms
-'(UTF8_STRING COMPOUND_TEXT TEXT C_STRING
+'(UTF8_STRING COMPOUND_TEXT TEXT C_STRING MANAGER
   WM_PROTOCOLS WM_TAKE_FOCUS WM_DELETE_WINDOW WM_STATE)
 "Atoms involved in ICCCM.")
 



[elpa] externals/exwm 2dcb26c 3/3: Use `xcb:connect' instead of `xcb:connect-to-socket'

2016-05-12 Thread Chris Feng
branch: externals/exwm
commit 2dcb26ce9d4411200c635f19c372fc6c34f3bafe
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Use `xcb:connect' instead of `xcb:connect-to-socket'

* exwm.el (exwm-init):
* exwm-systemtray.el (exwm-systemtray--init):
Use `xcb:connect' instead of `xcb:connect-to-socket'.
---
 exwm-systemtray.el |2 +-
 exwm.el|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/exwm-systemtray.el b/exwm-systemtray.el
index c85d743..cb08ba9 100644
--- a/exwm-systemtray.el
+++ b/exwm-systemtray.el
@@ -306,7 +306,7 @@ You shall use the default value if using auto-hide 
minibuffer.")
 (setq exwm-systemtray-height (max exwm-systemtray--icon-min-size
   (line-pixel-height
   ;; Create a new connection.
-  (setq exwm-systemtray--connection (xcb:connect-to-socket))
+  (setq exwm-systemtray--connection (xcb:connect))
   (set-process-query-on-exit-flag (slot-value exwm-systemtray--connection
   'process)
   nil)
diff --git a/exwm.el b/exwm.el
index f8a3fc7..c9dc6cd 100644
--- a/exwm.el
+++ b/exwm.el
@@ -481,7 +481,7 @@
   (exwm--log "Not running under X environment")
 (unless exwm--connection
   (exwm-enable 'undo)   ;never initialize again
-  (setq exwm--connection (xcb:connect-to-socket))
+  (setq exwm--connection (xcb:connect))
   (set-process-query-on-exit-flag (slot-value exwm--connection 'process)
   nil) ;prevent query message on exit
   (setq exwm--root



[elpa] externals/exwm 009854e 2/3: Announce manager selection with client message

2016-05-12 Thread Chris Feng
branch: externals/exwm
commit 009854e766728ed17741bf9f7e6d86f9ccc71871
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Announce manager selection with client message

* exwm-systemtray.el (exwm-systemtray--init): Send a client message to
announce the manager selection.
(xcb:systemtray:-ClientMessage): The client message.
---
 exwm-systemtray.el |   24 
 1 file changed, 24 insertions(+)

diff --git a/exwm-systemtray.el b/exwm-systemtray.el
index 861304a..c85d743 100644
--- a/exwm-systemtray.el
+++ b/exwm-systemtray.el
@@ -30,6 +30,7 @@
 
 ;;; Code:
 
+(require 'xcb-icccm)
 (require 'xcb-xembed)
 (require 'xcb-systemtray)
 (require 'exwm-core)
@@ -40,6 +41,15 @@
(visible :initarg :visible))
   :documentation "Attributes of a system tray icon.")
 
+(defclass xcb:systemtray:-ClientMessage
+  (xcb:icccm:--ClientMessage xcb:ClientMessage)
+  ((format :initform 32)
+   (type :initform xcb:Atom:MANAGER)
+   (time :initarg :time :type xcb:TIMESTAMP)  ;new slot
+   (selection :initarg :selection :type xcb:ATOM) ;new slot
+   (owner :initarg :owner :type xcb:WINDOW))  ;new slot
+  :documentation "A systemtray client message.")
+
 ;; GTK icons require at least 16 pixels to show normally.
 (defconst exwm-systemtray--icon-min-size 16 "Minimum icon size.")
 
@@ -325,6 +335,20 @@ You shall use the default value if using auto-hide 
minibuffer.")
:owner id
:selection xcb:Atom:_NET_SYSTEM_TRAY_S0
:time xcb:Time:CurrentTime))
+;; Send a client message to announce the selection.
+(xcb:+request exwm-systemtray--connection
+(make-instance 'xcb:SendEvent
+   :propagate 0
+   :destination exwm--root
+   :event-mask xcb:EventMask:StructureNotify
+   :event (xcb:marshal
+   (make-instance 'xcb:systemtray:-ClientMessage
+  :window exwm--root
+  :time xcb:Time:CurrentTime
+  :selection
+  xcb:Atom:_NET_SYSTEM_TRAY_S0
+  :owner id)
+   exwm-systemtray--connection)))
 ;; Set _NET_WM_NAME.
 (xcb:+request exwm-systemtray--connection
 (make-instance 'xcb:ewmh:set-_NET_WM_NAME



[elpa] externals/xelb 65b2934 1/2: Fix the parsing of X11 properties

2016-05-16 Thread Chris Feng
branch: externals/xelb
commit 65b2934f69ffcb53906207b39d7624cb5cfc77de
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Fix the parsing of X11 properties

* xcb-icccm.el (xcb:icccm:-GetProperty~reply): Do not use the
'bytes-after' field.
---
 xcb-icccm.el |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/xcb-icccm.el b/xcb-icccm.el
index c7f3c12..c787161 100644
--- a/xcb-icccm.el
+++ b/xcb-icccm.el
@@ -128,12 +128,10 @@ 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 length format bytes-after value-len value) obj
+(with-slots (~lsb length format value-len value) obj
   (if (or (= 0 value-len) (= 0 length))
   (setf value nil)  ;no available value
-(setq tmp (substring value
- 0  ;long-offset
- (- (length value) bytes-after))
+(setq tmp value ;long-offset is always 0
   value nil)
 (pcase format
   (8



[elpa] externals/xelb updated (ddca322 -> 05e35bd)

2016-05-16 Thread Chris Feng
ch11ng pushed a change to branch externals/xelb.

  from  ddca322   Implement basic authentication during connection setup
   new  65b2934   Fix the parsing of X11 properties
   new  05e35bd   Improve performance of `xcb:create-auth-info'


Summary of changes:
 xcb-icccm.el |6 ++
 xcb.el   |5 +++--
 2 files changed, 5 insertions(+), 6 deletions(-)



[elpa] externals/xelb 05e35bd 2/2: Improve performance of `xcb:create-auth-info'

2016-05-16 Thread Chris Feng
branch: externals/xelb
commit 05e35bd9413f460e37dd43349f219d25a5a3cdfc
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Improve performance of `xcb:create-auth-info'

* xcb.el (xcb:create-auth-info): Improve performance.
---
 xcb.el |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xcb.el b/xcb.el
index 6cf9222..a03dbb4 100644
--- a/xcb.el
+++ b/xcb.el
@@ -170,11 +170,12 @@ equal.  Otherwise a negative value would be returned."
   (setq xauth-output (split-string xauth-output))
   (if (string= name (car (last xauth-output 2)))
   ;; The auth data is a 128-bit hex string.
-  (setq data
+  (setq data (car (last xauth-output))
+data
 (concat
  (cl-loop for i in (number-sequence 0 30 2)
   collect (string-to-number
-   (substring (car (last xauth-output))
+   (substring data
   i (+ i 2))
16
 ;; No xauth entry available.



[elpa] externals/exwm 2220c8c: Bump version to 0.7

2016-07-26 Thread Chris Feng
branch: externals/exwm
commit 2220c8cea21093afb17da24e8c8ecb32c357a09d
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Bump version to 0.7
---
 exwm.el |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/exwm.el b/exwm.el
index dd803f7..7de2297 100644
--- a/exwm.el
+++ b/exwm.el
@@ -4,7 +4,7 @@
 
 ;; Author: Chris Feng <chris.w.f...@gmail.com>
 ;; Maintainer: Chris Feng <chris.w.f...@gmail.com>
-;; Version: 0.6
+;; Version: 0.7
 ;; Package-Requires: ((xelb "0.9"))
 ;; Keywords: unix
 ;; URL: https://github.com/ch11ng/exwm



[elpa] externals/exwm 39dc328: Fix various stability issues

2016-07-14 Thread Chris Feng
branch: externals/exwm
commit 39dc328157a970742aa40d3d9169376d2208fce3
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Fix various stability issues

* exwm-input.el (exwm-input--on-KeyPress-line-mode)
(exwm-input--on-KeyPress-char-mode): Append events at the tail.

* exwm-manage.el (exwm-manage--unmanage-window): Remove the
_NET_WM_DESKTOP property when an X window is withdrawn.

* exwm-systemtray.el (exwm-systemtray--init):
* exwm-workspace.el (exwm-workspace--confirm-kill-emacs):
Issue warning rather than error when there's an existing tray running.

* exwm.el (exwm--on-ClientMessage): The buffer window can be on a
floating frame.
---
 exwm-input.el  |6 --
 exwm-manage.el |   14 --
 exwm-systemtray.el |6 --
 exwm-workspace.el  |2 +-
 exwm.el|2 +-
 5 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 3cb189b..8813f76 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -313,7 +313,8 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 (unless minibuffer-window (setq exwm-input--during-key-sequence t))
 ;; Feed this event to command loop.  Also force it to be added to
 ;; `this-command-keys'.
-(push (cons t event) unread-command-events))
+(setq unread-command-events
+  (append unread-command-events `((t . ,event)
   (xcb:+request exwm--connection
   (make-instance 'xcb:AllowEvents
  :mode (or mode xcb:Allow:ReplayKeyboard)
@@ -336,7 +337,8 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
   (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
+(setq unread-command-events
+  (append unread-command-events (list event))
   (xcb:+request exwm--connection
   (make-instance 'xcb:AllowEvents
  :mode xcb:Allow:AsyncKeyboard
diff --git a/exwm-manage.el b/exwm-manage.el
index d4b3de4..1394890 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -248,7 +248,11 @@ corresponding buffer.")
 (run-hooks 'exwm-manage-finish-hook)
 
 (defun exwm-manage--unmanage-window (id  withdraw-only)
-  "Unmanage window ID."
+  "Unmanage window ID.
+
+If WITHDRAW-ONLY is non-nil, the X window will be properly placed back to the
+root window.  Set WITHDRAW-ONLY to 'quit if this functions is used when window
+manager is shutting down."
   (let ((buffer (exwm--id->buffer id)))
 (exwm--log "Unmanage #x%x (buffer: %s, widthdraw: %s)"
id buffer withdraw-only)
@@ -295,7 +299,13 @@ corresponding buffer.")
   ;; Delete WM_STATE property
   (xcb:+request exwm--connection
   (make-instance 'xcb:DeleteProperty
- :window id :property xcb:Atom:WM_STATE)))
+ :window id :property xcb:Atom:WM_STATE))
+  (unless (eq withdraw-only 'quit)
+;; Remove _NET_WM_DESKTOP.
+(xcb:+request exwm--connection
+(make-instance 'xcb:DeleteProperty
+   :window id
+   :property xcb:Atom:_NET_WM_DESKTOP
 (when exwm--floating-frame
   ;; Unmap the floating frame before destroying the containers.
   (let ((window (frame-parameter exwm--floating-frame 'exwm-outer-id)))
diff --git a/exwm-systemtray.el b/exwm-systemtray.el
index d1783de..db0e045 100644
--- a/exwm-systemtray.el
+++ b/exwm-systemtray.el
@@ -296,7 +296,7 @@ You shall use the default value if using auto-hide 
minibuffer.")
 (defvar xcb:Atom:_NET_SYSTEM_TRAY_S0)
 (defvar exwm-workspace--minibuffer)
 
-(defun exwm-systemtray--init ()
+(cl-defun exwm-systemtray--init ()
   "Initialize system tray module."
   (cl-assert (not exwm-systemtray--connection))
   (cl-assert (not exwm-systemtray--list))
@@ -319,7 +319,9 @@ You shall use the default value if using auto-hide 
minibuffer.")
   (make-instance 'xcb:GetSelectionOwner
  :selection xcb:Atom:_NET_SYSTEM_TRAY_S0))
 (when (/= owner xcb:Window:None)
-  (error "[EXWM] Other system tray detected")))
+  (xcb:disconnect exwm-systemtray--connection)
+  (warn "[EXWM] Other system tray detected")
+  (cl-return-from exwm-systemtray--init)))
   (let ((id (xcb:generate-id exwm-systemtray--connection)))
 (setq exwm-systemtray--selection-owner-window id)
 (xcb:+request exwm-systemtray--connection
diff --git a/exwm-workspace.el b/exwm-workspace.el
index bde423d..6902151 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -

[elpa] externals/exwm 0b8a373: Fix a `unread-command-events' issue for Emacs 24

2016-07-14 Thread Chris Feng
branch: externals/exwm
commit 0b8a373e4fd092b527b34070b6556be35983062c
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Fix a `unread-command-events' issue for Emacs 24

* exwm-input.el (exwm-input--unread-event)
(exwm-input--on-KeyPress-line-mode): Use `unread-command-events'
differently on Emacs 24 and 25.
---
 exwm-input.el |   16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 8813f76..57c0cc8 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -287,6 +287,19 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
   (global-set-key key command)
   (cl-pushnew key exwm-input--global-keys))
 
+;; FIXME: Putting (t . EVENT) into `unread-command-events' does not really work
+;;as documented in Emacs 24.  Since inserting a conventional EVENT does
+;;add it into (this-command-keys) there, we use `unread-command-events'
+;;differently on Emacs 24 and 25.
+(eval-and-compile
+  (if (< emacs-major-version 25)
+  (defsubst exwm-input--unread-event (event)
+(setq unread-command-events
+  (append unread-command-events (list event
+(defsubst exwm-input--unread-event (event)
+  (setq unread-command-events
+(append unread-command-events `((t . ,event)))
+
 (defvar exwm-input-command-whitelist nil
   "A list of commands that when active all keys should be forwarded to Emacs.")
 (make-obsolete-variable 'exwm-input-command-whitelist
@@ -313,8 +326,7 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 (unless minibuffer-window (setq exwm-input--during-key-sequence t))
 ;; Feed this event to command loop.  Also force it to be added to
 ;; `this-command-keys'.
-(setq unread-command-events
-  (append unread-command-events `((t . ,event)
+(exwm-input--unread-event event))
   (xcb:+request exwm--connection
   (make-instance 'xcb:AllowEvents
  :mode (or mode xcb:Allow:ReplayKeyboard)



[elpa] externals/exwm f4d89d7 1/2: Minor fixes for past few commits

2016-07-24 Thread Chris Feng
branch: externals/exwm
commit f4d89d7e2f571d0b78a7242fc13c21ca0f46bebe
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Minor fixes for past few commits

* exwm-input.el (exwm-input--unread-event): Temporarily disable it
due to bug#23980.

* exwm-workspace.el (exwm-workspace--init): Set the default frame
internal border to 0.

* exwm-workspace.el (exwm-workspace--remove-frame-as-workspace):
Fix a typo.
---
 exwm-input.el |2 +-
 exwm-workspace.el |7 +++
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index fa7883f..62779c9 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -323,7 +323,7 @@ This value should always be overwritten.")
 ;;add it into (this-command-keys) there, we use `unread-command-events'
 ;;differently on Emacs 24 and 25.
 (eval-and-compile
-  (if (< emacs-major-version 25)
+  (if (< emacs-major-version 26)
   (defsubst exwm-input--unread-event (event)
 (setq unread-command-events
   (append unread-command-events (list event
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 01f5b50..08c9075 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -1203,7 +1203,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' 
first."
 (exwm--log "Removing frame `%s' as workspace" frame)
 (when (= 1 (exwm-workspace--count))
   ;; The user managed to delete the last workspace, so create a new one.
-  (exwm--log "Last worksapce deleted; create a new one")
+  (exwm--log "Last workspace deleted; create a new one")
   (let ((exwm-workspace--create-silently t))
 (make-frame)))
 (let* ((index (exwm-workspace--position frame))
@@ -1289,6 +1289,8 @@ applied to all subsequently created X frames."
   "Initialize workspace module."
   ;; Prevent unexpected exit
   (setq confirm-kill-emacs #'exwm-workspace--confirm-kill-emacs)
+  (exwm-workspace--modify-all-x-frames-parameters
+   '((internal-border-width . 0)))
   (let ((initial-workspaces (frame-list)))
 (if (not (exwm-workspace--minibuffer-own-frame-p))
 ;; Initialize workspaces with minibuffers.
@@ -1309,7 +1311,6 @@ applied to all subsequently created X frames."
 (make-frame '((window-system . x) (minibuffer . only)
   (left . 1) (right . 1)
   (width . 1) (height . 1)
-  (internal-border-width . 0)
   (client . nil
   ;; Remove/hide existing frames.
   (dolist (f initial-workspaces)
@@ -1370,7 +1371,6 @@ applied to all subsequently created X frames."
   (add-hook 'echo-area-clear-hook #'exwm-workspace--on-echo-area-clear)
   ;; Recreate one frame with the external minibuffer set.
   (setq initial-workspaces (list (make-frame '((window-system . x)
-   (internal-border-width . 0)
(client . nil)
   ;; The default behavior of `display-buffer' (indirectly called by
   ;; `minibuffer-completion-help') is not correct here.
@@ -1384,7 +1384,6 @@ applied to all subsequently created X frames."
 ;; Create remaining workspaces.
 (dotimes (_ (- exwm-workspace-number (length initial-workspaces)))
   (nconc initial-workspaces (list (make-frame '((window-system . x)
-(internal-border-width . 0)
 (client . nil))
 ;; Configure workspaces
 (dolist (i initial-workspaces)



[elpa] externals/xelb 600b825 09/10: Support system-specific and legacy keysyms

2016-07-29 Thread Chris Feng
branch: externals/xelb
commit 600b82540d7f5c24b415d56a6612a5cea3577bb8
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Support system-specific and legacy keysyms

* xcb-keysyms.el (xcb:keysyms:event->keysym, xcb:keysyms:keysym->event):
Also search `system-key-alist' and `x-keysym-table' for system-specific
and legacy keysyms respectively.
---
 xcb-keysyms.el |   59 +---
 1 file changed, 39 insertions(+), 20 deletions(-)

diff --git a/xcb-keysyms.el b/xcb-keysyms.el
index a32d8b3..5db181d 100644
--- a/xcb-keysyms.el
+++ b/xcb-keysyms.el
@@ -419,8 +419,6 @@ Return 0 if conversion fails."
   0)))
 
 ;; This list is largely base on 'lispy_function_keys' in 'keyboard.c'.
-;; Emacs has a built-in variable `x-keysym-table' providing Latin-1 and legacy
-;; keysyms, which seems not very useful here.
 (defconst xcb:keysyms:-function-keys
   `[;#xff00 - #xff0f
 ,@(make-list 8 nil) backspace tab linefeed clear nil return nil nil
@@ -558,23 +556,39 @@ Return (0 . 0) when conversion fails."
 (`mouse-3 xcb:ButtonIndex:3)
 (`mouse-4 xcb:ButtonIndex:4)
 (`mouse-5 xcb:ButtonIndex:5)
-(_ (if (setq keysym (cl-position event
- xcb:keysyms:-function-keys))
-   ;; Function keys
-   (logior keysym #xff00)
- (if (setq keysym (cl-position event
-   xcb:keysyms:-xf86-keys))
- ;; XF86 keys
- (logior keysym #x1008ff00)
-   (if (setq keysym
- (cl-position event
-  xcb:keysyms:-iso-function-keys))
-   ;; ISO function keys
-   (logior keysym #xfe00)))
-  (if (<= #x20 event #xff)  ;Latin-1
-  (setq keysym event)
-(when (<= #x100 event #x10) ;Unicode
-  (setq keysym (+ #x100 event)
+(_
+ (cond
+  ((setq keysym (cl-position event
+ xcb:keysyms:-function-keys))
+   ;; Function keys.
+   (logior keysym #xff00))
+  ((setq keysym (cl-position event xcb:keysyms:-xf86-keys))
+   ;; XF86 keys.
+   (logior keysym #x1008ff00))
+  ((setq keysym (cl-position event
+ xcb:keysyms:-iso-function-keys))
+   ;; ISO function keys.
+   (logior keysym #xfe00))
+  (t
+   ;; Finally try system-specific keysyms.
+   (car (rassq event system-key-alist)))
+  (setq keysym
+(cond
+ ((<= #x20 event #xff)
+  ;; Latin-1.
+  event)
+ ((<= #x100 event #x10)
+  ;; Unicode.
+  (+ #x100 event))
+ (t (or
+ ;; Try system-specific keysyms.
+ (car (rassq event system-key-alist))
+ ;; Try legacy keysyms.
+ (catch 'break
+   (maphash (lambda (key val)
+  (when (= event val)
+(throw 'break key)))
+x-keysym-table)))
 (if (not keysym)
 '(0 . 0)
   (let ((keycode (xcb:keysyms:keysym->keycode obj keysym))
@@ -630,7 +644,12 @@ this function will also return symbols for pure modifiers 
keys."
   (aref xcb:keysyms:-xf86-keys (logand keysym #xff)))
  ((<= #xfe00 keysym #xfeff)
   (aref xcb:keysyms:-iso-function-keys
-(logand keysym #xff)
+(logand keysym #xff)))
+ (t (or
+ ;; Search system-specific keysyms.
+ (car (assq keysym system-key-alist))
+ ;; Search `x-keysym-table' for legacy keysyms.
+ (gethash keysym x-keysym-table)
 mod-alt mod-meta mod-hyper mod-super)
 (when event
   (if allow-modifiers



[elpa] externals/xelb f5216dc 10/10: Merge branch 'feat/xkb' into externals/xelb

2016-07-29 Thread Chris Feng
branch: externals/xelb
commit f5216dc13ff44a9f86bdff18272d9b8db1ee7cc5
Merge: e58ac74 600b825
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Merge branch 'feat/xkb' into externals/xelb
---
 .elpaignore|5 -
 el_client.el   |   77 +-
 xcb-dri2.el|4 +-
 xcb-keysyms.el |  655 ++--
 xcb-randr.el   |3 +-
 xcb-render.el  |   52 ++---
 xcb-screensaver.el |   30 +--
 xcb-sync.el|   24 +-
 xcb-types.el   |   63 ++---
 xcb-xf86vidmode.el |   28 +--
 xcb-xinput.el  |  147 
 xcb-xkb.el |  194 
 xcb-xproto.el  |  185 +++
 xcb.el |3 +
 14 files changed, 849 insertions(+), 621 deletions(-)

diff --git a/.elpaignore b/.elpaignore
index 319bcbf..b43bf86 100644
--- a/.elpaignore
+++ b/.elpaignore
@@ -1,6 +1 @@
-Makefile
 README.md
-el_client.el
-
-# Exclude xcb-xkb.el for now, as it does not work on Emacs 24
-xcb-xkb.el
diff --git a/el_client.el b/el_client.el
index 02d78ad..cdeb82d 100644
--- a/el_client.el
+++ b/el_client.el
@@ -41,10 +41,17 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl-lib))
+(require 'eieio)
 (require 'pp)
 
+;; Only used to eliminate compile warnings when distributed.
+(require 'xcb-types nil t)
+
  Variables
 
+(defconst xelb-excluded-replies<25 '(xcb:xkb:GetKbdByName~reply)
+  "Excluded replies for Emacs < 25 (they're too long to load/compile).")
+
 (defvar xelb-prefix "xcb:" "Namespace of this module.")
 (make-variable-buffer-local 'xelb-prefix)
 
@@ -141,6 +148,36 @@ an `xelb-auto-padding' attribute."
  (eq (xelb-node-name i) 'doc)))
   (throw 'break i))
 
+(defun xelb-node-size (node)
+  "Return the size of NODE in bytes."
+  (pcase (xelb-node-name node)
+(`pad (xelb-node-attr node 'bytes))
+(`field (xelb-type-size (xelb-node-type node)))
+(`list (* (xelb-type-size (xelb-node-type node))
+  (xelb-parse-expression (xelb-node-subnode node
+((or `comment `doc) 0)
+(x (error "Unexpected element: <%s>" x
+
+(defun xelb-type-size (type  slot)
+  "Return size of TYPE in bytes."
+  (pcase (indirect-variable type)
+(`xcb:-ignore 0)
+((or `xcb:-u1 `xcb:-i1 `xcb:void) 1)
+((or `xcb:-u2 `xcb:-i2) 2)
+((or `xcb:-u4 `xcb:-i4) 4)
+(`xcb:-u8 8)
+(`xcb:-pad (cl--slot-descriptor-initform slot))
+(`xcb:-list
+ (let ((initform (cadr (cl--slot-descriptor-initform slot
+   (* (plist-get initform 'size)
+  (xelb-type-size (plist-get initform 'type)
+((and x (guard (child-of-class-p x 'xcb:-struct)))
+ (apply #'+
+(mapcar (lambda (slot)
+  (xelb-type-size (cl--slot-descriptor-type slot) slot))
+(eieio-class-slots x
+(x (error "Unknown size of type: %s" x
+
 (defsubst xelb-generate-pad-name ()
   "Generate a new slot name for ."
   (make-symbol (format "pad~%d" (cl-incf xelb-pad-count
@@ -153,7 +190,10 @@ an `xelb-auto-padding' attribute."
 result header)
 (with-temp-buffer
   (insert-file-contents file)
-  (setq result (libxml-parse-xml-region (point-min) (point-max) nil t))
+  (setq result (libxml-parse-xml-region (point-min) (point-max)))
+  (unless (eq 'xcb (xelb-node-name result))
+;; There's an extra comment.
+(setq result (xelb-node-subnode result)))
   (cl-assert (eq 'xcb (xelb-node-name result)))
   (setq header (xelb-node-attr result 'header))
   (unless (string= header "xproto")
@@ -220,6 +260,7 @@ an `xelb-auto-padding' attribute."
 (let ((result (xelb-parse-top-level-element i)))
   (when result  ;skip , comments, etc
 (dolist (j result)
+  (eval j) ;Make it immediately available.
   (pp j))
 (princ "\n"
   ;; Print error/event alists
@@ -283,7 +324,10 @@ an `xelb-auto-padding' attribute."
   (let ((name (intern (concat xelb-prefix (xelb-node-attr node 'name
 (contents (xelb-node-subnodes node)))
 `((defclass ,name (xcb:-union)
-,(apply #'nconc (mapcar #'xelb-parse-structure-content contents))
+,(apply #'nconc
+`((~size :initform
+ ,(apply #'max (mapcar #'xelb-node-size contents
+(mapcar #'xelb-parse-structure-content contents))
 
 (defun xelb-parse-xidtype (node)
   "Parse ."
@@ -362,10 +406,21 @@ The `combine-adjacent' attribute is simply ignored."
`(cl-defmethod xcb:marshal ((obj ,name)) nil
   ,@expressions
   (cl-call-next-method obj)))
+,(when (memq re

[elpa] externals/xelb d7d1115 06/10: Adapt 'xcb-keysyms' library to use XKB

2016-07-29 Thread Chris Feng
branch: externals/xelb
commit d7d111517c691b6462b33d4cf0db4383ce62
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Adapt 'xcb-keysyms' library to use XKB

* xcb-keysyms.el: Remove a todo entry; load 'xcb-xkb'.
(xcb:keysyms:auto-update): Removed since no longer required.
(xcb:keysyms:num-lock-mask, xcb:keysyms:mode-switch-mask): Removed since
no longer used in conversion.
(xcb:keysyms:-opcode, xcb:keysyms:-device, xcb:keysyms:-keytypes)
(xcb:keysyms:-keycodes, xcb:keysyms:-modkeys, xcb:keysyms:-min-keycode)
(xcb:keysyms:-max-keycode): Shared internal local data.
(xcb:keysyms:init): Reworked to initialize XKB.
(xcb:keysyms:-on-NewKeyboardNotify): New event handler for XKB
NewKeyboardNotify evnet.
(xcb:keysyms:-on-MapNotify): New event handler for XKB MapNotify.
(xcb:keysyms:-update-keytypes): New method for updating XKB key types.
(xcb:keysyms:update-keyboard-mapping, xcb:keysyms:-update-keycodes):
Rename the former to the latter to update XKB keycodes-keysym mapping.
(xcb:keysyms:update-modifier-mapping, xcb:keysyms:-update-modkeys):
Rename the former to the latter to update XKB modifier keys.
(xcb:keysyms:keycode->keysym): Reworked to perform the conversion using
XKB rules; always return a cons cell with numerical elements.
(xcb:keysyms:keysym->keycode): Reworked to perform the conversion using
XKB keycodes; always return an integer.
(xcb:keysyms:event->keysym): Detect additional modifiers using the new
`xcb:keysyms:keycode->keysym'.
---
 xcb-keysyms.el |  536 +---
 1 file changed, 356 insertions(+), 180 deletions(-)

diff --git a/xcb-keysyms.el b/xcb-keysyms.el
index dd7b797..290ecc2 100644
--- a/xcb-keysyms.el
+++ b/xcb-keysyms.el
@@ -32,10 +32,6 @@
 ;;   thus shall be used in preference to 'xcb:ModMask:*' or
 ;;   'xcb:KeyButMask:Mod*'.
 
-;; Todo:
-;; + Is xcb:ModMask:Control/xcb:ModMask:Shift always equivalent to
-;;   control/shift in Emacs?
-
 ;; References:
 ;; + X protocol (http://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.txt)
 ;; + xcb/util-keysyms (git://anongit.freedesktop.org/xcb/util-keysyms)
@@ -43,183 +39,361 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl-lib))
-(require 'xcb)
 
-(defvar xcb:keysyms:auto-update t "Auto update keyboard mapping.")
-
-(defvar xcb:keysyms:meta-mask nil "META key mask.")
-(defvar xcb:keysyms:control-mask xcb:ModMask:Control "CONTROL key mask.")
-(defvar xcb:keysyms:shift-mask xcb:ModMask:Shift "SHIFT key mask.")
-(defvar xcb:keysyms:hyper-mask nil "HYPER key mask.")
-(defvar xcb:keysyms:super-mask nil "SUPER key mask.")
-(defvar xcb:keysyms:alt-mask nil "ALT key mask.")
-(defvar xcb:keysyms:lock-mask xcb:ModMask:Lock "LOCK key mask.")
-(defvar xcb:keysyms:num-lock-mask nil "NUM LOCK key mask.")
-(defvar xcb:keysyms:mode-switch-mask nil "MODE SWITCH key mask.")
+(require 'xcb)
+(require 'xcb-xkb)
+
+;; These variables are shared by all connections.
+(defvar xcb:keysyms:meta-mask 0 "META key mask.")
+(defvar xcb:keysyms:control-mask 0 "CONTROL key mask.")
+(defvar xcb:keysyms:shift-mask 0 "SHIFT key mask.")
+(defvar xcb:keysyms:hyper-mask 0 "HYPER key mask.")
+(defvar xcb:keysyms:super-mask 0 "SUPER key mask.")
+(defvar xcb:keysyms:alt-mask 0 "ALT key mask.")
+(defvar xcb:keysyms:lock-mask 0 "LOCK key mask.")
+;; Internal state / local data.
+(defvar xcb:keysyms:-opcode nil)
+(defvar xcb:keysyms:-device nil)
+(defvar xcb:keysyms:-keytypes nil)
+(defvar xcb:keysyms:-keycodes nil)
+(defvar xcb:keysyms:-modkeys nil)
+(defvar xcb:keysyms:-min-keycode nil)
+(defvar xcb:keysyms:-max-keycode nil)
 
 (cl-defmethod xcb:keysyms:init ((obj xcb:connection))
   "Initialize keysyms module.
 
 This method must be called before using any other method in this module."
-  (with-slots (min-keycode max-keycode) (xcb:get-setup obj)
-(xcb:keysyms:update-keyboard-mapping obj
- min-keycode
- (1+ (- max-keycode min-keycode)))
-(unless xcb:keysyms:meta-mask ;avoid duplicated initialization
-  (xcb:keysyms:update-modifier-mapping obj)
-  ;; Update on MappingNotify event.
-  (when xcb:keysyms:auto-update
-(xcb:+event obj 'xcb:MappingNotify
-`(lambda (data _)
-   (let ((obj1 (make-instance 'xcb:MappingNotify)))
- (xcb:unmarshal obj1 data)
- (with-slots (request first-keycode count) obj1
-   (cond
-((= request xcb:Mapping:Modifier)
- ;; Modifier keys changed
- (xcb:keysyms:update-mo

[elpa] externals/xelb bddad0e 04/10: Eliminate compile warnings for Emacs 24

2016-07-29 Thread Chris Feng
branch: externals/xelb
commit bddad0ed2e4fe01a35b8bab06a4bf69bc6c32465
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Eliminate compile warnings for Emacs 24

* el_client.el: Require eieio and xcb-types; do not use the forth
argument to `libxml-parse-xml-region'.
* xcb-types.el: Backport `cl--slot-descriptor-initform'.
---
 el_client.el |9 -
 xcb-types.el |4 
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/el_client.el b/el_client.el
index 06ca496..cdeb82d 100644
--- a/el_client.el
+++ b/el_client.el
@@ -41,8 +41,12 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl-lib))
+(require 'eieio)
 (require 'pp)
 
+;; Only used to eliminate compile warnings when distributed.
+(require 'xcb-types nil t)
+
  Variables
 
 (defconst xelb-excluded-replies<25 '(xcb:xkb:GetKbdByName~reply)
@@ -186,7 +190,10 @@ an `xelb-auto-padding' attribute."
 result header)
 (with-temp-buffer
   (insert-file-contents file)
-  (setq result (libxml-parse-xml-region (point-min) (point-max) nil t))
+  (setq result (libxml-parse-xml-region (point-min) (point-max)))
+  (unless (eq 'xcb (xelb-node-name result))
+;; There's an extra comment.
+(setq result (xelb-node-subnode result)))
   (cl-assert (eq 'xcb (xelb-node-name result)))
   (setq header (xelb-node-attr result 'header))
   (unless (string= header "xproto")
diff --git a/xcb-types.el b/xcb-types.el
index 421cee5..8d4e9a2 100644
--- a/xcb-types.el
+++ b/xcb-types.el
@@ -91,6 +91,10 @@
   (unless (fboundp 'eieio-slot-descriptor-name)
 (defsubst eieio-slot-descriptor-name (slot) (aref slot 0
 
+(eval-and-compile
+  (unless (fboundp 'cl--slot-descriptor-initform)
+(defsubst cl--slot-descriptor-initform (slot) (aref slot 1
+
 (eval-when-compile
   (unless (fboundp 'cl--slot-descriptor-type)
 (defsubst cl--slot-descriptor-type (slot) (aref slot 2



[elpa] externals/xelb 9a73b79 02/10: Fix issues with

2016-07-29 Thread Chris Feng
branch: externals/xelb
commit 9a73b79d764e1cdb6e644fc9447ff3208de26b50
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Fix issues with 

* el_client.el (xelb-parse): Evaluate just generated forms.
(xelb-parse-enumref): Return the enum value instead of symbol.
(xelb-parse-unop): Add a missing comma.

* el_client.el (xelb-parse-switch): Aggressively simplify [bit]cases.

* xcb-types.el (xcb:-marshal-field, xcb:-unmarshal-field): Adjust the
checks for switch conditions; skip `xcb:-ignore' type slots.

* xcb-dri2.el:
* xcb-render.el:
* xcb-screensaver.el:
* xcb-sync.el:
* xcb-xf86vidmode.el:
* xcb-xinput.el:
* xcb-xkb.el:
* xcb-xproto.el: Regenerated.
---
 el_client.el   |   17 +++--
 xcb-dri2.el|4 +-
 xcb-render.el  |   52 +++
 xcb-screensaver.el |   30 -
 xcb-sync.el|   24 +++
 xcb-types.el   |   36 ++-
 xcb-xf86vidmode.el |   28 ++--
 xcb-xinput.el  |  147 ++
 xcb-xkb.el |  176 --
 xcb-xproto.el  |  182 ++--
 10 files changed, 317 insertions(+), 379 deletions(-)

diff --git a/el_client.el b/el_client.el
index 1a0f300..ee015da 100644
--- a/el_client.el
+++ b/el_client.el
@@ -223,6 +223,7 @@ an `xelb-auto-padding' attribute."
 (let ((result (xelb-parse-top-level-element i)))
   (when result  ;skip , comments, etc
 (dolist (j result)
+  (eval j) ;Make it immediately available.
   (pp j))
 (princ "\n"
   ;; Print error/event alists
@@ -540,10 +541,16 @@ KeymapNotify event; instead, we handle this case in 
`xcb:unmarshal'."
  (setq fields (nconc fields tmp))
  (setq name-list
(nconc name-list (list (caar tmp)))
-(when (eq case-name 'bitcase)
+(if (eq case-name 'case)
+(when (= 1 (length condition))
+  ;; Flatten 1-element list.
+  (setq condition (car condition)))
   (setq condition (if (= 1 (length condition))
+  ;; Flatten 1-element list.
   (car condition)
-`(logior ,@condition)
+(if (cl-every #'integerp condition)
+(apply #'logior condition)
+  `(logior ,@condition))
   `(,condition ,@name-list)))
   cases))
 `((,name :initform '(expression ,expression cases ,cases)
@@ -612,13 +619,13 @@ KeymapNotify event; instead, we handle this case in 
`xcb:unmarshal'."
   "Parse ."
   (let ((name (concat (xelb-node-attr node 'ref) ":"
   (xelb-node-subnode node
-(or (intern-soft (concat "xcb:" name))
-(intern (concat xelb-prefix name)
+(symbol-value (or (intern-soft (concat "xcb:" name))
+  (intern (concat xelb-prefix name))
 
 (defun xelb-parse-unop (node)
   "Parse ."
   (cl-assert (string= "~" (xelb-node-attr node 'op)))
-  `(lognot (xelb-parse-expression (xelb-node-subnode node
+  `(lognot ,(xelb-parse-expression (xelb-node-subnode node
 
 (defun xelb-parse-sumof (node)
   "Parse ."
diff --git a/xcb-dri2.el b/xcb-dri2.el
index 8e52916..b967349 100644
--- a/xcb-dri2.el
+++ b/xcb-dri2.el
@@ -101,9 +101,7 @@
(+
 (xcb:-fieldref 'driver-name-length)
 3)
-   (lognot
-(xelb-parse-expression
- (xelb-node-subnode node
+   (lognot 3))
   (xcb:-fieldref 'driver-name-length)))
   :type xcb:-list)
(pad~3 :initform 4 :type xcb:-pad-align)
diff --git a/xcb-render.el b/xcb-render.el
index 7cb6f51..4be4fc1 100644
--- a/xcb-render.el
+++ b/xcb-render.el
@@ -316,19 +316,19 @@
   '(expression
 (xcb:-fieldref 'value-mask)
 cases
-((xcb:render:CP:Repeat repeat)
- (xcb:render:CP:AlphaMap alphamap)
- (xcb:render:CP:AlphaXOrigin alphaxorigin)
- (xcb:render:CP:AlphaYOrigin alphayorigin)
- (xcb:render:CP:ClipXOrigin clipxorigin)
- (xcb:render:CP:ClipYOrigin clipyorigin)
-  

[elpa] externals/xelb 39d4efb 07/10: Set XKB per-client flags

2016-07-29 Thread Chris Feng
branch: externals/xelb
commit 39d4efb437dc2f68eb31fc8164648363cc113b8e
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Set XKB per-client flags

* xcb-keysyms.el (xcb:keysyms:-set-per-client-flags): New function for
setting XKB per-client flags (required for GrabKey and SendEvent).
(xcb:keysyms:init, xcb:keysyms:-on-NewKeyboardNotify): Use it.
---
 xcb-keysyms.el |   23 +++
 1 file changed, 23 insertions(+)

diff --git a/xcb-keysyms.el b/xcb-keysyms.el
index 290ecc2..e965683 100644
--- a/xcb-keysyms.el
+++ b/xcb-keysyms.el
@@ -80,6 +80,8 @@ This method must be called before using any other method in 
this module."
 ;; Save the major opcode of XKB.
 (setq xcb:keysyms:-opcode
   (slot-value (xcb:get-extension-data obj 'xcb:xkb) 'major-opcode))
+;; Set per-client flags.
+(xcb:keysyms:-set-per-client-flags obj xcb:xkb:ID:UseCoreKbd)
 ;; Update data.
 (xcb:keysyms:-update-keytypes obj xcb:xkb:ID:UseCoreKbd)
 (xcb:keysyms:-update-keycodes obj xcb:xkb:ID:UseCoreKbd)
@@ -111,6 +113,25 @@ This method must be called before using any other method 
in this module."
  :newKeyboardDetails new-keyboard)))
 (xcb:flush obj
 
+(cl-defmethod xcb:keysyms:-set-per-client-flags ((obj xcb:connection) device)
+  "Set per-client flags."
+  (let ((per-client-flags (logior
+   ;; Instead of compatibility state.
+   xcb:xkb:PerClientFlag:GrabsUseXKBState
+   ;; Instead of grab state.
+   xcb:xkb:PerClientFlag:LookupStateWhenGrabbed
+   ;; Use XKB state in 'SendEvent'.
+   xcb:xkb:PerClientFlag:SendEventUsesXKBState)))
+;; The reply is not used.
+(xcb:+request-unchecked+reply obj
+(make-instance 'xcb:xkb:PerClientFlags
+   :deviceSpec device
+   :change per-client-flags
+   :value per-client-flags
+   :ctrlsToChange 0
+   :autoCtrls 0
+   :autoCtrlsValues 0
+
 (cl-defmethod xcb:keysyms:-on-NewKeyboardNotify ((obj xcb:connection) data)
   "Handle 'NewKeyboardNotify' event."
   (let ((obj1 (make-instance 'xcb:xkb:NewKeyboardNotify)))
@@ -131,6 +152,8 @@ This method must be called before using any other method in 
this module."
 ;; (xcb:keysyms:-update-keytypes obj deviceID)
 (xcb:keysyms:-update-keycodes obj deviceID)
 (xcb:keysyms:-update-modkeys obj deviceID))
+;; Device changed; update the per-client flags and local data.
+(xcb:keysyms:-set-per-client-flags obj deviceID)
 (xcb:keysyms:-update-keytypes obj deviceID)
 (xcb:keysyms:-update-keycodes obj deviceID)
 (xcb:keysyms:-update-modkeys obj deviceID)



[elpa] externals/exwm f528485 2/2: ; * exwm-floating.el (exwm-floating--unset-floating): Reposition an X

2016-07-29 Thread Chris Feng
branch: externals/exwm
commit f52848595d44064bb092d3028a7f9afe1107faf1
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

; * exwm-floating.el (exwm-floating--unset-floating): Reposition an X
; window when it changes from floating to tiling layout.
---
 exwm-floating.el |8 
 1 file changed, 8 insertions(+)

diff --git a/exwm-floating.el b/exwm-floating.el
index 7931c66..6702e38 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -277,6 +277,14 @@
 (make-instance 'xcb:ChangeWindowAttributes
:window id :value-mask xcb:CW:EventMask
:event-mask exwm--client-event-mask))
+;; The X window might have been moved due to the floating border.
+(xcb:+request exwm--connection
+(make-instance 'xcb:ConfigureWindow
+   :window id
+   :value-mask (logior xcb:ConfigWindow:X
+   xcb:ConfigWindow:Y)
+   :x 0
+   :y 0))
 ;; Reparent the floating frame back to the root window.
 (let ((frame-id (frame-parameter exwm--floating-frame 'exwm-outer-id))
   (frame-container (frame-parameter exwm--floating-frame



[elpa] externals/exwm 6bfedf8 1/5: Fix input focus transfer between workspaces

2016-07-29 Thread Chris Feng
branch: externals/exwm
commit 6bfedf8bf71ef11a26f2e8c3cddbac55ce873e5c
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Fix input focus transfer between workspaces

* exwm-input.el (exwm-input--set-focus): Make input focus revert to
parent by default (to prevent input focus from following pointer).

* exwm-input.el (exwm-input--update-focus): Switch to another workspace
if input focus is transfered to it.
* exwm-workspace.el (exwm-workspace--on-focus-in, exwm-workspace--init)
(exwm-workspace--exit): Remove `exwm-workspace--on-focus-in' and related
uses.
---
 exwm-input.el |   14 ++
 exwm-workspace.el |   13 -
 2 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 0b5ce98..0da0558 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -73,7 +73,7 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
 (exwm--log "Focus on #x%x with SetInputFocus" id)
 (xcb:+request exwm--connection
 (make-instance 'xcb:SetInputFocus
-   :revert-to xcb:InputFocus:PointerRoot
+   :revert-to xcb:InputFocus:Parent
:focus id
:time xcb:Time:CurrentTime)))
   (exwm-input--set-active-window id)
@@ -169,9 +169,15 @@ This value should always be overwritten.")
   (xcb:flush exwm--connection)))
 (when (eq (selected-window) window)
   (exwm--log "Focus on %s" window)
-  (select-frame-set-input-focus (window-frame window) t)
-  (exwm-input--set-active-window)
-  (xcb:flush exwm--connection)
+  (if (and (exwm-workspace--workspace-p (selected-frame))
+   (not (eq (selected-frame) exwm-workspace--current)))
+  ;; The focus is on another workspace (e.g. it got clicked)
+  ;; so switch to it.
+  (exwm-workspace-switch (selected-frame))
+;; The focus is still on the current workspace.
+(select-frame-set-input-focus (window-frame window) t)
+(exwm-input--set-active-window)
+(xcb:flush exwm--connection))
   (setq exwm-input--update-focus-lock nil))
 
 (defun exwm-input--on-minibuffer-setup ()
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 3a4a5a8..b2a0cab 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -610,16 +610,6 @@ INDEX must not exceed the current number of workspaces."
  (exwm-workspace--workspace-from-frame-or-index frame-or-index)
exwm-workspace--current
 
-(defun exwm-workspace--on-focus-in ()
-  "Handle unexpected frame switch."
-  ;; `focus-in-hook' is run by `handle-switch-frame'.
-  (unless (eq this-command #'handle-switch-frame)
-(let ((index (exwm-workspace--position (selected-frame
-  (exwm--log "Focus on workspace %s" index)
-  (when (and index (/= index exwm-workspace-current-index))
-(exwm--log "Workspace was switched unexpectedly")
-(exwm-workspace-switch index)
-
 (defun exwm-workspace--set-desktop (id)
   "Set _NET_WM_DESKTOP for X window ID."
   (with-current-buffer (exwm--id->buffer id)
@@ -1374,8 +1364,6 @@ applied to all subsequently created X frames."
   ;; `minibuffer-completion-help') is not correct here.
   (cl-pushnew '(exwm-workspace--display-buffer) display-buffer-alist
   :test #'equal))
-;; Handle unexpected frame switch.
-(add-hook 'focus-in-hook #'exwm-workspace--on-focus-in)
 ;; Prevent `other-buffer' from selecting already displayed EXWM buffers.
 (modify-all-frames-parameters
  '((buffer-predicate . exwm-layout--other-buffer-predicate)))
@@ -1413,7 +1401,6 @@ applied to all subsequently created X frames."
   (setq display-buffer-alist
 (cl-delete '(exwm-workspace--display-buffer) display-buffer-alist
:test #'equal))
-  (remove-hook 'focus-in-hook #'exwm-workspace--on-focus-in)
   (advice-remove 'x-create-frame #'exwm-workspace--x-create-frame)
   (remove-hook 'after-make-frame-functions
#'exwm-workspace--add-frame-as-workspace)



[elpa] externals/exwm updated (f528485 -> d225f19)

2016-07-29 Thread Chris Feng
ch11ng pushed a change to branch externals/exwm.

  from  f528485   ; * exwm-floating.el (exwm-floating--unset-floating): 
Reposition an X ; window when it changes from floating to tiling layout.
   new  6bfedf8   Fix input focus transfer between workspaces
   new  9f68fbd   Grab global keys on newly created workspaces
   new  ba0f41d   ; * exwm-manage.el (exwm-manage--manage-window): Check 
the value range ; of _NET_WM_DESKTOP.
   new  aa7de9d   Exit the active minibuffer on unmanaging X windows
   new  d225f19   Fit the *Completions* buffer


Summary of changes:
 exwm-input.el |   29 +++--
 exwm-manage.el|   34 +-
 exwm-workspace.el |   25 +++--
 exwm.el   |3 ++-
 4 files changed, 61 insertions(+), 30 deletions(-)



[elpa] externals/exwm d225f19 5/5: Fit the *Completions* buffer

2016-07-29 Thread Chris Feng
branch: externals/exwm
commit d225f191a908346535cf4525a4c6c56d93a84b31
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Fit the *Completions* buffer

* exwm-workspace.el (exwm-workspace--on-minibuffer-setup): Work around
the *Completions* buffer not getting fitted problem.

* exwm.el (exwm-enable): Enable `window-resize-pixelwise'.
---
 exwm-workspace.el |   12 +++-
 exwm.el   |3 ++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index b2a0cab..b425f92 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -986,7 +986,17 @@ Please check `exwm-workspace--minibuffer-own-frame-p' 
first."
  ;; Exclude non-graphical frames.
  (frame-parameter nil 'exwm-outer-id))
 (add-hook 'post-command-hook #'exwm-workspace--update-minibuffer-height)
-(exwm-workspace--show-minibuffer)))
+(exwm-workspace--show-minibuffer))
+  ;; FIXME: This is a temporary fix for the *Completions* buffer not
+  ;;being correctly fitted by its displaying window.  As with
+  ;;`exwm-workspace--display-buffer', the problem is caused by
+  ;;the fact that the minibuffer (rather than the workspace)
+  ;;frame is the 'selected frame'.  `get-buffer-window' will
+  ;;fail to retrieve the correct window.  It's likely there are
+  ;;other related issues.
+  (let ((window (get-buffer-window "*Completions*" exwm-workspace--current)))
+(when window
+  (fit-window-to-buffer window nil nil nil nil t
 
 (defun exwm-workspace--on-minibuffer-exit ()
   "Run in minibuffer-exit-hook to hide the minibuffer container."
diff --git a/exwm.el b/exwm.el
index 7de2297..4c156dc 100644
--- a/exwm.el
+++ b/exwm.el
@@ -679,7 +679,8 @@ This hook is only run when EXWM is started with 
emacsclient.")
  (dolist (i exwm-blocking-subrs)
(advice-remove i #'exwm--server-eval-at)))
 (_  ;enable EXWM
- (setq frame-resize-pixelwise t);mandatory; before init
+ (setq frame-resize-pixelwise t ;mandatory; before init
+   window-resize-pixelwise t)
  (add-hook 'window-setup-hook #'exwm-init t)  ;for Emacs
  (add-hook 'after-make-frame-functions #'exwm-init t) ;for Emacs Client
  (add-hook 'kill-emacs-hook #'exwm--server-stop)



[elpa] externals/exwm aa7de9d 4/5: Exit the active minibuffer on unmanaging X windows

2016-07-29 Thread Chris Feng
branch: externals/exwm
commit aa7de9dc6f13b0d937fe265b64368b7be6e8798e
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Exit the active minibuffer on unmanaging X windows

* exwm-manage.el (exwm-manage--unmanage-window): Exit the minibuffer as
a precaution to prevent the "selecting deleted buffer" error.
---
 exwm-manage.el |   28 
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/exwm-manage.el b/exwm-manage.el
index c083229..16abe98 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -352,14 +352,26 @@ manager is shutting down."
 ;; Destroy the X window container (and the frame container if any).
 (xcb:+request exwm--connection
 (make-instance 'xcb:DestroyWindow :window exwm--container))
-(let ((kill-buffer-query-functions nil)
-  (floating exwm--floating-frame))
-  (kill-buffer)
-  (when floating
-(select-window
- (frame-selected-window exwm-workspace--current)
-  (exwm-manage--set-client-list)
-  (xcb:flush exwm--connection
+(exwm-manage--set-client-list)
+(xcb:flush exwm--connection))
+  (let ((kill-buffer-func
+ (lambda (buffer)
+   (with-current-buffer buffer
+ (let ((kill-buffer-query-functions nil)
+   (floating exwm--floating-frame))
+   (kill-buffer)
+   (when floating
+ (select-window
+  (frame-selected-window exwm-workspace--current
+(if (not (active-minibuffer-window))
+;; Kill the buffer as usual.
+(funcall kill-buffer-func buffer)
+  ;; This can happen when this buffer was requested to be killed
+  ;; from the minibuffer (e.g. with `ido-kill-buffer-at-head').
+  ;; We have to exit the minibuffer first or there'll be a
+  ;; "selecting deleted buffer" error.
+  (run-with-idle-timer 0 nil kill-buffer-func buffer)
+  (exit-minibuffer))
 
 (defun exwm-manage--scan ()
   "Search for existing windows and try to manage them."



[elpa] externals/exwm 9f68fbd 2/5: Grab global keys on newly created workspaces

2016-07-29 Thread Chris Feng
branch: externals/exwm
commit 9f68fbd906ca14856a70a3c3b535188a670d01f4
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Grab global keys on newly created workspaces

* exwm-input.el (exwm-input--update-global-prefix-keys): Label grabbed
workspaces and re-grab keys only when keys change or there are newly
created workspaces.
(exwm-input--init, exwm-input--exit): Use the function in
`exwm-workspace-list-change-hook'.
---
 exwm-input.el |   15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 0da0558..f7a6704 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -292,7 +292,11 @@ This value should always be overwritten.")
   (setq exwm-input--global-prefix-keys nil)
   (dolist (i exwm-input--global-keys)
 (cl-pushnew (elt i 0) exwm-input--global-prefix-keys))
-  (unless (equal original exwm-input--global-prefix-keys)
+  ;; Stop here if the global prefix keys are update-to-date and
+  ;; there's no new workspace.
+  (unless (and (equal original exwm-input--global-prefix-keys)
+   (cl-every (lambda (w) (frame-parameter w 'exwm-grabbed))
+ exwm-workspace--list))
 (setq ungrab-key (make-instance 'xcb:UngrabKey
 :key xcb:Grab:Any :grab-window nil
 :modifiers xcb:ModMask:Any)
@@ -308,6 +312,8 @@ This value should always be overwritten.")
   (setf (slot-value ungrab-key 'grab-window) workspace)
   (if (xcb:+request-checked+request-check exwm--connection ungrab-key)
   (exwm--log "Failed to ungrab keys")
+;; Label this frame.
+(set-frame-parameter w 'exwm-grabbed t)
 (dolist (k exwm-input--global-prefix-keys)
   (setq keysym (xcb:keysyms:event->keysym exwm--connection k)
 keycode (xcb:keysyms:keysym->keycode exwm--connection
@@ -640,6 +646,9 @@ Its usage is the same with 
`exwm-input-set-simulation-keys'."
   (add-hook 'post-command-hook #'exwm-input--on-post-command)
   ;; Update focus when buffer list updates
   (add-hook 'buffer-list-update-hook #'exwm-input--on-buffer-list-update)
+  ;; Re-grab global keys.
+  (add-hook 'exwm-workspace-list-change-hook
+#'exwm-input--update-global-prefix-keys)
   ;; Update prefix keys for global keys
   (exwm-input--update-global-prefix-keys))
 
@@ -648,7 +657,9 @@ Its usage is the same with 
`exwm-input-set-simulation-keys'."
   (remove-hook 'pre-command-hook #'exwm-input--finish-key-sequence)
   (remove-hook 'pre-command-hook #'exwm-input--on-pre-command)
   (remove-hook 'post-command-hook #'exwm-input--on-post-command)
-  (remove-hook 'buffer-list-update-hook #'exwm-input--on-buffer-list-update))
+  (remove-hook 'buffer-list-update-hook #'exwm-input--on-buffer-list-update)
+  (remove-hook 'exwm-workspace-list-change-hook
+   #'exwm-input--update-global-prefix-keys))
 
 
 



[elpa] externals/exwm ba0f41d 3/5: ; * exwm-manage.el (exwm-manage--manage-window): Check the value range

2016-07-29 Thread Chris Feng
branch: externals/exwm
commit ba0f41db1b377196af8aa6607ef215e48a3daa26
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

; * exwm-manage.el (exwm-manage--manage-window): Check the value range
; of _NET_WM_DESKTOP.
---
 exwm-manage.el |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/exwm-manage.el b/exwm-manage.el
index 9e05ea2..c083229 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -98,6 +98,7 @@ corresponding buffer.")
 (declare-function exwm-workspace--current-height "exwm-workspace.el")
 (declare-function exwm-workspace--current-width  "exwm-workspace.el")
 (declare-function exwm-workspace--set-desktop "exwm-workspace.el" (id))
+(declare-function exwm-workspace--count "exwm-workspace.el" ())
 (declare-function exwm-workspace-move-window "exwm-workspace.el"
   (frame-or-index  id))
 
@@ -254,7 +255,10 @@ corresponding buffer.")
 desktop)
 (when reply
   (setq desktop (slot-value reply 'value)))
-(if (and desktop (/= desktop exwm-workspace-current-index))
+(if (and desktop
+ (/= desktop exwm-workspace-current-index)
+ ;; Check the range.
+ (< desktop (exwm-workspace--count)))
 (exwm-workspace-move-window desktop id)
   (exwm-workspace--set-desktop id)))
   (with-current-buffer (exwm--id->buffer id)



[elpa] externals/exwm e7ff9a9 1/2: Fix restarting issues

2016-08-01 Thread Chris Feng
branch: externals/exwm
commit e7ff9a9f90f0356a9ab8a9ca3857df03deeb1696
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Fix restarting issues

* exwm-workspace.el (exwm-workspace--confirm-kill-emacs): Prompt for
unsaved files before restarting; avoid running `server-force-stop'
early; restore the 'client' frame parameter before calling `exwm--exit';
correctly handle emacsclient.

* exwm.el (exwm-restart): Always kill subordinate Emacs instances.
---
 exwm-workspace.el |   55 +++--
 exwm.el   |   27 ++
 2 files changed, 59 insertions(+), 23 deletions(-)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index 7c2601a..097a950 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -25,6 +25,8 @@
 
 ;;; Code:
 
+(require 'server)
+
 (require 'exwm-core)
 
 (defvar exwm-workspace-number 1 "Initial number of workspaces.")
@@ -1046,15 +1048,32 @@ Please check `exwm-workspace--minibuffer-own-frame-p' 
first."
 
 (defun exwm-workspace--confirm-kill-emacs (prompt  force)
   "Confirm before exiting Emacs."
-  (when (or (and force (not (eq force 'no-check)))
-(and (or (eq force 'no-check) (not exwm--id-buffer-alist))
- (y-or-n-p prompt))
-(yes-or-no-p (format "[EXWM] %d window(s) will be destroyed.  %s"
- (length exwm--id-buffer-alist) prompt)))
-;; Run `kill-emacs-hook' before Emacs frames are unmapped so that
-;; errors can be visible.
-(run-hooks 'kill-emacs-hook)
-(setq kill-emacs-hook nil)
+  (when (cond
+ ((and force (not (eq force 'no-check)))
+  ;; Force killing Emacs.
+  t)
+ ((or (eq force 'no-check) (not exwm--id-buffer-alist))
+  ;; Check if there's any unsaved file.
+  (pcase (catch 'break
+   (let ((kill-emacs-query-functions
+  (append kill-emacs-query-functions
+  (list (lambda ()
+  (throw 'break 'break))
+ (save-buffers-kill-emacs)))
+(`break (y-or-n-p prompt))
+(x x)))
+ (t
+  (yes-or-no-p (format "[EXWM] %d window(s) will be destroyed.  %s"
+   (length exwm--id-buffer-alist) prompt
+;; Run `kill-emacs-hook' (`server-force-stop' excluded) before Emacs
+;; frames are unmapped so that errors (if any) can be visible.
+(if (memq #'server-force-stop kill-emacs-hook)
+(progn
+  (setq kill-emacs-hook (delq #'server-force-stop kill-emacs-hook))
+  (run-hooks 'kill-emacs-hook)
+  (setq kill-emacs-hook (list #'server-force-stop)))
+  (run-hooks 'kill-emacs-hook)
+  (setq kill-emacs-hook nil))
 ;; Hide & reparent out all frames (save-set can't be used here since
 ;; X windows will be re-mapped).
 (when (exwm-workspace--minibuffer-own-frame-p)
@@ -1079,22 +1098,20 @@ Please check `exwm-workspace--minibuffer-own-frame-p' 
first."
:parent exwm--root
:x 0
:y 0
-;; Exit each module.
-(exwm--exit)
-;; Destroy all resources created by this connection.
-(xcb:disconnect exwm--connection)
-(setq exwm--connection nil)
-;; Extra cleanups for emacsclient.
+;; Restore the 'client' frame parameter (before `exwm--exit').
 (when exwm-workspace--client
   (dolist (f exwm-workspace--list)
 (set-frame-parameter f 'client exwm-workspace--client))
   (when (exwm-workspace--minibuffer-own-frame-p)
 (set-frame-parameter exwm-workspace--minibuffer 'client
- exwm-workspace--client))
-  ;; Kill the client.
-  (server-save-buffers-kill-terminal nil))
+ exwm-workspace--client)))
+;; Exit each module.
+(exwm--exit)
+;; Destroy all resources created by this connection.
+(xcb:disconnect exwm--connection)
+(setq exwm--connection nil)
 ;; Set the return value.
-(not exwm-workspace--client)))
+t))
 
 (defun exwm-workspace--set-desktop-geometry ()
   "Set _NET_DESKTOP_GEOMETRY."
diff --git a/exwm.el b/exwm.el
index 861d51a..dd279bb 100644
--- a/exwm.el
+++ b/exwm.el
@@ -88,10 +88,29 @@
   "Restart EXWM."
   (interactive)
   (when (exwm-workspace--confirm-kill-emacs "[EXWM] Restart? " 'no-check)
-(apply #'call-process (car command-line-args) nil nil nil
-   (cdr command-line-args))
-;; Kill this instance at last.
-(kill-emacs)))
+(let* ((attr (process-attributes (emacs-pid)))
+   (args (cdr (assq 'args attr)))
+   (ppid (cdr (assq 'ppid attr)))
+   (pargs (cdr (assq 'args (process-attributes ppid)
+

[elpa] externals/exwm f04b041 2/2: Fix emacsclient issues

2016-08-01 Thread Chris Feng
branch: externals/exwm
commit f04b041cae5b119355737a9272c683ea8a791d7b
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Fix emacsclient issues

* exwm-workspace.el (exwm-workspace--client-p): New function for testing
emacsclient frames.
(exwm-workspace--update-minibuffer-height)
(exwm-workspace--on-minibuffer-setup)
(exwm-workspace--on-minibuffer-exit, exwm-workspace--on-echo-area-dirty)
(exwm-workspace--on-echo-area-clear):
* exwm-input.el (exwm-input--on-buffer-list-update)
(exwm-input--on-minibuffer-setup):
* exwm-layout.el (exwm-layout--on-minibuffer-setup)
(exwm-layout--on-echo-area-change):
Use it.

* exwm-workspace.el (exwm-workspace--add-frame-as-workspace): Always
clear the 'client' frame parameter.
(exwm-workspace--init): Fix a typo.
---
 exwm-input.el |   10 +++---
 exwm-layout.el|8 +---
 exwm-workspace.el |   56 -
 3 files changed, 42 insertions(+), 32 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index f218ea2..cbfd1dc 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -79,6 +79,9 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
   (exwm-input--set-active-window id)
   (xcb:flush exwm--connection
 
+(declare-function exwm-workspace--client-p "exwm-workspace.el"
+  ( frame))
+
 (defvar exwm-input--update-focus-window nil "The (Emacs) window to be focused.
 
 This value should always be overwritten.")
@@ -87,7 +90,7 @@ This value should always be overwritten.")
   "Run in `buffer-list-update-hook' to track input focus."
   (when (and (not (minibufferp)) ;Do not set input focus on minibuffer window.
  (eq (current-buffer) (window-buffer)) ;e.g. `with-temp-buffer'.
- (frame-parameter nil 'exwm-outer-id)) ;e.g. emacsclient frame.
+ (not (exwm-workspace--client-p)))
 (setq exwm-input--update-focus-window (selected-window))
 (exwm-input--update-focus-defer)))
 
@@ -183,8 +186,9 @@ This value should always be overwritten.")
 
 (defun exwm-input--on-minibuffer-setup ()
   "Run in `minibuffer-setup-hook' to set input focus."
-  ;; Set input focus on the Emacs frame
-  (x-focus-frame (window-frame (minibuffer-selected-window
+  (unless (exwm-workspace--client-p)
+;; Set input focus on the Emacs frame
+(x-focus-frame (window-frame (minibuffer-selected-window)
 
 (defun exwm-input--set-active-window ( id)
   "Set _NET_ACTIVE_WINDOW."
diff --git a/exwm-layout.el b/exwm-layout.el
index 905a1e3..ee97849 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -375,9 +375,12 @@ selected by `other-buffer'."
   (exwm-layout--set-client-list-stacking)
   (xcb:flush exwm--connection
 
+(declare-function exwm-workspace--client-p "exwm-workspace.el"
+  ( frame))
+
 (defun exwm-layout--on-minibuffer-setup ()
   "Refresh layout when minibuffer grows."
-  (when (frame-parameter nil 'exwm-outer-id)
+  (unless (exwm-workspace--client-p)
 (run-with-idle-timer 0.01 nil ;FIXME
  (lambda ()
(when (< 1 (window-height (minibuffer-window)))
@@ -386,8 +389,7 @@ selected by `other-buffer'."
 (defun exwm-layout--on-echo-area-change ( dirty)
   "Run when message arrives or in `echo-area-clear-hook' to refresh layout."
   (when (and (current-message)
- ;; Exclude non-graphical frames.
- (frame-parameter nil 'exwm-outer-id)
+ (not (exwm-workspace--client-p))
  (or (cl-position ?\n (current-message))
  (> (length (current-message))
 (frame-width exwm-workspace--current
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 097a950..4789aeb 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -48,6 +48,10 @@ NIL if FRAME is not a workspace"
   "Return t if FRAME is a workspace."
   (memq frame exwm-workspace--list))
 
+(defsubst exwm-workspace--client-p ( frame)
+  "Return non-nil if FRAME is an emacsclient frame."
+  (frame-parameter frame 'client))
+
 (defun exwm-workspace--workspace-from-frame-or-index (frame-or-index)
   "Retrieve the workspace frame from FRAME-OR-INDEX."
   (cond
@@ -882,24 +886,25 @@ Please check `exwm-workspace--minibuffer-own-frame-p' 
first."
 
 (defun exwm-workspace--update-minibuffer-height ( echo-area)
   "Update the minibuffer frame height."
-  (let ((height
- (with-current-buffer
- (window-buffer (minibuffer-window exwm-workspace--minibuffer))
-   (max 1
-(if echo-area
-(let ((width (frame-width exwm-workspace--minibuffer))
-  (result 0))
-

[elpa] externals/exwm fdeb39d 1/2: Add an option to force using tiling layout

2016-07-26 Thread Chris Feng
branch: externals/exwm
commit fdeb39dc0831f589e4924e17dad43b31a96b8dfe
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Add an option to force using tiling layout

* exwm-manage.el (exwm-manage-force-tiling): New variable indicating
whether X windows should always be managed in tiling layout.
(exwm-manage--manage-window): Add a condition.
---
 exwm-manage.el |   13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/exwm-manage.el b/exwm-manage.el
index 260571b..9e05ea2 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -28,6 +28,11 @@
 
 (require 'exwm-core)
 
+(defvar exwm-manage-force-tiling nil
+  "Non-nil to force managing all X windows in tiling layout.
+
+You can still make the X windows floating afterwards.")
+
 (defvar exwm-manage-finish-hook nil
   "Normal hook run after a window is just managed, in the context of the
 corresponding buffer.")
@@ -233,9 +238,11 @@ corresponding buffer.")
   (xcb:flush exwm--connection)
   (exwm--update-title id)
   (exwm--update-protocols id)
-  (if (or exwm-transient-for exwm--fixed-size
-  (memq xcb:Atom:_NET_WM_WINDOW_TYPE_UTILITY exwm-window-type)
-  (memq xcb:Atom:_NET_WM_WINDOW_TYPE_DIALOG exwm-window-type))
+  (if (and (not exwm-manage-force-tiling)
+   (or exwm-transient-for exwm--fixed-size
+   (memq xcb:Atom:_NET_WM_WINDOW_TYPE_UTILITY exwm-window-type)
+   (memq xcb:Atom:_NET_WM_WINDOW_TYPE_DIALOG
+ exwm-window-type)))
   (exwm-floating--set-floating id)
 (exwm-floating--unset-floating id))
   (exwm-input-grab-keyboard id)



[elpa] externals/exwm e6bf1b4 2/2: Always update input focus on entering minibuffer

2016-07-26 Thread Chris Feng
branch: externals/exwm
commit e6bf1b45ad77328af2b0a9be680c46e268bb2571
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Always update input focus on entering minibuffer

* exwm-input.el (exwm-input--on-minibuffer-setup): New function for
setting input focus on the workspace frame.
(exwm-input--init): Add the function to `minibuffer-setup-hook'.
* exwm-workspace.el (exwm-workspace--on-minibuffer-setup): Avoid setting
input focus here.
---
 exwm-input.el |7 +++
 exwm-workspace.el |4 +---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 62779c9..4a6d56e 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -174,6 +174,11 @@ This value should always be overwritten.")
   (xcb:flush exwm--connection)
   (setq exwm-input--update-focus-lock nil))
 
+(defun exwm-input--on-minibuffer-setup ()
+  "Run in `minibuffer-setup-hook' to set input focus."
+  ;; Set input focus on the Emacs frame
+  (x-focus-frame (window-frame (minibuffer-selected-window
+
 (defun exwm-input--set-active-window ( id)
   "Set _NET_ACTIVE_WINDOW."
   (xcb:+request exwm--connection
@@ -604,6 +609,8 @@ Its usage is the same with 
`exwm-input-set-simulation-keys'."
   #'exwm-floating--stop-moveresize)
   (xcb:+event exwm--connection 'xcb:MotionNotify
   #'exwm-floating--do-moveresize)
+  ;; The input focus should be set on the frame when minibuffer is active.
+  (add-hook 'minibuffer-setup-hook #'exwm-input--on-minibuffer-setup)
   ;; `pre-command-hook' marks the end of a key sequence (existing or not)
   (add-hook 'pre-command-hook #'exwm-input--finish-key-sequence)
   ;; Control `exwm-input--during-command'
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 08c9075..3a4a5a8 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -996,9 +996,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' 
first."
  ;; Exclude non-graphical frames.
  (frame-parameter nil 'exwm-outer-id))
 (add-hook 'post-command-hook #'exwm-workspace--update-minibuffer-height)
-(exwm-workspace--show-minibuffer)
-;; Set input focus on the Emacs frame
-(x-focus-frame (window-frame (minibuffer-selected-window)
+(exwm-workspace--show-minibuffer)))
 
 (defun exwm-workspace--on-minibuffer-exit ()
   "Run in minibuffer-exit-hook to hide the minibuffer container."



[elpa] externals/exwm updated (915ecc8 -> e6bf1b4)

2016-07-26 Thread Chris Feng
ch11ng pushed a change to branch externals/exwm.

  from  915ecc8   Bump version to 0.6
   new  fdeb39d   Add an option to force using tiling layout
   new  e6bf1b4   Always update input focus on entering minibuffer


Summary of changes:
 exwm-input.el |7 +++
 exwm-manage.el|   13 ++---
 exwm-workspace.el |4 +---
 3 files changed, 18 insertions(+), 6 deletions(-)



[elpa] externals/exwm 0b0982b 1/5: set fullscreen-frame-count to 0 on exiting

2016-07-30 Thread Chris Feng
branch: externals/exwm
commit 0b0982b5ac4c002b099aaef804328e9851d33e1c
Author: Taichi Uemura 
Commit: Taichi Uemura 

set fullscreen-frame-count to 0 on exiting
---
 exwm-workspace.el |1 +
 1 file changed, 1 insertion(+)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index b425f92..98c1148 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -1401,6 +1401,7 @@ applied to all subsequently created X frames."
 exwm-workspace--list nil
 exwm-workspace--client nil
 exwm-workspace--minibuffer nil
+exwm-workspace--fullscreen-frame-count 0
 default-minibuffer-frame nil)
   (remove-hook 'minibuffer-setup-hook #'exwm-workspace--on-minibuffer-setup)
   (remove-hook 'minibuffer-exit-hook #'exwm-workspace--on-minibuffer-exit)



[elpa] externals/xelb 93b6b73: ; * xcb.el (xcb:disconnect): Flush before disconnection.

2016-07-30 Thread Chris Feng
branch: externals/xelb
commit 93b6b7326a4cee287d56e320d66d478aa7099b91
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

; * xcb.el (xcb:disconnect): Flush before disconnection.
---
 xcb.el |1 +
 1 file changed, 1 insertion(+)

diff --git a/xcb.el b/xcb.el
index 4cba47c..2e52e36 100644
--- a/xcb.el
+++ b/xcb.el
@@ -367,6 +367,7 @@ Concurrency is disabled as it breaks the orders of errors, 
replies and events."
 
 (cl-defmethod xcb:disconnect ((obj xcb:connection))
   "Disconnect from X server."
+  (xcb:flush obj)
   (delete-process (slot-value obj 'process))
   ;; Reset every slot to its default value
   (let ((slots (eieio-class-slots 'xcb:connection)))



[elpa] externals/exwm a9b7756 2/5: Merge branch 'uemurax/reset-fullscreen-frame-count' into externals/exwm

2016-07-30 Thread Chris Feng
branch: externals/exwm
commit a9b775638d06d2fccd908d3546ef0a5ebd855800
Merge: d225f19 0b0982b
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Merge branch 'uemurax/reset-fullscreen-frame-count' into externals/exwm
---
 exwm-workspace.el |1 +
 1 file changed, 1 insertion(+)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index b425f92..98c1148 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -1401,6 +1401,7 @@ applied to all subsequently created X frames."
 exwm-workspace--list nil
 exwm-workspace--client nil
 exwm-workspace--minibuffer nil
+exwm-workspace--fullscreen-frame-count 0
 default-minibuffer-frame nil)
   (remove-hook 'minibuffer-setup-hook #'exwm-workspace--on-minibuffer-setup)
   (remove-hook 'minibuffer-exit-hook #'exwm-workspace--on-minibuffer-exit)



[elpa] externals/exwm b87f4fb 4/5: ; * exwm.el (exwm-enable): Ignore unrecognized command line arguments.

2016-07-30 Thread Chris Feng
branch: externals/exwm
commit b87f4fbd7170ec156d6fa575584f55c25dd1da1b
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

; * exwm.el (exwm-enable): Ignore unrecognized command line arguments.
---
 exwm.el |3 +++
 1 file changed, 3 insertions(+)

diff --git a/exwm.el b/exwm.el
index 4c156dc..692c863 100644
--- a/exwm.el
+++ b/exwm.el
@@ -681,6 +681,9 @@ This hook is only run when EXWM is started with 
emacsclient.")
 (_  ;enable EXWM
  (setq frame-resize-pixelwise t ;mandatory; before init
window-resize-pixelwise t)
+ ;; Ignore unrecognized command line arguments.  This can be helpful
+ ;; when EXWM is launched by some session manager.
+ (push #'vector command-line-functions)
  (add-hook 'window-setup-hook #'exwm-init t)  ;for Emacs
  (add-hook 'after-make-frame-functions #'exwm-init t) ;for Emacs Client
  (add-hook 'kill-emacs-hook #'exwm--server-stop)



[elpa] externals/exwm 8061e93 3/5: ; * exwm-workspace.el (exwm-workspace-switch): Input focus should be set

2016-07-30 Thread Chris Feng
branch: externals/exwm
commit 8061e93878440a386a5fe308b0829e707e5f8c9d
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

; * exwm-workspace.el (exwm-workspace-switch): Input focus should be set
; on the frame where the target window resides.
---
 exwm-workspace.el |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index 98c1148..ce2ed6f 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -463,7 +463,7 @@ The optional FORCE option is for internal use only."
 (set-frame-parameter (buffer-local-value 'exwm--frame (window-buffer))
  'exwm-selected-window (selected-window)))
   (select-window window)
-  (x-focus-frame frame);essential for transferring input focus
+  (x-focus-frame (window-frame window)) ;The real input focus.
   (set-frame-parameter frame 'exwm-selected-window nil)
   ;; Close the (possible) active minibuffer
   (when (active-minibuffer-window)



[elpa] externals/exwm updated (d225f19 -> 1e78045)

2016-07-30 Thread Chris Feng
ch11ng pushed a change to branch externals/exwm.

  from  d225f19   Fit the *Completions* buffer
   new  0b0982b   set fullscreen-frame-count to 0 on exiting
   new  a9b7756   Merge branch 'uemurax/reset-fullscreen-frame-count' into 
externals/exwm
   new  8061e93   ; * exwm-workspace.el (exwm-workspace-switch): Input 
focus should be set ; on the frame where the target window resides.
   new  b87f4fb   ; * exwm.el (exwm-enable): Ignore unrecognized command 
line arguments.
   new  1e78045   Add restart support


Summary of changes:
 exwm-input.el  |6 -
 exwm-manage.el |5 
 exwm-systemtray.el |5 
 exwm-workspace.el  |   68 ++--
 exwm.el|   52 +---
 5 files changed, 92 insertions(+), 44 deletions(-)



[elpa] externals/exwm 1e78045 5/5: Add restart support

2016-07-30 Thread Chris Feng
branch: externals/exwm
commit 1e78045f958edbb2f3ef7c21953f8b55b3bbae42
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Add restart support

* exwm-input.el (exwm-input--exit): Cancel timers.

* exwm-manage.el (exwm-manage--manage-window): Add reparented X windows
to save-set.
* exwm-systemtray.el (exwm-systemtray--embed): Add embeded icons to
save-set.

* exwm-workspace.el (exwm-workspace--confirm-kill-emacs): No need to
unmanage; also hide Emacs frames; always call `exwm--exit'.

* exwm.el (exwm-restart): New command for restarting EXWM.
(exwm--exit-icccm-ewmh): New function for cleaning up ICCCM/EWMH
properties.
(exwm-exit-hook): Update doc string.
(exwm--exit): Call `exwm--exit-icccm-ewmh' and do not reset variables.
---
 exwm-input.el  |6 -
 exwm-manage.el |5 
 exwm-systemtray.el |5 
 exwm-workspace.el  |   65 ++--
 exwm.el|   49 +++
 5 files changed, 87 insertions(+), 43 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index f7a6704..555cc87 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -659,7 +659,11 @@ Its usage is the same with 
`exwm-input-set-simulation-keys'."
   (remove-hook 'post-command-hook #'exwm-input--on-post-command)
   (remove-hook 'buffer-list-update-hook #'exwm-input--on-buffer-list-update)
   (remove-hook 'exwm-workspace-list-change-hook
-   #'exwm-input--update-global-prefix-keys))
+   #'exwm-input--update-global-prefix-keys)
+  (when exwm-input--update-focus-defer-timer
+(cancel-timer exwm-input--update-focus-defer-timer))
+  (when exwm-input--update-focus-timer
+(cancel-timer exwm-input--update-focus-timer)))
 
 
 
diff --git a/exwm-manage.el b/exwm-manage.el
index 16abe98..0b7b475 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -112,6 +112,11 @@ corresponding buffer.")
  :window id :value-mask xcb:CW:EventMask
  :event-mask exwm--client-event-mask))
   (throw 'return 'dead))
+;; Add this X window to save-set.
+(xcb:+request exwm--connection
+(make-instance 'xcb:ChangeSaveSet
+   :mode xcb:SetMode:Insert
+   :window id))
 (with-current-buffer (generate-new-buffer "*EXWM*")
   ;; Keep the oldest X window first.
   (setq exwm--id-buffer-alist
diff --git a/exwm-systemtray.el b/exwm-systemtray.el
index 56e5fb8..25f5fa5 100644
--- a/exwm-systemtray.el
+++ b/exwm-systemtray.el
@@ -89,6 +89,11 @@ You shall use the default value if using auto-hide 
minibuffer.")
 height* (round (* height (/ (float width*) width)
 (exwm--log "(System Tray) Resize from %dx%d to %dx%d"
width height width* height*))
+  ;; Add this icon to save-set.
+  (xcb:+request exwm-systemtray--connection
+  (make-instance 'xcb:ChangeSaveSet
+ :mode xcb:SetMode:Insert
+ :window icon))
   ;; Reparent to the embedder.
   (xcb:+request exwm-systemtray--connection
   (make-instance 'xcb:ReparentWindow
diff --git a/exwm-workspace.el b/exwm-workspace.el
index ce2ed6f..b73059a 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -1045,47 +1045,46 @@ Please check `exwm-workspace--minibuffer-own-frame-p' 
first."
   (0 (y-or-n-p prompt))
   (x (yes-or-no-p (format "[EXWM] %d window%s currently alive. %s"
   x (if (= x 1) "" "s") prompt
-;; Unmanage all X windows.
-(dolist (i exwm--id-buffer-alist)
-  (exwm-manage--unmanage-window (car i) 'quit)
-  (xcb:+request exwm--connection
-  (make-instance 'xcb:MapWindow :window (car i
-;; Reparent out the minibuffer frame.
+;; Hide & reparent out all frames (save-set can't be used here since
+;; X windows will be re-mapped).
 (when (exwm-workspace--minibuffer-own-frame-p)
-  (xcb:+request exwm--connection
-  (make-instance 'xcb:ReparentWindow
- :window (frame-parameter exwm-workspace--minibuffer
-  'exwm-outer-id)
- :parent exwm--root
- :x 0
- :y 0)))
-;; Reparent out all workspace frames.
+  (let ((id (frame-parameter exwm-workspace--minibuffer 'exwm-outer-id)))
+(xcb:+request exwm--connection
+(make-instance 'xcb:UnmapWindow
+   :window id))
+(xcb:+request exwm--connection
+(make-instance 'xcb:ReparentWindow
+   :window id
+   :parent exwm--root
+   :x 0
+ 

[elpa] externals/exwm a3dba8e 1/3: Fix restarting issues

2016-07-30 Thread Chris Feng
branch: externals/exwm
commit a3dba8edd9001e89e24c204b9186fdf8b444e78c
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Fix restarting issues

* exwm-workspace.el (exwm-workspace--confirm-kill-emacs):
* exwm.el (exwm-restart): Run `kill-emacs-hook' early; do not check for
X windows before restarting.
---
 exwm-workspace.el |   15 ++-
 exwm.el   |8 ++--
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index b73059a..3e2fe1a 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -1039,12 +1039,17 @@ Please check `exwm-workspace--minibuffer-own-frame-p' 
first."
 (declare-function exwm-manage--unmanage-window "exwm-manage.el")
 (declare-function exwm--exit "exwm.el")
 
-(defun exwm-workspace--confirm-kill-emacs (prompt)
+(defun exwm-workspace--confirm-kill-emacs (prompt  force)
   "Confirm before exiting Emacs."
-  (when (pcase (length exwm--id-buffer-alist)
-  (0 (y-or-n-p prompt))
-  (x (yes-or-no-p (format "[EXWM] %d window%s currently alive. %s"
-  x (if (= x 1) "" "s") prompt
+  (when (or (and force (not (eq force 'no-check)))
+(and (or (eq force 'no-check) (not exwm--id-buffer-alist))
+ (y-or-n-p prompt))
+(yes-or-no-p (format "[EXWM] %d window(s) will be destroyed.  %s"
+ (length exwm--id-buffer-alist) prompt)))
+;; Run `kill-emacs-hook' before Emacs frames are unmapped so that
+;; errors can be visible.
+(run-hooks 'kill-emacs-hook)
+(setq kill-emacs-hook nil)
 ;; Hide & reparent out all frames (save-set can't be used here since
 ;; X windows will be re-mapped).
 (when (exwm-workspace--minibuffer-own-frame-p)
diff --git a/exwm.el b/exwm.el
index b04990b..9a593d5 100644
--- a/exwm.el
+++ b/exwm.el
@@ -87,15 +87,11 @@
 (defun exwm-restart ()
   "Restart EXWM."
   (interactive)
-  (when (exwm-workspace--confirm-kill-emacs "[EXWM] Restart? ")
-(server-force-delete)
-(run-hooks 'kill-emacs-hook)
-;; FIXME: more?
+  (when (exwm-workspace--confirm-kill-emacs "[EXWM] Restart? " 'no-check)
 (apply #'call-process (car command-line-args) nil nil nil
(cdr command-line-args))
 ;; Kill this instance at last.
-(let ((kill-emacs-hook nil))
-  (kill-emacs
+(kill-emacs)))
 
 (defun exwm--update-window-type (id  force)
   "Update _NET_WM_WINDOW_TYPE."



[elpa] externals/xelb updated (93b6b73 -> adc0f82)

2016-07-30 Thread Chris Feng
ch11ng pushed a change to branch externals/xelb.

  from  93b6b73   ; * xcb.el (xcb:disconnect): Flush before disconnection.
   new  cc63bab   * xcb.el (xcb:disconnect): Check before disconnecting.
   new  adc0f82   Bump version to 0.10


Summary of changes:
 xcb.el  |   15 ---
 xelb.el |2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)



[elpa] externals/exwm updated (1e78045 -> 173bbde)

2016-07-30 Thread Chris Feng
ch11ng pushed a change to branch externals/exwm.

  from  1e78045   Add restart support
   new  a3dba8e   Fix restarting issues
   new  fc542bb   ; Eliminate compile warnings
   new  173bbde   Bump version to 0.8


Summary of changes:
 exwm-input.el |2 +-
 exwm-workspace.el |   28 +++-
 exwm.el   |   12 
 3 files changed, 24 insertions(+), 18 deletions(-)



[elpa] externals/exwm fc542bb 2/3: ; Eliminate compile warnings

2016-07-30 Thread Chris Feng
branch: externals/exwm
commit fc542bbcc9e703f7e187045f3620f08b46320be4
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

; Eliminate compile warnings
---
 exwm-input.el |2 +-
 exwm-workspace.el |   13 +
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 555cc87..f218ea2 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -135,6 +135,7 @@ This value should always be overwritten.")
 (declare-function exwm-workspace--minibuffer-own-frame-p "exwm-workspace.el")
 (declare-function exwm-workspace-switch "exwm-workspace.el"
   (frame-or-index  force))
+(declare-function exwm-workspace--workspace-p "exwm-workspace.el" (workspace))
 
 (defun exwm-input--update-focus (window)
   "Update input focus."
@@ -209,7 +210,6 @@ This value should always be overwritten.")
 (declare-function exwm-floating--start-moveresize "exwm-floating.el"
   (id  type))
 (declare-function exwm-workspace--position "exwm-workspace.el" (frame))
-(declare-function exwm-workspace--workspace-p "exwm-workspace.el" (workspace))
 
 (defvar exwm-workspace--list)
 
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 3e2fe1a..7c2601a 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -571,7 +571,8 @@ before it."
  (eq (elt exwm-workspace--list nth)
  exwm-workspace--current)))
   ;; Do the move.
-  (pop (nthcdr pos exwm-workspace--list))
+  (with-no-warnings ;For Emacs 24.
+(pop (nthcdr pos exwm-workspace--list)))
   (push workspace (nthcdr nth exwm-workspace--list))
   ;; Update the _NET_WM_DESKTOP property of each X window affected.
   (setq start (min pos nth)
@@ -994,9 +995,13 @@ Please check `exwm-workspace--minibuffer-own-frame-p' 
first."
   ;;frame is the 'selected frame'.  `get-buffer-window' will
   ;;fail to retrieve the correct window.  It's likely there are
   ;;other related issues.
-  (let ((window (get-buffer-window "*Completions*" exwm-workspace--current)))
-(when window
-  (fit-window-to-buffer window nil nil nil nil t
+  ;; This is not required by Emacs 24.
+  (when (fboundp 'window-preserve-size)
+(let ((window (get-buffer-window "*Completions*"
+ exwm-workspace--current)))
+  (when window
+(fit-window-to-buffer window)
+(window-preserve-size window)
 
 (defun exwm-workspace--on-minibuffer-exit ()
   "Run in minibuffer-exit-hook to hide the minibuffer container."



[elpa] externals/exwm 173bbde 3/3: Bump version to 0.8

2016-07-30 Thread Chris Feng
branch: externals/exwm
commit 173bbde88599cf9bf8dbda87d3282c2f243716be
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Bump version to 0.8
---
 exwm.el |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/exwm.el b/exwm.el
index 9a593d5..861d51a 100644
--- a/exwm.el
+++ b/exwm.el
@@ -4,8 +4,8 @@
 
 ;; Author: Chris Feng <chris.w.f...@gmail.com>
 ;; Maintainer: Chris Feng <chris.w.f...@gmail.com>
-;; Version: 0.7
-;; Package-Requires: ((xelb "0.9"))
+;; Version: 0.8
+;; Package-Requires: ((xelb "0.10"))
 ;; Keywords: unix
 ;; URL: https://github.com/ch11ng/exwm
 



[elpa] externals/xelb adc0f82 2/2: Bump version to 0.10

2016-07-30 Thread Chris Feng
branch: externals/xelb
commit adc0f824b692f355ceb8ea1c24ce44da30b60d1e
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Bump version to 0.10
---
 xelb.el |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xelb.el b/xelb.el
index c057505..2c141a9 100644
--- a/xelb.el
+++ b/xelb.el
@@ -4,7 +4,7 @@
 
 ;; Author: Chris Feng <chris.w.f...@gmail.com>
 ;; Maintainer: Chris Feng <chris.w.f...@gmail.com>
-;; Version: 0.9
+;; Version: 0.10
 ;; Package-Requires: ((emacs "24.4") (cl-generic "0.2"))
 ;; Keywords: unix
 ;; URL: https://github.com/ch11ng/xelb



[elpa] externals/xelb cc63bab 1/2: * xcb.el (xcb:disconnect): Check before disconnecting.

2016-07-30 Thread Chris Feng
branch: externals/xelb
commit cc63bab0e6118c4cd6b659d3ed16e511c8fa8eba
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

* xcb.el (xcb:disconnect): Check before disconnecting.
---
 xcb.el |   15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/xcb.el b/xcb.el
index 2e52e36..712d4c2 100644
--- a/xcb.el
+++ b/xcb.el
@@ -367,13 +367,14 @@ Concurrency is disabled as it breaks the orders of 
errors, replies and events."
 
 (cl-defmethod xcb:disconnect ((obj xcb:connection))
   "Disconnect from X server."
-  (xcb:flush obj)
-  (delete-process (slot-value obj 'process))
-  ;; Reset every slot to its default value
-  (let ((slots (eieio-class-slots 'xcb:connection)))
-(dolist (slot slots)
-  (setf (slot-value obj (eieio-slot-descriptor-name slot))
-(eieio-oref-default obj (eieio-slot-descriptor-name slot))
+  (when (slot-value obj 'connected)
+(xcb:flush obj)
+(delete-process (slot-value obj 'process))
+;; Reset every slot to its default value
+(let ((slots (eieio-class-slots 'xcb:connection)))
+  (dolist (slot slots)
+(setf (slot-value obj (eieio-slot-descriptor-name slot))
+  (eieio-oref-default obj (eieio-slot-descriptor-name slot)))
 
  Other routines
 



[elpa] externals/xelb 878c611 1/2: Fix sequence number wrapping issues

2016-08-11 Thread Chris Feng
branch: externals/xelb
commit 878c6110fb6c5b75aa806794d8a0188aaf697344
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Fix sequence number wrapping issues

* xcb.el (xcb:connection-timeout): Reduce timeout to 3.
(xcb:connection): Merge slots 'error-sequence' and 'reply-sequence' into
'last-seen-sequence'.
(xcb:-sequence-cmp16): Removed.

* xcb.el (xcb:-SEQUENCE-SEGMENT-MASK): New constant representing the
segment mask of a sequence number.
(xcb:-convert-sequence): New method for converting 16-bit sequence
number received from the server into that used in the client.
(xcb:-connection-filter): Use this method.
(xcb:-+request, xcb:-+request-checked, xcb:-+request-unchecked)
(xcb:-+reply, xcb:-request-check, xcb:aux:sync): Avoid using 16-bit
sequence number.
(xcb:-cache-request): Force wrapping sequence numbers.
(xcb:-+reqply, xcb:-request-check, xcb:aux:sync): Check sequence number
wrapping.

* xcb.el (xcb:aux:sync): Discard any reply or error.
---
 xcb.el |  104 +---
 1 file changed, 54 insertions(+), 50 deletions(-)

diff --git a/xcb.el b/xcb.el
index a0c601a..b4e3474 100644
--- a/xcb.el
+++ b/xcb.el
@@ -67,7 +67,7 @@
   (when xcb:debug-on
 `(message (concat "[XELB LOG] " ,format-string) ,@args)))
 
-(defvar xcb:connection-timeout 10 "Connection timeout.")
+(defvar xcb:connection-timeout 3 "Connection timeout.")
 
  X connection related
 
@@ -91,24 +91,11 @@
(extension-first-error-alist :initform nil)
(extension-first-event-alist :initform nil)
(request-sequence :initform 0)
-   (error-sequence :initform 0)
-   (reply-sequence :initform 0)
+   (last-seen-sequence :initform 0)
(xid :initform 0);last used X resource ID
(extra-plist :initform nil)) ;for storing extra data (e.g. by extensions)
   :documentation "X connection.")
 
-(defsubst xcb:-sequence-cmp16 (sequence1 sequence2)
-  "Compare 16-bit sequence numbers SEQUENCE1 and SEQUENCE2.
-
-Return a positive value if SEQUENCE1 is larger than SEQUENCE2, 0 if they are
-equal.  Otherwise a negative value would be returned."
-  (if (= sequence1 sequence2)
-  0
-(let ((diff (- sequence1 sequence2)))
-  (if (< #x7FFF (abs diff))
-  (- diff)  ;overflowed
-diff
-
 (defclass xcb:auth-info ()
   ((name :initarg :name :initform "" :type string)
(data :initarg :data :initform "" :type string))
@@ -234,6 +221,26 @@ equal.  Otherwise a negative value would be returned."
   (while (not (slot-value obj 'setup-data))
 (accept-process-output process 1 nil 1)
 
+(defconst xcb:-SEQUENCE-SEGMENT-MASK (lognot #x))
+
+(cl-defmethod xcb:-convert-sequence ((obj xcb:connection) sequence16)
+  "Convert 16-bit sequence number SEQUENCE16 (read from a packet).
+
+The result would be 29 or 61 bits, depending on the machine."
+  (with-slots (request-sequence last-seen-sequence) obj
+;; Assume there are no more than #x requests sent since the
+;; request corresponding to this packet was made.  Because errors
+;; and replies are always read out in the process filter, this
+;; assumption is quite safe.
+(let ((sequence (logior (logand request-sequence
+xcb:-SEQUENCE-SEGMENT-MASK)
+sequence16)))
+  ;; `xcb:-cache-request' ensures sequence number never wraps.
+  (when (> sequence request-sequence)
+(cl-decf sequence #x1))
+  (setf last-seen-sequence sequence)
+  sequence)))
+
 (defun xcb:-connection-filter (process message)
   "Filter function for an X connection.
 
@@ -290,6 +297,7 @@ Concurrency is disabled as it breaks the orders of errors, 
replies and events."
   cache 2))
(plist (slot-value connection 'error-plist))
struct)
+   (setq sequence (xcb:-convert-sequence connection sequence))
(when (plist-member plist sequence)
  (setq struct (plist-get plist sequence))
  (setf (slot-value connection 'error-plist)
@@ -297,8 +305,7 @@ Concurrency is disabled as it breaks the orders of errors, 
replies and events."
   (push `(,(aref cache 1) .
   ,(substring cache 0 32))
 struct
-   (setq cache (substring cache 32))
-   (setf (slot-value connection 'error-sequence) sequence)))
+   (setq cache (substring cache 32
 (1  ;reply
  (let* ((reply-words (funcall (if xcb:lsb #'xcb:-unpack-u4-lsb
   

[elpa] externals/xelb updated (8197598 -> b75641b)

2016-08-11 Thread Chris Feng
ch11ng pushed a change to branch externals/xelb.

  from  8197598   Fix XGE and XKB events support
   new  878c611   Fix sequence number wrapping issues
   new  b75641b   Split connection filter


Summary of changes:
 xcb.el |  183 ++--
 1 file changed, 97 insertions(+), 86 deletions(-)



[elpa] externals/xelb b75641b 2/2: Split connection filter

2016-08-11 Thread Chris Feng
branch: externals/xelb
commit b75641bf62f9a92208c23f855cba66c676b4c04f
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Split connection filter

* xcb.el (xcb:-connection-filter, xcb:-connection-setup-filter): Split
out connection setup code from the former into the latter.
(xcb:-connect): Set process filter to `xcb:-connection-setup-filter'.
---
 xcb.el |   79 +++-
 1 file changed, 43 insertions(+), 36 deletions(-)

diff --git a/xcb.el b/xcb.el
index b4e3474..5a75714 100644
--- a/xcb.el
+++ b/xcb.el
@@ -200,7 +200,7 @@
 (set-process-plist process
(plist-put (process-plist process) 'connection obj))
 (set-process-coding-system process 'binary 'binary)
-(set-process-filter process 'xcb:-connection-filter)
+(set-process-filter process #'xcb:-connection-setup-filter)
 (process-send-string;send setup packet
  process
  (apply #'unibyte-string
@@ -223,6 +223,47 @@
 
 (defconst xcb:-SEQUENCE-SEGMENT-MASK (lognot #x))
 
+(defun xcb:-connection-setup-filter (process message)
+  "Process filter used during connection setup."
+  (let* ((connection (plist-get (process-plist process) 'connection))
+ (cache (vconcat (slot-value connection 'message-cache) message)))
+(setf (slot-value connection 'message-cache) cache)
+(unless (or (slot-value connection 'lock)
+;; Shorter than the setup header.
+(> 8 (length cache)))
+  (setf (slot-value connection 'lock) t)
+  (let ((data-len (+ 8 (* 4 (if xcb:lsb
+(xcb:-unpack-u2-lsb cache 6)
+  (xcb:-unpack-u2 cache 6)
+obj)
+(when (>= (length cache) data-len)
+  (xcb:-log "Setup response: %s" cache)
+  (pcase (aref cache 0)
+(0
+ ;; Connection failed.
+ (setq obj (make-instance 'xcb:SetupFailed))
+ (xcb:unmarshal obj cache)
+ (setq cache (substring cache data-len))
+ (error "[XELB] Connection failed: %s" (slot-value obj 'reason)))
+(1
+ ;; Connection established.
+ (setf (slot-value connection 'message-cache) [])
+ (set-process-filter process #'xcb:-connection-filter)
+ (setq obj (make-instance 'xcb:Setup))
+ (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 required.
+ (setq obj (make-instance 'xcb:SetupAuthenticate))
+ (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)
+  (setf (slot-value connection 'lock) nil
+
 (cl-defmethod xcb:-convert-sequence ((obj xcb:connection) sequence16)
   "Convert 16-bit sequence number SEQUENCE16 (read from a packet).
 
@@ -249,43 +290,9 @@ Concurrency is disabled as it breaks the orders of errors, 
replies and events."
  (cache (vconcat (slot-value connection 'message-cache) message))
  (cache-length (length cache)))
 (setf (slot-value connection 'message-cache) cache)
-(catch 'return
-  ;; Queue message when locked
-  (when (slot-value connection 'lock)
-(throw 'return 'lock))
+(unless (slot-value connection 'lock)
   ;; Start parsing message
   (setf (slot-value connection 'lock) t)
-  ;; Connection setup
-  (unless (slot-value connection 'connected)
-(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)
- cache 6
-obj)
-(when (>= (length cache) data-len)
-  (xcb:-log "Setup response: %s" cache)
-  (pcase (aref cache 0)
-(0  ;failed
- (setq obj (make-instance 'xcb:SetupFailed))
- (xcb:unmarshal obj cache)
- (setq cache (substring cache data-len))
- (error "[XELB] Connection failed: %s"
-(slot-value obj 'reason)))
-(1  ;success
- (setq obj (make-instance 'xcb:Setup))
- (xcb:unmarshal obj cache)
- (setq cache (substring cache data-len))
- (setf (slot-value connect

[elpa] externals/exwm ea0fbaf 2/2: Bump version to 0.9

2016-08-13 Thread Chris Feng
branch: externals/exwm
commit ea0fbaf8cfa0d0969c32dce7779e569d34ded72a
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Bump version to 0.9
---
 exwm.el |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/exwm.el b/exwm.el
index a972367..3898ba4 100644
--- a/exwm.el
+++ b/exwm.el
@@ -4,8 +4,8 @@
 
 ;; Author: Chris Feng <chris.w.f...@gmail.com>
 ;; Maintainer: Chris Feng <chris.w.f...@gmail.com>
-;; Version: 0.8
-;; Package-Requires: ((xelb "0.10"))
+;; Version: 0.9
+;; Package-Requires: ((xelb "0.11"))
 ;; Keywords: unix
 ;; URL: https://github.com/ch11ng/exwm
 



[elpa] externals/exwm updated (108b394 -> ea0fbaf)

2016-08-13 Thread Chris Feng
ch11ng pushed a change to branch externals/exwm.

  from  108b394   Fix _NET_DESKTOP_VIEWPORT
   new  fe653ba   Only check input focus for globally active model
   new  ea0fbaf   Bump version to 0.9


Summary of changes:
 exwm-input.el |   61 -
 exwm.el   |4 ++--
 2 files changed, 32 insertions(+), 33 deletions(-)



[elpa] externals/exwm fe653ba 1/2: Only check input focus for globally active model

2016-08-13 Thread Chris Feng
branch: externals/exwm
commit fe653ba244758362ac83603a28389660834fcb5a
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Only check input focus for globally active model

* exwm-input.el (exwm-input--set-focus): Partly revert 810b471.
---
 exwm-input.el |   61 -
 1 file changed, 30 insertions(+), 31 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 668e495..e582812 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -61,38 +61,37 @@
 (defun exwm-input--set-focus (id)
   "Set input focus to window ID in a proper way."
   (when (exwm--id->buffer id)
-(let ((focus (slot-value (xcb:+request-unchecked+reply exwm--connection
+(with-current-buffer (exwm--id->buffer id)
+  (cond
+   ((and (not exwm--hints-input)
+ (memq xcb:Atom:WM_TAKE_FOCUS exwm--protocols))
+(when (= (frame-parameter nil 'exwm-id)
+ (slot-value (xcb:+request-unchecked+reply exwm--connection
  (make-instance 'xcb:GetInputFocus))
- 'focus)))
-  (unless (= focus id)
-(with-current-buffer (exwm--id->buffer id)
-  (cond
-   ((and (not exwm--hints-input)
- (memq xcb:Atom:WM_TAKE_FOCUS exwm--protocols))
-(when (= focus (frame-parameter nil 'exwm-id))
-  (exwm--log "Focus on #x%x with WM_TAKE_FOCUS" id)
-  (exwm-input--update-timestamp
-   (lambda (timestamp id)
- (let ((event (make-instance 'xcb:icccm:WM_TAKE_FOCUS
- :window id
- :time timestamp)))
-   (setq event (xcb:marshal event exwm--connection))
-   (xcb:+request exwm--connection
-   (make-instance 'xcb:icccm:SendEvent
-  :destination id
-  :event event))
-   (exwm-input--set-active-window id)
-   (xcb:flush exwm--connection)))
-   id)))
-   (t
-(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))
-(exwm-input--set-active-window id)
-(xcb:flush exwm--connection
+ 'focus))
+  (exwm--log "Focus on #x%x with WM_TAKE_FOCUS" id)
+  (exwm-input--update-timestamp
+   (lambda (timestamp id)
+ (let ((event (make-instance 'xcb:icccm:WM_TAKE_FOCUS
+ :window id
+ :time timestamp)))
+   (setq event (xcb:marshal event exwm--connection))
+   (xcb:+request exwm--connection
+   (make-instance 'xcb:icccm:SendEvent
+  :destination id
+  :event event))
+   (exwm-input--set-active-window id)
+   (xcb:flush exwm--connection)))
+   id)))
+   (t
+(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))
+(exwm-input--set-active-window id)
+(xcb:flush exwm--connection))
 
 (defun exwm-input--update-timestamp (callback  args)
   "Fetch the latest timestamp from the server and feed it to CALLBACK.



[elpa] externals/exwm c97cead 1/3: Implement compositing manager module

2016-08-14 Thread Chris Feng
branch: externals/exwm
commit c97ceadce5c69b103463b212207f15280ba6
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Implement compositing manager module

* exwm-cm.el: New compositing manager module.
---
 exwm-cm.el | 1778 
 1 file changed, 1778 insertions(+)

diff --git a/exwm-cm.el b/exwm-cm.el
new file mode 100644
index 000..8e019bb
--- /dev/null
+++ b/exwm-cm.el
@@ -0,0 +1,1778 @@
+;;; exwm-cm.el --- Compositing Manager for EXWM  -*- lexical-binding: t -*-
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Chris Feng <chris.w.f...@gmail.com>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs 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.
+
+;; GNU Emacs 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 GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This module provides a compositing manager (CM) for EXWM, mainly to
+;; enable transparency support.
+
+;; Usage:
+;; Add following lines to .emacs and modify accordingly:
+;;
+;; (require 'exwm-cm)
+;; ;; Make all Emacs frames opaque.
+;; (setq window-system-default-frame-alist '((x . ((alpha . 100)
+;; ;; Assign everything else a 80% opacity.
+;; (setq exwm-cm-opacity 80)
+;; (exwm-cm-enable)
+;;
+;; With the last line this CM would be started with EXWM.  You can also
+;; start and stop this CM with `exwm-cm-start' and `exwm-cm-stop' at any
+;; time.
+
+;; Theory:
+;; Due to its unique way of managing X windows, EXWM can not work with
+;; any existing CMs.  And this CM, designed specifically for EXWM,
+;; probably won't work well with other WMs, too.  The theories behind
+;; all CMs are basically the same, some peculiarities of this CM are
+;; summarized as the following sections.
+
+;; + Data structures:
+;;   This CM organizes all X windows concerned with compositing in a
+;;   tree hierarchy.  Below is a stripped-down version of such tree with
+;;   each node representing an X window (except the root placeholder),
+;;
+;;   (nil
+;;(root-xwin
+;; (unmanaged-xwin)
+;; (workspace-container
+;;  (unmanaged-xwin)
+;;  (xwin-container
+;;   (xwin)
+;;   (floating-frame-container
+;;(floating-frame)))
+;;  (xwin-container
+;;   (xwin))
+;;  (workspace-frame-container
+;;   (workspace-frame)))
+;; (minibuffer-frame-container
+;;  (minibuffer-frame
+;;
+;;   where
+;;   - nodes with non-nil CDRs are containers,
+;;   - siblings are arranged in stacking order (top to bottom),
+;;   - and "managed" and "unmanaged" are in WM's sense.
+;;
+;;   During a painting process, the tree is traversed starting from the
+;;   root node, with each leaf visited and painted.  The attributes of
+;;   each X window (position, size, etc) are recorded as an instance of
+;;   class `exwm-cm--attr'.  Such instance is associated with the
+;;   corresponding X window ID through a hash table.  The instance also
+;;   contains a slot pointing to a subtree of the aforementioned tree,
+;;   with the root node being the parent of the X window.  This makes it
+;;   convenient to carry out operations such as insertion, deletion,
+;;   restacking and reparenting.
+
+;; + Compositing strategies:
+;;   - Only leaves are painted, since branches (containers) are always
+;; invisible.
+;;   - The root X window is painted separately.
+;;   - Siblings below a workspace frame container are not painted; they
+;; are considered hidden.
+;;   - Only the top workspace in one (RandR) output is painted.
+;;   - Workspace frames and floating frames are always clipped by its
+;; Emacs windows displaying `exwm-mode' buffers, therefore they
+;; don't block X windows.
+
+;; Reference:
+;; + xcompmgr (http://cgit.freedesktop.org/xorg/app/xcompmgr/)
+
+;;; Code:
+
+(require 'xcb-composite)
+(require 'xcb-damage)
+(require 'xcb-ewmh)
+(require 'xcb-icccm)
+(require 'xcb-renderutil)
+(require 'xcb-shape)
+
+(require 'exwm-core)
+(require 'exwm-workspace)
+(require 'exwm-manage)
+
+(defconst exwm-cm--OPAQUE (float #x)
+  "The opacity value of the _NET_WM_WINDOW_OPACITY property.")
+(defvar exwm-cm--_NET_WM_WINDOW_OPACITY nil "The _NET_WM_WINDOW_OPACITY atom.")
+(defvar exwm-cm-opacity nil
+  "The default value of opacity when it's not explicitly specified.
+
+The value should be a floating number between 0 (transparent) and 100
+(o

[elpa] externals/exwm updated (ea0fbaf -> d8940d1)

2016-08-14 Thread Chris Feng
ch11ng pushed a change to branch externals/exwm.

  from  ea0fbaf   Bump version to 0.9
   new  c97cead   Implement compositing manager module
   new  a5ea75e   Document the compositing manager module
   new  d8940d1   Merge branch 'feat/compositor' into externals/exwm


Summary of changes:
 README.md  |1 +
 exwm-cm.el | 1778 
 exwm.el|1 +
 3 files changed, 1780 insertions(+)
 create mode 100644 exwm-cm.el



[elpa] externals/exwm a5ea75e 2/3: Document the compositing manager module

2016-08-14 Thread Chris Feng
branch: externals/exwm
commit a5ea75e9a2657f103f7a556c20349309eb4535e5
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Document the compositing manager module

* README.md:
* exwm.el:
Mention this new feature.
---
 README.md |1 +
 exwm.el   |1 +
 2 files changed, 2 insertions(+)

diff --git a/README.md b/README.md
index 103948c..409087c 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,7 @@ It features:
 + Dynamic workspace support
 + ICCCM/EWMH compliance
 + (Optional) RandR (multi-monitor) support
++ (Optional) Built-in composting manager
 + (Optional) Built-in system tray
 
 Please check out the
diff --git a/exwm.el b/exwm.el
index a972367..bb6b6a7 100644
--- a/exwm.el
+++ b/exwm.el
@@ -36,6 +36,7 @@
 ;; + Dynamic workspace support
 ;; + ICCCM/EWMH compliance
 ;; + (Optional) RandR (multi-monitor) support
+;; + (Optional) Built-in composting manager
 ;; + (Optional) Builtin system tray
 
 ;; Installation & configuration



[elpa] externals/exwm d8940d1 3/3: Merge branch 'feat/compositor' into externals/exwm

2016-08-14 Thread Chris Feng
branch: externals/exwm
commit d8940d1fe63c28ffd4c2fa604b12ed843c3c46d1
Merge: ea0fbaf a5ea75e
Author: Chris Feng <chris.w.f...@gmail.com>
Commit: Chris Feng <chris.w.f...@gmail.com>

Merge branch 'feat/compositor' into externals/exwm
---
 README.md  |1 +
 exwm-cm.el | 1778 
 exwm.el|1 +
 3 files changed, 1780 insertions(+)

diff --git a/README.md b/README.md
index 103948c..409087c 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,7 @@ It features:
 + Dynamic workspace support
 + ICCCM/EWMH compliance
 + (Optional) RandR (multi-monitor) support
++ (Optional) Built-in composting manager
 + (Optional) Built-in system tray
 
 Please check out the
diff --git a/exwm-cm.el b/exwm-cm.el
new file mode 100644
index 000..8e019bb
--- /dev/null
+++ b/exwm-cm.el
@@ -0,0 +1,1778 @@
+;;; exwm-cm.el --- Compositing Manager for EXWM  -*- lexical-binding: t -*-
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Chris Feng <chris.w.f...@gmail.com>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs 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.
+
+;; GNU Emacs 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 GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This module provides a compositing manager (CM) for EXWM, mainly to
+;; enable transparency support.
+
+;; Usage:
+;; Add following lines to .emacs and modify accordingly:
+;;
+;; (require 'exwm-cm)
+;; ;; Make all Emacs frames opaque.
+;; (setq window-system-default-frame-alist '((x . ((alpha . 100)
+;; ;; Assign everything else a 80% opacity.
+;; (setq exwm-cm-opacity 80)
+;; (exwm-cm-enable)
+;;
+;; With the last line this CM would be started with EXWM.  You can also
+;; start and stop this CM with `exwm-cm-start' and `exwm-cm-stop' at any
+;; time.
+
+;; Theory:
+;; Due to its unique way of managing X windows, EXWM can not work with
+;; any existing CMs.  And this CM, designed specifically for EXWM,
+;; probably won't work well with other WMs, too.  The theories behind
+;; all CMs are basically the same, some peculiarities of this CM are
+;; summarized as the following sections.
+
+;; + Data structures:
+;;   This CM organizes all X windows concerned with compositing in a
+;;   tree hierarchy.  Below is a stripped-down version of such tree with
+;;   each node representing an X window (except the root placeholder),
+;;
+;;   (nil
+;;(root-xwin
+;; (unmanaged-xwin)
+;; (workspace-container
+;;  (unmanaged-xwin)
+;;  (xwin-container
+;;   (xwin)
+;;   (floating-frame-container
+;;(floating-frame)))
+;;  (xwin-container
+;;   (xwin))
+;;  (workspace-frame-container
+;;   (workspace-frame)))
+;; (minibuffer-frame-container
+;;  (minibuffer-frame
+;;
+;;   where
+;;   - nodes with non-nil CDRs are containers,
+;;   - siblings are arranged in stacking order (top to bottom),
+;;   - and "managed" and "unmanaged" are in WM's sense.
+;;
+;;   During a painting process, the tree is traversed starting from the
+;;   root node, with each leaf visited and painted.  The attributes of
+;;   each X window (position, size, etc) are recorded as an instance of
+;;   class `exwm-cm--attr'.  Such instance is associated with the
+;;   corresponding X window ID through a hash table.  The instance also
+;;   contains a slot pointing to a subtree of the aforementioned tree,
+;;   with the root node being the parent of the X window.  This makes it
+;;   convenient to carry out operations such as insertion, deletion,
+;;   restacking and reparenting.
+
+;; + Compositing strategies:
+;;   - Only leaves are painted, since branches (containers) are always
+;; invisible.
+;;   - The root X window is painted separately.
+;;   - Siblings below a workspace frame container are not painted; they
+;; are considered hidden.
+;;   - Only the top workspace in one (RandR) output is painted.
+;;   - Workspace frames and floating frames are always clipped by its
+;; Emacs windows displaying `exwm-mode' buffers, therefore they
+;; don't block X windows.
+
+;; Reference:
+;; + xcompmgr (http://cgit.freedesktop.org/xorg/app/xcompmgr/)
+
+;;; Code:
+
+(require 'xcb-composite)
+(require 'xcb-damage)
+(require 'xcb-ewmh)
+(require 'xcb-icccm)
+(require 'xcb-renderutil)
+(require 'xcb-shape)
+
+(require 'exwm-core)
+(require 'exwm-workspace)
+(require 'exwm-manage)
+
+(defconst exwm-cm--OPA

<    1   2   3   4   5   6   7   8   >