Fix system tray issues after updating workspaces

* exwm-workspace.el (exwm-workspace-switch-hook): New hook run by
`exwm-workspace-switch'.
* exwm-randr.el (exwm-randr-refresh-hook): New hook run by
`exwm-randr--refresh'.
* exwm-systemtray.el (exwm-systemtray--on-randr-refresh)
(exwm-systemtray--on-workspace-switch, exwm-systemtray--init): Update the
system tray in `exwm-randr-refresh-hook' and `exwm-workspace-switch-hook'.

* exwm-layout.el (exwm-layout--set-frame-fullscreen):
* exwm-workspace.el (exwm-workspace--post-init): Wait until all workspace
frames are set fullscreen.

* exwm-workspace.el (exwm-workspace--current-width)
(exwm-workspace--current-height): New functions for retrieving the width
and height of the current workspace.
* exwm-layout.el (exwm-layout-set-fullscreen):
* exwm-manage.el (exwm-manage--manage-window)
(exwm-manage--on-ConfigureRequest):
* exwm-systemtray.el (exwm-systemtray--refresh, exwm-systemtray--init):
* exwm-workspace.le (exwm-workspace--resize-minibuffer-frame)
(exwm-workspace--on-ConfigureNotify): Switch to
`exwm-workspace--current-width' and `exwm-workspace--current-height'.

* exwm-core.el:
* exwm-floating.el:
* exwm-floating.el:
* exwm-input.el:
* exwm-layout.el:
* exwm-manage.el:
* exwm-randr.el:
* exwm-systemtray.el:
* exwm-workspace.el:
* exwm.el:
Clean up loading file.  Set/Unset some functions as commands.

* README.md: Add intro to system tray.
This commit is contained in:
Chris Feng 2016-02-19 17:12:43 +08:00
parent bfd43feb49
commit fc589b899b
10 changed files with 160 additions and 91 deletions

View file

@ -48,11 +48,19 @@
(require 'xcb-randr)
(require 'exwm-core)
(require 'exwm-layout)
(eval-when-compile (require 'exwm-workspace))
(defvar exwm-randr-workspace-output-plist nil)
(defvar exwm-randr-refresh-hook nil
"Normal hook run when the RandR module just refreshed.")
(defvar exwm-workspace-minibuffer-position)
(defvar exwm-layout--fullscreen-frame-count)
(defvar exwm-workspace-number)
(defvar exwm-workspace--list)
(declare-function exwm-layout--set-frame-fullscreen "exwm-layout.el" (frame))
(defun exwm-randr--refresh ()
"Refresh workspaces according to the updated RandR info."
(let (output-name geometry output-plist default-geometry workareas
@ -89,6 +97,7 @@
(setq workarea-offset (if exwm-workspace-minibuffer-position
0
(window-pixel-height (minibuffer-window))))
(setq exwm-layout--fullscreen-frame-count 0)
(dotimes (i exwm-workspace-number)
(let* ((output (plist-get exwm-randr-workspace-output-plist i))
(geometry (lax-plist-get output-plist output))
@ -98,15 +107,8 @@
output nil))
(set-frame-parameter frame 'exwm-randr-output output)
(set-frame-parameter frame 'exwm-geometry geometry)
(exwm-layout--set-frame-fullscreen frame)
(with-slots (x y width height) geometry
(exwm-layout--resize-container (frame-parameter frame
'exwm-outer-id)
(frame-parameter frame
'exwm-workspace)
x y width height)
(when (and (eq frame exwm-workspace--current)
(exwm-workspace--minibuffer-own-frame-p))
(exwm-workspace--resize-minibuffer-frame width height))
(setq workareas
(nconc workareas (list x y width (- height
workarea-offset)))
@ -120,7 +122,8 @@
(make-instance 'xcb:ewmh:set-_NET_DESKTOP_VIEWPORT
:window exwm--root
:data (vconcat viewports)))
(xcb:flush exwm--connection))))
(xcb:flush exwm--connection)
(run-hooks 'exwm-randr-refresh-hook))))
(defvar exwm-randr-screen-change-hook nil
"Normal hook run when screen changes.")