Minor fixes

This commit is contained in:
Chris Feng 2018-03-09 01:06:39 +08:00
parent 7aae6efdcd
commit 2f430db735
8 changed files with 24 additions and 32 deletions

View file

@ -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--iconic-state-p "exwm-layout.el" (&optional id))
(declare-function exwm-layout--refresh "exwm-layout.el" ()) (declare-function exwm-layout--refresh "exwm-layout.el" ())
(declare-function exwm-layout--show "exwm-layout.el" (id &optional window)) (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)) (declare-function exwm-workspace--position "exwm-workspace.el" (frame))
(defun exwm-floating--set-allowed-actions (id tilling) (defun exwm-floating--set-allowed-actions (id tilling)

View file

@ -146,6 +146,7 @@ This value should always be overwritten.")
(&rest _args)) (&rest _args))
(declare-function exwm-layout--iconic-state-p "exwm-layout.el" (&optional id)) (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-layout--show "exwm-layout.el" (id &optional window))
(declare-function exwm-reset "exwm.el" ())
(declare-function exwm-workspace--client-p "exwm-workspace.el" (declare-function exwm-workspace--client-p "exwm-workspace.el"
(&optional frame)) (&optional frame))
(declare-function exwm-workspace--minibuffer-own-frame-p "exwm-workspace.el") (declare-function exwm-workspace--minibuffer-own-frame-p "exwm-workspace.el")

View file

