1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

made titlebars display titles with double buffering to avoid flickering. needed because aa fonts need clearing area before redrawing to avoid artefacts and clearing area before redraw gives flicker

This commit is contained in:
dan
2002-10-18 22:17:20 +00:00
parent 7be0a97998
commit 0bb76c0a76

View File

@@ -940,6 +940,9 @@ void
wFrameWindowPaint(WFrameWindow *fwin) wFrameWindowPaint(WFrameWindow *fwin)
{ {
WScreen *scr = fwin->screen_ptr; WScreen *scr = fwin->screen_ptr;
int state;
state = fwin->flags.state;
if (fwin->flags.is_client_window_frame) if (fwin->flags.is_client_window_frame)
fwin->flags.justification = wPreferences.title_justification; fwin->flags.justification = wPreferences.title_justification;
@@ -955,16 +958,17 @@ wFrameWindowPaint(WFrameWindow *fwin)
updateTexture(fwin); updateTexture(fwin);
} else { } else {
/* first render the texture for the current state... */ /* first render the texture for the current state... */
remakeTexture(fwin, fwin->flags.state); remakeTexture(fwin, state);
/* ... and paint it */ /* ... and paint it */
updateTexture(fwin); updateTexture(fwin);
for (i=0; i < 3; i++) { for (i=0; i < 3; i++) {
if (i!=fwin->flags.state) if (i != state) {
remakeTexture(fwin, i); remakeTexture(fwin, i);
} }
} }
} }
}
if (fwin->flags.need_texture_change) { if (fwin->flags.need_texture_change) {
fwin->flags.need_texture_change = 0; fwin->flags.need_texture_change = 0;
@@ -973,10 +977,10 @@ wFrameWindowPaint(WFrameWindow *fwin)
} }
if (fwin->titlebar && !fwin->flags.repaint_only_resizebar if (fwin->titlebar && !fwin->flags.repaint_only_resizebar
&& fwin->title_texture[fwin->flags.state]->any.type==WTEX_SOLID) { && fwin->title_texture[state]->any.type==WTEX_SOLID) {
wDrawBevel(fwin->titlebar->window, fwin->titlebar->width, wDrawBevel(fwin->titlebar->window, fwin->titlebar->width,
fwin->titlebar->height, fwin->titlebar->height,
(WTexSolid*)fwin->title_texture[fwin->flags.state], (WTexSolid*)fwin->title_texture[state],
WREL_RAISED); WREL_RAISED);
} }
@@ -1015,7 +1019,7 @@ wFrameWindowPaint(WFrameWindow *fwin)
if (fwin->titlebar && !fwin->flags.repaint_only_resizebar) { if (fwin->titlebar && !fwin->flags.repaint_only_resizebar) {
int x, w; int x, y, w, h;
int lofs = 6, rofs = 6; int lofs = 6, rofs = 6;
int titlelen; int titlelen;
int allButtons = 1; int allButtons = 1;
@@ -1049,8 +1053,8 @@ wFrameWindowPaint(WFrameWindow *fwin)
#endif #endif
if (fwin->title) { if (fwin->title) {
Drawable buf;
char *title; char *title;
int h, y;
title = ShrinkString(*fwin->font, fwin->title, title = ShrinkString(*fwin->font, fwin->title,
fwin->titlebar->width - lofs - rofs); fwin->titlebar->width - lofs - rofs);
@@ -1077,42 +1081,27 @@ wFrameWindowPaint(WFrameWindow *fwin)
y = *fwin->title_clearance + TITLEBAR_EXTEND_SPACE; y = *fwin->title_clearance + TITLEBAR_EXTEND_SPACE;
h = WMFontHeight(*fwin->font); h = WMFontHeight(*fwin->font);
//#define DBL_BUF
#ifdef DBL_BUF
// what is going on here?
{
Drawable buf;
int i;
buf = XCreatePixmap(dpy, fwin->titlebar->window, w, h, buf = XCreatePixmap(dpy, fwin->titlebar->window, w, h,
scr->w_depth); scr->w_depth);
i = fwin->flags.state; XSetClipMask(dpy, scr->copy_gc, None);
if (fwin->title_texture[i]->any.type!=WTEX_SOLID) {
XCopyArea(dpy, fwin->title_back[i], buf, scr->copy_gc, if (fwin->title_texture[state]->any.type!=WTEX_SOLID) {
XCopyArea(dpy, fwin->title_back[state], buf, scr->copy_gc,
x, y, w, h, 0, 0); x, y, w, h, 0, 0);
} else { } else {
XSetForeground(dpy, scr->copy_gc, XSetForeground(dpy, scr->copy_gc,
fwin->title_texture[i]->solid.normal.pixel); fwin->title_texture[state]->solid.normal.pixel);
XFillRectangle(dpy, buf, scr->copy_gc, 0, 0, w, h); XFillRectangle(dpy, buf, scr->copy_gc, 0, 0, w, h);
} }
WMDrawString(scr->wmscreen, buf, WMDrawString(scr->wmscreen, buf, fwin->title_color[state],
fwin->title_color[fwin->flags.state],
*fwin->font, 0, 0, title, titlelen); *fwin->font, 0, 0, title, titlelen);
XCopyArea(dpy, buf, fwin->titlebar->window, scr->copy_gc, XCopyArea(dpy, buf, fwin->titlebar->window, scr->copy_gc,
0, 0, w, h, x, y); 0, 0, w, h, x, y);
XFreePixmap(dpy, buf); XFreePixmap(dpy, buf);
}
#else
XClearArea(dpy, fwin->titlebar->window, x, y, w, h, False);
WMDrawString(scr->wmscreen, fwin->titlebar->window,
fwin->title_color[fwin->flags.state],
*fwin->font, x, y, title, titlelen);
#endif
wfree(title); wfree(title);
} }