about summary refs log tree commit diff
path: root/exwm-workspace.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2016-07-13T10·51+0800
committerChris Feng <chris.w.feng@gmail.com>2016-07-13T11·36+0800
commit6c8255bf3978a4df3d76ffd6f7d6bbdbba8bba19 (patch)
treed48859b6a960edfb29ab9e6f623b1401ad337500 /exwm-workspace.el
parenteee5c6fa4dd776c1604e5ec7db34bc5401d8dea6 (diff)
Add/improve some ICCCM/EWMH features
* exwm-floating.el (exwm-floating--set-allowed-actions)
(exwm-floating--set-floating, exwm-floating--unset-floating):
Add _NET_WM_ALLOWED_ACTIONS support.

* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating): Support initial state hint.
* exwm.el (exwm--update-hints): Fetch initial state.
(exwm--update-state, exwm--on-PropertyNotify):
WM_STATE is not intended to be read.
* exwm-core.el (exwm-state):
* exwm-floating.el (exwm-floating-hide):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--set-state)
(exwm-layout--iconic-state-p, exwm-layout--show, exwm-layout--hide):
* exwm-manage.el (exwm-manage--on-MapRequest):
Improve WM_STATE support.

* exwm-input.el (exwm-input--set-focus):
* exwm-input.el (exwm-input--update-focus)
(exwm-input--set-active-window):
* exwm.el (exwm--on-ClientMessage): Add _NET_ACTIVE_WINDOW support.

* exwm-layout.el (exwm-layout--set-client-list-stacking):
Improve _NET_CLIENT_LIST_STACKING support.

* exwm-manage.el (exwm-manage--set-client-list)
(exwm-manage--manage-window, exwm-manage--unmanage-window):
Improve _NET_CLIENT_LIST support.

* exwm-manage.el (exwm-manage--manage-window):
* exwm-workspace.el (exwm-workspace--set-desktop)
(exwm-workspace-move-window):
* exwm.el (exwm--on-ClientMessage): Add _NET_WM_DESKTOP support.

* exwm-randr.el (exwm-randr--refresh):
* exwm-workspace.el (exwm-workspace--set-desktop-geometry)
(exwm-workspace--init): Add _NET_DESKTOP_GEOMETRY support.