@ -47,6 +47,7 @@
(defvar exwm-workspace--current) (defvar exwm-workspace--current)
(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")
(declare-function exwm-reset "exwm.el" ())
(declare-function exwm-workspace--client-p "exwm-workspace.el" (declare-function exwm-workspace--client-p "exwm-workspace.el"
(&optional frame)) (&optional frame))
(declare-function exwm-workspace--minibuffer-own-frame-p "exwm-workspace.el") (declare-function exwm-workspace--minibuffer-own-frame-p "exwm-workspace.el")

View file

@ -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-input-set-local-simulation-keys "exwm-input.el")
(declare-function exwm-layout--fullscreen-p "exwm-layout.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-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--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--set-fullscreen "exwm-workspace.el" (frame))
(declare-function exwm-workspace--update-struts "exwm-workspace.el" ()) (declare-function exwm-workspace--update-struts "exwm-workspace.el" ())
(declare-function exwm-workspace--update-workareas "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) (defun exwm-manage--update-geometry (id &optional force)
"Update window geometry." "Update window geometry."

View file

@ -81,7 +81,6 @@ the first one in result being the primary output."
(defvar exwm-workspace--fullscreen-frame-count) (defvar exwm-workspace--fullscreen-frame-count)
(defvar exwm-workspace--list) (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--count "exwm-workspace.el")
(declare-function exwm-workspace--set-active "exwm-workspace.el" (declare-function exwm-workspace--set-active "exwm-workspace.el"
(frame active)) (frame active))

View file

@ -376,6 +376,7 @@ You shall use the default value if using auto-hide minibuffer."
:selection xcb:Atom:_NET_SYSTEM_TRAY_S0)) :selection xcb:Atom:_NET_SYSTEM_TRAY_S0))
(when (/= owner xcb:Window:None) (when (/= owner xcb:Window:None)
(xcb:disconnect exwm-systemtray--connection) (xcb:disconnect exwm-systemtray--connection)
(setq exwm-systemtray--connection nil)
(warn "[EXWM] Other system tray detected") (warn "[EXWM] Other system tray detected")
(cl-return-from exwm-systemtray--init))) (cl-return-from exwm-systemtray--init)))
(let ((id (xcb:generate-id exwm-systemtray--connection))) (let ((id (xcb:generate-id exwm-systemtray--connection)))

View file

@ -1327,7 +1327,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
(exwm-workspace--remove-frame-as-workspace frame)))) (exwm-workspace--remove-frame-as-workspace frame))))
(defun exwm-workspace--on-after-make-frame (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 (cond
((exwm-workspace--workspace-p frame) ((exwm-workspace--workspace-p frame)
(exwm--log "Frame `%s' is already a workspace" 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 () (defun exwm-workspace--update-ewmh-props ()
"Update EWMH properties to match the workspace list." "Update EWMH properties to match the workspace list."
(let ((num-workspaces (exwm-workspace--count))) (let ((num-workspaces (exwm-workspace--count)))
;; Avoid setting 0 desktops.
(when (= 0 num-workspaces)
(setq num-workspaces 1))
;; Set _NET_NUMBER_OF_DESKTOPS. ;; Set _NET_NUMBER_OF_DESKTOPS.
(xcb:+request exwm--connection (xcb:+request exwm--connection
(make-instance 'xcb:ewmh:set-_NET_NUMBER_OF_DESKTOPS (make-instance 'xcb:ewmh:set-_NET_NUMBER_OF_DESKTOPS
@ -1470,19 +1473,14 @@ applied to all subsequently created X frames."
:test #'equal)) :test #'equal))
(setq default-minibuffer-frame nil) (setq default-minibuffer-frame nil)
(let ((id (frame-parameter exwm-workspace--minibuffer 'exwm-outer-id))) (let ((id (frame-parameter exwm-workspace--minibuffer 'exwm-outer-id)))
(xcb:+request exwm--connection (when (and exwm-workspace--minibuffer id)
(make-instance 'xcb:UnmapWindow
:window id))
(xcb:+request exwm--connection (xcb:+request exwm--connection
(make-instance 'xcb:ReparentWindow (make-instance 'xcb:ReparentWindow
:window id :window id
:parent exwm--root :parent exwm--root
:x 0 :x 0
:y 0)) :y 0)))
(xcb:+request exwm--connection (setq exwm-workspace--minibuffer nil)))
(make-instance 'xcb:MapWindow
:window id)))
(setq exwm-workspace--minibuffer nil))
(defun exwm-workspace--init () (defun exwm-workspace--init ()
"Initialize workspace module." "Initialize workspace module."
@ -1538,8 +1536,7 @@ applied to all subsequently created X frames."
;; Make new frames create new workspaces. ;; Make new frames create new workspaces.
(add-hook 'after-make-frame-functions (add-hook 'after-make-frame-functions
#'exwm-workspace--on-after-make-frame) #'exwm-workspace--on-after-make-frame)
(add-hook 'delete-frame-functions (add-hook 'delete-frame-functions #'exwm-workspace--on-delete-frame)
#'exwm-workspace--remove-frame-as-workspace)
;; Switch to the first workspace ;; Switch to the first workspace
(exwm-workspace-switch 0 t) (exwm-workspace-switch 0 t)
;; Prevent frame parameters introduced by this module from being ;; Prevent frame parameters introduced by this module from being
@ -1578,7 +1575,7 @@ applied to all subsequently created X frames."
(when exwm-workspace--client (when exwm-workspace--client
(dolist (f exwm-workspace--list) (dolist (f exwm-workspace--list)
(set-frame-parameter f 'client exwm-workspace--client)) (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 (set-frame-parameter exwm-workspace--minibuffer 'client
exwm-workspace--client)) exwm-workspace--client))
(setq exwm-workspace--client nil))) (setq exwm-workspace--client nil)))

16
exwm.el
View file

@ -685,14 +685,14 @@
"Acquire the WM_Sn selection. "Acquire the WM_Sn selection.
REPLACE specifies what to do in case there already is a window 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) (with-slots (owner)
(xcb:+request-unchecked+reply exwm--connection (xcb:+request-unchecked+reply exwm--connection
(make-instance 'xcb:GetSelectionOwner (make-instance 'xcb:GetSelectionOwner
:selection xcb:Atom:WM_S0)) :selection xcb:Atom:WM_S0))
(when (/= owner xcb:Window:None) (when (/= owner xcb:Window:None)
(when (eq replace 'ask) (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) (when (not replace)
(error "Other window manager detected"))) (error "Other window manager detected")))
(let ((new-owner (xcb:generate-id exwm--connection))) (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. ;; Wait for the other window manager to terminate.
(when (/= owner xcb:Window:None) (when (/= owner xcb:Window:None)
(let (reply) (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 (setq reply (xcb:+request-unchecked+reply exwm--connection
(make-instance 'xcb:GetGeometry :drawable owner))) (make-instance 'xcb:GetGeometry :drawable owner)))
(when (not reply) (when (not reply)
@ -785,8 +785,10 @@ manager. If t, replace it, if nil, abort and if `ask'."
(exwm--wmsn-acquire 'ask) (exwm--wmsn-acquire 'ask)
(when (xcb:+request-checked+request-check exwm--connection (when (xcb:+request-checked+request-check exwm--connection
(make-instance 'xcb:ChangeWindowAttributes (make-instance 'xcb:ChangeWindowAttributes
:window exwm--root :value-mask xcb:CW:EventMask :window exwm--root
:event-mask xcb:EventMask:SubstructureRedirect)) :value-mask xcb:CW:EventMask
:event-mask
xcb:EventMask:SubstructureRedirect))
(error "Other window manager is running")) (error "Other window manager is running"))
;; Disable some features not working well with EXWM ;; Disable some features not working well with EXWM
(setq use-dialog-box nil (setq use-dialog-box nil
@ -822,10 +824,6 @@ manager. If t, replace it, if nil, abort and if `ask'."
(exwm-workspace--exit) (exwm-workspace--exit)
(exwm-floating--exit) (exwm-floating--exit)
(exwm-layout--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 (when exwm--connection
(xcb:flush exwm--connection) (xcb:flush exwm--connection)
(xcb:disconnect exwm--connection)) (xcb:disconnect exwm--connection))