about summary refs log tree commit diff
path: root/exwm-core.el
diff options
context:
space:
mode:
authorAdrián Medraño Calvo <adrian@medranocalvo.com>2022-03-24T00·00+0000
committerAdrián Medraño Calvo <adrian@medranocalvo.com>2022-03-24T00·00+0000
commite43bd782580fc7f2aa7f5f92da1c5d7c992b6d1c (patch)
tree7c7305097a1950c4924a556fbf067acfbe7ab84f /exwm-core.el
parent563cba2abcfe1df6ed433dc09f6ef412a8e2c706 (diff)
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.
Diffstat (limited to 'exwm-core.el')
-rw-r--r--exwm-core.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/exwm-core.el b/exwm-core.el
index 5356ef9b97..995b590dc5 100644
--- a/exwm-core.el
+++ b/exwm-core.el
@@ -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.