[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[STUMP] [PATCH] double buffering
From: |
Vitaly Mayatskikh |
Subject: |
[STUMP] [PATCH] double buffering |
Date: |
Mon, 23 Feb 2009 15:57:33 +0100 |
User-agent: |
Wanderlust/2.15.6 (Almost Unreal) Emacs/22.3 Mule/5.0 (SAKAKI) |
Hi!
I'm tired to see darn flickering mode-line and message windows,
here's patch.
diff --git a/color.lisp b/color.lisp
index ee5d47b..60d7a6d 100644
--- a/color.lisp
+++ b/color.lisp
@@ -172,11 +172,26 @@ then call (update-color-map).")
(width 0)
(gc (ccontext-gc cc))
(win (ccontext-win cc))
+ (px (ccontext-px cc))
(*foreground* nil)
(*background* nil)
(*reverse* nil)
(*color-stack* '())
(*color-map* (screen-color-map-normal screen)))
+ (if draw
+ (progn
+ (when (or (not px)
+ (/= (xlib:drawable-width px) (xlib:drawable-width win))
+ (/= (xlib:drawable-height px) (xlib:drawable-height win)))
+ (when px (xlib:free-pixmap px))
+ (setf px (xlib:create-pixmap :drawable win
+ :width (xlib:drawable-width win)
+ :height (xlib:drawable-height win)
+ :depth (xlib:drawable-depth win))
+ (ccontext-px cc) px))
+ (xlib:with-gcontext (gc :foreground (xlib:gcontext-background gc))
+ (xlib:draw-rectangle px gc 0 0 (xlib:drawable-width px)
(xlib:drawable-height px) t)))
+ (setq px win))
(loop for s in strings
;; We need this so we can track the row for each element
for i from 0 to (length strings)
@@ -187,7 +202,7 @@ then call (update-color-map).")
do (progn
(let ((en (if (and en (eq #\^ (elt s (1+ en)))) (1+ en)
en)))
(when draw
- (xlib:draw-image-glyphs win gc
+ (xlib:draw-image-glyphs px gc
(+ padx x)
(+ pady (* i height)
(xlib:font-ascent
(screen-font screen)))
@@ -200,10 +215,12 @@ then call (update-color-map).")
(setf width (max width x)))
while en))
when (find i highlights :test 'eql)
- do (when draw (invert-rect screen win
+ do (when draw (invert-rect screen px
0 (* i height)
- (xlib:drawable-width win)
+ (xlib:drawable-width px)
height)))
+ (when draw
+ (xlib:copy-area px gc 0 0 (xlib:drawable-width px) (xlib:drawable-height
px) win 0 0))
(set-color screen cc "n" 0)
width))
diff --git a/message-window.lisp b/message-window.lisp
index 86bd929..d4b43fc 100644
--- a/message-window.lisp
+++ b/message-window.lisp
@@ -76,8 +76,6 @@ function expects to be wrapped in a with-state for win."
(xlib:window-priority win) :above)
(setup-win-gravity screen win *message-window-gravity*))
(xlib:map-window win)
- ;; Clear the window
- (xlib:clear-area win)
(incf (screen-ignore-msg-expose screen))
;; Have to flush this or the window might get cleared
;; after we've already started drawing it.
diff --git a/mode-line.lisp b/mode-line.lisp
index 0f6dc20..335bfa6 100644
--- a/mode-line.lisp
+++ b/mode-line.lisp
@@ -380,7 +380,6 @@ critical."
(when (or force (not (string= (mode-line-contents ml) string)))
(setf (mode-line-contents ml) string)
(resize-mode-line ml)
- (xlib:clear-area (mode-line-window ml))
(render-strings (mode-line-screen ml) (mode-line-cc ml)
*mode-line-pad-x* *mode-line-pad-y*
(split-string string (string #\Newline)) '())))))
diff --git a/primitives.lisp b/primitives.lisp
index d6107bb..c0fb449 100644
--- a/primitives.lisp
+++ b/primitives.lisp
@@ -429,6 +436,7 @@ Use the window's resource name.
(defstruct ccontext
win
+ px
gc
default-fg
default-bright
@@ -437,6 +445,9 @@ Use the window's resource name.
(defun screen-message-window (screen)
(ccontext-win (screen-message-cc screen)))
+(defun screen-message-pixmap (screen)
+ (ccontext-px (screen-message-cc screen)))
+
(defun screen-message-gc (screen)
(ccontext-gc (screen-message-cc screen)))
--
wbr, Vitaly
- [STUMP] [PATCH] double buffering,
Vitaly Mayatskikh <=