subtree(3p/exwm): update to EXWM 0.30

Merge commit '3e6bfe36afc8356bf72d89eff940282db6ea7cba' into HEAD

Change-Id: Ieebca600b409765d9109fd2b718bd74e533c12e1
This commit is contained in:
Vincent Ambo 2024-06-10 10:51:47 +03:00
commit 179a4e36d7
8 changed files with 60 additions and 73 deletions

View file

@ -82,6 +82,7 @@ Here are some predefined candidates:
(defvar exwm-input--simulation-keys) (defvar exwm-input--simulation-keys)
(defvar exwm-input-line-mode-passthrough) (defvar exwm-input-line-mode-passthrough)
(defvar exwm-input-prefix-keys) (defvar exwm-input-prefix-keys)
(defvar exwm-workspace--list)
(declare-function exwm-input--fake-key "exwm-input.el" (event)) (declare-function exwm-input--fake-key "exwm-input.el" (event))
(declare-function exwm-input--on-KeyPress-line-mode "exwm-input.el" (declare-function exwm-input--on-KeyPress-line-mode "exwm-input.el"
(key-press raw-data)) (key-press raw-data))
@ -94,6 +95,8 @@ Here are some predefined candidates:
(declare-function exwm-manage--kill-buffer-query-function "exwm-manage.el") (declare-function exwm-manage--kill-buffer-query-function "exwm-manage.el")
(declare-function exwm-workspace-move-window "exwm-workspace.el" (declare-function exwm-workspace-move-window "exwm-workspace.el"
(frame-or-index &optional id)) (frame-or-index &optional id))
(declare-function exwm-workspace-switch "exwm-workspace.el"
(frame-or-index &optional force))
(define-minor-mode exwm-debug (define-minor-mode exwm-debug
"Debug-logging enabled if non-nil." "Debug-logging enabled if non-nil."
@ -229,6 +232,14 @@ If CONN is non-nil, use it instead of the value of the variable
(setq ret-depth depth)) (setq ret-depth depth))
(list ret-visual ret-depth ret-colormap))) (list ret-visual ret-depth ret-colormap)))
(defun exwm--mode-name ()
"Mode name string used in `exwm-mode' buffers."
(let ((name "EXWM"))
(if (cl-some (lambda (i) (frame-parameter i 'exwm-urgency))
exwm-workspace--list)
(propertize name 'face 'font-lock-warning-face)
name)))
;; Internal variables ;; Internal variables
(defvar-local exwm--id nil) ;window ID (defvar-local exwm--id nil) ;window ID
(defvar-local exwm--configurations nil) ;initial configurations. (defvar-local exwm--configurations nil) ;initial configurations.
@ -311,7 +322,7 @@ One of `line-mode' or `char-mode'.")
;; Also, inactive entries should be disabled rather than hidden. ;; Also, inactive entries should be disabled rather than hidden.
(easy-menu-define exwm-mode-menu exwm-mode-map (easy-menu-define exwm-mode-menu exwm-mode-map
"Menu for `exwm-mode'." "Menu for `exwm-mode'."
'("EXWM" `("EXWM"
"---" "---"
"*General*" "*General*"
"---" "---"
@ -336,19 +347,17 @@ One of `line-mode' or `char-mode'.")
["Send key" exwm-input-send-next-key (eq exwm--input-mode 'line-mode)] ["Send key" exwm-input-send-next-key (eq exwm--input-mode 'line-mode)]
;; This is merely a reference. ;; This is merely a reference.
("Send simulation key" :filter ("Send simulation key" :filter
(lambda (&rest _args) ,(lambda (&rest _args)
(let (result) (let (result)
(maphash (maphash
(lambda (key value) (lambda (key value)
(when (sequencep key) (when (sequencep key)
(setq result (append result (setq result (append result
`([ `([,(format "Send '%s'"
,(format "Send '%s'"
(key-description value)) (key-description value))
(lambda () ,(lambda ()
(interactive) (interactive)
(dolist (i ',value) (mapc #'exwm-input--fake-key value))
(exwm-input--fake-key i)))
:keys ,(key-description key)]))))) :keys ,(key-description key)])))))
exwm-input--simulation-keys) exwm-input--simulation-keys)
result))) result)))
@ -368,26 +377,20 @@ One of `line-mode' or `char-mode'.")
["Switch workspace" exwm-workspace-switch] ["Switch workspace" exwm-workspace-switch]
;; Place this entry at bottom to avoid selecting others by accident. ;; Place this entry at bottom to avoid selecting others by accident.
("Switch to" :filter ("Switch to" :filter
(lambda (&rest _args) ,(lambda (&rest _args)
(mapcar (lambda (i) (mapcar (lambda (i)
`[,(format "Workspace %d" i) `[,(format "Workspace %d" i)
(lambda () ,(lambda ()
(interactive) (interactive)
(exwm-workspace-switch ,i)) (exwm-workspace-switch i))
(/= ,i exwm-workspace-current-index)]) (/= ,i exwm-workspace-current-index)])
(number-sequence 0 (1- (exwm-workspace--count)))))))) (number-sequence 0 (1- (length exwm-workspace--list))))))))
(define-derived-mode exwm-mode nil "EXWM" (define-derived-mode exwm-mode nil "EXWM"
"Major mode for managing X windows. "Major mode for managing X windows.
\\{exwm-mode-map}" \\{exwm-mode-map}"
;; :interactive nil :abbrev-table nil :syntax-table nil
(setq mode-name
'(:eval (propertize "EXWM" 'face
(when (cl-some (lambda (i)
(frame-parameter i 'exwm-urgency))
exwm-workspace--list)
'font-lock-warning-face))))
;; Change major-mode is not allowed ;; Change major-mode is not allowed
(add-hook 'change-major-mode-hook #'kill-buffer nil t) (add-hook 'change-major-mode-hook #'kill-buffer nil t)
;; Kill buffer -> close window ;; Kill buffer -> close window
@ -396,7 +399,8 @@ One of `line-mode' or `char-mode'.")
;; Redirect events when executing keyboard macros. ;; Redirect events when executing keyboard macros.
(push `(executing-kbd-macro . ,exwm--kmacro-map) (push `(executing-kbd-macro . ,exwm--kmacro-map)
minor-mode-overriding-map-alist) minor-mode-overriding-map-alist)
(setq buffer-read-only t (setq mode-name '(:eval (exwm--mode-name))
buffer-read-only t
cursor-type nil cursor-type nil
left-margin-width nil left-margin-width nil
right-margin-width nil right-margin-width nil

View file

@ -67,8 +67,8 @@ This hook runs in the context of the corresponding buffer."
(defcustom exwm-floating-border-width 1 (defcustom exwm-floating-border-width 1
"Border width of floating windows." "Border width of floating windows."
:type '(integer :type `(integer
:validate (lambda (widget) :validate ,(lambda (widget)
(when (< (widget-value widget) 0) (when (< (widget-value widget) 0)
(widget-put widget :error "Border width is at least 0") (widget-put widget :error "Border width is at least 0")
widget))) widget)))

View file

@ -46,7 +46,7 @@
'(?\C-x ?\C-u ?\C-h ?\M-x ?\M-` ?\M-& ?\M-:) '(?\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 There is no need to add prefix keys for global/simulation keys or those
defined in `exwm-mode-map' here." defined in `exwm-mode-map' here."
:type '(repeat key-sequence) :type '(repeat key-sequence)

View file

@ -602,9 +602,7 @@ See also `exwm-layout-enlarge-window'."
;; Auto refresh layout ;; Auto refresh layout
(exwm--log) (exwm--log)
(add-hook 'window-configuration-change-hook #'exwm-layout--refresh) (add-hook 'window-configuration-change-hook #'exwm-layout--refresh)
;; The behavior of `window-configuration-change-hook' will be changed. (add-hook 'window-size-change-functions #'exwm-layout--refresh)
(when (fboundp 'window-pixel-width-before-size-change)
(add-hook 'window-size-change-functions #'exwm-layout--refresh))
(unless (exwm-workspace--minibuffer-own-frame-p) (unless (exwm-workspace--minibuffer-own-frame-p)
;; Refresh when minibuffer grows ;; Refresh when minibuffer grows
(add-hook 'minibuffer-setup-hook #'exwm-layout--on-minibuffer-setup t) (add-hook 'minibuffer-setup-hook #'exwm-layout--on-minibuffer-setup t)
@ -616,8 +614,7 @@ See also `exwm-layout-enlarge-window'."
"Exit the layout module." "Exit the layout module."
(exwm--log) (exwm--log)
(remove-hook 'window-configuration-change-hook #'exwm-layout--refresh) (remove-hook 'window-configuration-change-hook #'exwm-layout--refresh)
(when (fboundp 'window-pixel-width-before-size-change) (remove-hook 'window-size-change-functions #'exwm-layout--refresh)
(remove-hook 'window-size-change-functions #'exwm-layout--refresh))
(remove-hook 'minibuffer-setup-hook #'exwm-layout--on-minibuffer-setup) (remove-hook 'minibuffer-setup-hook #'exwm-layout--on-minibuffer-setup)
(when exwm-layout--timer (when exwm-layout--timer
(cancel-timer exwm-layout--timer) (cancel-timer exwm-layout--timer)

View file

@ -46,15 +46,6 @@
(visible :initarg :visible)) (visible :initarg :visible))
:documentation "Attributes of a system tray icon.") :documentation "Attributes of a system tray icon.")
(defclass xcb:systemtray:-ClientMessage
(xcb:icccm:--ClientMessage xcb:ClientMessage)
((format :initform 32)
(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
:documentation "A systemtray client message.")
(defgroup exwm-systemtray nil (defgroup exwm-systemtray nil
"System tray." "System tray."
:group 'exwm) :group 'exwm)
@ -542,7 +533,7 @@ Argument DATA contains the raw event data."
:destination exwm--root :destination exwm--root
:event-mask xcb:EventMask:StructureNotify :event-mask xcb:EventMask:StructureNotify
:event (xcb:marshal :event (xcb:marshal
(make-instance 'xcb:systemtray:-ClientMessage (make-instance 'xcb:icccm:-ManagerSelection
:window exwm--root :window exwm--root
:time xcb:Time:CurrentTime :time xcb:Time:CurrentTime
:selection :selection

View file

@ -1257,12 +1257,10 @@ ALIST is an action alist, as accepted by function `display-buffer'."
;; fail to retrieve the correct window. It's likely there are ;; fail to retrieve the correct window. It's likely there are
;; other related issues. ;; other related issues.
;; This is not required by Emacs 24. ;; This is not required by Emacs 24.
(when (fboundp 'window-preserve-size) (let ((window (get-buffer-window "*Completions*" exwm-workspace--current)))
(let ((window (get-buffer-window "*Completions*"
exwm-workspace--current)))
(when window (when window
(fit-window-to-buffer window) (fit-window-to-buffer window)
(window-preserve-size window))))) (window-preserve-size window))))
(defun exwm-workspace--on-minibuffer-exit () (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."

View file

@ -293,7 +293,7 @@ SERIAL is a sequence number."
:destination exwm--root :destination exwm--root
:event-mask xcb:EventMask:StructureNotify :event-mask xcb:EventMask:StructureNotify
:event (xcb:marshal :event (xcb:marshal
(make-instance 'xcb:xsettings:-ClientMessage (make-instance 'xcb:icccm:-ManagerSelection
:window exwm--root :window exwm--root
:time xcb:Time:CurrentTime :time xcb:Time:CurrentTime
:selection exwm-xsettings--XSETTINGS_S0-atom :selection exwm-xsettings--XSETTINGS_S0-atom

View file

@ -4,8 +4,8 @@
;; Author: Chris Feng <chris.w.feng@gmail.com> ;; Author: Chris Feng <chris.w.feng@gmail.com>
;; Maintainer: Adrián Medraño Calvo <adrian@medranocalvo.com>, Steven Allen <steven@stebalien.com>, Daniel Mendler <mail@daniel-mendler.de> ;; Maintainer: Adrián Medraño Calvo <adrian@medranocalvo.com>, Steven Allen <steven@stebalien.com>, Daniel Mendler <mail@daniel-mendler.de>
;; Version: 0.28 ;; Version: 0.30
;; Package-Requires: ((emacs "27.1") (xelb "0.18")) ;; Package-Requires: ((emacs "27.1") (xelb "0.19"))
;; Keywords: unix ;; Keywords: unix
;; URL: https://github.com/emacs-exwm/exwm ;; URL: https://github.com/emacs-exwm/exwm
@ -493,23 +493,20 @@ RAW-DATA contains unmarshalled ClientMessage event data."
;; _NET_ACTIVE_WINDOW. ;; _NET_ACTIVE_WINDOW.
((= type xcb:Atom:_NET_ACTIVE_WINDOW) ((= type xcb:Atom:_NET_ACTIVE_WINDOW)
(let ((buffer (exwm--id->buffer id)) (let ((buffer (exwm--id->buffer id))
iconic window) window)
(if (buffer-live-p buffer) (if (buffer-live-p buffer)
;; Either an `exwm-mode' buffer (an X window) or a floating frame. ;; Either an `exwm-mode' buffer (an X window) or a floating frame.
(with-current-buffer buffer (with-current-buffer buffer
(when (eq exwm--frame exwm-workspace--current) (when (eq exwm--frame exwm-workspace--current)
(if exwm--floating-frame (if exwm--floating-frame
(select-frame exwm--floating-frame) (select-frame exwm--floating-frame)
(setq iconic (exwm-layout--iconic-state-p))
(when iconic
;; State change: iconic => normal.
(set-window-buffer (frame-selected-window exwm--frame)
(current-buffer)))
;; Focus transfer.
(setq window (get-buffer-window nil t)) (setq window (get-buffer-window nil t))
(when (or iconic (unless window
(not (eq window (selected-window)))) ;; State change: iconic => normal.
(select-window window))))) (setq window (frame-selected-window exwm--frame))
(set-window-buffer window (current-buffer)))
;; Focus transfer.
(select-window window))))
;; A workspace. ;; A workspace.
(dolist (f exwm-workspace--list) (dolist (f exwm-workspace--list)
(when (eq id (frame-parameter f 'exwm-outer-id)) (when (eq id (frame-parameter f 'exwm-outer-id))