[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/exwm e43bd78258 3/3: Use 32-bit visual for frame contai
From: |
ELPA Syncer |
Subject: |
[elpa] externals/exwm e43bd78258 3/3: Use 32-bit visual for frame containers |
Date: |
Thu, 19 May 2022 17:57:41 -0400 (EDT) |
branch: externals/exwm
commit e43bd782580fc7f2aa7f5f92da1c5d7c992b6d1c
Author: Adrián Medraño Calvo <adrian@medranocalvo.com>
Commit: Adrián Medraño Calvo <adrian@medranocalvo.com>
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.
---
exwm-core.el | 15 +++++++++++++++
exwm-workspace.el | 21 +++++++++++++++++----
2 files changed, 32 insertions(+), 4 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.
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 083c8ac893..fc68e1b070 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -1326,7 +1326,8 @@ Please check `exwm-workspace--minibuffer-own-frame-p'
first."
(let ((outer-id (string-to-number (frame-parameter frame
'outer-window-id)))
(window-id (string-to-number (frame-parameter frame 'window-id)))
- (container (xcb:generate-id exwm--connection)))
+ (container (xcb:generate-id exwm--connection))
+ frame-colormap frame-visual frame-depth)
;; Save window IDs
(set-frame-parameter frame 'exwm-outer-id outer-id)
(set-frame-parameter frame 'exwm-id window-id)
@@ -1340,9 +1341,17 @@ Please check `exwm-workspace--minibuffer-own-frame-p'
first."
(dolist (param '(exwm-randr-monitor
exwm-geometry))
(set-frame-parameter frame param (frame-parameter w param))))
+ ;; Support transparency on the container X window when the Emacs frame
+ ;; does. Note that in addition to setting the visual, colormap and depth
+ ;; we must also reset the `:border-pixmap', as its default value is
+ ;; relative to the parent window, which might have a different depth.
+ (let* ((vdc (exwm--get-visual-depth-colormap exwm--connection outer-id)))
+ (setq frame-visual (car vdc))
+ (setq frame-depth (cadr vdc))
+ (setq frame-colormap (caddr vdc)))
(xcb:+request exwm--connection
(make-instance 'xcb:CreateWindow
- :depth 0
+ :depth frame-depth
:wid container
:parent exwm--root
:x -1
@@ -1351,10 +1360,14 @@ Please check `exwm-workspace--minibuffer-own-frame-p'
first."
:height 1
:border-width 0
:class xcb:WindowClass:InputOutput
- :visual 0
+ :visual frame-visual
:value-mask (logior xcb:CW:BackPixmap
+ xcb:CW:BorderPixel
+ xcb:CW:Colormap
xcb:CW:OverrideRedirect)
- :background-pixmap xcb:BackPixmap:ParentRelative
+ :background-pixmap xcb:BackPixmap:None
+ :border-pixel 0
+ :colormap frame-colormap
:override-redirect 1))
(xcb:+request exwm--connection
(make-instance 'xcb:ConfigureWindow