Various fixes for workspace

Fixes for full screen, move window, etc.
This commit is contained in:
Chris Feng 2015-07-18 21:16:14 +08:00
parent cf87bb55ed
commit 968d0b4882
3 changed files with 11 additions and 6 deletions

View file

@ -30,8 +30,6 @@
;; Todo: ;; Todo:
;; + Pointer simulation mode (e.g. 'C-c 1'/'C-c 2' for single/double click, ;; + Pointer simulation mode (e.g. 'C-c 1'/'C-c 2' for single/double click,
;; move with arrow keys). ;; 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, ;; + Simulation keys to mimic Emacs key bindings for text edit (redo, select,
;; cancel, clear, etc). Some of them are not present on common keyboard ;; cancel, clear, etc). Some of them are not present on common keyboard
;; (keycode = 0). May need to use XKB extension. ;; (keycode = 0). May need to use XKB extension.

View file

@ -68,8 +68,9 @@
(not-empty (make-vector exwm-workspace-number nil))) (not-empty (make-vector exwm-workspace-number nil)))
(dolist (i exwm--id-buffer-alist) (dolist (i exwm--id-buffer-alist)
(with-current-buffer (cdr i) (with-current-buffer (cdr i)
(when exwm--frame
(setf (elt not-empty (cl-position exwm--frame exwm-workspace--list)) (setf (elt not-empty (cl-position exwm--frame exwm-workspace--list))
t))) t))))
(setq exwm-workspace--switch-history (setq exwm-workspace--switch-history
(mapcar (mapcar
(lambda (i) (lambda (i)
@ -147,8 +148,6 @@ The optional FORCE option is for internal use only "
(unless (and (<= 0 index) (< index exwm-workspace-number)) (unless (and (<= 0 index) (< index exwm-workspace-number))
(user-error "[EXWM] Workspace index out of range: %d" index)) (user-error "[EXWM] Workspace index out of range: %d" index))
(when (/= exwm-workspace-current-index 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))) (let ((frame (elt exwm-workspace--list index)))
(with-current-buffer (exwm--id->buffer id) (with-current-buffer (exwm--id->buffer id)
(setq exwm--frame frame) (setq exwm--frame frame)
@ -163,6 +162,8 @@ The optional FORCE option is for internal use only "
:parent (frame-parameter frame 'exwm-window-id) :parent (frame-parameter frame 'exwm-window-id)
:x 0 :y 0)) :x 0 :y 0))
;; Move the window itself ;; Move the window itself
(set-window-buffer (get-buffer-window (exwm--id->buffer id))
(other-buffer))
(xcb:+request exwm--connection (xcb:+request exwm--connection
(make-instance 'xcb:ChangeWindowAttributes (make-instance 'xcb:ChangeWindowAttributes
:window id :value-mask xcb:CW:EventMask :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) (unless (frame-parameter i 'window-id)
(setq exwm-workspace--list (delq i exwm-workspace--list))))) (setq exwm-workspace--list (delq i exwm-workspace--list)))))
(cl-assert (= 1 (length 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 ;; Configure the existing frame
(set-frame-parameter (car exwm-workspace--list) 'fullscreen 'fullboth) (set-frame-parameter (car exwm-workspace--list) 'fullscreen 'fullboth)
;; Create remaining frames ;; Create remaining frames
@ -220,6 +222,7 @@ The optional FORCE option is for internal use only "
(make-instance 'xcb:ChangeWindowAttributes (make-instance 'xcb:ChangeWindowAttributes
:window window-id :value-mask xcb:CW:EventMask :window window-id :value-mask xcb:CW:EventMask
:event-mask xcb:EventMask:SubstructureRedirect)))) :event-mask xcb:EventMask:SubstructureRedirect))))
(xcb:flush exwm--connection)
;; Switch to the first workspace ;; Switch to the first workspace
(exwm-workspace-switch 0 t)) (exwm-workspace-switch 0 t))

View file

@ -188,6 +188,10 @@
xcb:EventMask:SubstructureRedirect))) xcb:EventMask:SubstructureRedirect)))
(xcb:flush exwm--connection)) (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 () (defun exwm-reset ()
"Reset window to standard state: non-fullscreen, line-mode." "Reset window to standard state: non-fullscreen, line-mode."
(interactive) (interactive)