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-line-mode-passthrough)
(defvar exwm-input-prefix-keys)
(defvar exwm-workspace--list)
(declare-function exwm-input--fake-key "exwm-input.el" (event))
(declare-function exwm-input--on-KeyPress-line-mode "exwm-input.el"
(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-workspace-move-window "exwm-workspace.el"
(frame-or-index &optional id))
(declare-function exwm-workspace-switch "exwm-workspace.el"
(frame-or-index &optional force))
(define-minor-mode exwm-debug
"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))
(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
(defvar-local exwm--id nil) ;window ID
(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.
(easy-menu-define exwm-mode-menu exwm-mode-map
"Menu for `exwm-mode'."
'("EXWM"
`("EXWM"
"---"
"*General*"
"---"
@ -336,22 +347,20 @@ One of `line-mode' or `char-mode'.")
["Send key" exwm-input-send-next-key (eq exwm--input-mode 'line-mode)]
;; This is merely a reference.
("Send simulation key" :filter
(lambda (&rest _args)
(let (result)
(maphash
(lambda (key value)
(when (sequencep key)
(setq result (append result
`([
,(format "Send '%s'"
(key-description value))
(lambda ()
(interactive)
(dolist (i ',value)
(exwm-input--fake-key i)))
:keys ,(key-description key)])))))
exwm-input--simulation-keys)
result)))
,(lambda (&rest _args)
(let (result)
(maphash
(lambda (key value)
(when (sequencep key)
(setq result (append result
`([,(format "Send '%s'"
(key-description value))
,(lambda ()
(interactive)
(mapc #'exwm-input--fake-key value))
:keys ,(key-description key)])))))
exwm-input--simulation-keys)
result)))
["Define global binding" exwm-input-set-key]
@ -368,26 +377,20 @@ One of `line-mode' or `char-mode'.")
["Switch workspace" exwm-workspace-switch]
;; Place this entry at bottom to avoid selecting others by accident.
("Switch to" :filter
(lambda (&rest _args)
(mapcar (lambda (i)
`[,(format "Workspace %d" i)
(lambda ()
(interactive)
(exwm-workspace-switch ,i))
(/= ,i exwm-workspace-current-index)])
(number-sequence 0 (1- (exwm-workspace--count))))))))
,(lambda (&rest _args)
(mapcar (lambda (i)
`[,(format "Workspace %d" i)
,(lambda ()
(interactive)
(exwm-workspace-switch i))
(/= ,i exwm-workspace-current-index)])
(number-sequence 0 (1- (length exwm-workspace--list))))))))
(define-derived-mode exwm-mode nil "EXWM"
"Major mode for managing X windows.
\\{exwm-mode-map}"
;;
(setq mode-name
'(:eval (propertize "EXWM" 'face
(when (cl-some (lambda (i)
(frame-parameter i 'exwm-urgency))
exwm-workspace--list)
'font-lock-warning-face))))
:interactive nil :abbrev-table nil :syntax-table nil
;; Change major-mode is not allowed
(add-hook 'change-major-mode-hook #'kill-buffer nil t)
;; Kill buffer -> close window
@ -396,7 +399,8 @@ One of `line-mode' or `char-mode'.")
;; Redirect events when executing keyboard macros.
(push `(executing-kbd-macro . ,exwm--kmacro-map)
minor-mode-overriding-map-alist)
(setq buffer-read-only t
(setq mode-name '(:eval (exwm--mode-name))
buffer-read-only t
cursor-type nil
left-margin-width nil
right-margin-width nil

View file

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

View file

@ -46,7 +46,7 @@
'(?\C-x ?\C-u ?\C-h ?\M-x ?\M-` ?\M-& ?\M-:)
"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)

View file

@ -602,9 +602,7 @@ See also `exwm-layout-enlarge-window'."
;; Auto refresh layout
(exwm--log)
(add-hook 'window-configuration-change-hook #'exwm-layout--refresh)
;; The behavior of `window-configuration-change-hook' will be changed.
(when (fboundp 'window-pixel-width-before-size-change)
(add-hook 'window-size-change-functions #'exwm-layout--refresh))
(add-hook 'window-size-change-functions #'exwm-layout--refresh)
(unless (exwm-workspace--minibuffer-own-frame-p)
;; Refresh when minibuffer grows
(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."
(exwm--log)
(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)
(when exwm-layout--timer
(cancel-timer exwm-layout--timer)

View file

@ -46,15 +46,6 @@
(visible :initarg :visible))
: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
"System tray."
:group 'exwm)
@ -542,7 +533,7 @@ Argument DATA contains the raw event data."
:destination exwm--root
:event-mask xcb:EventMask:StructureNotify
:event (xcb:marshal
(make-instance 'xcb:systemtray:-ClientMessage
(make-instance 'xcb:icccm:-ManagerSelection
:window exwm--root
:time xcb:Time:CurrentTime
: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
;; other related issues.
;; This is not required by Emacs 24.
(when (fboundp 'window-preserve-size)
(let ((window (get-buffer-window "*Completions*"
exwm-workspace--current)))
(when window
(fit-window-to-buffer window)
(window-preserve-size window)))))
(let ((window (get-buffer-window "*Completions*" exwm-workspace--current)))
(when window
(fit-window-to-buffer window)
(window-preserve-size window))))
(defun exwm-workspace--on-minibuffer-exit ()
"Run in `minibuffer-exit-hook' to hide the minibuffer container."

View file

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

View file

@ -4,8 +4,8 @@
;; 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>
;; Version: 0.28
;; Package-Requires: ((emacs "27.1") (xelb "0.18"))
;; Version: 0.30
;; Package-Requires: ((emacs "27.1") (xelb "0.19"))
;; Keywords: unix
;; URL: https://github.com/emacs-exwm/exwm
@ -493,23 +493,20 @@ RAW-DATA contains unmarshalled ClientMessage event data."
;; _NET_ACTIVE_WINDOW.
((= type xcb:Atom:_NET_ACTIVE_WINDOW)
(let ((buffer (exwm--id->buffer id))
iconic window)
window)
(if (buffer-live-p buffer)
;; Either an `exwm-mode' buffer (an X window) or a floating frame.
(with-current-buffer buffer
(when (eq exwm--frame exwm-workspace--current)
(if 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))
(when (or iconic
(not (eq window (selected-window))))
(select-window window)))))
(unless window
;; State change: iconic => normal.
(setq window (frame-selected-window exwm--frame))
(set-window-buffer window (current-buffer)))
;; Focus transfer.
(select-window window))))
;; A workspace.
(dolist (f exwm-workspace--list)
(when (eq id (frame-parameter f 'exwm-outer-id))