mirror of
https://github.com/emacs-exwm/exwm.git
synced 2024-11-27 06:48:00 +01:00
; Use `derived-mode-p'.
This commit is contained in:
parent
1364f80f09
commit
bc5f0b3ffa
6 changed files with 27 additions and 26 deletions
|
@ -79,11 +79,11 @@
|
|||
|
||||
You can find the original one at `exwm-config-ido-buffer-window-other-frame'."
|
||||
(with-current-buffer (window-buffer (selected-window))
|
||||
(if (and (eq major-mode 'exwm-mode)
|
||||
(if (and (derived-mode-p 'exwm-mode)
|
||||
exwm--floating-frame)
|
||||
;; Switch from a floating frame.
|
||||
(with-current-buffer buffer
|
||||
(if (and (eq major-mode 'exwm-mode)
|
||||
(if (and (derived-mode-p 'exwm-mode)
|
||||
exwm--floating-frame
|
||||
(eq exwm--frame exwm-workspace--current))
|
||||
;; Switch to another floating frame.
|
||||
|
@ -92,7 +92,7 @@ You can find the original one at `exwm-config-ido-buffer-window-other-frame'."
|
|||
(or (get-buffer-window buffer exwm-workspace--current)
|
||||
(selected-window))))
|
||||
(with-current-buffer buffer
|
||||
(when (eq major-mode 'exwm-mode)
|
||||
(when (derived-mode-p 'exwm-mode)
|
||||
(if (eq exwm--frame exwm-workspace--current)
|
||||
(when exwm--floating-frame
|
||||
;; Switch to a floating frame on the current workspace.
|
||||
|
|
|
@ -411,7 +411,7 @@ This is also used by X window containers.")
|
|||
(defun exwm-floating-hide ()
|
||||
"Hide the current floating X window (which would show again when selected)."
|
||||
(interactive)
|
||||
(when (and (eq major-mode 'exwm-mode)
|
||||
(when (and (derived-mode-p 'exwm-mode)
|
||||
exwm--floating-frame)
|
||||
(exwm-layout--hide exwm--id)
|
||||
(select-frame-set-input-focus exwm-workspace--current)))
|
||||
|
@ -641,7 +641,7 @@ This is also used by X window containers.")
|
|||
"Move a floating window right by DELTA-X pixels and down by DELTA-Y pixels.
|
||||
|
||||
Both DELTA-X and DELTA-Y default to 1. This command should be bound locally."
|
||||
(unless (and (eq major-mode 'exwm-mode) exwm--floating-frame)
|
||||
(unless (and (derived-mode-p 'exwm-mode) exwm--floating-frame)
|
||||
(user-error "[EXWM] `exwm-floating-move' is only for floating X windows"))
|
||||
(unless delta-x (setq delta-x 1))
|
||||
(unless delta-y (setq delta-y 1))
|
||||
|
|
|
@ -224,7 +224,7 @@ ARGS are additional arguments to CALLBACK."
|
|||
;; The X window is on another workspace.
|
||||
(exwm-workspace-switch frame)
|
||||
(with-current-buffer buffer
|
||||
(when (and (eq major-mode 'exwm-mode)
|
||||
(when (and (derived-mode-p 'exwm-mode)
|
||||
(not (eq exwm--frame exwm-workspace--current)))
|
||||
;; The floating X window is on another workspace.
|
||||
(exwm-workspace-switch exwm--frame)))))
|
||||
|
@ -295,7 +295,7 @@ ARGS are additional arguments to CALLBACK."
|
|||
"Update input focus."
|
||||
(when (window-live-p window)
|
||||
(with-current-buffer (window-buffer window)
|
||||
(if (eq major-mode 'exwm-mode)
|
||||
(if (derived-mode-p 'exwm-mode)
|
||||
(if (not (eq exwm--frame exwm-workspace--current))
|
||||
(progn
|
||||
(set-frame-parameter exwm--frame 'exwm-selected-window window)
|
||||
|
@ -369,14 +369,14 @@ ARGS are additional arguments to CALLBACK."
|
|||
(cond ((and (eq button-event exwm-input-move-event)
|
||||
;; Either an undecorated or a floating X window.
|
||||
(with-current-buffer buffer
|
||||
(or (not (eq major-mode 'exwm-mode))
|
||||
(or (not (derived-mode-p 'exwm-mode))
|
||||
exwm--floating-frame)))
|
||||
;; Move
|
||||
(exwm-floating--start-moveresize
|
||||
event xcb:ewmh:_NET_WM_MOVERESIZE_MOVE))
|
||||
((and (eq button-event exwm-input-resize-event)
|
||||
(with-current-buffer buffer
|
||||
(or (not (eq major-mode 'exwm-mode))
|
||||
(or (not (derived-mode-p 'exwm-mode))
|
||||
exwm--floating-frame)))
|
||||
;; Resize
|
||||
(exwm-floating--start-moveresize event))
|
||||
|
@ -389,7 +389,7 @@ ARGS are additional arguments to CALLBACK."
|
|||
;; The X window is on another workspace
|
||||
(exwm-workspace-switch frame)
|
||||
(with-current-buffer buffer
|
||||
(when (and (eq major-mode 'exwm-mode)
|
||||
(when (and (derived-mode-p 'exwm-mode)
|
||||
(not (eq exwm--frame
|
||||
exwm-workspace--current)))
|
||||
;; The floating X window is on another workspace
|
||||
|
@ -410,7 +410,7 @@ ARGS are additional arguments to CALLBACK."
|
|||
"Handle KeyPress event."
|
||||
(let ((obj (make-instance 'xcb:KeyPress)))
|
||||
(xcb:unmarshal obj data)
|
||||
(if (eq major-mode 'exwm-mode)
|
||||
(if (derived-mode-p 'exwm-mode)
|
||||
(funcall exwm--on-KeyPress obj data)
|
||||
(exwm-input--on-KeyPress-char-mode obj))))
|
||||
|
||||
|
@ -613,7 +613,7 @@ instead."
|
|||
exwm--connection (car keysym)
|
||||
(logand state (lognot (cdr keysym)))))
|
||||
(setq event (exwm-input--mimic-read-event raw-event)))
|
||||
(if (not (eq major-mode 'exwm-mode))
|
||||
(if (not (derived-mode-p 'exwm-mode))
|
||||
(exwm-input--unread-event raw-event)
|
||||
;; Grab keyboard temporarily.
|
||||
(setq exwm-input--temp-line-mode t)
|
||||
|
|
|
@ -225,7 +225,7 @@ is t EXWM buffers are never selected by `other-buffer'.
|
|||
When variable `exwm-layout--other-buffer-exclude-buffers' is a
|
||||
list of buffers, EXWM buffers belonging to that list are never
|
||||
selected by `other-buffer'."
|
||||
(or (not (eq 'exwm-mode (buffer-local-value 'major-mode buffer)))
|
||||
(or (not (with-current-buffer buffer (derived-mode-p 'exwm-mode)))
|
||||
(and (not exwm-layout--other-buffer-exclude-exwm-mode-buffers)
|
||||
(not (memq buffer exwm-layout--other-buffer-exclude-buffers))
|
||||
;; Do not select if already shown in some window.
|
||||
|
@ -268,7 +268,7 @@ selected by `other-buffer'."
|
|||
;; Refresh a floating frame
|
||||
(let ((window (frame-first-window frame)))
|
||||
(with-current-buffer (window-buffer window)
|
||||
(when (and (eq major-mode 'exwm-mode)
|
||||
(when (and (derived-mode-p 'exwm-mode)
|
||||
;; It may be a buffer waiting to be killed.
|
||||
(exwm--id->buffer exwm--id))
|
||||
(exwm--log "Refresh floating window #x%x" exwm--id)
|
||||
|
@ -279,7 +279,7 @@ selected by `other-buffer'."
|
|||
(let ((exwm-layout--other-buffer-exclude-exwm-mode-buffers t))
|
||||
(dolist (window windows)
|
||||
(with-current-buffer (window-buffer window)
|
||||
(when (eq major-mode 'exwm-mode)
|
||||
(when (derived-mode-p 'exwm-mode)
|
||||
(switch-to-prev-buffer window))))))
|
||||
;; Refresh the whole workspace
|
||||
;; Workspaces other than the active one can also be refreshed (RandR)
|
||||
|
@ -310,7 +310,8 @@ selected by `other-buffer'."
|
|||
(car-safe (window-prev-buffers window)))))
|
||||
(and
|
||||
prev-buffer
|
||||
(eq 'exwm-mode (buffer-local-value 'major-mode prev-buffer))
|
||||
(with-current-buffer prev-buffer
|
||||
(derived-mode-p 'exwm-mode))
|
||||
(push prev-buffer covered-buffers))))))))
|
||||
;; Set some sensible buffer to vacated windows.
|
||||
(let ((exwm-layout--other-buffer-exclude-buffers covered-buffers))
|
||||
|
@ -320,7 +321,7 @@ selected by `other-buffer'."
|
|||
(let ((exwm-layout--other-buffer-exclude-exwm-mode-buffers t))
|
||||
(dolist (window (window-list frame 0))
|
||||
(with-current-buffer (window-buffer window)
|
||||
(when (and (eq major-mode 'exwm-mode)
|
||||
(when (and (derived-mode-p 'exwm-mode)
|
||||
(or exwm--floating-frame (not (eq frame exwm--frame))))
|
||||
(switch-to-prev-buffer window)))))
|
||||
(exwm-layout--set-client-list-stacking)
|
||||
|
@ -359,7 +360,7 @@ windows."
|
|||
(cond
|
||||
((zerop delta)) ;no operation
|
||||
((window-minibuffer-p)) ;avoid resize minibuffer-window
|
||||
((not (and (eq major-mode 'exwm-mode) exwm--floating-frame))
|
||||
((not (and (derived-mode-p 'exwm-mode) exwm--floating-frame))
|
||||
;; Resize on tiling layout
|
||||
(unless (= 0 (window-resizable nil delta horizontal nil t)) ;not resizable
|
||||
(let ((window-resize-pixelwise t))
|
||||
|
@ -461,7 +462,7 @@ See also `exwm-layout-enlarge-window'."
|
|||
(defun exwm-layout-hide-mode-line ()
|
||||
"Hide mode-line."
|
||||
(interactive)
|
||||
(when (and (eq major-mode 'exwm-mode) mode-line-format)
|
||||
(when (and (derived-mode-p 'exwm-mode) mode-line-format)
|
||||
(let (mode-line-height)
|
||||
(when exwm--floating-frame
|
||||
(setq mode-line-height (window-mode-line-height
|
||||
|
@ -479,7 +480,7 @@ See also `exwm-layout-enlarge-window'."
|
|||
(defun exwm-layout-show-mode-line ()
|
||||
"Show mode-line."
|
||||
(interactive)
|
||||
(when (and (eq major-mode 'exwm-mode) (not mode-line-format))
|
||||
(when (and (derived-mode-p 'exwm-mode) (not mode-line-format))
|
||||
(setq mode-line-format exwm--mode-line-format
|
||||
exwm--mode-line-format nil)
|
||||
(if (not exwm--floating-frame)
|
||||
|
@ -496,7 +497,7 @@ See also `exwm-layout-enlarge-window'."
|
|||
(defun exwm-layout-toggle-mode-line ()
|
||||
"Toggle the display of mode-line."
|
||||
(interactive)
|
||||
(when (eq major-mode 'exwm-mode)
|
||||
(when (derived-mode-p 'exwm-mode)
|
||||
(if mode-line-format
|
||||
(exwm-layout-hide-mode-line)
|
||||
(exwm-layout-show-mode-line))))
|
||||
|
|
|
@ -506,7 +506,7 @@ for internal use only."
|
|||
(list
|
||||
(cond
|
||||
((null current-prefix-arg)
|
||||
(unless (and (eq major-mode 'exwm-mode)
|
||||
(unless (and (derived-mode-p 'exwm-mode)
|
||||
;; The prompt is invisible in fullscreen mode.
|
||||
(exwm-layout--fullscreen-p))
|
||||
(let ((exwm-workspace--prompt-add-allowed t)
|
||||
|
@ -644,7 +644,7 @@ Passing a workspace frame as the first option is for internal use only."
|
|||
(defun exwm-workspace-swap (workspace1 workspace2)
|
||||
"Interchange position of WORKSPACE1 with that of WORKSPACE2."
|
||||
(interactive
|
||||
(unless (and (eq major-mode 'exwm-mode)
|
||||
(unless (and (derived-mode-p 'exwm-mode)
|
||||
;; The prompt is invisible in fullscreen mode.
|
||||
(exwm-layout--fullscreen-p))
|
||||
(let (w1 w2)
|
||||
|
@ -684,7 +684,7 @@ before it."
|
|||
(interactive
|
||||
(cond
|
||||
((null current-prefix-arg)
|
||||
(unless (and (eq major-mode 'exwm-mode)
|
||||
(unless (and (derived-mode-p 'exwm-mode)
|
||||
;; The prompt is invisible in fullscreen mode.
|
||||
(exwm-layout--fullscreen-p))
|
||||
(list exwm-workspace--current
|
||||
|
@ -921,7 +921,7 @@ INDEX must not exceed the current number of workspaces."
|
|||
(rename-buffer (concat " " (buffer-name)))))))))))
|
||||
(when buffer-or-name
|
||||
(with-current-buffer buffer-or-name
|
||||
(if (eq major-mode 'exwm-mode)
|
||||
(if (derived-mode-p 'exwm-mode)
|
||||
;; EXWM buffer.
|
||||
(if (eq exwm--frame exwm-workspace--current)
|
||||
;; On the current workspace.
|
||||
|
|
2
exwm.el
2
exwm.el
|
@ -108,7 +108,7 @@
|
|||
"Reset the state of the selected window (non-fullscreen, line-mode, etc)."
|
||||
(interactive)
|
||||
(with-current-buffer (window-buffer)
|
||||
(when (eq major-mode 'exwm-mode)
|
||||
(when (derived-mode-p 'exwm-mode)
|
||||
(when (exwm-layout--fullscreen-p)
|
||||
(exwm-layout-unset-fullscreen))
|
||||
;; Force refresh
|
||||
|
|
Loading…
Reference in a new issue