Refactor color-related code

* exwm-core.el (exwm--color->pixel): New function for converting color
to TrueColor pixel.
* exwm-floating.el (exwm-floating--border-pixel)
(exwm-floating--border-colormap, exwm-floating--init-border): Removed.
(exwm-floating-border-color, exwm-floating--set-floating): Use
`exwm--color->pixel' and only support TrueColor.
This commit is contained in:
Chris Feng 2020-02-02 00:00:00 +00:00
parent 27a884e947
commit 36d2f0056e
2 changed files with 28 additions and 59 deletions

View file

@ -184,6 +184,15 @@ least SECS seconds later."
(if mouse-autoselect-window
xcb:EventMask:EnterWindow 0)))
(defun exwm--color->pixel (color)
"Convert COLOR to PIXEL (index in TrueColor colormap)."
(when (and color
(eq (x-display-visual-class) 'true-color))
(let ((rgb (x-color-values color)))
(logior (lsh (lsh (pop rgb) -8) 16)
(lsh (lsh (pop rgb) -8) 8)
(lsh (pop rgb) -8)))))
;; Internal variables
(defvar-local exwm--id nil) ;window ID
(defvar-local exwm--configurations nil) ;initial configurations.