Use 32-bit visual for frame containers

* exwm-core.el (exwm--get-visual-depth-colormap): New function.
* exwm-workspace.el (exwm-workspace--add-frame-as-workspace): Use
Emacs' frame's visual, depth and colormap. Reset all attributes
that refer (also by default) to the parent window (the root
window), as it might have a different visual, depth or colormap.

Special-thanks-to: Elijah Malaby <qwe12345678910@gmail.com> for figuring out the
  changes needed to suport 32-bit visuals and proposing the initial
  version of this improvement.
This commit is contained in:
Adrián Medraño Calvo 2022-03-24 00:00:00 +00:00
parent 563cba2abc
commit e43bd78258
2 changed files with 32 additions and 4 deletions

View file

@ -193,6 +193,21 @@ least SECS seconds later."
(lsh (lsh (pop rgb) -8) 8)
(lsh (pop rgb) -8)))))
(defun exwm--get-visual-depth-colormap (conn id)
"Get visual, depth and colormap from X window ID.
Return a three element list with the respective results."
(let (ret-visual ret-depth ret-colormap)
(with-slots (visual colormap)
(xcb:+request-unchecked+reply conn
(make-instance 'xcb:GetWindowAttributes :window id))
(setq ret-visual visual)
(setq ret-colormap colormap))
(with-slots (depth)
(xcb:+request-unchecked+reply conn
(make-instance 'xcb:GetGeometry :drawable id))
(setq ret-depth depth))
(list ret-visual ret-depth ret-colormap)))
;; Internal variables
(defvar-local exwm--id nil) ;window ID
(defvar-local exwm--configurations nil) ;initial configurations.