* exwm-layout.el (exwm-layout--set-frame-fullscreen):
* exwm-randr.el (exwm-randr--refresh):
* exwm-workspace.el (exwm-workspace--resize-minibuffer):
(exwm-workspace-switch):
* exwm.el (exwm--on-ClientMessage):
Calling `exwm-workspace-switch' in bc80eefe does not work correctly
sometimes.  This commit improves it by directly specify the geometry info
rather than getting it from Emacs frame.
This commit is contained in:
Chris Feng 2016-02-06 20:33:56 +08:00
parent bc80eefe3f
commit 97daba20ad
4 changed files with 37 additions and 27 deletions

View file

@ -203,6 +203,8 @@
(id (frame-parameter frame 'exwm-outer-id)) (id (frame-parameter frame 'exwm-outer-id))
(workspace (frame-parameter frame 'exwm-workspace))) (workspace (frame-parameter frame 'exwm-workspace)))
(with-slots (x y width height) geometry (with-slots (x y width height) geometry
(when (eq frame exwm-workspace--current)
(exwm-workspace--resize-minibuffer width height))
(exwm-layout--resize-container id workspace x y width height) (exwm-layout--resize-container id workspace x y width height)
(xcb:flush exwm--connection)))) (xcb:flush exwm--connection))))

View file

@ -103,6 +103,8 @@
(frame-parameter frame (frame-parameter frame
'exwm-workspace) 'exwm-workspace)
x y width height) x y width height)
(when (eq frame exwm-workspace--current)
(exwm-workspace--resize-minibuffer width height))
(setq workareas (setq workareas
(nconc workareas (list x y width (- height (nconc workareas (list x y width (- height
workarea-offset))) workarea-offset)))
@ -116,9 +118,7 @@
(make-instance 'xcb:ewmh:set-_NET_DESKTOP_VIEWPORT (make-instance 'xcb:ewmh:set-_NET_DESKTOP_VIEWPORT
:window exwm--root :window exwm--root
:data (vconcat viewports))) :data (vconcat viewports)))
(xcb:flush exwm--connection)) (xcb:flush exwm--connection)))
;; Force update workspace settings.
(exwm-workspace-switch exwm-workspace-current-index t))
(defvar exwm-randr-screen-change-hook nil (defvar exwm-randr-screen-change-hook nil
"Normal hook run when screen changes.") "Normal hook run when screen changes.")

View file

@ -111,6 +111,29 @@ Value nil means to use the default position which is fixed at bottom, while
(defvar exwm-workspace--display-echo-area-timer nil (defvar exwm-workspace--display-echo-area-timer nil
"Timer for auto-hiding echo area.") "Timer for auto-hiding echo area.")
(defun exwm-workspace--resize-minibuffer (&optional width height)
"Resize minibuffer (and its container) to fit the size of workspace.
If WIDTH and HEIGHT of the workspace is not specified, they're get from the
workspace frame."
(let ((y (if (eq exwm-workspace-minibuffer-position 'top)
0
(- (or height (frame-pixel-height exwm-workspace--current))
(frame-pixel-height exwm-workspace--minibuffer))))
(width (or width (frame-pixel-width exwm-workspace--current)))
(container (frame-parameter exwm-workspace--minibuffer
'exwm-container)))
(xcb:+request exwm--connection
(make-instance 'xcb:ConfigureWindow
:window container
:value-mask (logior xcb:ConfigWindow:Y
xcb:ConfigWindow:Width
xcb:ConfigWindow:StackMode)
:y y
:width width
:stack-mode xcb:StackMode:Above))
(set-frame-width exwm-workspace--minibuffer width nil t)))
;;;###autoload ;;;###autoload
(defun exwm-workspace-switch (index &optional force) (defun exwm-workspace-switch (index &optional force)
"Switch to workspace INDEX. Query for INDEX if it's not specified. "Switch to workspace INDEX. Query for INDEX if it's not specified.
@ -148,27 +171,14 @@ The optional FORCE option is for internal use only."
(if (not (memq exwm-workspace-minibuffer-position '(top bottom))) (if (not (memq exwm-workspace-minibuffer-position '(top bottom)))
(setq default-minibuffer-frame frame) (setq default-minibuffer-frame frame)
;; Resize/reposition the minibuffer frame ;; Resize/reposition the minibuffer frame
(let ((x 0) (xcb:+request exwm--connection
(y (if (eq exwm-workspace-minibuffer-position 'top) (make-instance 'xcb:ReparentWindow
0 :window
(- (frame-pixel-height frame) (frame-parameter exwm-workspace--minibuffer
(frame-pixel-height exwm-workspace--minibuffer)))) 'exwm-container)
(width (x-display-pixel-width)) :parent (frame-parameter frame 'exwm-workspace)
(container (frame-parameter exwm-workspace--minibuffer :x 0 :y 0))
'exwm-container))) (exwm-workspace--resize-minibuffer))
(xcb:+request exwm--connection
(make-instance 'xcb:ReparentWindow
:window container
:parent (frame-parameter frame 'exwm-workspace)
:x x :y y))
(xcb:+request exwm--connection
(make-instance 'xcb:ConfigureWindow
:window container
:value-mask (logior xcb:ConfigWindow:Width
xcb:ConfigWindow:StackMode)
:width width
:stack-mode xcb:StackMode:Above))
(set-frame-width exwm-workspace--minibuffer width nil t)))
;; Hide windows in other workspaces by preprending a space ;; Hide windows in other workspaces by preprending a space
(unless exwm-workspace-show-all-buffers (unless exwm-workspace-show-all-buffers
(dolist (i exwm--id-buffer-alist) (dolist (i exwm--id-buffer-alist)

View file

@ -341,9 +341,7 @@
:window id :window id
:data (vector :data (vector
xcb:Atom:_NET_WM_STATE_FULLSCREEN))) xcb:Atom:_NET_WM_STATE_FULLSCREEN)))
(xcb:flush exwm--connection))) (xcb:flush exwm--connection))))
;; Force update workspace settings.
(exwm-workspace-switch exwm-workspace-current-index t))
(when buffer ;ensure it's managed (when buffer ;ensure it's managed
(with-current-buffer buffer (with-current-buffer buffer
;; _NET_WM_STATE_MODAL ;; _NET_WM_STATE_MODAL