* exwm-workspace.el (exwm-workspace--set-desktop-geometry):
Renamed from `exwm-workspace--update-desktop-geometry'.
* exwm-randr.el (exwm-randr--refresh): Improve _NET_WORKAREA support.

* exwm-workspace.el (exwm-workspace--set-fullscreen):
Correct variables names.

* exwm-workspace.el (exwm-workspace--init):
* exwm.el (exwm--init-icccm-ewmh):
Set _NET_NUMBER_OF_DESKTOPS in workspace module.

* exwm-workspace.el (exwm-workspace--init):
* exwm.el (exwm--init-icccm-ewmh):
Set _NET_DESKTOP_VIEWPORT in workspace module.

* exwm.el (exwm--on-ClientMessage): Improve _NET_CURRENT_DESKTOP
support.

* exwm.el (exwm--on-ClientMessage): Add _NET_CLOSE_WINDOW support.

* exwm.el (exwm--on-ClientMessage): Add WM_CHANGE_STATE support.

* exwm.el (exwm--init-icccm-ewmh): Update supported atoms.
Diffstat (limited to 'exwm-workspace.el')
-rw-r--r--exwm-workspace.el45
1 files changed, 38 insertions, 7 deletions
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 64c636eb2c81..bde423d72729 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -166,7 +166,7 @@ Value nil means to use the default position which is fixed at bottom, while
               height* height))
       (when (and (eq frame exwm-workspace--current)
                  (exwm-workspace--minibuffer-own-frame-p))
-        (exwm-workspace--resize-minibuffer-frame width* height*))
+        (exwm-workspace--resize-minibuffer-frame width height))
       (exwm-layout--resize-container id container 0 0 width* height*)
       (exwm-layout--resize-container nil workspace x* y* width* height* t)
       (xcb:flush exwm--connection)))
@@ -275,7 +275,7 @@ The optional FORCE option is for internal use only."
         (set-frame-parameter frame 'exwm--urgency nil)
         ;; Update switch workspace history
         (setq exwm-workspace--switch-history-outdated t)
-        ;; Update _NET_CURRENT_DESKTOP
+        ;; Set _NET_CURRENT_DESKTOP.
         (xcb:+request exwm--connection
             (make-instance 'xcb:ewmh:set-_NET_CURRENT_DESKTOP
                            :window exwm--root :data index))
@@ -292,6 +292,14 @@ The optional FORCE option is for internal use only."
         (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)
+    (xcb:+request exwm--connection
+        (make-instance 'xcb:ewmh:set-_NET_WM_DESKTOP
+                       :window id
+                       :data (cl-position exwm--frame exwm-workspace--list)))))
+
 (defvar exwm-floating-border-width)
 (defvar exwm-floating-border-color)
 
@@ -433,7 +441,10 @@ The optional FORCE option is for internal use only."
                                :stack-mode xcb:StackMode:Above)))
           (xcb:flush exwm--connection)
           (set-window-buffer (frame-selected-window frame)
-                             (exwm--id->buffer id)))))
+                             (exwm--id->buffer id)))
+        ;; Set _NET_WM_DESKTOP.
+        (exwm-workspace--set-desktop id)
+        (xcb:flush exwm--connection)))
     (setq exwm-workspace--switch-history-outdated t)))
 
 ;;;###autoload
@@ -696,8 +707,17 @@ The optional FORCE option is for internal use only."
       (server-save-buffers-kill-terminal nil)
       nil)))
 
-(defun exwm-workspace--update-workareas (&optional workareas)
-  "Update _NET_WORKAREA."
+(defun exwm-workspace--set-desktop-geometry ()
+  "Set _NET_DESKTOP_GEOMETRY."
+  ;; We don't support large desktop so it's the same with screen size.
+  (xcb:+request exwm--connection
+      (make-instance 'xcb:ewmh:set-_NET_DESKTOP_GEOMETRY
+                     :window exwm--root
+                     :width (x-display-pixel-width)
+                     :height (x-display-pixel-height))))
+
+(defun exwm-workspace--set-workareas (&optional workareas)
+  "Set _NET_WORKAREA."
   ;; Calculate workareas if not present.
   (unless workareas
     (if (frame-parameter (car exwm-workspace--list) 'exwm-geometry)
@@ -884,9 +904,20 @@ The optional FORCE option is for internal use only."
   (xcb:flush exwm--connection)
   ;; We have to advice `x-create-frame' or every call to it would hang EXWM
   (advice-add 'x-create-frame :around #'exwm-workspace--x-create-frame)
+  ;; Set _NET_NUMBER_OF_DESKTOPS (it's currently fixed).
+  (xcb:+request exwm--connection
+      (make-instance 'xcb:ewmh:set-_NET_NUMBER_OF_DESKTOPS
+                     :window exwm--root :data exwm-workspace-number))
+  ;; Set _NET_DESKTOP_GEOMETRY.
+  (exwm-workspace--set-desktop-geometry)
+  ;; Set _NET_DESKTOP_VIEWPORT (we don't support large desktop).
+  (xcb:+request exwm--connection
+      (make-instance 'xcb:ewmh:set-_NET_DESKTOP_VIEWPORT
+                     :window exwm--root
+                     :data (make-vector (* 2 exwm-workspace-number) 0)))
   ;; Set _NET_WORKAREA.
-  (exwm-workspace--update-workareas)
-  ;; Set _NET_VIRTUAL_ROOTS
+  (exwm-workspace--set-workareas)
+  ;; Set _NET_VIRTUAL_ROOTS (it's currently fixed.)
   (xcb:+request exwm--connection
       (make-instance 'xcb:ewmh:set-_NET_VIRTUAL_ROOTS
                      :window exwm--root