fix flickering of shaped windows on focus changes

This commit is contained in:
Mark Tiefenbruck 2008-10-03 20:48:38 -07:00
parent 9df75ed7a6
commit c91926cf71
5 changed files with 44 additions and 51 deletions

View file

@ -1,5 +1,8 @@
(Format: Year/Month/Day)
Changes for 1.1.2
*08/10/04:
* Fix flickering of shaped windows, #2131548 and #2001027 (Mark)
FbTk/Shape.cc
*08/10/01:
* Don't flash original window while cycling (Mark)
FocusControl.cc FbTk/XLayer.cc/hh

View file

@ -190,32 +190,23 @@ void Shape::update() {
return;
}
Region clip = XCreateRegion();
Region bound = XCreateRegion();
XRectangle rect;
rect.x = 0;
rect.y = 0;
rect.width = width;
rect.height = height;
XShapeCombineRectangles(display,
m_win->window(), ShapeClip,
0, 0, /* offsets */
&rect,
1, /* number of rectangles */
ShapeSet, /* op */
2 /* ordering: YXSorted... only 1: doesn't matter */ );
XUnionRectWithRegion(&rect, clip, clip);
rect.x = -bw;
rect.y = -bw;
rect.width = width+2*bw;
rect.height = height+2*bw;
XShapeCombineRectangles(display,
m_win->window(), ShapeBounding,
0, 0, /* offsets */
&rect,
1, /* number of rectangles */
ShapeSet, /* op */
2 /* ordering: YXSorted... only 1: doesn't matter */ );
XUnionRectWithRegion(&rect, bound, bound);
if (m_shapesource != 0) {
@ -229,45 +220,51 @@ void Shape::update() {
rect.width = m_shapesource->width();
rect.height = m_shapesource->height();
XShapeCombineRectangles(display,
m_win->window(), ShapeClip,
0, 0, /* offsets */
&rect,
1, /* number of rectangles */
ShapeSubtract, /* op */
2 /* ordering: YXSorted... only 1: doesn't matter */ );
Region clientarea = XCreateRegion();
XUnionRectWithRegion(&rect, clientarea, clientarea);
XSubtractRegion(clip, clientarea, clip);
XSubtractRegion(bound, clientarea, bound);
XDestroyRegion(clientarea);
XShapeCombineShape(display,
m_win->window(), ShapeClip,
rect.x, rect.y, // xOff, yOff
m_shapesource->window(),
ShapeClip, ShapeUnion);
ShapeClip, ShapeSet);
XShapeCombineRegion(display,
m_win->window(), ShapeClip,
0, 0, // offsets
clip, ShapeUnion);
/*
Now the bounding rectangle. Note that the frame has a shared border with the region above the
client (i.e. titlebar), so we don't want to wipe the shared border, hence the adjustments.
*/
rect.x = m_shapesource_xoff; // note that the full bounding region is already offset by a -borderwidth!
rect.y = m_shapesource_yoff;
rect.width = m_shapesource->width(); // we don't wipe the outer bounding region [i think]
rect.height = m_shapesource->height();
// we want to delete the client area, dont care about borders really
XShapeCombineRectangles(display,
m_win->window(), ShapeBounding,
0, 0, /* offsets */
&rect,
1, /* number of rectangles */
ShapeSubtract, /* op */
2 /* ordering: YXSorted... only 1: doesn't matter */ );
XShapeCombineShape(display,
m_win->window(), ShapeBounding,
rect.x , rect.y, // xOff, yOff
rect.x, rect.y, // xOff, yOff
m_shapesource->window(),
ShapeBounding, ShapeUnion);
ShapeBounding, ShapeSet);
XShapeCombineRegion(display,
m_win->window(), ShapeBounding,
0, 0, // offsets
bound, ShapeUnion);
} else {
XShapeCombineRegion(display,
m_win->window(), ShapeClip,
0, 0, // offsets
clip, ShapeSet);
XShapeCombineRegion(display,
m_win->window(), ShapeBounding,
0, 0, // offsets
bound, ShapeSet);
}
XDestroyRegion(clip);
XDestroyRegion(bound);
CornerPixmaps &corners = s_corners[m_win->screenNumber()];
#define SHAPECORNER(corner, x, y, shapekind) \

View file

@ -665,12 +665,6 @@ void FbWinFrame::moveLabelButtonRightOf(FbTk::TextButton &btn, const FbTk::TextB
m_tab_container.moveItem(&btn, movement);
}
void FbWinFrame::setLabelButtonFocus(IconButton &btn) {
if (btn.parent() != &m_tab_container)
return;
m_label.setText(btn.text());
}
void FbWinFrame::setClientWindow(FbTk::FbWindow &win) {
win.setBorderWidth(0);

View file

@ -146,8 +146,6 @@ public:
void moveLabelButtonLeftOf(FbTk::TextButton &btn, const FbTk::TextButton &dest);
//move the first label button to the right of the second
void moveLabelButtonRightOf(FbTk::TextButton &btn, const FbTk::TextButton &dest);
/// which button is to be rendered focused
void setLabelButtonFocus(IconButton &btn);
/// attach a client window for client area
void setClientWindow(FbTk::FbWindow &win);
/// remove attached client window

View file

@ -409,7 +409,7 @@ void FluxboxWindow::init() {
associateClient(*m_client);
frame().setLabelButtonFocus(*m_labelbuttons[m_client]);
frame().setFocusTitle(title());
// redirect events from frame to us
frame().setEventHandler(*this);
@ -987,16 +987,17 @@ bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) {
if (old)
old->focusSig().notify();
}
if (old != &client)
titleSig().notify();
#ifdef DEBUG
cerr<<"FluxboxWindow::"<<__FUNCTION__<<": labelbutton[client] = "<<
button<<endl;
#endif // DEBUG
// frame focused doesn't necessarily mean input focused
frame().setLabelButtonFocus(*button);
frame().setShapingClient(&client, false);
if (old != &client) {
titleSig().notify();
frame().setFocusTitle(title());
frame().setShapingClient(&client, false);
}
return ret;
}