aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorsimonb <simonb>2007-08-09 03:55:51 (GMT)
committersimonb <simonb>2007-08-09 03:55:51 (GMT)
commit3c9f9f61c818172dba6d25a749f5e18ac46b3db8 (patch)
treeee88c54a1bc03be9e161f417c4778ad0cdb876cb /src/Window.cc
parent9807e5e676810c9665df68ac6e6a770efa2f555e (diff)
downloadfluxbox-3c9f9f61c818172dba6d25a749f5e18ac46b3db8.zip
fluxbox-3c9f9f61c818172dba6d25a749f5e18ac46b3db8.tar.bz2
port shape fixes stage 2 from trunk
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc61
1 files changed, 8 insertions, 53 deletions
diff --git a/src/Window.cc b/src/Window.cc
index c64a0c9..b0aa678 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -260,7 +260,6 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm,
260 m_old_decoration_mask(0), 260 m_old_decoration_mask(0),
261 m_client(&client), 261 m_client(&client),
262 m_toggled_decos(false), 262 m_toggled_decos(false),
263 m_shaped(false),
264 m_icon_hidden(false), 263 m_icon_hidden(false),
265 m_focus_hidden(false), 264 m_focus_hidden(false),
266 m_old_pos_x(0), m_old_pos_y(0), 265 m_old_pos_x(0), m_old_pos_y(0),
@@ -355,16 +354,10 @@ void FluxboxWindow::init() {
355 m_client->setFluxboxWindow(this); 354 m_client->setFluxboxWindow(this);
356 m_client->setGroupLeftWindow(None); // nothing to the left. 355 m_client->setGroupLeftWindow(None); // nothing to the left.
357 356
358 // check for shape extension and whether the window is shaped
359 m_shaped = false;
360
361 if (Fluxbox::instance()->haveShape()) { 357 if (Fluxbox::instance()->haveShape()) {
362 Shape::setShapeNotify(winClient()); 358 Shape::setShapeNotify(winClient());
363 m_shaped = Shape::isShaped(winClient());
364 } 359 }
365 360
366 frame().setUseShape(!m_shaped);
367
368 //!! TODO init of client should be better 361 //!! TODO init of client should be better
369 // we don't want to duplicate code here and in attachClient 362 // we don't want to duplicate code here and in attachClient
370 m_clientlist.push_back(m_client); 363 m_clientlist.push_back(m_client);
@@ -554,36 +547,12 @@ void FluxboxWindow::init() {
554 547
555 sendConfigureNotify(); 548 sendConfigureNotify();
556 549
557 if (m_shaped)
558 shape();
559
560 setupWindow(); 550 setupWindow();
561 551
562 FbTk::App::instance()->sync(false); 552 FbTk::App::instance()->sync(false);
563 553
564} 554}
565 555
566/// apply shape to this window
567void FluxboxWindow::shape() {
568#ifdef SHAPE
569 if (m_shaped) {
570 XShapeCombineShape(display,
571 frame().window().window(), ShapeClip,
572 0, frame().clientArea().y(), // xOff, yOff
573 m_client->window(),
574 ShapeClip, ShapeSet);
575 XShapeCombineShape(display,
576 frame().window().window(), ShapeBounding,
577 0, frame().clientArea().y(), // xOff, yOff
578 m_client->window(),
579 ShapeBounding, ShapeSet);
580 XFlush(display);
581 }
582#endif // SHAPE
583
584}
585
586
587/// attach a client to this window and destroy old window 556/// attach a client to this window and destroy old window
588void FluxboxWindow::attachClient(WinClient &client, int x, int y) { 557void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
589 //!! TODO: check for isGroupable in client 558 //!! TODO: check for isGroupable in client
@@ -1024,6 +993,7 @@ bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) {
1024#endif // DEBUG 993#endif // DEBUG
1025 // frame focused doesn't necessarily mean input focused 994 // frame focused doesn't necessarily mean input focused
1026 frame().setLabelButtonFocus(*button); 995 frame().setLabelButtonFocus(*button);
996 frame().setShapingClient(&client, false);
1027 997
1028 return setinput && focus(); 998 return setinput && focus();
1029} 999}
@@ -1041,6 +1011,8 @@ void FluxboxWindow::associateClientWindow(bool use_attrs,
1041 m_client->updateTitle(); 1011 m_client->updateTitle();
1042 m_client->updateIconTitle(); 1012 m_client->updateIconTitle();
1043 1013
1014 frame().setShapingClient(m_client, false);
1015
1044 if (use_attrs) 1016 if (use_attrs)
1045 frame().moveResizeForClient(x, y, 1017 frame().moveResizeForClient(x, y,
1046 width, height, gravity, client_bw); 1018 width, height, gravity, client_bw);
@@ -1258,7 +1230,6 @@ void FluxboxWindow::moveResize(int new_x, int new_y,
1258 sendConfigureNotify(); 1230 sendConfigureNotify();
1259 } 1231 }
1260 1232
1261 shape();
1262 1233
1263 if (!moving) { 1234 if (!moving) {
1264 m_last_resize_x = new_x; 1235 m_last_resize_x = new_x;
@@ -1278,8 +1249,6 @@ void FluxboxWindow::moveResizeForClient(int new_x, int new_y,
1278 shaded = false; 1249 shaded = false;
1279 sendConfigureNotify(); 1250 sendConfigureNotify();
1280 1251
1281 shape();
1282
1283 if (!moving) { 1252 if (!moving) {
1284 m_last_resize_x = new_x; 1253 m_last_resize_x = new_x;
1285 m_last_resize_y = new_y; 1254 m_last_resize_y = new_y;
@@ -1599,7 +1568,7 @@ void FluxboxWindow::setFullscreen(bool flag) {
1599 1568
1600 fullscreen = false; 1569 fullscreen = false;
1601 1570
1602 frame().setUseShape(!m_shaped); 1571 frame().setUseShape(true);
1603 if (m_toggled_decos) { 1572 if (m_toggled_decos) {
1604 if (m_old_decoration_mask & DECORM_TITLEBAR) 1573 if (m_old_decoration_mask & DECORM_TITLEBAR)
1605 setDecorationMask(DECOR_NONE); 1574 setDecorationMask(DECOR_NONE);
@@ -2244,24 +2213,10 @@ void FluxboxWindow::handleEvent(XEvent &event) {
2244#endif // DEBUG 2213#endif // DEBUG
2245 XShapeEvent *shape_event = (XShapeEvent *)&event; 2214 XShapeEvent *shape_event = (XShapeEvent *)&event;
2246 2215
2247 if (shape_event->kind != ShapeBounding) 2216 if (shape_event->shaped)
2248 break; 2217 frame().setShapingClient(m_client, true);
2249 2218 else
2250 if (shape_event->shaped) { 2219 frame().setShapingClient(0, true);
2251 m_shaped = true;
2252 shape();
2253 } else {
2254 m_shaped = false;
2255 // set no shape
2256 XShapeCombineMask(display,
2257 frame().window().window(), ShapeClip,
2258 0, 0,
2259 None, ShapeSet);
2260 XShapeCombineMask(display,
2261 frame().window().window(), ShapeBounding,
2262 0, 0,
2263 None, ShapeSet);
2264 }
2265 2220
2266 FbTk::App::instance()->sync(false); 2221 FbTk::App::instance()->sync(false);
2267 break; 2222 break;