about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2018-03-08T17·06+0800
committerChris Feng <chris.w.feng@gmail.com>2018-03-08T17·06+0800
commit2f430db735f33abb4fc009fc6ec8c12f74f57dba (patch)
tree9f147150649943df040d42b0c0da44e849827f59
parent7aae6efdcd5d64c528315d08e49cdef2e956b540 (diff)
Minor fixes
-rw-r--r--exwm-floating.el1
-rw-r--r--exwm-input.el1
-rw-r--r--exwm-layout.el1
-rw-r--r--exwm-manage.el4
-rw-r--r--exwm-randr.el1
-rw-r--r--exwm-systemtray.el1
-rw-r--r--exwm-workspace.el31
-rw-r--r--exwm.el16
8 files changed, 24 insertions, 32 deletions
diff --git a/exwm-floating.el b/exwm-floating.el
index 6f8f9d8d3c22..8b1612e42a42 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -79,7 +79,6 @@ This is also used by X window containers.")
 (declare-function exwm-layout--iconic-state-p "exwm-layout.el" (&optional id))
 (declare-function exwm-layout--refresh "exwm-layout.el" ())
 (declare-function exwm-layout--show "exwm-layout.el" (id &optional window))
-(declare-function exwm-workspace--minibuffer-own-frame-p "exwm-workspace.el")
 (declare-function exwm-workspace--position "exwm-workspace.el" (frame))
 
 (defun exwm-floating--set-allowed-actions (id tilling)
diff --git a/exwm-input.el b/exwm-input.el
index 0c8853c5f338..6f96d7173803 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -146,6 +146,7 @@ This value should always be overwritten.")
                   (&rest _args))
 (declare-function exwm-layout--iconic-state-p "exwm-layout.el" (&optional id))
 (declare-function exwm-layout--show "exwm-layout.el" (id &optional window))
+(declare-function exwm-reset "exwm.el" ())
 (declare-function exwm-workspace--client-p "exwm-workspace.el"
                   (&optional frame))
 (declare-function exwm-workspace--minibuffer-own-frame-p "exwm-workspace.el")
diff --git a/exwm-layout.el b/exwm-layout.el
index babd37410a28..19d14d1140c3 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -47,6 +47,7 @@
 (defvar exwm-workspace--current)
 (declare-function exwm-input-grab-keyboard "exwm-input.el")
 (declare-function exwm-input-release-keyboard "exwm-input.el")
+(declare-function exwm-reset "exwm.el" ())
 (declare-function exwm-workspace--client-p "exwm-workspace.el"
                   (&optional frame))
 (declare-function exwm-workspace--minibuffer-own-frame-p "exwm-workspace.el")
diff --git a/exwm-manage.el b/exwm-manage.el
index cb2bf28b173d..3e47f749c909 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -111,14 +111,10 @@ You can still make the X windows floating afterwards."
 (declare-function exwm-input-set-local-simulation-keys "exwm-input.el")
 (declare-function exwm-layout--fullscreen-p "exwm-layout.el" ())
 (declare-function exwm-layout--iconic-state-p "exwm-layout.el" (&optional id))
-(declare-function exwm-workspace--count "exwm-workspace.el" ())
 (declare-function exwm-workspace--position "exwm-workspace.el" (frame))
-(declare-function exwm-workspace--set-desktop "exwm-workspace.el" (id))
 (declare-function exwm-workspace--set-fullscreen "exwm-workspace.el" (frame))
 (declare-function exwm-workspace--update-struts "exwm-workspace.el" ())
 (declare-function exwm-workspace--update-workareas "exwm-workspace.el" ())
