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-19T02·33+0800
committerChris Feng <chris.w.feng@gmail.com>2016-07-19T02·33+0800
commit4c9afc25b322d30b21eeea2cf3af7def0fc1dbb4 (patch)
tree7593855383adc91ad59176b7b03eb93153a2a981 /exwm-workspace.el
parent622618ac6e401857b335b7e5dd1969cb9e1f948b (diff)
Adapt dynamic workspace for floating module
* exwm-workspace.el (exwm-workspace--add-frame-as-workspace):
Fix the checking criteria of floating frames; Copy RandR frame
parameters from the first workspace frame (rather than the selected one
which can be a floating frame).

* exwm-workspace.el (exwm-workspace--remove-frame-as-workspace):
Check frame type first.
Diffstat (limited to 'exwm-workspace.el')
-rw-r--r--exwm-workspace.el20
1 files changed, 13 insertions, 7 deletions
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 0843c27e92c6..36502a2503a8 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -981,7 +981,10 @@ INDEX must not exceed the current number of workspaces."
                frame
                (frame-parameter frame 'display)
                (slot-value exwm--connection 'display)))
-   ((frame-parameter frame 'exwm-floating)
+   ((frame-parameter frame 'unsplittable)
+    ;; We create floating frames with the "unsplittable" parameter set.
+    ;; Though it may not be a floating frame, we won't treat an
+    ;; unsplittable frame as a workspace anyway.
     (exwm--log "Frame `%s' is floating" frame))
    (t
     (exwm--log "Adding frame `%s' as workspace" frame)
@@ -995,12 +998,13 @@ INDEX must not exceed the current number of workspaces."
       (set-frame-parameter frame 'exwm-outer-id outer-id)
       (set-frame-parameter frame 'exwm-container container)
       (set-frame-parameter frame 'exwm-workspace workspace)
-      ;; Use same RandR output and geometry as previous workspace.
-      (let ((prev-workspace (selected-frame)))
+      ;; Copy RandR frame parameters from the first workspace to
+      ;; prevent potential problems.  The values do not matter here as
+      ;; they'll be updated by the RandR module later.
+      (let ((w (car exwm-workspace--list)))
         (dolist (param '(exwm-randr-output
                          exwm-geometry))
-          (set-frame-parameter frame param
-                               (frame-parameter prev-workspace param))))
+          (set-frame-parameter frame param (frame-parameter w param))))
       (xcb:+request exwm--connection
           (make-instance 'xcb:CreateWindow
                          :depth 0 :wid workspace :parent exwm--root
@@ -1056,10 +1060,12 @@ INDEX must not exceed the current number of workspaces."
 (defun exwm-workspace--remove-frame-as-workspace (frame)
   "Stop treating frame FRAME as a workspace."
   (cond
-   ((= 1 (exwm-workspace--count))
-    (exwm--log "Cannot remove last workspace"))
    ((not (exwm-workspace--workspace-p frame))
     (exwm--log "Frame `%s' is not a workspace" frame))
+   ((= 1 (exwm-workspace--count))
+    ;; FIXME: When using dedicated minibuffer frame, deleting the last
+    ;;        frame hangs Emacs.
+    (user-error "[EXWM] Cannot remove last workspace"))
    (t
     (exwm--log "Removing frame `%s' as workspace" frame)
     (let* ((index (exwm-workspace--position frame))