about summary refs log tree commit diff
path: root/exwm-manage.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2016-08-12T11·27+0800
committerChris Feng <chris.w.feng@gmail.com>2016-08-12T11·27+0800
commitebcc9591f3c1210efda007bec6852369b75fa8ad (patch)
tree1729d150e042581df4999aa9e0a14bcbc96e127d /exwm-manage.el
parente4ecd792103c33e03ef9ff590d9c8e6b86431efd (diff)
Check for _NET_WM_STATE_FULLSCREEN on managing
* exwm-core.el (exwm--fullscreen): Removed.
(exwm--ewmh-state): New variable for recording the _NET_WM_STATE hint.
* exwm-core.el (exwm-mode-menu, exwm-mode-map):
* exwm-layout.el (exwm-layout-set-fullscreen)
(exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--unmanage-window)
(exwm-manage--on-ConfigureRequest):
* exwm-workspace.el (exwm-workspace-switch, exwm-workspace-swap)
(exwm-workspace-move):
* exwm.el (exwm-reset, exwm--on-ClientMessage):
Use the new variable.
* exwm-manage.el (exwm-manage--update-ewmh-state): New function for
updating _NET_WM_STATE.
(exwm-manage--manage-window): Update _NET_WM_STATE and check for
_NET_WM_STATE_FULLSCREEN.
Diffstat (limited to 'exwm-manage.el')
-rw-r--r--exwm-manage.el21
1 files changed, 18 insertions, 3 deletions
diff --git a/exwm-manage.el b/exwm-manage.el
index 60ff2e24b8a4..0f1a80b72946 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -48,6 +48,16 @@ corresponding buffer.")
         (when reply                     ;nil when destroyed
           (setq exwm--geometry reply))))))
 
+(defun exwm-manage--update-ewmh-state (id)
+  "Update _NET_WM_STATE."
+  (with-current-buffer (exwm--id->buffer id)
+    (unless exwm--ewmh-state
+      (let ((reply (xcb:+request-unchecked+reply exwm--connection
+                       (make-instance 'xcb:ewmh:get-_NET_WM_STATE
+                                      :window id))))
+        (when reply
+          (setq exwm--ewmh-state (append (slot-value reply 'value) nil)))))))
+
 ;; The _MOTIF_WM_HINTS atom (see <Xm/MwmUtil.h> for more details)
 ;; It's currently only used in 'exwm-manage' module
 (defvar exwm-manage--_MOTIF_WM_HINTS nil "_MOTIF_WM_HINTS atom.")
@@ -286,7 +296,12 @@ corresponding buffer.")
                  (< desktop (exwm-workspace--count)))
             (exwm-workspace-move-window desktop id)
           (exwm-workspace--set-desktop id)))
+      (exwm-manage--update-ewmh-state id)
       (with-current-buffer (exwm--id->buffer id)
+        (when (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)
+          (setq exwm--ewmh-state
+                (delq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))
+          (exwm-layout-set-fullscreen id))
         (run-hooks 'exwm-manage-finish-hook)))))
 
 (defvar exwm-workspace--id-struts-alist)
@@ -373,7 +388,7 @@ manager is shutting down."
                 (make-instance 'xcb:ReparentWindow
                                :window window :parent exwm--root :x 0 :y 0))))
         ;; Restore the workspace if this X window is currently fullscreen.
-        (when exwm--fullscreen
+        (when (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)
           (exwm-workspace--set-fullscreen exwm--frame))
         ;; Destroy the X window container (and the frame container if any).
         (xcb:+request exwm--connection
@@ -552,7 +567,7 @@ 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
+                 (or (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)
                      ;; Make sure it's a floating X window wanting to resize
                      ;; itself.
                      (or (not exwm--floating-frame)
@@ -578,7 +593,7 @@ border-width: %d; sibling: #x%x; stack-mode: %d"
           ;; Send client message for managed windows
           (with-current-buffer buffer
             (setq edges
-                  (if exwm--fullscreen
+                  (if (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)
                       (list 0 0
                             (exwm-workspace--current-width)
                             (exwm-workspace--current-height))