diff options
author | fluxgen <fluxgen> | 2003-05-14 14:43:06 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-05-14 14:43:06 (GMT) |
commit | 54acafe5a895bc11225ebcca5db27e25b8234e21 (patch) | |
tree | 9dd312354b6ba822e259ade60eb53961b9ae1363 /src/Window.cc | |
parent | 615ec14ab26bdff2458457a26c5adfe743154873 (diff) | |
download | fluxbox-54acafe5a895bc11225ebcca5db27e25b8234e21.zip fluxbox-54acafe5a895bc11225ebcca5db27e25b8234e21.tar.bz2 |
added better shape support
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 77 |
1 files changed, 75 insertions, 2 deletions
diff --git a/src/Window.cc b/src/Window.cc index 385565a..a9aa97d 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Window.cc,v 1.174 2003/05/13 14:05:00 fluxgen Exp $ | 25 | // $Id: Window.cc,v 1.175 2003/05/14 14:42:30 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -326,6 +326,27 @@ FluxboxWindow::~FluxboxWindow() { | |||
326 | void FluxboxWindow::init() { | 326 | void FluxboxWindow::init() { |
327 | m_attaching_tab = 0; | 327 | m_attaching_tab = 0; |
328 | assert(m_client); | 328 | assert(m_client); |
329 | |||
330 | // check for shape extension and whether the window is shaped | ||
331 | m_shaped = false; | ||
332 | #ifdef SHAPE | ||
333 | if (Fluxbox::instance()->haveShape()) { | ||
334 | Display *disp = FbTk::App::instance()->display(); | ||
335 | int not_used; | ||
336 | unsigned int not_used2; | ||
337 | int shaped; | ||
338 | XShapeSelectInput(disp, m_client->window(), ShapeNotifyMask); | ||
339 | XShapeQueryExtents(disp, m_client->window(), | ||
340 | &shaped, /// bShaped | ||
341 | ¬_used, ¬_used, // xbs, ybs | ||
342 | ¬_used2, ¬_used2, // wbs, hbs | ||
343 | ¬_used, // cShaped | ||
344 | ¬_used, ¬_used, // xcs, ycs | ||
345 | ¬_used2, ¬_used2); // wcs, hcs | ||
346 | m_shaped = (shaped != 0 ? true : false); | ||
347 | } | ||
348 | #endif // SHAPE | ||
349 | |||
329 | //!! TODO init of client should be better | 350 | //!! TODO init of client should be better |
330 | // we don't want to duplicate code here and in attachClient | 351 | // we don't want to duplicate code here and in attachClient |
331 | m_clientlist.push_back(m_client); | 352 | m_clientlist.push_back(m_client); |
@@ -335,6 +356,8 @@ void FluxboxWindow::init() { | |||
335 | 356 | ||
336 | #endif // DEBUG | 357 | #endif // DEBUG |
337 | 358 | ||
359 | |||
360 | |||
338 | m_frame.resize(m_client->width(), m_client->height()); | 361 | m_frame.resize(m_client->width(), m_client->height()); |
339 | TextButton *btn = new TextButton(m_frame.label(), | 362 | TextButton *btn = new TextButton(m_frame.label(), |
340 | m_frame.theme().font(), | 363 | m_frame.theme().font(), |
@@ -403,7 +426,7 @@ void FluxboxWindow::init() { | |||
403 | XWindowAttributes wattrib; | 426 | XWindowAttributes wattrib; |
404 | if (! m_client->getAttrib(wattrib) || | 427 | if (! m_client->getAttrib(wattrib) || |
405 | !wattrib.screen // no screen? ?? | 428 | !wattrib.screen // no screen? ?? |
406 | || wattrib.override_redirect) { // override redirect | 429 | || wattrib.override_redirect) { // override redirect |
407 | return; | 430 | return; |
408 | } | 431 | } |
409 | 432 | ||
@@ -514,8 +537,27 @@ void FluxboxWindow::init() { | |||
514 | // no focus default | 537 | // no focus default |
515 | setFocusFlag(false); | 538 | setFocusFlag(false); |
516 | 539 | ||
540 | if (m_shaped) | ||
541 | shape(); | ||
517 | } | 542 | } |
518 | 543 | ||
544 | /// apply shape to this window | ||
545 | void FluxboxWindow::shape() { | ||
546 | #ifdef SHAPE | ||
547 | if (m_shaped) { | ||
548 | Display *disp = FbTk::App::instance()->display(); | ||
549 | XShapeCombineShape(disp, | ||
550 | m_frame.window().window(), ShapeBounding, | ||
551 | 0, m_frame.clientArea().y(), // xOff, yOff | ||
552 | m_client->window(), | ||
553 | ShapeBounding, ShapeSet); | ||
554 | XFlush(disp); | ||
555 | } | ||
556 | #endif // SHAPE | ||
557 | |||
558 | } | ||
559 | |||
560 | |||
519 | /// attach a client to this window and destroy old window | 561 | /// attach a client to this window and destroy old window |
520 | void FluxboxWindow::attachClient(WinClient &client) { | 562 | void FluxboxWindow::attachClient(WinClient &client) { |
521 | //!! TODO: check for isGroupable in client | 563 | //!! TODO: check for isGroupable in client |
@@ -1122,6 +1164,8 @@ void FluxboxWindow::moveResize(int new_x, int new_y, | |||
1122 | if (send_event && ! moving) { | 1164 | if (send_event && ! moving) { |
1123 | sendConfigureNotify(); | 1165 | sendConfigureNotify(); |
1124 | } | 1166 | } |
1167 | |||
1168 | shape(); | ||
1125 | } | 1169 | } |
1126 | 1170 | ||
1127 | bool FluxboxWindow::setInputFocus() { | 1171 | bool FluxboxWindow::setInputFocus() { |
@@ -1949,7 +1993,36 @@ void FluxboxWindow::handleEvent(XEvent &event) { | |||
1949 | propertyNotifyEvent(event.xproperty.atom); | 1993 | propertyNotifyEvent(event.xproperty.atom); |
1950 | } | 1994 | } |
1951 | break; | 1995 | break; |
1996 | |||
1997 | |||
1998 | |||
1952 | default: | 1999 | default: |
2000 | #ifdef SHAPE | ||
2001 | if (Fluxbox::instance()->haveShape() && | ||
2002 | event.type == Fluxbox::instance()->shapeEventbase() + ShapeNotify) { | ||
2003 | XShapeEvent *shape_event = (XShapeEvent *)&event; | ||
2004 | |||
2005 | if (shape_event->kind != ShapeBounding) | ||
2006 | break; | ||
2007 | |||
2008 | if (shape_event->shaped) { | ||
2009 | m_shaped = true; | ||
2010 | shape(); | ||
2011 | } else { | ||
2012 | m_shaped = false; | ||
2013 | // set no shape | ||
2014 | Display *disp = FbTk::App::instance()->display(); | ||
2015 | XShapeCombineMask(disp, | ||
2016 | m_frame.window().window(), ShapeBounding, | ||
2017 | 0, 0, | ||
2018 | None, ShapeSet); | ||
2019 | } | ||
2020 | |||
2021 | XSync(FbTk::App::instance()->display(), False); | ||
2022 | break; | ||
2023 | } | ||
2024 | #endif // SHAPE | ||
2025 | |||
1953 | break; | 2026 | break; |
1954 | } | 2027 | } |
1955 | } | 2028 | } |