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--refresh "exwm-layout.el" ())
(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))
(defun exwm-floating--set-allowed-actions (id tilling)

View file

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

View file

@ -47,6 +47,7 @@
(defvar exwm-workspace--current)
(declare-function exwm-input-grab-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"
(&optional frame))
(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-layout--fullscreen-p "exwm-layout.el" ())
(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--set-desktop "exwm-workspace.el" (id))
(declare-function exwm-workspace--set-fullscreen "exwm-workspace.el" (frame))
(declare-function exwm-workspace--update-struts "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)
"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--list)
(declare-function exwm-workspace--active-p "exwm-workspace.el" (frame))
(declare-function exwm-workspace--count "exwm-workspace.el")
(declare-function exwm-workspace--set-active "exwm-workspace.el"
(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))
(when (/= owner xcb:Window:None)
(xcb:disconnect exwm-systemtray--connection)
(setq exwm-systemtray--connection nil)
(warn "[EXWM] Other system tray detected")
(cl-return-from exwm-systemtray--init)))
(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))))
(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
((exwm-workspace--workspace-p 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 ()
"Update EWMH properties to match the workspace list."
(let ((num-workspaces (exwm-workspace--count)))
;; Avoid setting 0 desktops.
(when (= 0 num-workspaces)
(setq num-workspaces 1))
;; Set _NET_NUMBER_OF_DESKTOPS.
(xcb:+request exwm--connection
(make-instance 'xcb:ewmh:set-_NET_NUMBER_OF_DESKTOPS
@ -1470,19 +1473,14 @@ applied to all subsequently created X frames."
:test #'equal))
(setq default-minibuffer-frame nil)
(let ((id (frame-parameter exwm-workspace--minibuffer 'exwm-outer-id)))
(xcb:+request exwm--connection
(make-instance 'xcb:UnmapWindow
:window id))
(when (and exwm-workspace--minibuffer id)
(xcb:+request exwm--connection
(make-instance 'xcb:ReparentWindow
:window id
:parent exwm--root
:x 0
:y 0))
(xcb:+request exwm--connection
(make-instance 'xcb:MapWindow
:window id)))
(setq exwm-workspace--minibuffer nil))
:y 0)))
(setq exwm-workspace--minibuffer nil)))
(defun exwm-workspace--init ()
"Initialize workspace module."
@ -1538,8 +1536,7 @@ applied to all subsequently created X frames."
;; Make new frames create new workspaces.
(add-hook 'after-make-frame-functions
#'exwm-workspace--on-after-make-frame)
(add-hook 'delete-frame-functions
#'exwm-workspace--remove-frame-as-workspace)
(add-hook 'delete-frame-functions #'exwm-workspace--on-delete-frame)
;; Switch to the first workspace
(exwm-workspace-switch 0 t)
;; Prevent frame parameters introduced by this module from being
@ -1578,7 +1575,7 @@ applied to all subsequently created X frames."
(when exwm-workspace--client
(dolist (f exwm-workspace--list)
(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
exwm-workspace--client))
(setq exwm-workspace--client nil)))

14
exwm.el
View file

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