-(declare-function exwm-workspace-move-window "exwm-workspace.el"
-                  (frame-or-index &optional id))
 
 (defun exwm-manage--update-geometry (id &optional force)
   "Update window geometry."
diff --git a/exwm-randr.el b/exwm-randr.el
index 485d9c882643..0658bee77930 100644
--- a/exwm-randr.el
+++ b/exwm-randr.el
@@ -81,7 +81,6 @@ the first one in result being the primary output."
 
 (defvar exwm-workspace--fullscreen-frame-count)
 (defvar exwm-workspace--list)
-(declare-function exwm-workspace--active-p "exwm-workspace.el" (frame))
 (declare-function exwm-workspace--count "exwm-workspace.el")
 (declare-function exwm-workspace--set-active "exwm-workspace.el"
                   (frame active))
diff --git a/exwm-systemtray.el b/exwm-systemtray.el
index d932032e5905..dea5dbbc2e6e 100644
--- a/exwm-systemtray.el
+++ b/exwm-systemtray.el
@@ -376,6 +376,7 @@ You shall use the default value if using auto-hide minibuffer."
                          :selection xcb:Atom:_NET_SYSTEM_TRAY_S0))
     (when (/= owner xcb:Window:None)
       (xcb:disconnect exwm-systemtray--connection)
+      (setq exwm-systemtray--connection nil)
       (warn "[EXWM] Other system tray detected")
       (cl-return-from exwm-systemtray--init)))
   (let ((id (xcb:generate-id exwm-systemtray--connection)))
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 5178e50d19ae..903172154720 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -1327,7 +1327,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
     (exwm-workspace--remove-frame-as-workspace frame))))
 
 (defun exwm-workspace--on-after-make-frame (frame)
-  "Hook run upon `delete-frame' that configures FRAME as a workspace."
+  "Hook run upon `make-frame' that configures FRAME as a workspace."
   (cond
    ((exwm-workspace--workspace-p frame)
     (exwm--log "Frame `%s' is already a workspace" frame))
@@ -1354,6 +1354,9 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
 (defun exwm-workspace--update-ewmh-props ()
   "Update EWMH properties to match the workspace list."
   (let ((num-workspaces (exwm-workspace--count)))
+    ;; Avoid setting 0 desktops.
+    (when (= 0 num-workspaces)
+      (setq num-workspaces 1))
     ;; Set _NET_NUMBER_OF_DESKTOPS.
     (xcb:+request exwm--connection
         (make-instance 'xcb:ewmh:set-_NET_NUMBER_OF_DESKTOPS
@@ -1470,19 +1473,14 @@ applied to all subsequently created X frames."
                    :test #'equal))
   (setq default-minibuffer-frame nil)
   (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
-                       :y 0))
-    (xcb:+request exwm--connection
-        (make-instance 'xcb:MapWindow
-                       :window id)))
-  (setq exwm-workspace--minibuffer nil))
+    (when (and exwm-workspace--minibuffer id)
+      (xcb:+request exwm--connection
+          (make-instance 'xcb:ReparentWindow
+                         :window id
+                         :parent exwm--root
+                         :x 0
+                         :y 0)))
+    (setq exwm-workspace--minibuffer nil)))
 
 (defun exwm-workspace--init ()
   "Initialize workspace module."
@@ -1538,8 +1536,7 @@ applied to all subsequently created X frames."
   ;; Make new frames create new workspaces.
   (add-hook 'after-make-frame-functions
             #'exwm-workspace--on-after-make-frame)
-  (add-hook 'delete-frame-functions
-            #'exwm-workspace--remove-frame-as-workspace)
+  (add-hook 'delete-frame-functions #'exwm-workspace--on-delete-frame)
   ;; Switch to the first workspace
   (exwm-workspace-switch 0 t)
   ;; Prevent frame parameters introduced by this module from being
@@ -1578,7 +1575,7 @@ applied to all subsequently created X frames."
   (when exwm-workspace--client
     (dolist (f exwm-workspace--list)
       (set-frame-parameter f 'client exwm-workspace--client))
-    (when (exwm-workspace--own-frame-p)
+    (when (exwm-workspace--minibuffer-own-frame-p)
       (set-frame-parameter exwm-workspace--minibuffer 'client
                            exwm-workspace--client))
     (setq exwm-workspace--client nil)))
diff --git a/exwm.el b/exwm.el
index 90b1fe4e2a23..379500b41206 100644
--- a/exwm.el
+++ b/exwm.el
@@ -685,14 +685,14 @@
   "Acquire the WM_Sn selection.
 
 REPLACE specifies what to do in case there already is a window
-manager.  If t, replace it, if nil, abort and if `ask'."
+manager.  If t, replace it, if nil, abort and ask the user if `ask'."
   (with-slots (owner)
       (xcb:+request-unchecked+reply exwm--connection
           (make-instance 'xcb:GetSelectionOwner
                          :selection xcb:Atom:WM_S0))
     (when (/= owner xcb:Window:None)
       (when (eq replace 'ask)
-        (setq replace (yes-or-no-p "Replace existing window manager?")))
+        (setq replace (yes-or-no-p "Replace existing window manager? ")))
       (when (not replace)
         (error "Other window manager detected")))
     (let ((new-owner (xcb:generate-id exwm--connection)))
@@ -727,7 +727,7 @@ manager.  If t, replace it, if nil, abort and if `ask'."
       ;; Wait for the other window manager to terminate.
       (when (/= owner xcb:Window:None)
         (let (reply)
-          (cl-dotimes (i 10) ;exwm--wmsn-acquire-timeout)
+          (cl-dotimes (i exwm--wmsn-acquire-timeout)
             (setq reply (xcb:+request-unchecked+reply exwm--connection
                             (make-instance 'xcb:GetGeometry :drawable owner)))
             (when (not reply)
@@ -785,8 +785,10 @@ manager.  If t, replace it, if nil, abort and if `ask'."
         (exwm--wmsn-acquire 'ask)
         (when (xcb:+request-checked+request-check exwm--connection
                   (make-instance 'xcb:ChangeWindowAttributes
-                                 :window exwm--root :value-mask xcb:CW:EventMask
-                                 :event-mask xcb:EventMask:SubstructureRedirect))
+                                 :window exwm--root
+                                 :value-mask xcb:CW:EventMask
+                                 :event-mask
+                                 xcb:EventMask:SubstructureRedirect))
           (error "Other window manager is running"))
         ;; Disable some features not working well with EXWM
         (setq use-dialog-box nil
@@ -822,10 +824,6 @@ manager.  If t, replace it, if nil, abort and if `ask'."
   (exwm-workspace--exit)
   (exwm-floating--exit)
   (exwm-layout--exit)
-  (xcb:+request-checked+request-check exwm--connection
-      (make-instance 'xcb:ChangeWindowAttributes
-                     :window exwm--root :value-mask xcb:CW:EventMask
-                     :event-mask xcb:EventMask:NoEvent))
   (when exwm--connection
     (xcb:flush exwm--connection)
     (xcb:disconnect exwm--connection))