about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2015-07-18T13·16+0800
committerChris Feng <chris.w.feng@gmail.com>2015-07-18T13·16+0800
commit968d0b48825e9d4b7f0c918f33337f34c1db7487 (patch)
tree8d5541796ed6af7ea045e132e262888124e1fc4d
parentcf87bb55ed2b7070aceaea70783a578563734b7d (diff)
Various fixes for workspace
Fixes for full screen, move window, etc.
-rw-r--r--exwm-input.el2
-rw-r--r--exwm-workspace.el11
-rw-r--r--exwm.el4
3 files changed, 11 insertions, 6 deletions
diff --git a/exwm-input.el b/exwm-input.el
index 107df0599ef5..1f8e4f4de680 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -30,8 +30,6 @@
 ;; Todo:
 ;; + Pointer simulation mode (e.g. 'C-c 1'/'C-c 2' for single/double click,
 ;;   move with arrow keys).
-;; + Demonstrate how to add a local key binding (add global prefix key and
-;;   modify `exwm-mode-map').
 ;; + Simulation keys to mimic Emacs key bindings for text edit (redo, select,
 ;;   cancel, clear, etc). Some of them are not present on common keyboard
 ;;   (keycode = 0). May need to use XKB extension.
diff --git a/exwm-workspace.el b/exwm-workspace.el
index c225c434ddf7..94d0e75eaf95 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -68,8 +68,9 @@
         (not-empty (make-vector exwm-workspace-number nil)))
     (dolist (i exwm--id-buffer-alist)
       (with-current-buffer (cdr i)
-        (setf (elt not-empty (cl-position exwm--frame exwm-workspace--list))
-              t)))
+        (when exwm--frame
+          (setf (elt not-empty (cl-position exwm--frame exwm-workspace--list))
+                t))))
     (setq exwm-workspace--switch-history
           (mapcar
            (lambda (i)
@@ -147,8 +148,6 @@ The optional FORCE option is for internal use only "
   (unless (and (<= 0 index) (< index exwm-workspace-number))
     (user-error "[EXWM] Workspace index out of range: %d" index))
   (when (/= exwm-workspace-current-index index)
-    (set-window-buffer (get-buffer-window (exwm--id->buffer id))
-                       (other-buffer))
     (let ((frame (elt exwm-workspace--list index)))
       (with-current-buffer (exwm--id->buffer id)
         (setq exwm--frame frame)
@@ -163,6 +162,8 @@ The optional FORCE option is for internal use only "
                            :parent (frame-parameter frame 'exwm-window-id)
                            :x 0 :y 0))
           ;; Move the window itself
+          (set-window-buffer (get-buffer-window (exwm--id->buffer id))
+                             (other-buffer))
           (xcb:+request exwm--connection
               (make-instance 'xcb:ChangeWindowAttributes
                              :window id :value-mask xcb:CW:EventMask
@@ -197,6 +198,7 @@ The optional FORCE option is for internal use only "
       (unless (frame-parameter i 'window-id)
         (setq exwm-workspace--list (delq i exwm-workspace--list)))))
   (cl-assert (= 1 (length exwm-workspace--list)))
+  (exwm--make-emacs-idle-for 0.1)      ;wait for the frame ready
   ;; Configure the existing frame
   (set-frame-parameter (car exwm-workspace--list) 'fullscreen 'fullboth)
   ;; Create remaining frames
@@ -220,6 +222,7 @@ The optional FORCE option is for internal use only "
           (make-instance 'xcb:ChangeWindowAttributes
                          :window window-id :value-mask xcb:CW:EventMask
                          :event-mask xcb:EventMask:SubstructureRedirect))))
+  (xcb:flush exwm--connection)
   ;; Switch to the first workspace
   (exwm-workspace-switch 0 t))
 
diff --git a/exwm.el b/exwm.el
index 49c4380405be..c6e005976f28 100644
--- a/exwm.el
+++ b/exwm.el
@@ -188,6 +188,10 @@
                                          xcb:EventMask:SubstructureRedirect)))
   (xcb:flush exwm--connection))
 
+(defun exwm--make-emacs-idle-for (seconds)
+  "Put Emacs in idle state for SECONDS seconds."
+  (with-timeout (seconds) (read-event)))
+
 (defun exwm-reset ()
   "Reset window to standard state: non-fullscreen, line-mode."
   (interactive)