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:
@@ -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,13 +958,14 @@ 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
@@ -1035,7 +1039,7 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
|||||||
else
|
else
|
||||||
allButtons = 0;
|
allButtons = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (fwin->right_button && !fwin->flags.hide_right_button
|
if (fwin->right_button && !fwin->flags.hide_right_button
|
||||||
&& !fwin->flags.rbutton_dont_fit)
|
&& !fwin->flags.rbutton_dont_fit)
|
||||||
rofs += fwin->right_button->width + 3;
|
rofs += fwin->right_button->width + 3;
|
||||||
@@ -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
|
buf = XCreatePixmap(dpy, fwin->titlebar->window, w, h,
|
||||||
#ifdef DBL_BUF
|
scr->w_depth);
|
||||||
// what is going on here?
|
|
||||||
{
|
|
||||||
Drawable buf;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
buf = XCreatePixmap(dpy, fwin->titlebar->window, w, h,
|
XSetClipMask(dpy, scr->copy_gc, None);
|
||||||
scr->w_depth);
|
|
||||||
|
|
||||||
i = fwin->flags.state;
|
if (fwin->title_texture[state]->any.type!=WTEX_SOLID) {
|
||||||
if (fwin->title_texture[i]->any.type!=WTEX_SOLID) {
|
XCopyArea(dpy, fwin->title_back[state], buf, scr->copy_gc,
|
||||||
XCopyArea(dpy, fwin->title_back[i], 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[state]->solid.normal.pixel);
|
||||||
fwin->title_texture[i]->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,
|
|
||||||
fwin->title_color[fwin->flags.state],
|
|
||||||
*fwin->font, 0, 0, title, titlelen);
|
|
||||||
|
|
||||||
XCopyArea(dpy, buf, fwin->titlebar->window, scr->copy_gc,
|
|
||||||
0, 0, w, h, x, y);
|
|
||||||
|
|
||||||
XFreePixmap(dpy, buf);
|
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
XClearArea(dpy, fwin->titlebar->window, x, y, w, h, False);
|
|
||||||
|
|
||||||
WMDrawString(scr->wmscreen, fwin->titlebar->window,
|
WMDrawString(scr->wmscreen, buf, fwin->title_color[state],
|
||||||
fwin->title_color[fwin->flags.state],
|
*fwin->font, 0, 0, title, titlelen);
|
||||||
*fwin->font, x, y, title, titlelen);
|
|
||||||
#endif
|
XCopyArea(dpy, buf, fwin->titlebar->window, scr->copy_gc,
|
||||||
|
0, 0, w, h, x, y);
|
||||||
|
|
||||||
|
XFreePixmap(dpy, buf);
|
||||||
|
|
||||||
wfree(title);
|
wfree(title);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user