diff options
author | Chris Feng <chris.w.feng@gmail.com> | 2020-02-02T00·00+0000 |
---|---|---|
committer | Chris Feng <chris.w.feng@gmail.com> | 2020-02-02T00·00+0000 |
commit | 36d2f0056eff396d115d4cbf5777221fc5bb9c4c (patch) | |
tree | be725f22faf9738c685fdc8ea23fe1d11ddfbbd5 /exwm-core.el | |
parent | 27a884e9472485e15a9b7dc7b62985a956c5f20d (diff) |
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.
Diffstat (limited to 'exwm-core.el')
-rw-r--r-- | exwm-core.el | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/exwm-core.el b/exwm-core.el index 7e37a71b6c0e..553fb4b4e3a7 100644 --- a/exwm-core.el +++ b/exwm-core.el @@ -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. |