diff options
Diffstat (limited to 'src/FbTk/Shape.cc')
-rw-r--r-- | src/FbTk/Shape.cc | 71 |
1 files changed, 34 insertions, 37 deletions
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) \ |