mirror of
https://github.com/ch11ng/exwm.git
synced 2024-11-27 13:07:59 +01:00
Correct several EWMH properties
The following EWMH properties on the root window are corrected in this commit: _NET_VIRTUAL_ROOTS, _NET_WORKAREA and _NET_DESKTOP_VIEWPORT.
This commit is contained in:
parent
981293f06a
commit
b50a6e6dd9
5 changed files with 58 additions and 52 deletions
|
@ -381,9 +381,13 @@
|
||||||
"Perform move/resize."
|
"Perform move/resize."
|
||||||
(when exwm-floating--moveresize-calculate
|
(when exwm-floating--moveresize-calculate
|
||||||
(let ((obj (make-instance 'xcb:MotionNotify))
|
(let ((obj (make-instance 'xcb:MotionNotify))
|
||||||
(frame-x (or (frame-parameter exwm-workspace--current 'exwm-x) 0))
|
(geometry (frame-parameter exwm-workspace--current 'exwm-geometry))
|
||||||
(frame-y (or (frame-parameter exwm-workspace--current 'exwm-y) 0))
|
(frame-x 0)
|
||||||
|
(frame-y 0)
|
||||||
result)
|
result)
|
||||||
|
(when geometry
|
||||||
|
(setq frame-x (slot-value geometry 'x)
|
||||||
|
frame-y (slot-value geometry 'y)))
|
||||||
(xcb:unmarshal obj data)
|
(xcb:unmarshal obj data)
|
||||||
(setq result (funcall exwm-floating--moveresize-calculate
|
(setq result (funcall exwm-floating--moveresize-calculate
|
||||||
(slot-value obj 'root-x) (slot-value obj 'root-y)))
|
(slot-value obj 'root-x) (slot-value obj 'root-y)))
|
||||||
|
|
|
@ -167,28 +167,27 @@
|
||||||
;; frame to the actual monitor size, `exwm-layout-set-fullscreen' resizes an X
|
;; frame to the actual monitor size, `exwm-layout-set-fullscreen' resizes an X
|
||||||
;; window to the frame size.
|
;; window to the frame size.
|
||||||
(defun exwm-layout--set-frame-fullscreen (frame)
|
(defun exwm-layout--set-frame-fullscreen (frame)
|
||||||
"Make frame FRAME fullscreen, with regard to its XRandR output if applicable."
|
"Make frame FRAME fullscreen, with regard to its RandR output if applicable."
|
||||||
(let ((geometry (or (frame-parameter frame 'exwm-geometry)
|
(let ((geometry (or (frame-parameter frame 'exwm-geometry)
|
||||||
(xcb:+request-unchecked+reply
|
(xcb:+request-unchecked+reply exwm--connection
|
||||||
exwm--connection
|
|
||||||
(make-instance 'xcb:GetGeometry
|
(make-instance 'xcb:GetGeometry
|
||||||
:drawable exwm--root))
|
:drawable exwm--root))
|
||||||
(make-instance 'xcb:RECTANGLE :x 0 :y 0
|
(make-instance 'xcb:RECTANGLE :x 0 :y 0
|
||||||
:width (x-display-width)
|
:width (x-display-pixel-width)
|
||||||
:height (x-display-height))))
|
:height (x-display-pixel-height))))
|
||||||
(id (frame-parameter frame 'exwm-outer-id)))
|
(id (frame-parameter frame 'exwm-outer-id)))
|
||||||
(with-slots (x y width height) geometry
|
(with-slots (x y width height) geometry
|
||||||
(xcb:+request exwm--connection
|
(xcb:+request exwm--connection
|
||||||
(make-instance 'xcb:ConfigureWindow
|
(make-instance 'xcb:ConfigureWindow
|
||||||
:window id
|
:window id
|
||||||
:value-mask (logior xcb:ConfigWindow:X
|
:value-mask (logior xcb:ConfigWindow:X
|
||||||
xcb:ConfigWindow:Y
|
xcb:ConfigWindow:Y
|
||||||
xcb:ConfigWindow:Width
|
xcb:ConfigWindow:Width
|
||||||
xcb:ConfigWindow:Height)
|
xcb:ConfigWindow:Height)
|
||||||
:x x :y y
|
:x x :y y
|
||||||
:width width
|
:width width
|
||||||
:height height))
|
:height height))
|
||||||
(xcb:flush exwm--connection))))
|
(xcb:flush exwm--connection))))
|
||||||
|
|
||||||
(defun exwm-layout--refresh ()
|
(defun exwm-layout--refresh ()
|
||||||
"Refresh layout."
|
"Refresh layout."
|
||||||
|
|
|
@ -36,9 +36,6 @@
|
||||||
;; With above lines, workspace 0 should be assigned to the output named "VGA1",
|
;; With above lines, workspace 0 should be assigned to the output named "VGA1",
|
||||||
;; staying at the left of other workspaces on the output "LVDS1".
|
;; staying at the left of other workspaces on the output "LVDS1".
|
||||||
|
|
||||||
;; Todo:
|
|
||||||
;; + Update EWMH hints.
|
|
||||||
|
|
||||||
;; References:
|
;; References:
|
||||||
;; + RandR (http://www.x.org/archive/X11R7.7/doc/randrproto/randrproto.txt)
|
;; + RandR (http://www.x.org/archive/X11R7.7/doc/randrproto/randrproto.txt)
|
||||||
|
|
||||||
|
@ -50,7 +47,7 @@
|
||||||
|
|
||||||
(defun exwm-randr--refresh ()
|
(defun exwm-randr--refresh ()
|
||||||
"Refresh workspaces according to the updated RandR info."
|
"Refresh workspaces according to the updated RandR info."
|
||||||
(let (output-plist default-geometry)
|
(let (geometry output-plist default-geometry workareas viewports)
|
||||||
;; Query all outputs
|
;; Query all outputs
|
||||||
(with-slots (config-timestamp outputs)
|
(with-slots (config-timestamp outputs)
|
||||||
(xcb:+request-unchecked+reply exwm--connection
|
(xcb:+request-unchecked+reply exwm--connection
|
||||||
|
@ -72,10 +69,12 @@
|
||||||
(make-instance 'xcb:randr:GetCrtcInfo
|
(make-instance 'xcb:randr:GetCrtcInfo
|
||||||
:crtc crtc
|
:crtc crtc
|
||||||
:config-timestamp config-timestamp))
|
:config-timestamp config-timestamp))
|
||||||
(setq output-plist (plist-put output-plist name
|
(setq geometry (make-instance 'xcb:RECTANGLE
|
||||||
(vector x y width height)))
|
:x x :y y
|
||||||
|
:width width :height height)
|
||||||
|
output-plist (plist-put output-plist name geometry))
|
||||||
(unless default-geometry ;assume the first output as primary
|
(unless default-geometry ;assume the first output as primary
|
||||||
(setq default-geometry (vector x y width height))))))))
|
(setq default-geometry geometry)))))))
|
||||||
(cl-assert (<= 2 (length output-plist)))
|
(cl-assert (<= 2 (length output-plist)))
|
||||||
(dotimes (i exwm-workspace-number)
|
(dotimes (i exwm-workspace-number)
|
||||||
(let* ((output (plist-get exwm-randr-workspace-output-plist i))
|
(let* ((output (plist-get exwm-randr-workspace-output-plist i))
|
||||||
|
@ -85,23 +84,27 @@
|
||||||
(setq geometry default-geometry
|
(setq geometry default-geometry
|
||||||
output nil))
|
output nil))
|
||||||
(set-frame-parameter frame 'exwm-randr-output output)
|
(set-frame-parameter frame 'exwm-randr-output output)
|
||||||
(set-frame-parameter frame 'exwm-geometry
|
(set-frame-parameter frame 'exwm-geometry geometry)
|
||||||
(make-instance 'xcb:RECTANGLE
|
(with-slots (x y width height) geometry
|
||||||
:x (elt geometry 0)
|
(xcb:+request exwm--connection
|
||||||
:y (elt geometry 1)
|
(make-instance 'xcb:ConfigureWindow
|
||||||
:width (elt geometry 2)
|
:window (frame-parameter frame 'exwm-outer-id)
|
||||||
:height (elt geometry 3)))
|
:value-mask (logior xcb:ConfigWindow:X
|
||||||
(set-frame-parameter frame 'exwm-x (elt geometry 0))
|
xcb:ConfigWindow:Y
|
||||||
(set-frame-parameter frame 'exwm-y (elt geometry 1))
|
xcb:ConfigWindow:Width
|
||||||
(xcb:+request exwm--connection
|
xcb:ConfigWindow:Height)
|
||||||
(make-instance 'xcb:ConfigureWindow
|
:x x :y y :width width :height height))
|
||||||
:window (frame-parameter frame 'exwm-outer-id)
|
(setq workareas (nconc workareas (list x y width height))
|
||||||
:value-mask (logior xcb:ConfigWindow:X
|
viewports (nconc viewports (list x y))))))
|
||||||
xcb:ConfigWindow:Y
|
;; Update _NET_WORKAREA
|
||||||
xcb:ConfigWindow:Width
|
(xcb:+request exwm--connection
|
||||||
xcb:ConfigWindow:Height)
|
(make-instance 'xcb:ewmh:set-_NET_WORKAREA
|
||||||
:x (elt geometry 0) :y (elt geometry 1)
|
:window exwm--root :data (vconcat workareas)))
|
||||||
:width (elt geometry 2) :height (elt geometry 3)))))
|
;; Update _NET_DESKTOP_VIEWPORT
|
||||||
|
(xcb:+request exwm--connection
|
||||||
|
(make-instance 'xcb:ewmh:set-_NET_DESKTOP_VIEWPORT
|
||||||
|
:window exwm--root
|
||||||
|
:data (vconcat viewports)))
|
||||||
(xcb:flush exwm--connection)))
|
(xcb:flush exwm--connection)))
|
||||||
|
|
||||||
(defun exwm-randr--init ()
|
(defun exwm-randr--init ()
|
||||||
|
|
|
@ -264,6 +264,14 @@ The optional FORCE option is for internal use only."
|
||||||
(raise-frame (car exwm-workspace--list))
|
(raise-frame (car exwm-workspace--list))
|
||||||
;; Handle unexpected frame switch
|
;; Handle unexpected frame switch
|
||||||
(add-hook 'focus-in-hook 'exwm-workspace--on-focus-in)
|
(add-hook 'focus-in-hook 'exwm-workspace--on-focus-in)
|
||||||
|
;; Set _NET_VIRTUAL_ROOTS
|
||||||
|
(xcb:+request exwm--connection
|
||||||
|
(make-instance 'xcb:ewmh:set-_NET_VIRTUAL_ROOTS
|
||||||
|
:window exwm--root
|
||||||
|
:data (vconcat (mapcar
|
||||||
|
(lambda (i)
|
||||||
|
(frame-parameter i 'exwm-window-id))
|
||||||
|
exwm-workspace--list))))
|
||||||
;; Switch to the first workspace
|
;; Switch to the first workspace
|
||||||
(exwm-workspace-switch 0 t))
|
(exwm-workspace-switch 0 t))
|
||||||
|
|
||||||
|
|
10
exwm.el
10
exwm.el
|
@ -579,20 +579,12 @@
|
||||||
:data (make-vector (* 2 exwm-workspace-number) 0)))
|
:data (make-vector (* 2 exwm-workspace-number) 0)))
|
||||||
;; Set _NET_WORKAREA (with minibuffer and bottom mode-line excluded)
|
;; Set _NET_WORKAREA (with minibuffer and bottom mode-line excluded)
|
||||||
(let* ((workareas
|
(let* ((workareas
|
||||||
(vconcat (window-absolute-pixel-edges (get-largest-window t))))
|
(vector 0 0 (x-display-pixel-width) (x-display-pixel-height)))
|
||||||
(workareas (mapconcat (lambda (i) workareas)
|
(workareas (mapconcat (lambda (i) workareas)
|
||||||
(make-list exwm-workspace-number 0) [])))
|
(make-list exwm-workspace-number 0) [])))
|
||||||
(xcb:+request exwm--connection
|
(xcb:+request exwm--connection
|
||||||
(make-instance 'xcb:ewmh:set-_NET_WORKAREA
|
(make-instance 'xcb:ewmh:set-_NET_WORKAREA
|
||||||
:window exwm--root :data workareas)))
|
:window exwm--root :data workareas)))
|
||||||
;; Set _NET_VIRTUAL_ROOTS
|
|
||||||
(xcb:+request exwm--connection
|
|
||||||
(make-instance 'xcb:ewmh:set-_NET_VIRTUAL_ROOTS
|
|
||||||
:window exwm--root
|
|
||||||
:data (vconcat (mapcar
|
|
||||||
(lambda (i)
|
|
||||||
(frame-parameter i 'exwm-window-id))
|
|
||||||
exwm-workspace--list))))
|
|
||||||
(xcb:flush exwm--connection))
|
(xcb:flush exwm--connection))
|
||||||
|
|
||||||
(defvar exwm-init-hook nil
|
(defvar exwm-init-hook nil
|
||||||
|
|
Loading…
Reference in a new issue