mirror of
https://github.com/emacs-exwm/exwm.git
synced 2024-11-23 21:17:59 +01:00
Fix emacsclient related issues
* exwm-systemtray.el (exwm-systemtray-height): The value is not available when emacsclient has just loaded the library (and it crashes emacsclient). * exwm-workspace.el (exwm-workspace--init): Set `default-minibuffer-frame' later to prevent it from being modified when using emacsclient. * exwm-floating.el: * exwm-randr.el: * exwm-systemtray.el: * exwm-workspace.el: * exwm.el: Use `exwm-workspace--minibuffer-own-frame-p' instead of the raw variable.
This commit is contained in:
parent
7116b01b0c
commit
55cec760ca
5 changed files with 15 additions and 16 deletions
|
@ -53,7 +53,6 @@
|
||||||
(defvar exwm-workspace--list)
|
(defvar exwm-workspace--list)
|
||||||
(defvar exwm-workspace-current-index)
|
(defvar exwm-workspace-current-index)
|
||||||
(defvar exwm-workspace--switch-history-outdated)
|
(defvar exwm-workspace--switch-history-outdated)
|
||||||
(defvar exwm-workspace-minibuffer-position)
|
|
||||||
|
|
||||||
(declare-function exwm-layout--refresh "exwm-layout.el")
|
(declare-function exwm-layout--refresh "exwm-layout.el")
|
||||||
(declare-function exwm-layout--show "exwm-layout.el")
|
(declare-function exwm-layout--show "exwm-layout.el")
|
||||||
|
@ -104,7 +103,7 @@
|
||||||
;; FIXME: check normal hints restrictions
|
;; FIXME: check normal hints restrictions
|
||||||
(let* ((display-width (frame-pixel-width original-frame))
|
(let* ((display-width (frame-pixel-width original-frame))
|
||||||
(display-height (- (frame-pixel-height original-frame)
|
(display-height (- (frame-pixel-height original-frame)
|
||||||
(if exwm-workspace-minibuffer-position
|
(if (exwm-workspace--minibuffer-own-frame-p)
|
||||||
0
|
0
|
||||||
(window-pixel-height (minibuffer-window
|
(window-pixel-height (minibuffer-window
|
||||||
original-frame)))
|
original-frame)))
|
||||||
|
|
|
@ -54,7 +54,6 @@
|
||||||
(defvar exwm-randr-refresh-hook nil
|
(defvar exwm-randr-refresh-hook nil
|
||||||
"Normal hook run when the RandR module just refreshed.")
|
"Normal hook run when the RandR module just refreshed.")
|
||||||
|
|
||||||
(defvar exwm-workspace-minibuffer-position)
|
|
||||||
(defvar exwm-layout--fullscreen-frame-count)
|
(defvar exwm-layout--fullscreen-frame-count)
|
||||||
(defvar exwm-workspace-number)
|
(defvar exwm-workspace-number)
|
||||||
(defvar exwm-workspace--list)
|
(defvar exwm-workspace--list)
|
||||||
|
@ -94,7 +93,7 @@
|
||||||
(setq default-geometry geometry)))))))
|
(setq default-geometry geometry)))))))
|
||||||
(exwm--log "(randr) outputs: %s" output-plist)
|
(exwm--log "(randr) outputs: %s" output-plist)
|
||||||
(when output-plist
|
(when output-plist
|
||||||
(setq workarea-offset (if exwm-workspace-minibuffer-position
|
(setq workarea-offset (if (exwm-workspace--minibuffer-own-frame-p)
|
||||||
0
|
0
|
||||||
(window-pixel-height (minibuffer-window))))
|
(window-pixel-height (minibuffer-window))))
|
||||||
(setq exwm-layout--fullscreen-frame-count 0)
|
(setq exwm-layout--fullscreen-frame-count 0)
|
||||||
|
|
|
@ -43,9 +43,7 @@
|
||||||
;; GTK icons require at least 16 pixels to show normally.
|
;; GTK icons require at least 16 pixels to show normally.
|
||||||
(defconst exwm-systemtray--icon-min-size 16 "Minimum icon size.")
|
(defconst exwm-systemtray--icon-min-size 16 "Minimum icon size.")
|
||||||
|
|
||||||
(defvar exwm-systemtray-height (max exwm-systemtray--icon-min-size
|
(defvar exwm-systemtray-height nil "System tray height.
|
||||||
(line-pixel-height))
|
|
||||||
"System tray height.
|
|
||||||
|
|
||||||
You shall use the default value if using auto-hide minibuffer.")
|
You shall use the default value if using auto-hide minibuffer.")
|
||||||
|
|
||||||
|
@ -258,12 +256,11 @@ You shall use the default value if using auto-hide minibuffer.")
|
||||||
(t
|
(t
|
||||||
(exwm--log "(System Tray) Unknown opcode message: %s" obj)))))))
|
(exwm--log "(System Tray) Unknown opcode message: %s" obj)))))))
|
||||||
|
|
||||||
(defvar exwm-workspace-minibuffer-position)
|
|
||||||
(defvar exwm-workspace--current)
|
(defvar exwm-workspace--current)
|
||||||
|
|
||||||
(defun exwm-systemtray--on-workspace-switch ()
|
(defun exwm-systemtray--on-workspace-switch ()
|
||||||
"Reparent/Refresh the system tray in `exwm-workspace-switch-hook'."
|
"Reparent/Refresh the system tray in `exwm-workspace-switch-hook'."
|
||||||
(unless exwm-workspace-minibuffer-position
|
(unless (exwm-workspace--minibuffer-own-frame-p)
|
||||||
(xcb:+request exwm-systemtray--connection
|
(xcb:+request exwm-systemtray--connection
|
||||||
(make-instance 'xcb:ReparentWindow
|
(make-instance 'xcb:ReparentWindow
|
||||||
:window exwm-systemtray--embedder
|
:window exwm-systemtray--embedder
|
||||||
|
@ -277,7 +274,7 @@ You shall use the default value if using auto-hide minibuffer.")
|
||||||
|
|
||||||
(defun exwm-systemtray--on-randr-refresh ()
|
(defun exwm-systemtray--on-randr-refresh ()
|
||||||
"Reposition/Refresh the system tray in `exwm-randr-refresh-hook'."
|
"Reposition/Refresh the system tray in `exwm-randr-refresh-hook'."
|
||||||
(unless exwm-workspace-minibuffer-position
|
(unless (exwm-workspace--minibuffer-own-frame-p)
|
||||||
(xcb:+request exwm-systemtray--connection
|
(xcb:+request exwm-systemtray--connection
|
||||||
(make-instance 'xcb:ConfigureWindow
|
(make-instance 'xcb:ConfigureWindow
|
||||||
:window exwm-systemtray--embedder
|
:window exwm-systemtray--embedder
|
||||||
|
@ -295,6 +292,9 @@ You shall use the default value if using auto-hide minibuffer.")
|
||||||
(cl-assert (not exwm-systemtray--list))
|
(cl-assert (not exwm-systemtray--list))
|
||||||
(cl-assert (not exwm-systemtray--selection-owner-window))
|
(cl-assert (not exwm-systemtray--selection-owner-window))
|
||||||
(cl-assert (not exwm-systemtray--embedder))
|
(cl-assert (not exwm-systemtray--embedder))
|
||||||
|
(unless exwm-systemtray-height
|
||||||
|
(setq exwm-systemtray-height (max exwm-systemtray--icon-min-size
|
||||||
|
(line-pixel-height))))
|
||||||
;; Create a new connection.
|
;; Create a new connection.
|
||||||
(setq exwm-systemtray--connection (xcb:connect-to-socket))
|
(setq exwm-systemtray--connection (xcb:connect-to-socket))
|
||||||
(set-process-query-on-exit-flag (slot-value exwm-systemtray--connection
|
(set-process-query-on-exit-flag (slot-value exwm-systemtray--connection
|
||||||
|
@ -345,7 +345,7 @@ You shall use the default value if using auto-hide minibuffer.")
|
||||||
:border-width 0 :class xcb:WindowClass:CopyFromParent
|
:border-width 0 :class xcb:WindowClass:CopyFromParent
|
||||||
:visual 0 :value-mask xcb:CW:EventMask
|
:visual 0 :value-mask xcb:CW:EventMask
|
||||||
:event-mask xcb:EventMask:SubstructureNotify))
|
:event-mask xcb:EventMask:SubstructureNotify))
|
||||||
(if exwm-workspace-minibuffer-position
|
(if (exwm-workspace--minibuffer-own-frame-p)
|
||||||
(setq parent (frame-parameter exwm-workspace--minibuffer
|
(setq parent (frame-parameter exwm-workspace--minibuffer
|
||||||
'exwm-container)
|
'exwm-container)
|
||||||
;; Vertically centered.
|
;; Vertically centered.
|
||||||
|
|
|
@ -274,7 +274,7 @@ The optional FORCE option is for internal use only."
|
||||||
(frame-parameter frame 'exwm-workspace)
|
(frame-parameter frame 'exwm-workspace)
|
||||||
:x x :y y))
|
:x x :y y))
|
||||||
(xcb:flush exwm--connection)
|
(xcb:flush exwm--connection)
|
||||||
(unless exwm-workspace-minibuffer-position
|
(unless (exwm-workspace--minibuffer-own-frame-p)
|
||||||
;; The frame needs to be recreated since it won't use the
|
;; The frame needs to be recreated since it won't use the
|
||||||
;; minibuffer on the new workspace.
|
;; minibuffer on the new workspace.
|
||||||
(let* ((old-frame exwm--floating-frame)
|
(let* ((old-frame exwm--floating-frame)
|
||||||
|
@ -567,7 +567,7 @@ This functions is modified from `display-buffer-reuse-window' and
|
||||||
(xcb:+request exwm--connection
|
(xcb:+request exwm--connection
|
||||||
(make-instance 'xcb:MapWindow :window (car i))))
|
(make-instance 'xcb:MapWindow :window (car i))))
|
||||||
;; Reparent out the minibuffer frame.
|
;; Reparent out the minibuffer frame.
|
||||||
(when exwm-workspace-minibuffer-position
|
(when (exwm-workspace--minibuffer-own-frame-p)
|
||||||
(xcb:+request exwm--connection
|
(xcb:+request exwm--connection
|
||||||
(make-instance 'xcb:ReparentWindow
|
(make-instance 'xcb:ReparentWindow
|
||||||
:window (frame-parameter exwm-workspace--minibuffer
|
:window (frame-parameter exwm-workspace--minibuffer
|
||||||
|
@ -614,13 +614,14 @@ This functions is modified from `display-buffer-reuse-window' and
|
||||||
(setq exwm-workspace--minibuffer
|
(setq exwm-workspace--minibuffer
|
||||||
(make-frame '((window-system . x) (minibuffer . only)
|
(make-frame '((window-system . x) (minibuffer . only)
|
||||||
(left . 10000) (right . 10000)
|
(left . 10000) (right . 10000)
|
||||||
(width . 0) (height . 0)))
|
(width . 0) (height . 0))))
|
||||||
default-minibuffer-frame exwm-workspace--minibuffer)
|
|
||||||
;; Remove/hide existing frames.
|
;; Remove/hide existing frames.
|
||||||
(dolist (f old-frames)
|
(dolist (f old-frames)
|
||||||
(if (frame-parameter f 'client)
|
(if (frame-parameter f 'client)
|
||||||
(make-frame-invisible f)
|
(make-frame-invisible f)
|
||||||
(delete-frame f))))
|
(delete-frame f))))
|
||||||
|
;; This is the only usable minibuffer frame.
|
||||||
|
(setq default-minibuffer-frame exwm-workspace--minibuffer)
|
||||||
(let ((outer-id (string-to-number
|
(let ((outer-id (string-to-number
|
||||||
(frame-parameter exwm-workspace--minibuffer
|
(frame-parameter exwm-workspace--minibuffer
|
||||||
'outer-window-id)))
|
'outer-window-id)))
|
||||||
|
|
2
exwm.el
2
exwm.el
|
@ -462,7 +462,7 @@
|
||||||
(let* ((workareas
|
(let* ((workareas
|
||||||
(vector 0 0 (x-display-pixel-width)
|
(vector 0 0 (x-display-pixel-width)
|
||||||
(- (x-display-pixel-height)
|
(- (x-display-pixel-height)
|
||||||
(if exwm-workspace-minibuffer-position
|
(if (exwm-workspace--minibuffer-own-frame-p)
|
||||||
0
|
0
|
||||||
(window-pixel-height (minibuffer-window))))))
|
(window-pixel-height (minibuffer-window))))))
|
||||||
(workareas (mapconcat (lambda (_) workareas)
|
(workareas (mapconcat (lambda (_) workareas)
|
||||||
|
|
Loading…
Reference in a new issue