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

@ -26,7 +26,6 @@
;;; Code:
(require 'exwm-core)
(eval-when-compile (require 'exwm-workspace))
(defvar exwm-floating-border-width)
@ -51,7 +50,6 @@
xcb:ConfigWindow:Height))
:width width :height height))))
;;;###autoload
(defun exwm-layout--show (id &optional window)
"Show window ID exactly fit in the Emacs window WINDOW."
(exwm--log "Show #x%x in %s" id window)
@ -112,7 +110,6 @@
exwm--connection))))
(xcb:flush exwm--connection))
;;;###autoload
(defun exwm-layout--hide (id)
"Hide window ID."
(unless (eq xcb:icccm:WM_STATE:IconicState ;already hidden
@ -137,6 +134,9 @@
:icon xcb:Window:None))
(xcb:flush exwm--connection)))
(defvar exwm-workspace--current)
(defvar exwm-workspace--list)
;;;###autoload
(defun exwm-layout-set-fullscreen (&optional id)
"Make window ID fullscreen."
@ -153,9 +153,8 @@
(vector (slot-value geometry 'x) (slot-value geometry 'y))))
(xcb:flush exwm--connection))
(exwm-layout--resize-container exwm--id exwm--container 0 0
(frame-pixel-width exwm-workspace--current)
(frame-pixel-height
exwm-workspace--current))
(exwm-workspace--current-width)
(exwm-workspace--current-height))
(xcb:+request exwm--connection
(make-instance 'xcb:ewmh:set-_NET_WM_STATE
:window exwm--id
@ -164,6 +163,7 @@
(setq exwm--fullscreen t)
(exwm-input-release-keyboard)))
;;;###autoload
(defun exwm-layout-unset-fullscreen (&optional id)
"Restore window from fullscreen state."
(interactive)
@ -187,6 +187,9 @@
(setq exwm--fullscreen nil)
(exwm-input-grab-keyboard)))
(defvar exwm-layout--fullscreen-frame-count 0
"Count the fullscreen workspace frames.")
;; This function is superficially similar to `exwm-layout-set-fullscreen', but
;; they do very different things: `exwm-layout--set-frame-fullscreen' resizes a
;; frame to the actual monitor size, `exwm-layout-set-fullscreen' resizes an X
@ -207,7 +210,8 @@
(exwm-workspace--minibuffer-own-frame-p))
(exwm-workspace--resize-minibuffer-frame width height))
(exwm-layout--resize-container id workspace x y width height)
(xcb:flush exwm--connection))))
(xcb:flush exwm--connection)))
(cl-incf exwm-layout--fullscreen-frame-count))
(defvar exwm-layout-show-all-buffers nil
"Non-nil to allow switching to buffers on other workspaces.")
@ -297,6 +301,7 @@
(exwm-layout--refresh)
(run-with-idle-timer 0.01 nil #'exwm-layout--refresh)))) ;FIXME
;;;###autoload
(defun exwm-layout-enlarge-window (delta &optional horizontal)
"Make the selected window DELTA pixels taller.
@ -371,6 +376,7 @@ windows."
:height height))
(xcb:flush exwm--connection))))))
;;;###autoload
(defun exwm-layout-enlarge-window-horizontally (delta)
"Make the selected window DELTA pixels wider.
@ -378,6 +384,7 @@ See also `exwm-layout-enlarge-window'."
(interactive "p")
(exwm-layout-enlarge-window delta t))
;;;###autoload
(defun exwm-layout-shrink-window (delta)
"Make the selected window DELTA pixels lower.
@ -385,6 +392,7 @@ See also `exwm-layout-enlarge-window'."
(interactive "p")
(exwm-layout-enlarge-window (- delta)))
;;;###autoload
(defun exwm-layout-shrink-window-horizontally (delta)
"Make the selected window DELTA pixels narrower.
@ -392,6 +400,7 @@ See also `exwm-layout-enlarge-window'."
(interactive "p")
(exwm-layout-enlarge-window (- delta) t))
;;;###autoload
(defun exwm-layout-hide-mode-line ()
"Hide mode-line."
(interactive)
@ -409,6 +418,7 @@ See also `exwm-layout-enlarge-window'."
mode-line-height)
nil t)))))
;;;###autoload
(defun exwm-layout-show-mode-line ()
"Show mode-line."
(interactive)