From ba625cce9a80bb8c1b706ca117aff0ae0752a54c Mon Sep 17 00:00:00 2001 From: Philippe Brochard Date: Tue, 30 Jul 2013 19:05:38 +0200 Subject: [PATCH] Use different colors for windows and frames in fastswitch-mode. Limit drawing area when there is a lot of children. --- src/clfswm-fastswitch-mode.lisp | 9 +++++++-- src/config.lisp | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/clfswm-fastswitch-mode.lisp b/src/clfswm-fastswitch-mode.lisp index 5894798..2acb5a3 100644 --- a/src/clfswm-fastswitch-mode.lisp +++ b/src/clfswm-fastswitch-mode.lisp @@ -45,7 +45,10 @@ (labels ((display-match-child () (let ((pos 1)) (dolist (ex-child *fastswitch-match-child*) - (xlib:with-gcontext (*fastswitch-gc* :foreground (get-color *fastswitch-foreground-letter-second*)) + (xlib:with-gcontext (*fastswitch-gc* + :foreground (get-color (if (frame-p (expose-child-child ex-child)) + *fastswitch-foreground-letter-second-frame* + *fastswitch-foreground-letter-second*))) (xlib:draw-glyphs *pixmap-buffer* *fastswitch-gc* (* (xlib:max-char-width *fastswitch-font*) pos) (+ (* 2 (xlib:font-ascent *fastswitch-font*)) (xlib:font-descent *fastswitch-font*) 1) @@ -61,7 +64,9 @@ (* (xlib:max-char-width *fastswitch-font*) pos) (+ (* 2 (xlib:font-ascent *fastswitch-font*)) (xlib:font-descent *fastswitch-font*) 1) (child-fullname (expose-child-child ex-child))) - (incf pos (1+ (length (child-fullname (expose-child-child ex-child)))))))))) + (incf pos (1+ (length (child-fullname (expose-child-child ex-child)))))) + (when (> (* pos (xlib:max-char-width *fastswitch-font*)) (xlib:drawable-width *fastswitch-window*)) + (return)))))) (clear-pixmap-buffer *fastswitch-window* *fastswitch-gc*) (xlib:with-gcontext (*fastswitch-gc* :foreground (get-color *fastswitch-foreground-letter*) :background (get-color *fastswitch-background*)) diff --git a/src/config.lisp b/src/config.lisp index 09f4dad..91c5ee7 100644 --- a/src/config.lisp +++ b/src/config.lisp @@ -349,6 +349,8 @@ on the root window in the main mode with the mouse") 'Fastswitch-mode "Fastswitch string window foreground color for letters") (defconfig *fastswitch-foreground-letter-second* "magenta" 'Fastswitch-mode "Fastswitch string window foreground color for letters") +(defconfig *fastswitch-foreground-letter-second-frame* "yellow" + 'Fastswitch-mode "Fastswitch string window foreground color for letters for frames") (defconfig *fastswitch-foreground-childname* "grey70" 'Fastswitch-mode "Fastswitch string window foreground color for childname") (defconfig *fastswitch-border* "grey20" -- 2.11.4.GIT