subtree(3p/exwm): bump exwm to upstream commit '56db521a'
This bumps us past EXWM 0.28, which has several major fixes. Change-Id: Ie89997cc5d60f4e5aaedfe60368571420b7e4b9d
This commit is contained in:
commit
5f53841a34
13 changed files with 453 additions and 307 deletions
8
third_party/exwm/exwm-background.el
vendored
8
third_party/exwm/exwm-background.el
vendored
|
@ -1,6 +1,6 @@
|
|||
;;; exwm-background.el --- X Background Module for EXWM -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2022 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2022-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Steven Allen <steven@stebalien.com>
|
||||
|
||||
|
@ -172,19 +172,17 @@ replace it.")
|
|||
(defun exwm-background--init ()
|
||||
"Initialize background module."
|
||||
(exwm--log)
|
||||
|
||||
(add-hook 'enable-theme-functions 'exwm-background--update)
|
||||
(add-hook 'disable-theme-functions 'exwm-background--update)
|
||||
|
||||
(exwm-background--update))
|
||||
|
||||
(defun exwm-background--exit ()
|
||||
"Uninitialize the background module."
|
||||
(exwm--log)
|
||||
|
||||
(remove-hook 'enable-theme-functions 'exwm-background--update)
|
||||
(remove-hook 'disable-theme-functions 'exwm-background--update)
|
||||
(when exwm-background--connection
|
||||
(when (and exwm-background--connection
|
||||
(slot-value exwm-background--connection 'connected))
|
||||
(xcb:disconnect exwm-background--connection))
|
||||
(setq exwm-background--pixmap nil
|
||||
exwm-background--connection nil
|
||||
|
|
2
third_party/exwm/exwm-cm.el
vendored
2
third_party/exwm/exwm-cm.el
vendored
|
@ -1,6 +1,6 @@
|
|||
;;; exwm-cm.el --- Compositing Manager for EXWM -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2016-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Chris Feng <chris.w.feng@gmail.com>
|
||||
|
||||
|
|
2
third_party/exwm/exwm-config.el
vendored
2
third_party/exwm/exwm-config.el
vendored
|
@ -1,6 +1,6 @@
|
|||
;;; exwm-config.el --- Predefined configurations -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2015-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Chris Feng <chris.w.feng@gmail.com>
|
||||
|
||||
|
|
28
third_party/exwm/exwm-core.el
vendored
28
third_party/exwm/exwm-core.el
vendored
|
@ -1,6 +1,6 @@
|
|||
;;; exwm-core.el --- Core definitions -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2015-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Chris Feng <chris.w.feng@gmail.com>
|
||||
|
||||
|
@ -93,10 +93,12 @@ Here are some predefined candidates:
|
|||
(frame-or-index &optional id))
|
||||
|
||||
(define-minor-mode exwm-debug
|
||||
"Debug-logging enabled if non-nil"
|
||||
:global t)
|
||||
"Debug-logging enabled if non-nil."
|
||||
:global t
|
||||
:group 'exwm-debug)
|
||||
|
||||
(defmacro exwm--debug (&rest forms)
|
||||
"Evaluate FORMS if mode `exwm-debug' is active."
|
||||
(when exwm-debug `(progn ,@forms)))
|
||||
|
||||
(defmacro exwm--log (&optional format-string &rest objects)
|
||||
|
@ -116,10 +118,12 @@ FORMAT-STRING is a string specifying the message to output, as in
|
|||
|
||||
(defsubst exwm--id->buffer (id)
|
||||
"X window ID => Emacs buffer."
|
||||
(declare (indent defun))
|
||||
(cdr (assoc id exwm--id-buffer-alist)))
|
||||
|
||||
(defsubst exwm--buffer->id (buffer)
|
||||
"Emacs buffer BUFFER => X window ID."
|
||||
(declare (indent defun))
|
||||
(car (rassoc buffer exwm--id-buffer-alist)))
|
||||
|
||||
(defun exwm--lock (&rest _args)
|
||||
|
@ -159,7 +163,9 @@ Nil can be passed as placeholder."
|
|||
:x x :y y :width width :height height)))
|
||||
|
||||
(defun exwm--intern-atom (atom &optional conn)
|
||||
"Intern X11 ATOM."
|
||||
"Intern X11 ATOM.
|
||||
If CONN is non-nil, use it instead of the value of the variable
|
||||
`exwm--connection'."
|
||||
(slot-value (xcb:+request-unchecked+reply (or conn exwm--connection)
|
||||
(make-instance 'xcb:InternAtom
|
||||
:only-if-exists 0
|
||||
|
@ -183,6 +189,7 @@ least SECS seconds later."
|
|||
(defsubst exwm--terminal-p (&optional frame)
|
||||
"Return t when FRAME's terminal is EXWM's terminal.
|
||||
If FRAME is null, use selected frame."
|
||||
(declare (indent defun))
|
||||
(eq exwm--terminal (frame-terminal frame)))
|
||||
|
||||
(defun exwm--get-client-event-mask ()
|
||||
|
@ -197,13 +204,16 @@ If FRAME is null, use selected frame."
|
|||
(when (and color
|
||||
(eq (x-display-visual-class) 'true-color))
|
||||
(let ((rgb (x-color-values color)))
|
||||
(logior (lsh (lsh (pop rgb) -8) 16)
|
||||
(lsh (lsh (pop rgb) -8) 8)
|
||||
(lsh (pop rgb) -8)))))
|
||||
(logior (ash (ash (pop rgb) -8) 16)
|
||||
(ash (ash (pop rgb) -8) 8)
|
||||
(ash (pop rgb) -8)))))
|
||||
|
||||
(defun exwm--get-visual-depth-colormap (conn id)
|
||||
"Get visual, depth and colormap from X window ID.
|
||||
Return a three element list with the respective results."
|
||||
Return a three element list with the respective results.
|
||||
|
||||
If CONN is non-nil, use it instead of the value of the variable
|
||||
`exwm--connection'."
|
||||
(let (ret-visual ret-depth ret-colormap)
|
||||
(with-slots (visual colormap)
|
||||
(xcb:+request-unchecked+reply conn
|
||||
|
@ -235,7 +245,7 @@ One of `line-mode' or `char-mode'.")
|
|||
(defvar-local exwm--geometry nil)
|
||||
(defvar-local exwm-class-name nil "Class name in WM_CLASS.")
|
||||
(defvar-local exwm-instance-name nil "Instance name in WM_CLASS.")
|
||||
(defvar-local exwm-title nil "Window title (either _NET_WM_NAME or WM_NAME)")
|
||||
(defvar-local exwm-title nil "Window title (either _NET_WM_NAME or WM_NAME).")
|
||||
(defvar-local exwm--title-is-utf8 nil)
|
||||
(defvar-local exwm-transient-for nil "WM_TRANSIENT_FOR.")
|
||||
(defvar-local exwm--protocols nil)
|
||||
|
|
12
third_party/exwm/exwm-floating.el
vendored
12
third_party/exwm/exwm-floating.el
vendored
|
@ -1,6 +1,6 @@
|
|||
;;; exwm-floating.el --- Floating Module for EXWM -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2015-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Chris Feng <chris.w.feng@gmail.com>
|
||||
|
||||
|
@ -118,13 +118,13 @@ context of the corresponding buffer."
|
|||
(defvar exwm-workspace--current)
|
||||
(defvar exwm-workspace--frame-y-offset)
|
||||
(defvar exwm-workspace--window-y-offset)
|
||||
(defvar exwm-workspace--workareas)
|
||||
(declare-function exwm-layout--hide "exwm-layout.el" (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--show "exwm-layout.el" (id &optional window))
|
||||
(declare-function exwm-workspace--position "exwm-workspace.el" (frame))
|
||||
(declare-function exwm-workspace--update-offsets "exwm-workspace.el" ())
|
||||
(declare-function exwm-workspace--workarea "exwm-workspace.el" (frame))
|
||||
|
||||
(defun exwm-floating--set-allowed-actions (id tilling)
|
||||
"Set _NET_WM_ALLOWED_ACTIONS."
|
||||
|
@ -186,12 +186,8 @@ context of the corresponding buffer."
|
|||
(set-frame-parameter frame 'exwm-container frame-container)
|
||||
;; Fix illegal parameters
|
||||
;; FIXME: check normal hints restrictions
|
||||
(let* ((workarea (elt exwm-workspace--workareas
|
||||
(exwm-workspace--position original-frame)))
|
||||
(x* (aref workarea 0))
|
||||
(y* (aref workarea 1))
|
||||
(width* (aref workarea 2))
|
||||
(height* (aref workarea 3)))
|
||||
(with-slots ((x* x) (y* y) (width* width) (height* height))
|
||||
(exwm-workspace--workarea original-frame)
|
||||
;; Center floating windows
|
||||
(when (and (or (= x 0) (= x x*))
|
||||
(or (= y 0) (= y y*)))
|
||||
|
|
58
third_party/exwm/exwm-input.el
vendored
58
third_party/exwm/exwm-input.el
vendored
|
@ -1,6 +1,6 @@
|
|||
;;; exwm-input.el --- Input Module for EXWM -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2015-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Chris Feng <chris.w.feng@gmail.com>
|
||||
|
||||
|
@ -45,9 +45,9 @@
|
|||
|
||||
(defcustom exwm-input-prefix-keys
|
||||
'(?\C-x ?\C-u ?\C-h ?\M-x ?\M-` ?\M-& ?\M-:)
|
||||
"List of prefix keys EXWM should forward to Emacs when in line-mode.
|
||||
"List of prefix keys EXWM should forward to Emacs when in `line-mode'.
|
||||
|
||||
The point is to make keys like 'C-x C-f' forwarded to Emacs in line-mode.
|
||||
The point is to make keys like 'C-x C-f' forwarded to Emacs in `line-mode'.
|
||||
There is no need to add prefix keys for global/simulation keys or those
|
||||
defined in `exwm-mode-map' here."
|
||||
:type '(repeat key-sequence)
|
||||
|
@ -87,7 +87,7 @@ defined in `exwm-mode-map' here."
|
|||
value))))
|
||||
|
||||
(defcustom exwm-input-line-mode-passthrough nil
|
||||
"Non-nil makes 'line-mode' forward all events to Emacs."
|
||||
"Non-nil makes `line-mode' forward all events to Emacs."
|
||||
:type 'boolean)
|
||||
|
||||
;; Input focus update requests should be accumulated for a short time
|
||||
|
@ -115,13 +115,13 @@ defined in `exwm-mode-map' here."
|
|||
(defvar exwm-input--local-simulation-keys nil
|
||||
"Whether simulation keys are local.")
|
||||
|
||||
(defvar exwm-input--simulation-keys nil "Simulation keys in line-mode.")
|
||||
(defvar exwm-input--simulation-keys nil "Simulation keys in `line-mode'.")
|
||||
|
||||
(defvar exwm-input--skip-buffer-list-update nil
|
||||
"Skip the upcoming 'buffer-list-update'.")
|
||||
"Skip the upcoming `buffer-list-update'.")
|
||||
|
||||
(defvar exwm-input--temp-line-mode nil
|
||||
"Non-nil indicates it's in temporary line-mode for char-mode.")
|
||||
"Non-nil indicates it's in temporary line-mode for `char-mode'.")
|
||||
|
||||
(defvar exwm-input--timestamp-atom nil)
|
||||
|
||||
|
@ -452,9 +452,12 @@ ARGS are additional arguments to CALLBACK."
|
|||
(t
|
||||
;; Replay this event by default.
|
||||
(setq fake-last-command t)
|
||||
(setq mode xcb:Allow:ReplayPointer))))
|
||||
(setq mode xcb:Allow:ReplayPointer)))
|
||||
(when fake-last-command
|
||||
(if buffer
|
||||
(with-current-buffer buffer
|
||||
(exwm-input--fake-last-command))
|
||||
(exwm-input--fake-last-command))))
|
||||
(xcb:+request exwm--connection
|
||||
(make-instance 'xcb:AllowEvents :mode mode :time xcb:Time:CurrentTime))
|
||||
(xcb:flush exwm--connection))
|
||||
|
@ -584,9 +587,11 @@ instead."
|
|||
(and (= emacs-major-version 26)
|
||||
(< emacs-minor-version 2)))
|
||||
(defsubst exwm-input--unread-event (event)
|
||||
(declare (indent defun))
|
||||
(setq unread-command-events
|
||||
(append unread-command-events (list event))))
|
||||
(defsubst exwm-input--unread-event (event)
|
||||
(declare (indent defun))
|
||||
(setq unread-command-events
|
||||
(append unread-command-events `((t . ,event)))))))
|
||||
|
||||
|
@ -663,8 +668,26 @@ Current buffer must be an `exwm-mode' buffer."
|
|||
(defun exwm-input--fake-last-command ()
|
||||
"Fool some packages into thinking there is a change in the buffer."
|
||||
(setq last-command #'exwm-input--noop)
|
||||
;; The Emacs manual says:
|
||||
;; > Quitting is suppressed while running pre-command-hook and
|
||||
;; > post-command-hook. If an error happens while executing one of these
|
||||
;; > hooks, it does not terminate execution of the hook; instead the error is
|
||||
;; > silenced and the function in which the error occurred is removed from the
|
||||
;; > hook.
|
||||
;; We supress errors but neither continue execution nor we remove from the
|
||||
;; hook.
|
||||
(condition-case err
|
||||
(run-hooks 'pre-command-hook)
|
||||
(run-hooks 'post-command-hook))
|
||||
((error)
|
||||
(exwm--log "Error occurred while running pre-command-hook: %s"
|
||||
(error-message-string err))
|
||||
(xcb-debug:backtrace)))
|
||||
(condition-case err
|
||||
(run-hooks 'post-command-hook)
|
||||
((error)
|
||||
(exwm--log "Error occurred while running post-command-hook: %s"
|
||||
(error-message-string err))
|
||||
(xcb-debug:backtrace))))
|
||||
|
||||
(defun exwm-input--on-KeyPress-line-mode (key-press raw-data)
|
||||
"Parse X KeyPress event to Emacs key event and then feed the command loop."
|
||||
|
@ -708,7 +731,7 @@ Current buffer must be an `exwm-mode' buffer."
|
|||
(xcb:flush exwm--connection))))
|
||||
|
||||
(defun exwm-input--on-KeyPress-char-mode (key-press &optional _raw-data)
|
||||
"Handle KeyPress event in char-mode."
|
||||
"Handle KeyPress event in `char-mode'."
|
||||
(with-slots (detail state) key-press
|
||||
(let ((keysym (xcb:keysyms:keycode->keysym exwm--connection detail state))
|
||||
event raw-event)
|
||||
|
@ -749,7 +772,7 @@ button event."
|
|||
xcb:Allow:ReplayPointer))))
|
||||
|
||||
(defun exwm-input--on-ButtonPress-char-mode ()
|
||||
"Handle button events in char-mode.
|
||||
"Handle button events in `char-mode'.
|
||||
The return value is used as event_mode to release the original
|
||||
button event."
|
||||
(exwm--log)
|
||||
|
@ -825,7 +848,7 @@ button event."
|
|||
|
||||
;;;###autoload
|
||||
(defun exwm-input-grab-keyboard (&optional id)
|
||||
"Switch to line-mode."
|
||||
"Switch to `line-mode'."
|
||||
(interactive (list (when (derived-mode-p 'exwm-mode)
|
||||
(exwm--buffer->id (window-buffer)))))
|
||||
(when id
|
||||
|
@ -836,7 +859,7 @@ button event."
|
|||
|
||||
;;;###autoload
|
||||
(defun exwm-input-release-keyboard (&optional id)
|
||||
"Switch to char-mode."
|
||||
"Switch to `char-mode`."
|
||||
(interactive (list (when (derived-mode-p 'exwm-mode)
|
||||
(exwm--buffer->id (window-buffer)))))
|
||||
(when id
|
||||
|
@ -847,7 +870,7 @@ button event."
|
|||
|
||||
;;;###autoload
|
||||
(defun exwm-input-toggle-keyboard (&optional id)
|
||||
"Toggle between 'line-mode' and 'char-mode'."
|
||||
"Toggle between `line-mode' and `char-mode'."
|
||||
(interactive (list (when (derived-mode-p 'exwm-mode)
|
||||
(exwm--buffer->id (window-buffer)))))
|
||||
(when id
|
||||
|
@ -964,7 +987,7 @@ multiple keys. If END-KEY is non-nil, stop sending keys if it's pressed."
|
|||
|
||||
It is an alist of the form (original-key . simulated-key), where both
|
||||
original-key and simulated-key are key sequences. Original-key is what you
|
||||
type to an X window in line-mode which then gets translated to simulated-key
|
||||
type to an X window in `line-mode' which then gets translated to simulated-key
|
||||
by EXWM and forwarded to the X window.
|
||||
|
||||
Notes:
|
||||
|
@ -1075,7 +1098,7 @@ where both ORIGINAL-KEY and SIMULATED-KEY are key sequences."
|
|||
(defmacro exwm-input-invoke-factory (keys)
|
||||
"Make a command that invokes KEYS when called.
|
||||
|
||||
One use is to access the keymap bound to KEYS (as prefix keys) in char-mode."
|
||||
One use is to access the keymap bound to KEYS (as prefix keys) in `char-mode'."
|
||||
(let* ((keys (kbd keys))
|
||||
(description (key-description keys)))
|
||||
`(defun ,(intern (concat "exwm-input--invoke--" description)) ()
|
||||
|
@ -1215,12 +1238,13 @@ One use is to access the keymap bound to KEYS (as prefix keys) in char-mode."
|
|||
(when exwm-input--update-focus-timer
|
||||
(cancel-timer exwm-input--update-focus-timer))
|
||||
;; Make input focus working even without a WM.
|
||||
(when (slot-value exwm--connection 'connected)
|
||||
(xcb:+request exwm--connection
|
||||
(make-instance 'xcb:SetInputFocus
|
||||
:revert-to xcb:InputFocus:PointerRoot
|
||||
:focus exwm--root
|
||||
:time xcb:Time:CurrentTime))
|
||||
(xcb:flush exwm--connection))
|
||||
(xcb:flush exwm--connection)))
|
||||
|
||||
|
||||
|
||||
|
|
29
third_party/exwm/exwm-layout.el
vendored
29
third_party/exwm/exwm-layout.el
vendored
|
@ -1,6 +1,6 @@
|
|||
;;; exwm-layout.el --- Layout Module for EXWM -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2015-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Chris Feng <chris.w.feng@gmail.com>
|
||||
|
||||
|
@ -57,6 +57,7 @@
|
|||
(declare-function exwm-input--grab-keyboard "exwm-input.el")
|
||||
(declare-function exwm-input-grab-keyboard "exwm-input.el")
|
||||
(declare-function exwm-workspace--active-p "exwm-workspace.el" (frame))
|
||||
(declare-function exwm-workspace--get-geometry "exwm-workspace.el" (frame))
|
||||
(declare-function exwm-workspace--minibuffer-own-frame-p "exwm-workspace.el")
|
||||
(declare-function exwm-workspace--workspace-p "exwm-workspace.el"
|
||||
(workspace))
|
||||
|
@ -64,7 +65,7 @@
|
|||
(frame-or-index &optional id))
|
||||
|
||||
(defun exwm-layout--set-state (id state)
|
||||
"Set WM_STATE."
|
||||
"Set WM_STATE of X window ID to STATE."
|
||||
(exwm--log "id=#x%x" id)
|
||||
(xcb:+request exwm--connection
|
||||
(make-instance 'xcb:icccm:set-WM_STATE
|
||||
|
@ -73,24 +74,28 @@
|
|||
(setq exwm-state state)))
|
||||
|
||||
(defun exwm-layout--iconic-state-p (&optional id)
|
||||
"Check whether X window ID is in iconic state."
|
||||
(= xcb:icccm:WM_STATE:IconicState
|
||||
(if id
|
||||
(buffer-local-value 'exwm-state (exwm--id->buffer id))
|
||||
exwm-state)))
|
||||
|
||||
(defun exwm-layout--set-ewmh-state (xwin)
|
||||
"Set _NET_WM_STATE."
|
||||
(with-current-buffer (exwm--id->buffer xwin)
|
||||
(defun exwm-layout--set-ewmh-state (id)
|
||||
"Set _NET_WM_STATE of X window ID to the value of variable `exwm--ewmh-state'."
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(xcb:+request exwm--connection
|
||||
(make-instance 'xcb:ewmh:set-_NET_WM_STATE
|
||||
:window exwm--id
|
||||
:data exwm--ewmh-state))))
|
||||
|
||||
(defun exwm-layout--fullscreen-p ()
|
||||
"Check whether current `exwm-mode' buffer is in fullscreen state."
|
||||
(when (derived-mode-p 'exwm-mode)
|
||||
(memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)))
|
||||
|
||||
(defun exwm-layout--auto-iconify ()
|
||||
"Helper function to iconify unused X windows.
|
||||
See variable `exwm-layout-auto-iconify'."
|
||||
(when (and exwm-layout-auto-iconify
|
||||
(not exwm-transient-for))
|
||||
(let ((xwin exwm--id)
|
||||
|
@ -210,7 +215,7 @@
|
|||
|
||||
;;;###autoload
|
||||
(cl-defun exwm-layout-unset-fullscreen (&optional id)
|
||||
"Restore window from fullscreen state."
|
||||
"Restore X window ID from fullscreen state."
|
||||
(interactive)
|
||||
(exwm--log "id=#x%x" (or id 0))
|
||||
(unless (and (or id (derived-mode-p 'exwm-mode))
|
||||
|
@ -241,7 +246,7 @@
|
|||
|
||||
;;;###autoload
|
||||
(cl-defun exwm-layout-toggle-fullscreen (&optional id)
|
||||
"Toggle fullscreen mode."
|
||||
"Toggle fullscreen mode of X window ID."
|
||||
(interactive (list (exwm--buffer->id (window-buffer))))
|
||||
(exwm--log "id=#x%x" (or id 0))
|
||||
(unless (or id (derived-mode-p 'exwm-mode))
|
||||
|
@ -298,7 +303,8 @@ selected by `other-buffer'."
|
|||
clients clients-floating))))))
|
||||
|
||||
(defun exwm-layout--refresh (&optional frame)
|
||||
"Refresh layout."
|
||||
"Refresh layout of FRAME.
|
||||
If FRAME is nil, refresh layout of selected frame."
|
||||
;; `window-size-change-functions' sets this argument while
|
||||
;; `window-configuration-change-hook' makes the frame selected.
|
||||
(unless frame
|
||||
|
@ -408,11 +414,12 @@ selected by `other-buffer'."
|
|||
(frame (window-frame mini-window)))
|
||||
(when (exwm-workspace--workspace-p frame)
|
||||
(exwm--defer 0 (lambda ()
|
||||
(when (< 1 (window-height mini-window)))
|
||||
(exwm-layout--refresh frame))))))
|
||||
(when (< 1 (window-height mini-window))
|
||||
(exwm-layout--refresh frame)))))))
|
||||
|
||||
(defun exwm-layout--on-echo-area-change (&optional dirty)
|
||||
"Run when message arrives or in `echo-area-clear-hook' to refresh layout."
|
||||
"Run when message arrives or in `echo-area-clear-hook' to refresh layout.
|
||||
If DIRTY is non-nil, refresh layout immediately."
|
||||
(let ((frame (window-frame (active-minibuffer-window)))
|
||||
(msg (current-message)))
|
||||
;; Check whether the frame where current window's minibuffer resides (not
|
||||
|
|
65
third_party/exwm/exwm-manage.el
vendored
65
third_party/exwm/exwm-manage.el
vendored
|
@ -1,7 +1,7 @@
|
|||
;;; exwm-manage.el --- Window Management Module for -*- lexical-binding: t -*-
|
||||
;;; EXWM
|
||||
|
||||
;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2015-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Chris Feng <chris.w.feng@gmail.com>
|
||||
|
||||
|
@ -34,8 +34,8 @@
|
|||
:group 'exwm)
|
||||
|
||||
(defcustom exwm-manage-finish-hook nil
|
||||
"Normal hook run after a window is just managed, in the context of the
|
||||
corresponding buffer."
|
||||
"Normal hook run after a window is just managed.
|
||||
This hook runs in the context of the corresponding `exwm-mode' buffer."
|
||||
:type 'hook)
|
||||
|
||||
(defcustom exwm-manage-force-tiling nil
|
||||
|
@ -157,7 +157,6 @@ want to match against EXWM internal variables such as `exwm-title',
|
|||
(defvar exwm-workspace--id-struts-alist)
|
||||
(defvar exwm-workspace--list)
|
||||
(defvar exwm-workspace--switch-history-outdated)
|
||||
(defvar exwm-workspace--workareas)
|
||||
(defvar exwm-workspace-current-index)
|
||||
(declare-function exwm--update-class "exwm.el" (id &optional force))
|
||||
(declare-function exwm--update-hints "exwm.el" (id &optional force))
|
||||
|
@ -170,17 +169,22 @@ want to match against EXWM internal variables such as `exwm-title',
|
|||
(declare-function exwm--update-window-type "exwm.el" (id &optional force))
|
||||
(declare-function exwm-floating--set-floating "exwm-floating.el" (id))
|
||||
(declare-function exwm-floating--unset-floating "exwm-floating.el" (id))
|
||||
(declare-function exwm-input-grab-keyboard "exwm-input.el")
|
||||
(declare-function exwm-input-grab-keyboard "exwm-input.el" (&optional id))
|
||||
(declare-function exwm-input-release-keyboard "exwm-input.el" (&optional id))
|
||||
(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-layout-set-fullscreen "exwm-layout.el" (&optional id))
|
||||
(declare-function exwm-workspace--get-geometry "exwm-workspace.el" (frame))
|
||||
(declare-function exwm-workspace--position "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-workareas "exwm-workspace.el" ())
|
||||
(declare-function exwm-workspace--workarea "exwm-workspace.el" (frame))
|
||||
|
||||
(defun exwm-manage--update-geometry (id &optional force)
|
||||
"Update window geometry."
|
||||
"Update geometry of X window ID.
|
||||
Override current geometry if FORCE is non-nil."
|
||||
(exwm--log "id=#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(unless (and exwm--geometry (not force))
|
||||
|
@ -196,7 +200,7 @@ want to match against EXWM internal variables such as `exwm-title',
|
|||
:height (/ (x-display-pixel-height) 2))))))))
|
||||
|
||||
(defun exwm-manage--update-ewmh-state (id)
|
||||
"Update _NET_WM_STATE."
|
||||
"Update _NET_WM_STATE of X window ID."
|
||||
(exwm--log "id=#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(unless exwm--ewmh-state
|
||||
|
@ -207,7 +211,8 @@ want to match against EXWM internal variables such as `exwm-title',
|
|||
(setq exwm--ewmh-state (append (slot-value reply 'value) nil)))))))
|
||||
|
||||
(defun exwm-manage--update-mwm-hints (id &optional force)
|
||||
"Update _MOTIF_WM_HINTS."
|
||||
"Update _MOTIF_WM_HINTS of X window ID.
|
||||
Override current hinds if FORCE is non-nil."
|
||||
(exwm--log "id=#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(unless (and (not exwm--mwm-hints-decorations) (not force))
|
||||
|
@ -326,12 +331,8 @@ want to match against EXWM internal variables such as `exwm-title',
|
|||
(with-slots (x y width height) exwm--geometry
|
||||
;; Center window of type _NET_WM_WINDOW_TYPE_SPLASH
|
||||
(when (memq xcb:Atom:_NET_WM_WINDOW_TYPE_SPLASH exwm-window-type)
|
||||
(let* ((workarea (elt exwm-workspace--workareas
|
||||
(exwm-workspace--position exwm--frame)))
|
||||
(x* (aref workarea 0))
|
||||
(y* (aref workarea 1))
|
||||
(width* (aref workarea 2))
|
||||
(height* (aref workarea 3)))
|
||||
(with-slots ((x* x) (y* y) (width* width) (height* height))
|
||||
(exwm-workspace--workarea exwm--frame)
|
||||
(exwm--set-geometry id
|
||||
(+ x* (/ (- width* width) 2))
|
||||
(+ y* (/ (- height* height) 2))
|
||||
|
@ -415,7 +416,7 @@ want to match against EXWM internal variables such as `exwm-title',
|
|||
"Unmanage window ID.
|
||||
|
||||
If WITHDRAW-ONLY is non-nil, the X window will be properly placed back to the
|
||||
root window. Set WITHDRAW-ONLY to 'quit if this functions is used when window
|
||||
root window. Set WITHDRAW-ONLY to `quit' if this functions is used when window
|
||||
manager is shutting down."
|
||||
(let ((buffer (exwm--id->buffer id)))
|
||||
(exwm--log "Unmanage #x%x (buffer: %s, widthdraw: %s)"
|
||||
|
@ -430,7 +431,9 @@ manager is shutting down."
|
|||
(exwm-workspace--update-workareas)
|
||||
(dolist (f exwm-workspace--list)
|
||||
(exwm-workspace--set-fullscreen f)))
|
||||
(when (buffer-live-p buffer)
|
||||
(when (and (buffer-live-p buffer)
|
||||
;; Invoked from `exwm-manage--exit' upon disconnection.
|
||||
(slot-value exwm--connection 'connected))
|
||||
(with-current-buffer buffer
|
||||
;; Unmap the X window.
|
||||
(xcb:+request exwm--connection
|
||||
|
@ -512,8 +515,11 @@ manager is shutting down."
|
|||
|
||||
(defun exwm-manage--kill-buffer-query-function ()
|
||||
"Run in `kill-buffer-query-functions'."
|
||||
(exwm--log "id=#x%x; buffer=%s" exwm--id (current-buffer))
|
||||
(exwm--log "id=#x%x; buffer=%s" (or exwm--id 0) (current-buffer))
|
||||
(catch 'return
|
||||
(when (or (not exwm--connection)
|
||||
(not (slot-value exwm--connection 'connected)))
|
||||
(throw 'return t))
|
||||
(when (or (not exwm--id)
|
||||
(xcb:+request-checked+request-check exwm--connection
|
||||
(make-instance 'xcb:ChangeWindowAttributes
|
||||
|
@ -590,7 +596,8 @@ Would you like to kill it? "
|
|||
(throw 'return nil)))))
|
||||
|
||||
(defun exwm-manage--kill-client (&optional id)
|
||||
"Kill an X client."
|
||||
"Kill X client ID.
|
||||
If ID is nil, kill X window corresponding to current buffer."
|
||||
(unless id (setq id (exwm--buffer->id (current-buffer))))
|
||||
(exwm--log "id=#x%x" id)
|
||||
(let* ((response (xcb:+request-unchecked+reply exwm--connection
|
||||
|
@ -608,14 +615,16 @@ Would you like to kill it? "
|
|||
(xcb:flush exwm--connection)))
|
||||
|
||||
(defun exwm-manage--add-frame (frame)
|
||||
"Run in `after-make-frame-functions'."
|
||||
"Run in `after-make-frame-functions'.
|
||||
FRAME is the newly created frame."
|
||||
(exwm--log "frame=%s" frame)
|
||||
(when (display-graphic-p frame)
|
||||
(push (string-to-number (frame-parameter frame 'outer-window-id))
|
||||
exwm-manage--frame-outer-id-list)))
|
||||
|
||||
(defun exwm-manage--remove-frame (frame)
|
||||
"Run in `delete-frame-functions'."
|
||||
"Run in `delete-frame-functions'.
|
||||
FRAME is the frame to be deleted."
|
||||
(exwm--log "frame=%s" frame)
|
||||
(when (display-graphic-p frame)
|
||||
(setq exwm-manage--frame-outer-id-list
|
||||
|
@ -623,7 +632,8 @@ Would you like to kill it? "
|
|||
exwm-manage--frame-outer-id-list))))
|
||||
|
||||
(defun exwm-manage--on-ConfigureRequest (data _synthetic)
|
||||
"Handle ConfigureRequest event."
|
||||
"Handle ConfigureRequest event.
|
||||
DATA contains unmarshalled ConfigureRequest event data."
|
||||
(exwm--log)
|
||||
(let ((obj (make-instance 'xcb:ConfigureRequest))
|
||||
buffer edges width-delta height-delta)
|
||||
|
@ -713,7 +723,8 @@ border-width: %d; sibling: #x%x; stack-mode: %d"
|
|||
(xcb:flush exwm--connection))
|
||||
|
||||
(defun exwm-manage--on-MapRequest (data _synthetic)
|
||||
"Handle MapRequest event."
|
||||
"Handle MapRequest event.
|
||||
DATA contains unmarshalled MapRequest event data."
|
||||
(let ((obj (make-instance 'xcb:MapRequest)))
|
||||
(xcb:unmarshal obj data)
|
||||
(with-slots (parent window) obj
|
||||
|
@ -733,7 +744,8 @@ border-width: %d; sibling: #x%x; stack-mode: %d"
|
|||
(exwm-manage--manage-window window))))))
|
||||
|
||||
(defun exwm-manage--on-UnmapNotify (data _synthetic)
|
||||
"Handle UnmapNotify event."
|
||||
"Handle UnmapNotify event.
|
||||
DATA contains unmarshalled UnmapNotify event data."
|
||||
(let ((obj (make-instance 'xcb:UnmapNotify)))
|
||||
(xcb:unmarshal obj data)
|
||||
(with-slots (window) obj
|
||||
|
@ -741,7 +753,8 @@ border-width: %d; sibling: #x%x; stack-mode: %d"
|
|||
(exwm-manage--unmanage-window window t))))
|
||||
|
||||
(defun exwm-manage--on-MapNotify (data _synthetic)
|
||||
"Handle MapNotify event."
|
||||
"Handle MapNotify event.
|
||||
DATA contains unmarshalled MapNotify event data."
|
||||
(let ((obj (make-instance 'xcb:MapNotify)))
|
||||
(xcb:unmarshal obj data)
|
||||
(with-slots (window) obj
|
||||
|
@ -766,7 +779,9 @@ border-width: %d; sibling: #x%x; stack-mode: %d"
|
|||
(xcb:flush exwm--connection)))))
|
||||
|
||||
(defun exwm-manage--on-DestroyNotify (data synthetic)
|
||||
"Handle DestroyNotify event."
|
||||
"Handle DestroyNotify event.
|
||||
DATA contains unmarshalled DestroyNotify event data.
|
||||
SYNTHETIC indicates whether the event is a synthetic event."
|
||||
(unless synthetic
|
||||
(exwm--log)
|
||||
(let ((obj (make-instance 'xcb:DestroyNotify)))
|
||||
|
|
4
third_party/exwm/exwm-randr.el
vendored
4
third_party/exwm/exwm-randr.el
vendored
|
@ -1,6 +1,6 @@
|
|||
;;; exwm-randr.el --- RandR Module for EXWM -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2015-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Chris Feng <chris.w.feng@gmail.com>
|
||||
|
||||
|
@ -52,6 +52,8 @@
|
|||
(require 'exwm-core)
|
||||
(require 'exwm-workspace)
|
||||
|
||||
(declare-function x-get-atom-name "C source code" (VALUE &optional FRAME))
|
||||
|
||||
(defgroup exwm-randr nil
|
||||
"RandR."
|
||||
:version "25.3"
|
||||
|
|
48
third_party/exwm/exwm-systemtray.el
vendored
48
third_party/exwm/exwm-systemtray.el
vendored
|
@ -1,7 +1,7 @@
|
|||
;;; exwm-systemtray.el --- System Tray Module for -*- lexical-binding: t -*-
|
||||
;;; EXWM
|
||||
|
||||
;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2016-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Chris Feng <chris.w.feng@gmail.com>
|
||||
|
||||
|
@ -38,6 +38,8 @@
|
|||
(require 'exwm-core)
|
||||
(require 'exwm-workspace)
|
||||
|
||||
(declare-function exwm-workspace--workarea "exwm-workspace.el" (frame))
|
||||
|
||||
(defclass exwm-systemtray--icon ()
|
||||
((width :initarg :width)
|
||||
(height :initarg :height)
|
||||
|
@ -47,7 +49,7 @@
|
|||
(defclass xcb:systemtray:-ClientMessage
|
||||
(xcb:icccm:--ClientMessage xcb:ClientMessage)
|
||||
((format :initform 32)
|
||||
(type :initform xcb:Atom:MANAGER)
|
||||
(type :initform 'xcb:Atom:MANAGER)
|
||||
(time :initarg :time :type xcb:TIMESTAMP) ;new slot
|
||||
(selection :initarg :selection :type xcb:ATOM) ;new slot
|
||||
(owner :initarg :owner :type xcb:WINDOW)) ;new slot
|
||||
|
@ -119,7 +121,7 @@ using 32-bit depth. Using `workspace-background' instead.")
|
|||
(defvar xcb:Atom:_NET_SYSTEM_TRAY_S0)
|
||||
|
||||
(defun exwm-systemtray--embed (icon)
|
||||
"Embed an icon."
|
||||
"Embed an ICON."
|
||||
(exwm--log "Try to embed #x%x" icon)
|
||||
(let ((info (xcb:+request-unchecked+reply exwm-systemtray--connection
|
||||
(make-instance 'xcb:xembed:get-_XEMBED_INFO
|
||||
|
@ -208,7 +210,7 @@ using 32-bit depth. Using `workspace-background' instead.")
|
|||
(exwm-systemtray--refresh))))
|
||||
|
||||
(defun exwm-systemtray--unembed (icon)
|
||||
"Unembed an icon."
|
||||
"Unembed an ICON."
|
||||
(exwm--log "Unembed #x%x" icon)
|
||||
(xcb:+request exwm-systemtray--connection
|
||||
(make-instance 'xcb:UnmapWindow :window icon))
|
||||
|
@ -240,14 +242,13 @@ using 32-bit depth. Using `workspace-background' instead.")
|
|||
(setq x (+ x (slot-value (cdr pair) 'width)
|
||||
exwm-systemtray-icon-gap))
|
||||
(setq map t)))
|
||||
(let ((workarea (elt exwm-workspace--workareas
|
||||
exwm-workspace-current-index)))
|
||||
(let ((workarea (exwm-workspace--workarea exwm-workspace-current-index)))
|
||||
(xcb:+request exwm-systemtray--connection
|
||||
(make-instance 'xcb:ConfigureWindow
|
||||
:window exwm-systemtray--embedder-window
|
||||
:value-mask (logior xcb:ConfigWindow:X
|
||||
xcb:ConfigWindow:Width)
|
||||
:x (- (aref workarea 2) x)
|
||||
:x (- (slot-value workarea 'width) x)
|
||||
:width x)))
|
||||
(when map
|
||||
(xcb:+request exwm-systemtray--connection
|
||||
|
@ -330,7 +331,8 @@ indicate how to support actual transparency."
|
|||
(<= planes 24))))
|
||||
|
||||
(defun exwm-systemtray--on-DestroyNotify (data _synthetic)
|
||||
"Unembed icons on DestroyNotify."
|
||||
"Unembed icons on DestroyNotify.
|
||||
Argument DATA contains the raw event data."
|
||||
(exwm--log)
|
||||
(let ((obj (make-instance 'xcb:DestroyNotify)))
|
||||
(xcb:unmarshal obj data)
|
||||
|
@ -339,7 +341,8 @@ indicate how to support actual transparency."
|
|||
(exwm-systemtray--unembed window)))))
|
||||
|
||||
(defun exwm-systemtray--on-ReparentNotify (data _synthetic)
|
||||
"Unembed icons on ReparentNotify."
|
||||
"Unembed icons on ReparentNotify.
|
||||
Argument DATA contains the raw event data."
|
||||
(exwm--log)
|
||||
(let ((obj (make-instance 'xcb:ReparentNotify)))
|
||||
(xcb:unmarshal obj data)
|
||||
|
@ -349,7 +352,8 @@ indicate how to support actual transparency."
|
|||
(exwm-systemtray--unembed window)))))
|
||||
|
||||
(defun exwm-systemtray--on-ResizeRequest (data _synthetic)
|
||||
"Resize the tray icon on ResizeRequest."
|
||||
"Resize the tray icon on ResizeRequest.
|
||||
Argument DATA contains the raw event data."
|
||||
(exwm--log)
|
||||
(let ((obj (make-instance 'xcb:ResizeRequest))
|
||||
attr)
|
||||
|
@ -377,7 +381,8 @@ indicate how to support actual transparency."
|
|||
(exwm-systemtray--refresh)))))
|
||||
|
||||
(defun exwm-systemtray--on-PropertyNotify (data _synthetic)
|
||||
"Map/Unmap the tray icon on PropertyNotify."
|
||||
"Map/Unmap the tray icon on PropertyNotify.
|
||||
Argument DATA contains the raw event data."
|
||||
(exwm--log)
|
||||
(let ((obj (make-instance 'xcb:PropertyNotify))
|
||||
attr info visible)
|
||||
|
@ -402,7 +407,8 @@ indicate how to support actual transparency."
|
|||
(exwm-systemtray--refresh))))))
|
||||
|
||||
(defun exwm-systemtray--on-ClientMessage (data _synthetic)
|
||||
"Handle client messages."
|
||||
"Handle client messages.
|
||||
Argument DATA contains the raw event data."
|
||||
(let ((obj (make-instance 'xcb:ClientMessage))
|
||||
opcode data32)
|
||||
(xcb:unmarshal obj data)
|
||||
|
@ -421,7 +427,8 @@ indicate how to support actual transparency."
|
|||
(exwm--log "Unknown opcode message: %s" obj)))))))
|
||||
|
||||
(defun exwm-systemtray--on-KeyPress (data _synthetic)
|
||||
"Forward all KeyPress events to Emacs frame."
|
||||
"Forward all KeyPress events to Emacs frame.
|
||||
Argument DATA contains the raw event data."
|
||||
(exwm--log)
|
||||
;; This function is only executed when there's no autohide minibuffer,
|
||||
;; a workspace frame has the input focus and the pointer is over a
|
||||
|
@ -450,9 +457,9 @@ indicate how to support actual transparency."
|
|||
(frame-parameter exwm-workspace--current
|
||||
'window-id))
|
||||
:x 0
|
||||
:y (- (elt (elt exwm-workspace--workareas
|
||||
:y (- (slot-value (exwm-workspace--workarea
|
||||
exwm-workspace-current-index)
|
||||
3)
|
||||
'height)
|
||||
exwm-workspace--frame-y-offset
|
||||
exwm-systemtray-height))))
|
||||
(exwm-systemtray--refresh-background-color)
|
||||
|
@ -471,9 +478,9 @@ indicate how to support actual transparency."
|
|||
(make-instance 'xcb:ConfigureWindow
|
||||
:window exwm-systemtray--embedder-window
|
||||
:value-mask xcb:ConfigWindow:Y
|
||||
:y (- (elt (elt exwm-workspace--workareas
|
||||
:y (- (slot-value (exwm-workspace--workarea
|
||||
exwm-workspace-current-index)
|
||||
3)
|
||||
'height)
|
||||
exwm-workspace--frame-y-offset
|
||||
exwm-systemtray-height))))
|
||||
(exwm-systemtray--refresh))
|
||||
|
@ -567,9 +574,9 @@ indicate how to support actual transparency."
|
|||
(exwm-workspace--update-offsets)
|
||||
(setq frame exwm-workspace--current
|
||||
;; Bottom aligned.
|
||||
y (- (elt (elt exwm-workspace--workareas
|
||||
y (- (slot-value (exwm-workspace--workarea
|
||||
exwm-workspace-current-index)
|
||||
3)
|
||||
'height)
|
||||
exwm-workspace--frame-y-offset
|
||||
exwm-systemtray-height)))
|
||||
(setq parent (string-to-number (frame-parameter frame 'window-id)))
|
||||
|
@ -652,6 +659,7 @@ indicate how to support actual transparency."
|
|||
"Exit the systemtray module."
|
||||
(exwm--log)
|
||||
(when exwm-systemtray--connection
|
||||
(when (slot-value exwm-systemtray--connection 'connected)
|
||||
;; Hide & reparent out the embedder before disconnection to prevent
|
||||
;; embedded icons from being reparented to an Emacs frame (which is the
|
||||
;; parent of the embedder).
|
||||
|
@ -664,7 +672,7 @@ indicate how to support actual transparency."
|
|||
:parent exwm--root
|
||||
:x 0
|
||||
:y 0))
|
||||
(xcb:disconnect exwm-systemtray--connection)
|
||||
(xcb:disconnect exwm-systemtray--connection))
|
||||
(setq exwm-systemtray--connection nil
|
||||
exwm-systemtray--list nil
|
||||
exwm-systemtray--selection-owner-window nil
|
||||
|
|
236
third_party/exwm/exwm-workspace.el
vendored
236
third_party/exwm/exwm-workspace.el
vendored
|
@ -1,6 +1,6 @@
|
|||
;;; exwm-workspace.el --- Workspace Module for EXWM -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 1015-2021 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 1015-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Chris Feng <chris.w.feng@gmail.com>
|
||||
|
||||
|
@ -39,8 +39,8 @@
|
|||
:type 'hook)
|
||||
|
||||
(defcustom exwm-workspace-list-change-hook nil
|
||||
"Normal hook run when the workspace list is changed (workspace added,
|
||||
deleted, moved, etc)."
|
||||
"Normal hook run when the workspace list is changed.
|
||||
This happens when a workspace is added, deleted, moved, etc."
|
||||
:type 'hook)
|
||||
|
||||
(defcustom exwm-workspace-show-all-buffers nil
|
||||
|
@ -74,8 +74,7 @@ A restart is required for this change to take effect."
|
|||
:type 'integer)
|
||||
|
||||
(defcustom exwm-workspace-switch-create-limit 10
|
||||
"Number of workspaces `exwm-workspace-switch-create' allowed to create
|
||||
each time."
|
||||
"Number of workspaces `exwm-workspace-switch-create' is allowed to create."
|
||||
:type 'integer)
|
||||
|
||||
(defvar exwm-workspace-current-index 0 "Index of current active workspace.")
|
||||
|
@ -150,8 +149,8 @@ Please manually run the hook `exwm-workspace-list-change-hook' afterwards.")
|
|||
|
||||
(defsubst exwm-workspace--position (frame)
|
||||
"Retrieve index of given FRAME in workspace list.
|
||||
|
||||
NIL if FRAME is not a workspace"
|
||||
NIL if FRAME is not a workspace."
|
||||
(declare (indent defun))
|
||||
(cl-position frame exwm-workspace--list))
|
||||
|
||||
(defsubst exwm-workspace--count ()
|
||||
|
@ -160,12 +159,23 @@ NIL if FRAME is not a workspace"
|
|||
|
||||
(defsubst exwm-workspace--workspace-p (frame)
|
||||
"Return t if FRAME is a workspace."
|
||||
(declare (indent defun))
|
||||
(memq frame exwm-workspace--list))
|
||||
|
||||
(defsubst exwm-workspace--workarea (frame)
|
||||
"Return workarea corresponding to FRAME.
|
||||
FRAME may be either a workspace frame or a workspace position."
|
||||
(declare (indent defun))
|
||||
(elt exwm-workspace--workareas
|
||||
(if (integerp frame)
|
||||
frame
|
||||
(exwm-workspace--position frame))))
|
||||
|
||||
(defvar exwm-workspace--switch-map nil
|
||||
"Keymap used for interactively selecting workspace.")
|
||||
|
||||
(defun exwm-workspace--init-switch-map ()
|
||||
"Initialize variable `exwm-workspace--switch-map'."
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map [t] (lambda () (interactive)))
|
||||
(define-key map "+" #'exwm-workspace--prompt-add)
|
||||
|
@ -216,7 +226,8 @@ NIL if FRAME is not a workspace"
|
|||
(t (user-error "[EXWM] Invalid workspace: %s" frame-or-index))))
|
||||
|
||||
(defun exwm-workspace--prompt-for-workspace (&optional prompt)
|
||||
"Prompt for a workspace, returning the workspace frame."
|
||||
"Prompt for a workspace, returning the workspace frame.
|
||||
Show PROMPT to the user if non-nil."
|
||||
(exwm-workspace--update-switch-history)
|
||||
(let* ((current-idx (exwm-workspace--position exwm-workspace--current))
|
||||
(history-add-new-input nil) ;prevent modifying history
|
||||
|
@ -331,63 +342,69 @@ NIL if FRAME is not a workspace"
|
|||
|
||||
(defun exwm-workspace--update-workareas ()
|
||||
"Update `exwm-workspace--workareas'."
|
||||
(let ((root-width (x-display-pixel-width))
|
||||
(let* ((root-width (x-display-pixel-width))
|
||||
(root-height (x-display-pixel-height))
|
||||
workareas
|
||||
edge width position
|
||||
delta)
|
||||
;; Calculate workareas with no struts.
|
||||
(if (frame-parameter (car exwm-workspace--list) 'exwm-geometry)
|
||||
;; Use the 'exwm-geometry' frame parameter if possible.
|
||||
(dolist (f exwm-workspace--list)
|
||||
(with-slots (x y width height) (frame-parameter f 'exwm-geometry)
|
||||
(setq workareas (append workareas
|
||||
(list (vector x y width height))))))
|
||||
;; Get workareas prior to struts.
|
||||
(workareas (mapcar
|
||||
(lambda (frame)
|
||||
(if-let (rect (frame-parameter frame 'exwm-geometry))
|
||||
;; Use the 'exwm-geometry' frame parameter if it
|
||||
;; exists. Make sure to clone it, will be modified
|
||||
;; below!
|
||||
(clone rect)
|
||||
;; Fall back to use the screen size.
|
||||
(let ((workarea (vector 0 0 root-width root-height)))
|
||||
(setq workareas (make-list (exwm-workspace--count) workarea))))
|
||||
(make-instance 'xcb:RECTANGLE
|
||||
:x 0
|
||||
:y 0
|
||||
:width root-width
|
||||
:height root-height)))
|
||||
exwm-workspace--list)))
|
||||
;; Exclude areas occupied by struts.
|
||||
(dolist (struts exwm-workspace--struts)
|
||||
(setq edge (aref struts 0)
|
||||
width (aref struts 1)
|
||||
position (aref struts 2))
|
||||
(let* ((edge (aref struts 0))
|
||||
(size (aref struts 1))
|
||||
(position (aref struts 2))
|
||||
(beg (and position (aref position 0)))
|
||||
(end (and position (aref position 1)))
|
||||
delta)
|
||||
(dolist (w workareas)
|
||||
(with-slots (x y width height) w
|
||||
(pcase edge
|
||||
;; Left and top are always processed first.
|
||||
(`left
|
||||
(setq delta (- (aref w 0) width))
|
||||
(when (and (< delta 0)
|
||||
('left
|
||||
(setq delta (- size x))
|
||||
(when (and (< 0 delta)
|
||||
(< delta width)
|
||||
(or (not position)
|
||||
(< (max (aref position 0) (aref w 1))
|
||||
(min (aref position 1)
|
||||
(+ (aref w 1) (aref w 3))))))
|
||||
(cl-incf (aref w 2) delta)
|
||||
(setf (aref w 0) width)))
|
||||
(`right
|
||||
(setq delta (- root-width (aref w 0) (aref w 2) width))
|
||||
(when (and (< delta 0)
|
||||
(< (max beg y)
|
||||
(min end (+ y height)))))
|
||||
(cl-decf width delta)
|
||||
(setf x size)))
|
||||
('right
|
||||
(setq delta (- size (- root-width x width)))
|
||||
(when (and (< 0 delta)
|
||||
(< delta width)
|
||||
(or (not position)
|
||||
(< (max (aref position 0) (aref w 1))
|
||||
(min (aref position 1)
|
||||
(+ (aref w 1) (aref w 3))))))
|
||||
(cl-incf (aref w 2) delta)))
|
||||
(`top
|
||||
(setq delta (- (aref w 1) width))
|
||||
(when (and (< delta 0)
|
||||
(< (max beg y)
|
||||
(min end (+ y height)))))
|
||||
(cl-decf width delta)))
|
||||
('top
|
||||
(setq delta (- size y))
|
||||
(when (and (< 0 delta)
|
||||
(< delta height)
|
||||
(or (not position)
|
||||
(< (max (aref position 0) (aref w 0))
|
||||
(min (aref position 1)
|
||||
(+ (aref w 0) (aref w 2))))))
|
||||
(cl-incf (aref w 3) delta)
|
||||
(setf (aref w 1) width)))
|
||||
(`bottom
|
||||
(setq delta (- root-height (aref w 1) (aref w 3) width))
|
||||
(when (and (< delta 0)
|
||||
(< (max beg x)
|
||||
(min end (+ x width)))))
|
||||
(cl-decf height delta)
|
||||
(setf y size)))
|
||||
('bottom
|
||||
(setq delta (- size (- root-height y height)))
|
||||
(when (and (< 0 delta)
|
||||
(< delta height)
|
||||
(or (not position)
|
||||
(< (max (aref position 0) (aref w 0))
|
||||
(min (aref position 1)
|
||||
(+ (aref w 0) (aref w 2))))))
|
||||
(cl-incf (aref w 3) delta))))))
|
||||
(< (max beg x)
|
||||
(min end (+ x width)))))
|
||||
(cl-decf height delta))))))))
|
||||
;; Save the result.
|
||||
(setq exwm-workspace--workareas workareas)
|
||||
(xcb:flush exwm--connection))
|
||||
|
@ -423,7 +440,8 @@ NIL if FRAME is not a workspace"
|
|||
exwm-workspace--window-y-offset (- (elt edges 1) y))))))))
|
||||
|
||||
(defun exwm-workspace--set-active (frame active)
|
||||
"Make frame FRAME active on its monitor."
|
||||
"Make frame FRAME active on its monitor.
|
||||
ACTIVE indicates whether to set the frame active or inactive."
|
||||
(exwm--log "active=%s; frame=%s" active frame)
|
||||
(set-frame-parameter frame 'exwm-active active)
|
||||
(if active
|
||||
|
@ -433,21 +451,16 @@ NIL if FRAME is not a workspace"
|
|||
(xcb:flush exwm--connection))
|
||||
|
||||
(defun exwm-workspace--active-p (frame)
|
||||
"Return non-nil if FRAME is active"
|
||||
"Return non-nil if FRAME is active."
|
||||
(frame-parameter frame 'exwm-active))
|
||||
|
||||
(defun exwm-workspace--set-fullscreen (frame)
|
||||
"Make frame FRAME fullscreen according to `exwm-workspace--workareas'."
|
||||
(exwm--log "frame=%s" frame)
|
||||
(let ((workarea (elt exwm-workspace--workareas
|
||||
(exwm-workspace--position frame)))
|
||||
(id (frame-parameter frame 'exwm-outer-id))
|
||||
(container (frame-parameter frame 'exwm-container))
|
||||
x y width height)
|
||||
(setq x (aref workarea 0)
|
||||
y (aref workarea 1)
|
||||
width (aref workarea 2)
|
||||
height (aref workarea 3))
|
||||
(let ((id (frame-parameter frame 'exwm-outer-id))
|
||||
(container (frame-parameter frame 'exwm-container)))
|
||||
(with-slots (x y width height)
|
||||
(exwm-workspace--workarea frame)
|
||||
(exwm--log "x=%s; y=%s; w=%s; h=%s" x y width height)
|
||||
(when (and (eq frame exwm-workspace--current)
|
||||
(exwm-workspace--minibuffer-own-frame-p))
|
||||
|
@ -456,7 +469,7 @@ NIL if FRAME is not a workspace"
|
|||
(exwm--set-geometry container x y width height)
|
||||
(exwm--set-geometry container x y 1 1))
|
||||
(exwm--set-geometry id nil nil width height)
|
||||
(xcb:flush exwm--connection))
|
||||
(xcb:flush exwm--connection)))
|
||||
;; This is only used for workspace initialization.
|
||||
(when exwm-workspace--fullscreen-frame-count
|
||||
(cl-incf exwm-workspace--fullscreen-frame-count)))
|
||||
|
@ -464,20 +477,20 @@ NIL if FRAME is not a workspace"
|
|||
(defun exwm-workspace--resize-minibuffer-frame ()
|
||||
"Resize minibuffer (and its container) to fit the size of workspace."
|
||||
(cl-assert (exwm-workspace--minibuffer-own-frame-p))
|
||||
(let ((workarea (elt exwm-workspace--workareas exwm-workspace-current-index))
|
||||
(let ((workarea (exwm-workspace--workarea exwm-workspace-current-index))
|
||||
(container (frame-parameter exwm-workspace--minibuffer
|
||||
'exwm-container))
|
||||
y width)
|
||||
(setq y (if (eq exwm-workspace-minibuffer-position 'top)
|
||||
(- (aref workarea 1)
|
||||
(- (slot-value workarea 'y)
|
||||
exwm-workspace--attached-minibuffer-height)
|
||||
;; Reset the frame size.
|
||||
(set-frame-height exwm-workspace--minibuffer 1)
|
||||
(redisplay) ;FIXME.
|
||||
(+ (aref workarea 1) (aref workarea 3)
|
||||
(+ (slot-value workarea 'y) (slot-value workarea 'height)
|
||||
(- (frame-pixel-height exwm-workspace--minibuffer))
|
||||
exwm-workspace--attached-minibuffer-height))
|
||||
width (aref workarea 2))
|
||||
width (slot-value workarea 'width))
|
||||
(xcb:+request exwm--connection
|
||||
(make-instance 'xcb:ConfigureWindow
|
||||
:window container
|
||||
|
@ -488,7 +501,7 @@ NIL if FRAME is not a workspace"
|
|||
xcb:ConfigWindow:Sibling
|
||||
0)
|
||||
xcb:ConfigWindow:StackMode)
|
||||
:x (aref workarea 0)
|
||||
:x (slot-value workarea 'x)
|
||||
:y y
|
||||
:width width
|
||||
:sibling exwm-manage--desktop
|
||||
|
@ -551,11 +564,13 @@ PREFIX-DIGITS is a list of the digits introduced so far."
|
|||
|
||||
;;;###autoload
|
||||
(defun exwm-workspace-switch (frame-or-index &optional force)
|
||||
"Switch to workspace INDEX (0-based).
|
||||
"Switch to workspace FRAME-OR-INDEX (0-based).
|
||||
|
||||
Query for the index if not specified when called interactively. Passing a
|
||||
workspace frame as the first option or making use of the rest options are
|
||||
for internal use only."
|
||||
for internal use only.
|
||||
|
||||
When FORCE is true, allow switching to current workspace."
|
||||
(interactive
|
||||
(list
|
||||
(cond
|
||||
|
@ -681,7 +696,7 @@ for internal use only."
|
|||
|
||||
;;;###autoload
|
||||
(defun exwm-workspace-switch-create (frame-or-index)
|
||||
"Switch to workspace INDEX or creating it first if it does not exist yet.
|
||||
"Switch to workspace FRAME-OR-INDEX creating it first non-existent.
|
||||
|
||||
Passing a workspace frame as the first option is for internal use only."
|
||||
(interactive
|
||||
|
@ -967,7 +982,7 @@ INDEX must not exceed the current number of workspaces."
|
|||
|
||||
;;;###autoload
|
||||
(defun exwm-workspace-switch-to-buffer (buffer-or-name)
|
||||
"Make the current Emacs window display another buffer."
|
||||
"Make selected window display BUFFER-OR-NAME."
|
||||
(interactive
|
||||
(let ((inhibit-quit t))
|
||||
;; Show all buffers
|
||||
|
@ -1019,7 +1034,7 @@ INDEX must not exceed the current number of workspaces."
|
|||
(switch-to-buffer buffer-or-name)))))
|
||||
|
||||
(defun exwm-workspace-rename-buffer (newname)
|
||||
"Rename a buffer."
|
||||
"Rename current buffer to NEWNAME."
|
||||
(let ((hidden (= ?\s (aref newname 0)))
|
||||
(basename (replace-regexp-in-string "<[0-9]+>$" "" newname))
|
||||
(counter 1)
|
||||
|
@ -1035,10 +1050,12 @@ INDEX must not exceed the current number of workspaces."
|
|||
buffer-list-update-hook)))
|
||||
(rename-buffer (concat (and hidden " ") newname)))))
|
||||
|
||||
(defun exwm-workspace--x-create-frame (orig-fun params)
|
||||
"Set override-redirect on the frame created by `x-create-frame'."
|
||||
(defun exwm-workspace--x-create-frame (orig-x-create-frame params)
|
||||
"Set override-redirect on the frame created by `x-create-frame'.
|
||||
ORIG-X-CREATE-FRAME is the advised function `x-create-frame'.
|
||||
PARAMS are the original arguments."
|
||||
(exwm--log)
|
||||
(let ((frame (funcall orig-fun params)))
|
||||
(let ((frame (funcall orig-x-create-frame params)))
|
||||
(xcb:+request exwm--connection
|
||||
(make-instance 'xcb:ChangeWindowAttributes
|
||||
:window (string-to-number
|
||||
|
@ -1057,7 +1074,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
|
||||
;;;###autoload
|
||||
(defun exwm-workspace-attach-minibuffer ()
|
||||
"Attach the minibuffer so that it always shows."
|
||||
"Attach the minibuffer making it always visible."
|
||||
(interactive)
|
||||
(exwm--log)
|
||||
(when (and (exwm-workspace--minibuffer-own-frame-p)
|
||||
|
@ -1109,7 +1126,9 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
(exwm-workspace-attach-minibuffer))))
|
||||
|
||||
(defun exwm-workspace--update-minibuffer-height (&optional echo-area)
|
||||
"Update the minibuffer frame height."
|
||||
"Update the minibuffer frame height.
|
||||
When ECHO-AREA is non-nil, take the size of the echo area into
|
||||
account when calculating the height."
|
||||
(when (exwm--terminal-p)
|
||||
(let ((height
|
||||
(with-current-buffer
|
||||
|
@ -1132,9 +1151,9 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
(set-frame-height exwm-workspace--minibuffer height))))
|
||||
|
||||
(defun exwm-workspace--on-ConfigureNotify (data _synthetic)
|
||||
"Adjust the container to fit the minibuffer frame."
|
||||
(let ((obj (make-instance 'xcb:ConfigureNotify))
|
||||
workarea y)
|
||||
"Adjust the container to fit the minibuffer frame.
|
||||
DATA contains unmarshalled ConfigureNotify event data."
|
||||
(let ((obj (make-instance 'xcb:ConfigureNotify)) y)
|
||||
(xcb:unmarshal obj data)
|
||||
(with-slots (window height) obj
|
||||
(when (eq (frame-parameter exwm-workspace--minibuffer 'exwm-outer-id)
|
||||
|
@ -1154,13 +1173,13 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
(when (/= (exwm-workspace--count) (length exwm-workspace--workareas))
|
||||
;; There is a chance the workareas are not updated timely.
|
||||
(exwm-workspace--update-workareas))
|
||||
(setq workarea (elt exwm-workspace--workareas
|
||||
exwm-workspace-current-index)
|
||||
y (if (eq exwm-workspace-minibuffer-position 'top)
|
||||
(- (aref workarea 1)
|
||||
(with-slots ((y* y) (height* height))
|
||||
(exwm-workspace--workarea exwm-workspace-current-index)
|
||||
(setq y (if (eq exwm-workspace-minibuffer-position 'top)
|
||||
(- y*
|
||||
exwm-workspace--attached-minibuffer-height)
|
||||
(+ (aref workarea 1) (aref workarea 3) (- height)
|
||||
exwm-workspace--attached-minibuffer-height)))
|
||||
(+ y* height* (- height)
|
||||
exwm-workspace--attached-minibuffer-height))))
|
||||
(xcb:+request exwm--connection
|
||||
(make-instance 'xcb:ConfigureWindow
|
||||
:window (frame-parameter exwm-workspace--minibuffer
|
||||
|
@ -1172,7 +1191,8 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
(xcb:flush exwm--connection)))))
|
||||
|
||||
(defun exwm-workspace--display-buffer (buffer alist)
|
||||
"Display BUFFER as if the current workspace is selected."
|
||||
"Display BUFFER as if the current workspace were selected.
|
||||
ALIST is an action alist, as accepted by function `display-buffer'."
|
||||
;; Only when the floating minibuffer frame is selected.
|
||||
;; This also protect this functions from being recursively called.
|
||||
(when (eq (selected-frame) exwm-workspace--minibuffer)
|
||||
|
@ -1224,7 +1244,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
(xcb:flush exwm--connection))
|
||||
|
||||
(defun exwm-workspace--on-minibuffer-setup ()
|
||||
"Run in minibuffer-setup-hook to show the minibuffer and its container."
|
||||
"Run in `minibuffer-setup-hook' to show the minibuffer and its container."
|
||||
(exwm--log)
|
||||
(when (and (= 1 (minibuffer-depth))
|
||||
(exwm--terminal-p))
|
||||
|
@ -1246,7 +1266,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
(window-preserve-size window)))))
|
||||
|
||||
(defun exwm-workspace--on-minibuffer-exit ()
|
||||
"Run in minibuffer-exit-hook to hide the minibuffer container."
|
||||
"Run in `minibuffer-exit-hook' to hide the minibuffer container."
|
||||
(exwm--log)
|
||||
(when (and (= 1 (minibuffer-depth))
|
||||
(exwm--terminal-p))
|
||||
|
@ -1280,7 +1300,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
#'exwm-workspace--echo-area-maybe-clear))))
|
||||
|
||||
(defun exwm-workspace--on-echo-area-clear ()
|
||||
"Run in echo-area-clear-hook to hide echo area container."
|
||||
"Run in `echo-area-clear-hook' to hide echo area container."
|
||||
(when (exwm--terminal-p)
|
||||
(unless (active-minibuffer-window)
|
||||
(exwm-workspace--hide-minibuffer))
|
||||
|
@ -1389,16 +1409,19 @@ Return nil if FRAME is the only workspace."
|
|||
(unless (eq frame nextw)
|
||||
nextw)))
|
||||
|
||||
(defun exwm-workspace--remove-frame-as-workspace (frame)
|
||||
"Stop treating frame FRAME as a workspace."
|
||||
(defun exwm-workspace--remove-frame-as-workspace (frame &optional quit)
|
||||
"Stop treating FRAME as a workspace.
|
||||
When QUIT is non-nil cleanup avoid communicating with the X server."
|
||||
;; TODO: restore all frame parameters (e.g. exwm-workspace, buffer-predicate,
|
||||
;; etc)
|
||||
(exwm--log "Removing frame `%s' as workspace" frame)
|
||||
(unless quit
|
||||
(let* ((next-frame (exwm-workspace--get-next-workspace frame))
|
||||
(following-frames (cdr (memq frame exwm-workspace--list))))
|
||||
;; Need to remove the workspace from the list for the correct calculation of
|
||||
;; indexes below.
|
||||
(setq exwm-workspace--list (delete frame exwm-workspace--list))
|
||||
;; Move the windows to the next workspace and switch to it.
|
||||
(unless next-frame
|
||||
;; The user managed to delete the last workspace, so create a new one.
|
||||
(exwm--log "Last workspace deleted; create a new one")
|
||||
|
@ -1414,7 +1437,7 @@ Return nil if FRAME is the only workspace."
|
|||
(exwm-workspace--set-desktop (car pair)))))
|
||||
;; If the current workspace is deleted, switch to next one.
|
||||
(when (eq frame exwm-workspace--current)
|
||||
(exwm-workspace-switch next-frame)))
|
||||
(exwm-workspace-switch next-frame))))
|
||||
;; Reparent out the frame.
|
||||
(let ((outer-id (frame-parameter frame 'exwm-outer-id)))
|
||||
(xcb:+request exwm--connection
|
||||
|
@ -1448,11 +1471,12 @@ Return nil if FRAME is the only workspace."
|
|||
;; Update EWMH properties.
|
||||
(exwm-workspace--update-ewmh-props)
|
||||
;; Update switch history.
|
||||
(unless quit
|
||||
(setq exwm-workspace--switch-history-outdated t)
|
||||
(run-hooks 'exwm-workspace-list-change-hook))
|
||||
(run-hooks 'exwm-workspace-list-change-hook)))
|
||||
|
||||
(defun exwm-workspace--on-delete-frame (frame)
|
||||
"Hook run upon `delete-frame' that tears down FRAME's configuration as a workspace."
|
||||
"Hook run upon `delete-frame' removing FRAME as a workspace."
|
||||
(cond
|
||||
((not (exwm-workspace--workspace-p frame))
|
||||
(exwm--log "Frame `%s' is not a workspace" frame))
|
||||
|
@ -1537,6 +1561,7 @@ applied to all subsequently created X frames."
|
|||
(interactive "e"))
|
||||
|
||||
(defun exwm-workspace--init-minibuffer-frame ()
|
||||
"Initialize minibuffer-only frame."
|
||||
(exwm--log)
|
||||
;; Initialize workspaces without minibuffers.
|
||||
(setq exwm-workspace--minibuffer
|
||||
|
@ -1607,6 +1632,7 @@ applied to all subsequently created X frames."
|
|||
:test #'equal))
|
||||
|
||||
(defun exwm-workspace--exit-minibuffer-frame ()
|
||||
"Cleanup minibuffer-only frame."
|
||||
(exwm--log)
|
||||
;; Only on minibuffer-frame.
|
||||
(remove-hook 'minibuffer-setup-hook #'exwm-workspace--on-minibuffer-setup)
|
||||
|
@ -1623,7 +1649,9 @@ applied to all subsequently created X frames."
|
|||
(setq default-minibuffer-frame nil)
|
||||
(when (frame-live-p exwm-workspace--minibuffer) ; might be already dead
|
||||
(let ((id (frame-parameter exwm-workspace--minibuffer 'exwm-outer-id)))
|
||||
(when (and exwm-workspace--minibuffer id)
|
||||
(when (and exwm-workspace--minibuffer id
|
||||
;; Invoked from `exwm-manage--exit' upon disconnection.
|
||||
(slot-value exwm--connection 'connected))
|
||||
(xcb:+request exwm--connection
|
||||
(make-instance 'xcb:ReparentWindow
|
||||
:window id
|
||||
|
@ -1708,10 +1736,10 @@ applied to all subsequently created X frames."
|
|||
#'exwm-workspace--on-echo-area-clear))
|
||||
;; Hide & reparent out all frames (save-set can't be used here since
|
||||
;; X windows will be re-mapped).
|
||||
(setq exwm-workspace--current nil)
|
||||
(when (slot-value exwm--connection 'connected)
|
||||
(dolist (i exwm-workspace--list)
|
||||
(when (frame-live-p i) ; might be already dead
|
||||
(exwm-workspace--remove-frame-as-workspace i)
|
||||
(exwm-workspace--remove-frame-as-workspace i 'quit)
|
||||
(modify-frame-parameters i '((exwm-selected-window . nil)
|
||||
(exwm-urgency . nil)
|
||||
(exwm-outer-id . nil)
|
||||
|
@ -1719,8 +1747,10 @@ applied to all subsequently created X frames."
|
|||
(exwm-container . nil)
|
||||
;; (internal-border-width . nil) ; integerp
|
||||
(fullscreen . nil)
|
||||
(buffer-predicate . nil)))))
|
||||
(buffer-predicate . nil))))))
|
||||
;; Don't let dead frames linger.
|
||||
(setq exwm-workspace--current nil)
|
||||
(setq exwm-workspace-current-index 0)
|
||||
(setq exwm-workspace--list nil))
|
||||
|
||||
(defun exwm-workspace--post-init ()
|
||||
|
|
11
third_party/exwm/exwm-xim.el
vendored
11
third_party/exwm/exwm-xim.el
vendored
|
@ -1,6 +1,6 @@
|
|||
;;; exwm-xim.el --- XIM Module for EXWM -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2019-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Chris Feng <chris.w.feng@gmail.com>
|
||||
|
||||
|
@ -68,7 +68,7 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile (require 'cl-lib))
|
||||
(require 'cl-lib)
|
||||
|
||||
(require 'xcb-keysyms)
|
||||
(require 'xcb-xim)
|
||||
|
@ -167,6 +167,7 @@ C,no"
|
|||
|
||||
(defun exwm-xim--on-SelectionRequest (data _synthetic)
|
||||
"Handle SelectionRequest events on IMS window.
|
||||
DATA contains unmarshalled SelectionRequest event data.
|
||||
|
||||
Such events would be received when clients query for LOCALES or TRANSPORT."
|
||||
(exwm--log)
|
||||
|
@ -754,10 +755,12 @@ Such event would be received when the client window is destroyed."
|
|||
;; Close IMS communication connections.
|
||||
(mapc (lambda (i)
|
||||
(when (vectorp i)
|
||||
(xcb:disconnect (elt i 0))))
|
||||
(when (slot-value (elt i 0) 'connected)
|
||||
(xcb:disconnect (elt i 0)))))
|
||||
exwm-xim--server-client-plist)
|
||||
;; Close the IMS connection.
|
||||
(unless exwm-xim--conn
|
||||
(unless (and exwm-xim--conn
|
||||
(slot-value exwm-xim--conn 'connected))
|
||||
(cl-return-from exwm-xim--exit))
|
||||
;; Remove exwm-xim from XIM_SERVERS.
|
||||
(let ((reply (xcb:+request-unchecked+reply exwm-xim--conn
|
||||
|
|
107
third_party/exwm/exwm.el
vendored
107
third_party/exwm/exwm.el
vendored
|
@ -1,10 +1,10 @@
|
|||
;;; exwm.el --- Emacs X Window Manager -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2015-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Chris Feng <chris.w.feng@gmail.com>
|
||||
;; Maintainer: Adrián Medraño Calvo <adrian@medranocalvo.com>
|
||||
;; Version: 0.27
|
||||
;; Version: 0.28
|
||||
;; Package-Requires: ((xelb "0.18"))
|
||||
;; Keywords: unix
|
||||
;; URL: https://github.com/ch11ng/exwm
|
||||
|
@ -72,6 +72,8 @@
|
|||
(require 'exwm-manage)
|
||||
(require 'exwm-input)
|
||||
|
||||
(declare-function x-get-atom-name "C source code" (VALUE &optional FRAME))
|
||||
|
||||
(defgroup exwm nil
|
||||
"Emacs X Window Manager."
|
||||
:tag "EXWM"
|
||||
|
@ -153,7 +155,8 @@
|
|||
(kill-emacs))))))
|
||||
|
||||
(defun exwm--update-desktop (xwin)
|
||||
"Update _NET_WM_DESKTOP."
|
||||
"Update _NET_WM_DESKTOP.
|
||||
Argument XWIN contains the X window of the `exwm-mode' buffer."
|
||||
(exwm--log "#x%x" xwin)
|
||||
(with-current-buffer (exwm--id->buffer xwin)
|
||||
(let ((reply (xcb:+request-unchecked+reply exwm--connection
|
||||
|
@ -180,7 +183,11 @@
|
|||
(exwm-workspace--set-desktop xwin)))))))
|
||||
|
||||
(defun exwm--update-window-type (id &optional force)
|
||||
"Update _NET_WM_WINDOW_TYPE."
|
||||
"Update `exwm-window-type' from _NET_WM_WINDOW_TYPE.
|
||||
Argument ID contains the X window of the `exwm-mode' buffer.
|
||||
|
||||
When FORCE is nil the update only takes place if
|
||||
`exwm-window-type' is unset."
|
||||
(exwm--log "#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(unless (and exwm-window-type (not force))
|
||||
|
@ -191,7 +198,11 @@
|
|||
(setq exwm-window-type (append (slot-value reply 'value) nil)))))))
|
||||
|
||||
(defun exwm--update-class (id &optional force)
|
||||
"Update WM_CLASS."
|
||||
"Update `exwm-instance-name' and `exwm-class' from WM_CLASS.
|
||||
Argument ID contains the X window of the `exwm-mode' buffer.
|
||||
|
||||
When FORCE is nil the update only takes place if any of
|
||||
`exwm-instance-name' or `exwm-class' is unset."
|
||||
(exwm--log "#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(unless (and exwm-instance-name exwm-class-name (not force))
|
||||
|
@ -204,7 +215,11 @@
|
|||
(run-hooks 'exwm-update-class-hook)))))))
|
||||
|
||||
(defun exwm--update-utf8-title (id &optional force)
|
||||
"Update _NET_WM_NAME."
|
||||
"Update `exwm-title' from _NET_WM_NAME.
|
||||
Argument ID contains the X window of the `exwm-mode' buffer.
|
||||
|
||||
When FORCE is nil the update only takes place if `exwm-title' is
|
||||
unset."
|
||||
(exwm--log "#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(when (or force (not exwm-title))
|
||||
|
@ -217,7 +232,11 @@
|
|||
(run-hooks 'exwm-update-title-hook)))))))
|
||||
|
||||
(defun exwm--update-ctext-title (id &optional force)
|
||||
"Update WM_NAME."
|
||||
"Update `exwm-title' from WM_NAME.
|
||||
Argument ID contains the X window of the `exwm-mode' buffer.
|
||||
|
||||
When FORCE is nil the update only takes place if `exwm-title' is
|
||||
unset."
|
||||
(exwm--log "#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(unless (or exwm--title-is-utf8
|
||||
|
@ -230,13 +249,18 @@
|
|||
(run-hooks 'exwm-update-title-hook)))))))
|
||||
|
||||
(defun exwm--update-title (id)
|
||||
"Update _NET_WM_NAME or WM_NAME."
|
||||
"Update _NET_WM_NAME or WM_NAME.
|
||||
Argument ID contains the X window of the `exwm-mode' buffer."
|
||||
(exwm--log "#x%x" id)
|
||||
(exwm--update-utf8-title id)
|
||||
(exwm--update-ctext-title id))
|
||||
|
||||
(defun exwm--update-transient-for (id &optional force)
|
||||
"Update WM_TRANSIENT_FOR."
|
||||
"Update `exwm-transient-for' from WM_TRANSIENT_FOR.
|
||||
Argument ID contains the X window of the `exwm-mode' buffer.
|
||||
|
||||
When FORCE is nil the update only takes place if `exwm-title' is
|
||||
unset."
|
||||
(exwm--log "#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(unless (and exwm-transient-for (not force))
|
||||
|
@ -247,7 +271,15 @@
|
|||
(setq exwm-transient-for (slot-value reply 'value)))))))
|
||||
|
||||
(defun exwm--update-normal-hints (id &optional force)
|
||||
"Update WM_NORMAL_HINTS."
|
||||
"Update normal hints from WM_NORMAL_HINTS.
|
||||
Argument ID contains the X window of the `exwm-mode' buffer.
|
||||
|
||||
When FORCE is nil the update only takes place all of
|
||||
`exwm--normal-hints-x exwm--normal-hints-y',
|
||||
`exwm--normal-hints-width exwm--normal-hints-height',
|
||||
`exwm--normal-hints-min-width exwm--normal-hints-min-height' and
|
||||
`exwm--normal-hints-max-width exwm--normal-hints-max-height' are
|
||||
unset."
|
||||
(exwm--log "#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(unless (and (not force)
|
||||
|
@ -295,7 +327,11 @@
|
|||
exwm--normal-hints-max-height)))))))))
|
||||
|
||||
(defun exwm--update-hints (id &optional force)
|
||||
"Update WM_HINTS."
|
||||
"Update hints from WM_HINTS.
|
||||
Argument ID contains the X window of the `exwm-mode' buffer.
|
||||
|
||||
When FORCE is nil the update only takes place if both of
|
||||
`exwm--hints-input' and `exwm--hints-urgency' are unset."
|
||||
(exwm--log "#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(unless (and (not force) exwm--hints-input exwm--hints-urgency)
|
||||
|
@ -317,7 +353,11 @@
|
|||
(setq exwm-workspace--switch-history-outdated t))))))))
|
||||
|
||||
(defun exwm--update-protocols (id &optional force)
|
||||
"Update WM_PROTOCOLS."
|
||||
"Update `exwm--protocols' from WM_PROTOCOLS.
|
||||
Argument ID contains the X window of the `exwm-mode' buffer.
|
||||
|
||||
When FORCE is nil the update only takes place if `exwm--protocols'
|
||||
is unset."
|
||||
(exwm--log "#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(unless (and exwm--protocols (not force))
|
||||
|
@ -328,7 +368,7 @@
|
|||
(setq exwm--protocols (append (slot-value reply 'value) nil)))))))
|
||||
|
||||
(defun exwm--update-struts-legacy (id)
|
||||
"Update _NET_WM_STRUT."
|
||||
"Update struts of X window ID from _NET_WM_STRUT."
|
||||
(exwm--log "#x%x" id)
|
||||
(let ((pair (assq id exwm-workspace--id-struts-alist))
|
||||
reply struts)
|
||||
|
@ -349,7 +389,7 @@
|
|||
(exwm-workspace--set-fullscreen f)))))
|
||||
|
||||
(defun exwm--update-struts-partial (id)
|
||||
"Update _NET_WM_STRUT_PARTIAL."
|
||||
"Update struts of X window ID from _NET_WM_STRUT_PARTIAL."
|
||||
(exwm--log "#x%x" id)
|
||||
(let ((reply (xcb:+request-unchecked+reply exwm--connection
|
||||
(make-instance 'xcb:ewmh:get-_NET_WM_STRUT_PARTIAL
|
||||
|
@ -369,13 +409,14 @@
|
|||
(exwm-workspace--set-fullscreen f))))
|
||||
|
||||
(defun exwm--update-struts (id)
|
||||
"Update _NET_WM_STRUT_PARTIAL or _NET_WM_STRUT."
|
||||
"Update struts of X window ID from _NET_WM_STRUT_PARTIAL or _NET_WM_STRUT."
|
||||
(exwm--log "#x%x" id)
|
||||
(exwm--update-struts-partial id)
|
||||
(exwm--update-struts-legacy id))
|
||||
|
||||
(defun exwm--on-PropertyNotify (data _synthetic)
|
||||
"Handle PropertyNotify event."
|
||||
"Handle PropertyNotify event.
|
||||
DATA contains unmarshalled PropertyNotify event data."
|
||||
(let ((obj (make-instance 'xcb:PropertyNotify))
|
||||
atom id buffer)
|
||||
(xcb:unmarshal obj data)
|
||||
|
@ -413,7 +454,8 @@
|
|||
atom)))))))
|
||||
|
||||
(defun exwm--on-ClientMessage (raw-data _synthetic)
|
||||
"Handle ClientMessage event."
|
||||
"Handle ClientMessage event.
|
||||
RAW-DATA contains unmarshalled ClientMessage event data."
|
||||
(let ((obj (make-instance 'xcb:ClientMessage))
|
||||
type id data)
|
||||
(xcb:unmarshal obj raw-data)
|
||||
|
@ -598,7 +640,8 @@
|
|||
(x-get-atom-name type exwm-workspace--current) type)))))
|
||||
|
||||
(defun exwm--on-SelectionClear (data _synthetic)
|
||||
"Handle SelectionClear events."
|
||||
"Handle SelectionClear events.
|
||||
DATA contains unmarshalled SelectionClear event data."
|
||||
(exwm--log)
|
||||
(let ((obj (make-instance 'xcb:SelectionClear))
|
||||
owner selection)
|
||||
|
@ -611,6 +654,10 @@
|
|||
|
||||
(defun exwm--on-delete-terminal (terminal)
|
||||
"Handle terminal being deleted without Emacs being killed.
|
||||
This function is Hooked to `delete-terminal-functions'.
|
||||
|
||||
TERMINAL is the terminal being (or that has been) deleted.
|
||||
|
||||
This may happen when invoking `save-buffers-kill-terminal' within an emacsclient
|
||||
session."
|
||||
(when (eq terminal exwm--terminal)
|
||||
|
@ -836,7 +883,8 @@ manager. If t, replace it, if nil, abort and ask the user if `ask'."
|
|||
|
||||
;;;###autoload
|
||||
(cl-defun exwm-init (&optional frame)
|
||||
"Initialize EXWM."
|
||||
"Initialize EXWM.
|
||||
FRAME, if given, indicates the X display EXWM should manage."
|
||||
(interactive)
|
||||
(exwm--log "%s" frame)
|
||||
(if frame
|
||||
|
@ -907,12 +955,12 @@ manager. If t, replace it, if nil, abort and ask the user if `ask'."
|
|||
(run-hooks 'exwm-exit-hook)
|
||||
(setq confirm-kill-emacs nil)
|
||||
;; Exit modules.
|
||||
(when exwm--connection
|
||||
(exwm-input--exit)
|
||||
(exwm-manage--exit)
|
||||
(exwm-workspace--exit)
|
||||
(exwm-floating--exit)
|
||||
(exwm-layout--exit)
|
||||
(when exwm--connection
|
||||
(xcb:flush exwm--connection)
|
||||
(xcb:disconnect exwm--connection))
|
||||
(setq exwm--connection nil)
|
||||
|
@ -956,10 +1004,11 @@ manager. If t, replace it, if nil, abort and ask the user if `ask'."
|
|||
(delete-process exwm--server-process)
|
||||
(setq exwm--server-process nil)))
|
||||
|
||||
(defun exwm--server-eval-at (&rest args)
|
||||
"Wrapper of `server-eval-at' used to advice subrs."
|
||||
(defun exwm--server-eval-at (function &rest args)
|
||||
"Wrapper of `server-eval-at' used to advice subrs.
|
||||
FUNCTION is the function to be evaluated, ARGS are the arguments."
|
||||
;; Start the subordinate Emacs server if it's not alive
|
||||
(exwm--log "%s" args)
|
||||
(exwm--log "%s %s" function args)
|
||||
(unless (server-running-p exwm--server-name)
|
||||
(when exwm--server-process (delete-process exwm--server-process))
|
||||
(setq exwm--server-process
|
||||
|
@ -977,8 +1026,8 @@ manager. If t, replace it, if nil, abort and ask the user if `ask'."
|
|||
(server-eval-at
|
||||
exwm--server-name
|
||||
`(progn (select-frame (car (frame-list)))
|
||||
(let ((result ,(nconc (list (make-symbol (subr-name (car args))))
|
||||
(cdr args))))
|
||||
(let ((result ,(nconc (list (make-symbol (subr-name function)))
|
||||
args)))
|
||||
(pcase (type-of result)
|
||||
;; Return the name of a buffer
|
||||
(`buffer (buffer-name result))
|
||||
|
@ -1001,11 +1050,15 @@ manager. If t, replace it, if nil, abort and ask the user if `ask'."
|
|||
;; This is invoked instead of `save-buffers-kill-emacs' (C-x C-c) on client
|
||||
;; frames.
|
||||
(if (exwm--terminal-p)
|
||||
(exwm--confirm-kill-emacs "[EXWM] Kill terminal?")
|
||||
(exwm--confirm-kill-emacs "Kill terminal?")
|
||||
t))
|
||||
|
||||
(defun exwm--confirm-kill-emacs (prompt &optional force)
|
||||
"Confirm before exiting Emacs."
|
||||
"Confirm before exiting Emacs.
|
||||
PROMPT a reason to present to the user.
|
||||
If FORCE is nil, ask the user for confirmation.
|
||||
If FORCE is the symbol `no-check', ask if there are unsaved buffers.
|
||||
If FORCE is any other non-nil value, force killing of Emacs."
|
||||
(exwm--log)
|
||||
(when (cond
|
||||
((and force (not (eq force 'no-check)))
|
||||
|
|
Loading…
Reference in a new issue