diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2008-10-04 03:48:38 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-10-04 03:48:38 (GMT) |
commit | c91926cf71dcaaea2cf6e56e74b1de50ff17f6f5 (patch) | |
tree | 2016d3cbaf743d8ac7b90d39b1c9b85faa668038 | |
parent | 9df75ed7a6c70d621895ebacbba4a13afe4ecaed (diff) | |
download | fluxbox_pavel-c91926cf71dcaaea2cf6e56e74b1de50ff17f6f5.zip fluxbox_pavel-c91926cf71dcaaea2cf6e56e74b1de50ff17f6f5.tar.bz2 |
fix flickering of shaped windows on focus changes
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/FbTk/Shape.cc | 71 | ||||
-rw-r--r-- | src/FbWinFrame.cc | 6 | ||||
-rw-r--r-- | src/FbWinFrame.hh | 2 | ||||
-rw-r--r-- | src/Window.cc | 13 |
5 files changed, 44 insertions, 51 deletions
@@ -1,5 +1,8 @@ | |||
1 | (Format: Year/Month/Day) | 1 | (Format: Year/Month/Day) |
2 | Changes for 1.1.2 | 2 | Changes for 1.1.2 |
3 | *08/10/04: | ||
4 | * Fix flickering of shaped windows, #2131548 and #2001027 (Mark) | ||
5 | FbTk/Shape.cc | ||
3 | *08/10/01: | 6 | *08/10/01: |
4 | * Don't flash original window while cycling (Mark) | 7 | * Don't flash original window while cycling (Mark) |
5 | FocusControl.cc FbTk/XLayer.cc/hh | 8 | FocusControl.cc FbTk/XLayer.cc/hh |
diff --git a/src/FbTk/Shape.cc b/src/FbTk/Shape.cc index 7c14832..6bb63aa 100644 --- a/src/FbTk/Shape.cc +++ b/src/FbTk/Shape.cc | |||
@@ -190,32 +190,23 @@ void Shape::update() { | |||
190 | return; | 190 | return; |
191 | } | 191 | } |
192 | 192 | ||
193 | Region clip = XCreateRegion(); | ||
194 | Region bound = XCreateRegion(); | ||
195 | |||
193 | XRectangle rect; | 196 | XRectangle rect; |
194 | rect.x = 0; | 197 | rect.x = 0; |
195 | rect.y = 0; | 198 | rect.y = 0; |
196 | rect.width = width; | 199 | rect.width = width; |
197 | rect.height = height; | 200 | rect.height = height; |
198 | 201 | ||
199 | XShapeCombineRectangles(display, | 202 | XUnionRectWithRegion(&rect, clip, clip); |
200 | m_win->window(), ShapeClip, | ||
201 | 0, 0, /* offsets */ | ||
202 | &rect, | ||
203 | 1, /* number of rectangles */ | ||
204 | ShapeSet, /* op */ | ||
205 | 2 /* ordering: YXSorted... only 1: doesn't matter */ ); | ||
206 | 203 | ||
207 | rect.x = -bw; | 204 | rect.x = -bw; |
208 | rect.y = -bw; | 205 | rect.y = -bw; |
209 | rect.width = width+2*bw; | 206 | rect.width = width+2*bw; |
210 | rect.height = height+2*bw; | 207 | rect.height = height+2*bw; |
211 | 208 | ||
212 | XShapeCombineRectangles(display, | 209 | XUnionRectWithRegion(&rect, bound, bound); |
213 | m_win->window(), ShapeBounding, | ||
214 | 0, 0, /* offsets */ | ||
215 | &rect, | ||
216 | 1, /* number of rectangles */ | ||
217 | ShapeSet, /* op */ | ||
218 | 2 /* ordering: YXSorted... only 1: doesn't matter */ ); | ||
219 | 210 | ||
220 | if (m_shapesource != 0) { | 211 | if (m_shapesource != 0) { |
221 | 212 | ||
@@ -229,45 +220,51 @@ void Shape::update() { | |||
229 | rect.width = m_shapesource->width(); | 220 | rect.width = m_shapesource->width(); |
230 | rect.height = m_shapesource->height(); | 221 | rect.height = m_shapesource->height(); |
231 | 222 | ||
232 | XShapeCombineRectangles(display, | 223 | Region clientarea = XCreateRegion(); |
233 | m_win->window(), ShapeClip, | 224 | XUnionRectWithRegion(&rect, clientarea, clientarea); |
234 | 0, 0, /* offsets */ | 225 | XSubtractRegion(clip, clientarea, clip); |
235 | &rect, | 226 | XSubtractRegion(bound, clientarea, bound); |
236 | 1, /* number of rectangles */ | 227 | XDestroyRegion(clientarea); |
237 | ShapeSubtract, /* op */ | ||
238 | 2 /* ordering: YXSorted... only 1: doesn't matter */ ); | ||
239 | 228 | ||
240 | XShapeCombineShape(display, | 229 | XShapeCombineShape(display, |
241 | m_win->window(), ShapeClip, | 230 | m_win->window(), ShapeClip, |
242 | rect.x, rect.y, // xOff, yOff | 231 | rect.x, rect.y, // xOff, yOff |
243 | m_shapesource->window(), | 232 | m_shapesource->window(), |
244 | ShapeClip, ShapeUnion); | 233 | ShapeClip, ShapeSet); |
234 | |||
235 | XShapeCombineRegion(display, | ||
236 | m_win->window(), ShapeClip, | ||
237 | 0, 0, // offsets | ||
238 | clip, ShapeUnion); | ||
245 | 239 | ||
246 | /* | 240 | /* |
247 | Now the bounding rectangle. Note that the frame has a shared border with the region above the | 241 | Now the bounding rectangle. Note that the frame has a shared border with the region above the |
248 | client (i.e. titlebar), so we don't want to wipe the shared border, hence the adjustments. | 242 | client (i.e. titlebar), so we don't want to wipe the shared border, hence the adjustments. |
249 | */ | 243 | */ |
250 | rect.x = m_shapesource_xoff; // note that the full bounding region is already offset by a -borderwidth! | ||
251 | rect.y = m_shapesource_yoff; | ||
252 | rect.width = m_shapesource->width(); // we don't wipe the outer bounding region [i think] | ||
253 | rect.height = m_shapesource->height(); | ||
254 | |||
255 | // we want to delete the client area, dont care about borders really | ||
256 | XShapeCombineRectangles(display, | ||
257 | m_win->window(), ShapeBounding, | ||
258 | 0, 0, /* offsets */ | ||
259 | &rect, | ||
260 | 1, /* number of rectangles */ | ||
261 | ShapeSubtract, /* op */ | ||
262 | 2 /* ordering: YXSorted... only 1: doesn't matter */ ); | ||
263 | 244 | ||
264 | XShapeCombineShape(display, | 245 | XShapeCombineShape(display, |
265 | m_win->window(), ShapeBounding, | 246 | m_win->window(), ShapeBounding, |
266 | rect.x , rect.y, // xOff, yOff | 247 | rect.x, rect.y, // xOff, yOff |
267 | m_shapesource->window(), | 248 | m_shapesource->window(), |
268 | ShapeBounding, ShapeUnion); | 249 | ShapeBounding, ShapeSet); |
250 | |||
251 | XShapeCombineRegion(display, | ||
252 | m_win->window(), ShapeBounding, | ||
253 | 0, 0, // offsets | ||
254 | bound, ShapeUnion); | ||
255 | } else { | ||
256 | XShapeCombineRegion(display, | ||
257 | m_win->window(), ShapeClip, | ||
258 | 0, 0, // offsets | ||
259 | clip, ShapeSet); | ||
260 | XShapeCombineRegion(display, | ||
261 | m_win->window(), ShapeBounding, | ||
262 | 0, 0, // offsets | ||
263 | bound, ShapeSet); | ||
269 | } | 264 | } |
270 | 265 | ||
266 | XDestroyRegion(clip); | ||
267 | XDestroyRegion(bound); | ||
271 | 268 | ||
272 | CornerPixmaps &corners = s_corners[m_win->screenNumber()]; | 269 | CornerPixmaps &corners = s_corners[m_win->screenNumber()]; |
273 | #define SHAPECORNER(corner, x, y, shapekind) \ | 270 | #define SHAPECORNER(corner, x, y, shapekind) \ |
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 85cd25b..ce25004 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc | |||
@@ -665,12 +665,6 @@ void FbWinFrame::moveLabelButtonRightOf(FbTk::TextButton &btn, const FbTk::TextB | |||
665 | m_tab_container.moveItem(&btn, movement); | 665 | m_tab_container.moveItem(&btn, movement); |
666 | } | 666 | } |
667 | 667 | ||
668 | void FbWinFrame::setLabelButtonFocus(IconButton &btn) { | ||
669 | if (btn.parent() != &m_tab_container) | ||
670 | return; | ||
671 | m_label.setText(btn.text()); | ||
672 | } | ||
673 | |||
674 | void FbWinFrame::setClientWindow(FbTk::FbWindow &win) { | 668 | void FbWinFrame::setClientWindow(FbTk::FbWindow &win) { |
675 | 669 | ||
676 | win.setBorderWidth(0); | 670 | win.setBorderWidth(0); |
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh index ff9c19e..4cb5c65 100644 --- a/src/FbWinFrame.hh +++ b/src/FbWinFrame.hh | |||
@@ -146,8 +146,6 @@ public: | |||
146 | void moveLabelButtonLeftOf(FbTk::TextButton &btn, const FbTk::TextButton &dest); | 146 | void moveLabelButtonLeftOf(FbTk::TextButton &btn, const FbTk::TextButton &dest); |
147 | //move the first label button to the right of the second | 147 | //move the first label button to the right of the second |
148 | void moveLabelButtonRightOf(FbTk::TextButton &btn, const FbTk::TextButton &dest); | 148 | void moveLabelButtonRightOf(FbTk::TextButton &btn, const FbTk::TextButton &dest); |
149 | /// which button is to be rendered focused | ||
150 | void setLabelButtonFocus(IconButton &btn); | ||
151 | /// attach a client window for client area | 149 | /// attach a client window for client area |
152 | void setClientWindow(FbTk::FbWindow &win); | 150 | void setClientWindow(FbTk::FbWindow &win); |
153 | /// remove attached client window | 151 | /// remove attached client window |
diff --git a/src/Window.cc b/src/Window.cc index cd0e708..4606da5 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -409,7 +409,7 @@ void FluxboxWindow::init() { | |||
409 | 409 | ||
410 | associateClient(*m_client); | 410 | associateClient(*m_client); |
411 | 411 | ||
412 | frame().setLabelButtonFocus(*m_labelbuttons[m_client]); | 412 | frame().setFocusTitle(title()); |
413 | 413 | ||
414 | // redirect events from frame to us | 414 | // redirect events from frame to us |
415 | frame().setEventHandler(*this); | 415 | frame().setEventHandler(*this); |
@@ -987,16 +987,17 @@ bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) { | |||
987 | if (old) | 987 | if (old) |
988 | old->focusSig().notify(); | 988 | old->focusSig().notify(); |
989 | } | 989 | } |
990 | if (old != &client) | ||
991 | titleSig().notify(); | ||
992 | 990 | ||
993 | #ifdef DEBUG | 991 | #ifdef DEBUG |
994 | cerr<<"FluxboxWindow::"<<__FUNCTION__<<": labelbutton[client] = "<< | 992 | cerr<<"FluxboxWindow::"<<__FUNCTION__<<": labelbutton[client] = "<< |
995 | button<<endl; | 993 | button<<endl; |
996 | #endif // DEBUG | 994 | #endif // DEBUG |
997 | // frame focused doesn't necessarily mean input focused | 995 | |
998 | frame().setLabelButtonFocus(*button); | 996 | if (old != &client) { |
999 | frame().setShapingClient(&client, false); | 997 | titleSig().notify(); |
998 | frame().setFocusTitle(title()); | ||
999 | frame().setShapingClient(&client, false); | ||
1000 | } | ||
1000 | return ret; | 1001 | return ret; |
1001 | } | 1002 | } |
1002 | 1003 | ||