New function exwm-workspace--workspace-p

* exwm-workspace.el (exwm-workspace--workspace-p): New function.
	* exwm-input.el (exwm-input--on-ButtonPress):
	* exwm-workspace.el (exwm-workspace-switch):
	* exwm-layout.el (exwm-layout--refresh): Use it.
This commit is contained in:
Adrián Medraño Calvo 2016-07-17 12:00:00 +00:00
parent 8e2da00b6e
commit 9018545726
3 changed files with 10 additions and 4 deletions

View file

@ -180,6 +180,7 @@ It's updated in several occasions, and only used by `exwm-input--set-focus'.")
(declare-function exwm-floating--start-moveresize "exwm-floating.el" (declare-function exwm-floating--start-moveresize "exwm-floating.el"
(id &optional type)) (id &optional type))
(declare-function exwm-workspace--position "exwm-workspace.el" (frame)) (declare-function exwm-workspace--position "exwm-workspace.el" (frame))
(declare-function exwm-workspace--workspace-p "exwm-workspace.el" (workspace))
(defvar exwm-workspace--list) (defvar exwm-workspace--list)
@ -206,7 +207,7 @@ It's updated in several occasions, and only used by `exwm-input--set-focus'.")
(unless (eq window (selected-window)) (unless (eq window (selected-window))
(setq frame (window-frame window)) (setq frame (window-frame window))
(unless (eq frame exwm-workspace--current) (unless (eq frame exwm-workspace--current)
(if (memq frame exwm-workspace--list) (if (exwm-workspace--workspace-p frame)
;; The X window is on another workspace ;; The X window is on another workspace
(exwm-workspace-switch (exwm-workspace-switch
(exwm-workspace--position frame)) (exwm-workspace--position frame))

View file

@ -153,7 +153,6 @@
(xcb:flush exwm--connection)))) (xcb:flush exwm--connection))))
(defvar exwm-workspace--current) (defvar exwm-workspace--current)
(defvar exwm-workspace--list)
(declare-function exwm-input-grab-keyboard "exwm-input.el") (declare-function exwm-input-grab-keyboard "exwm-input.el")
(declare-function exwm-input-release-keyboard "exwm-input.el") (declare-function exwm-input-release-keyboard "exwm-input.el")
@ -282,6 +281,8 @@ selected by `other-buffer'."
(defvar exwm-layout-show-all-buffers nil (defvar exwm-layout-show-all-buffers nil
"Non-nil to allow switching to buffers on other workspaces.") "Non-nil to allow switching to buffers on other workspaces.")
(declare-function exwm-workspace--workspace-p "exwm-workspace.el"
(workspace))
(defun exwm-layout--set-client-list-stacking () (defun exwm-layout--set-client-list-stacking ()
"Set _NET_CLIENT_LIST_STACKING." "Set _NET_CLIENT_LIST_STACKING."
@ -312,7 +313,7 @@ selected by `other-buffer'."
covered-buffers ;EXWM-buffers covered by a new X window. covered-buffers ;EXWM-buffers covered by a new X window.
vacated-windows ;Windows previously displaying EXWM-buffers. vacated-windows ;Windows previously displaying EXWM-buffers.
windows) windows)
(if (not (memq frame exwm-workspace--list)) (if (not (exwm-workspace--workspace-p frame))
(if (frame-parameter frame 'exwm-outer-id) (if (frame-parameter frame 'exwm-outer-id)
;; Refresh a floating frame ;; Refresh a floating frame
(let ((window (frame-first-window frame))) (let ((window (frame-first-window frame)))

View file

@ -40,6 +40,10 @@ NIL if FRAME is not a workspace"
"Retrieve total number of workspaces." "Retrieve total number of workspaces."
(length exwm-workspace--list)) (length exwm-workspace--list))
(defsubst exwm-workspace--workspace-p (frame)
"Return t if FRAME is a workspace."
(memq frame exwm-workspace--list))
(defvar exwm-workspace--switch-map (defvar exwm-workspace--switch-map
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
(define-key map [t] (lambda () (interactive))) (define-key map [t] (lambda () (interactive)))
@ -334,7 +338,7 @@ The optional FORCE option is for internal use only."
:stack-mode xcb:StackMode:Above)))) :stack-mode xcb:StackMode:Above))))
(setq exwm-workspace--current frame (setq exwm-workspace--current frame
exwm-workspace-current-index index) exwm-workspace-current-index index)
(unless (memq (selected-frame) exwm-workspace--list) (unless (exwm-workspace--workspace-p (selected-frame))
;; Save the floating frame window selected on the previous workspace. ;; Save the floating frame window selected on the previous workspace.
(set-frame-parameter (with-current-buffer (window-buffer) (set-frame-parameter (with-current-buffer (window-buffer)
exwm--frame) exwm--frame)