diff options
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 64 |
1 files changed, 10 insertions, 54 deletions
diff --git a/src/Window.cc b/src/Window.cc index ab917da..9ee1c5e 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -268,7 +268,6 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm, | |||
268 | m_old_decoration_mask(0), | 268 | m_old_decoration_mask(0), |
269 | m_client(&client), | 269 | m_client(&client), |
270 | m_toggled_decos(false), | 270 | m_toggled_decos(false), |
271 | m_shaped(false), | ||
272 | m_icon_hidden(false), | 271 | m_icon_hidden(false), |
273 | m_focus_hidden(false), | 272 | m_focus_hidden(false), |
274 | m_old_pos_x(0), m_old_pos_y(0), | 273 | m_old_pos_x(0), m_old_pos_y(0), |
@@ -350,16 +349,10 @@ void FluxboxWindow::init() { | |||
350 | m_client->setFluxboxWindow(this); | 349 | m_client->setFluxboxWindow(this); |
351 | m_client->setGroupLeftWindow(None); // nothing to the left. | 350 | m_client->setGroupLeftWindow(None); // nothing to the left. |
352 | 351 | ||
353 | // check for shape extension and whether the window is shaped | ||
354 | m_shaped = false; | ||
355 | |||
356 | if (Fluxbox::instance()->haveShape()) { | 352 | if (Fluxbox::instance()->haveShape()) { |
357 | Shape::setShapeNotify(winClient()); | 353 | Shape::setShapeNotify(winClient()); |
358 | m_shaped = Shape::isShaped(winClient()); | ||
359 | } | 354 | } |
360 | 355 | ||
361 | frame().setUseShape(!m_shaped); | ||
362 | |||
363 | //!! TODO init of client should be better | 356 | //!! TODO init of client should be better |
364 | // we don't want to duplicate code here and in attachClient | 357 | // we don't want to duplicate code here and in attachClient |
365 | m_clientlist.push_back(m_client); | 358 | m_clientlist.push_back(m_client); |
@@ -548,36 +541,12 @@ void FluxboxWindow::init() { | |||
548 | // no focus default | 541 | // no focus default |
549 | setFocusFlag(false); | 542 | setFocusFlag(false); |
550 | 543 | ||
551 | if (m_shaped) | ||
552 | shape(); | ||
553 | |||
554 | setupWindow(); | 544 | setupWindow(); |
555 | 545 | ||
556 | FbTk::App::instance()->sync(false); | 546 | FbTk::App::instance()->sync(false); |
557 | 547 | ||
558 | } | 548 | } |
559 | 549 | ||
560 | /// apply shape to this window | ||
561 | void FluxboxWindow::shape() { | ||
562 | #ifdef SHAPE | ||
563 | if (m_shaped) { | ||
564 | XShapeCombineShape(display, | ||
565 | frame().window().window(), ShapeClip, | ||
566 | 0, frame().clientArea().y(), // xOff, yOff | ||
567 | m_client->window(), | ||
568 | ShapeClip, ShapeSet); | ||
569 | XShapeCombineShape(display, | ||
570 | frame().window().window(), ShapeBounding, | ||
571 | 0, frame().clientArea().y(), // xOff, yOff | ||
572 | m_client->window(), | ||
573 | ShapeBounding, ShapeSet); | ||
574 | XFlush(display); | ||
575 | } | ||
576 | #endif // SHAPE | ||
577 | |||
578 | } | ||
579 | |||
580 | |||
581 | /// attach a client to this window and destroy old window | 550 | /// attach a client to this window and destroy old window |
582 | void FluxboxWindow::attachClient(WinClient &client, int x, int y) { | 551 | void FluxboxWindow::attachClient(WinClient &client, int x, int y) { |
583 | //!! TODO: check for isGroupable in client | 552 | //!! TODO: check for isGroupable in client |
@@ -995,8 +964,10 @@ bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) { | |||
995 | if (!button) | 964 | if (!button) |
996 | return false; | 965 | return false; |
997 | 966 | ||
998 | if (&client != m_client) | 967 | if (&client != m_client) { |
999 | m_screen.focusControl().setScreenFocusedWindow(client); | 968 | m_screen.focusControl().setScreenFocusedWindow(client); |
969 | frame().setShapingClient(&client, false); | ||
970 | } | ||
1000 | m_client = &client; | 971 | m_client = &client; |
1001 | m_client->raise(); | 972 | m_client->raise(); |
1002 | m_client->focusSig().notify(); | 973 | m_client->focusSig().notify(); |
@@ -1042,6 +1013,8 @@ void FluxboxWindow::associateClientWindow(bool use_attrs, | |||
1042 | updateTitleFromClient(*m_client); | 1013 | updateTitleFromClient(*m_client); |
1043 | updateIconNameFromClient(*m_client); | 1014 | updateIconNameFromClient(*m_client); |
1044 | 1015 | ||
1016 | frame().setShapingClient(m_client, false); | ||
1017 | |||
1045 | if (use_attrs) | 1018 | if (use_attrs) |
1046 | frame().moveResizeForClient(x, y, | 1019 | frame().moveResizeForClient(x, y, |
1047 | width, height, gravity, client_bw); | 1020 | width, height, gravity, client_bw); |
@@ -1299,7 +1272,6 @@ void FluxboxWindow::moveResize(int new_x, int new_y, | |||
1299 | sendConfigureNotify(); | 1272 | sendConfigureNotify(); |
1300 | } | 1273 | } |
1301 | 1274 | ||
1302 | shape(); | ||
1303 | 1275 | ||
1304 | if (!moving) { | 1276 | if (!moving) { |
1305 | m_last_resize_x = new_x; | 1277 | m_last_resize_x = new_x; |
@@ -1319,8 +1291,6 @@ void FluxboxWindow::moveResizeForClient(int new_x, int new_y, | |||
1319 | shaded = false; | 1291 | shaded = false; |
1320 | sendConfigureNotify(); | 1292 | sendConfigureNotify(); |
1321 | 1293 | ||
1322 | shape(); | ||
1323 | |||
1324 | if (!moving) { | 1294 | if (!moving) { |
1325 | m_last_resize_x = new_x; | 1295 | m_last_resize_x = new_x; |
1326 | m_last_resize_y = new_y; | 1296 | m_last_resize_y = new_y; |
@@ -1617,7 +1587,7 @@ void FluxboxWindow::setFullscreen(bool flag) { | |||
1617 | 1587 | ||
1618 | fullscreen = false; | 1588 | fullscreen = false; |
1619 | 1589 | ||
1620 | frame().setUseShape(!m_shaped); | 1590 | frame().setUseShape(true); |
1621 | if (m_toggled_decos) { | 1591 | if (m_toggled_decos) { |
1622 | if (m_old_decoration_mask & DECORM_TITLEBAR) | 1592 | if (m_old_decoration_mask & DECORM_TITLEBAR) |
1623 | setDecoration(DECOR_NONE); | 1593 | setDecoration(DECOR_NONE); |
@@ -2342,24 +2312,10 @@ void FluxboxWindow::handleEvent(XEvent &event) { | |||
2342 | #endif // DEBUG | 2312 | #endif // DEBUG |
2343 | XShapeEvent *shape_event = (XShapeEvent *)&event; | 2313 | XShapeEvent *shape_event = (XShapeEvent *)&event; |
2344 | 2314 | ||
2345 | if (shape_event->kind != ShapeBounding) | 2315 | if (shape_event->shaped) |
2346 | break; | 2316 | frame().setShapingClient(m_client, true); |
2347 | 2317 | else | |
2348 | if (shape_event->shaped) { | 2318 | frame().setShapingClient(0, true); |
2349 | m_shaped = true; | ||
2350 | shape(); | ||
2351 | } else { | ||
2352 | m_shaped = false; | ||
2353 | // set no shape | ||
2354 | XShapeCombineMask(display, | ||
2355 | frame().window().window(), ShapeClip, | ||
2356 | 0, 0, | ||
2357 | None, ShapeSet); | ||
2358 | XShapeCombineMask(display, | ||
2359 | frame().window().window(), ShapeBounding, | ||
2360 | 0, 0, | ||
2361 | None, ShapeSet); | ||
2362 | } | ||
2363 | 2319 | ||
2364 | FbTk::App::instance()->sync(false); | 2320 | FbTk::App::instance()->sync(false); |
2365 | break; | 2321 | break; |