aboutsummaryrefslogtreecommitdiff
path: root/src/FbWinFrame.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbWinFrame.cc')
-rw-r--r--src/FbWinFrame.cc125
1 files changed, 79 insertions, 46 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index a806888..a31c327 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -487,12 +487,7 @@ void FbWinFrame::setFocus(bool newvalue) {
487 } 487 }
488 } 488 }
489 489
490 if (m_decoration_mask & DECORM_BORDER && 490 setBorderWidth();
491 (theme().focusedTheme()->border().width() !=
492 theme().unfocusedTheme()->border().width() ||
493 theme().focusedTheme()->border().color().pixel() !=
494 theme().unfocusedTheme()->border().color().pixel()))
495 setBorderWidth(theme()->border().width());
496 491
497 applyAll(); 492 applyAll();
498 clearAll(); 493 clearAll();
@@ -759,28 +754,6 @@ bool FbWinFrame::showHandle() {
759 return true; 754 return true;
760} 755}
761 756
762bool FbWinFrame::hideAllDecorations() {
763 bool changed = false;
764 changed |= hideHandle();
765 changed |= hideTitlebar();
766 // resize done by hide*
767 reconfigure();
768
769 return changed;
770}
771
772bool FbWinFrame::showAllDecorations() {
773 bool changed = false;
774 if (!m_use_handle)
775 changed |= showHandle();
776 if (!m_use_titlebar)
777 changed |= showTitlebar();
778 // resize shouldn't be necessary
779 reconfigure();
780
781 return changed;
782}
783
784/** 757/**
785 Set new event handler for the frame's windows 758 Set new event handler for the frame's windows
786*/ 759*/
@@ -871,8 +844,7 @@ void FbWinFrame::reconfigure() {
871 gravityTranslate(grav_x, grav_y, -m_active_gravity, m_active_orig_client_bw, false); 844 gravityTranslate(grav_x, grav_y, -m_active_gravity, m_active_orig_client_bw, false);
872 845
873 m_bevel = theme()->bevelWidth(); 846 m_bevel = theme()->bevelWidth();
874 setBorderWidth(m_decoration_mask & DECORM_BORDER ? 847 setBorderWidth();
875 theme()->border().width() : 0);
876 848
877 if (m_decoration_mask & DECORM_HANDLE && theme()->handleWidth() != 0) 849 if (m_decoration_mask & DECORM_HANDLE && theme()->handleWidth() != 0)
878 showHandle(); 850 showHandle();
@@ -1439,14 +1411,78 @@ void FbWinFrame::applyTabContainer() {
1439 } 1411 }
1440} 1412}
1441 1413
1442void FbWinFrame::setBorderWidth(unsigned int border_width) { 1414void FbWinFrame::applyDecorations() {
1443 int bw_changes = 0;
1444
1445 int grav_x=0, grav_y=0; 1415 int grav_x=0, grav_y=0;
1446 // negate gravity 1416 // negate gravity
1447 gravityTranslate(grav_x, grav_y, -m_active_gravity, m_active_orig_client_bw, false); 1417 gravityTranslate(grav_x, grav_y, -m_active_gravity, m_active_orig_client_bw,
1418 false);
1419
1420 bool client_move = setBorderWidth(false);
1421
1422 // tab deocration only affects if we're external
1423 // must do before the setTabMode in case it goes
1424 // to external and is meant to be hidden
1425 if (m_decoration_mask & DECORM_TAB)
1426 client_move |= showTabs();
1427 else
1428 client_move |= hideTabs();
1429
1430 // we rely on frame not doing anything if it is already shown/hidden
1431 if (m_decoration_mask & DECORM_TITLEBAR) {
1432 client_move |= showTitlebar();
1433 if (m_screen.getDefaultInternalTabs())
1434 client_move |= setTabMode(INTERNAL);
1435 else
1436 client_move |= setTabMode(EXTERNAL);
1437 } else {
1438 client_move |= hideTitlebar();
1439 if (m_decoration_mask & DECORM_TAB)
1440 client_move |= setTabMode(EXTERNAL);
1441 }
1442
1443 if (m_decoration_mask & DECORM_HANDLE)
1444 client_move |= showHandle();
1445 else
1446 client_move |= hideHandle();
1448 1447
1448 // apply gravity once more
1449 gravityTranslate(grav_x, grav_y, m_active_gravity, m_active_orig_client_bw,
1450 false);
1449 1451
1452 // if the location changes, shift it
1453 if (grav_x != 0 || grav_y != 0) {
1454 move(grav_x + x(), grav_y + y());
1455 client_move = true;
1456 }
1457
1458 reconfigure();
1459 if (client_move)
1460 frameExtentSig().notify();
1461}
1462
1463bool FbWinFrame::setBorderWidth(bool do_move) {
1464 unsigned int border_width = m_decoration_mask & DECORM_BORDER ?
1465 theme()->border().width() : 0;
1466
1467 if (border_width &&
1468 theme()->border().color().pixel() != window().borderColor()) {
1469 window().setBorderColor(theme()->border().color());
1470 titlebar().setBorderColor(theme()->border().color());
1471 handle().setBorderColor(theme()->border().color());
1472 gripLeft().setBorderColor(theme()->border().color());
1473 gripRight().setBorderColor(theme()->border().color());
1474 }
1475
1476 if (border_width == window().borderWidth())
1477 return false;
1478
1479 int grav_x=0, grav_y=0;
1480 // negate gravity
1481 if (do_move)
1482 gravityTranslate(grav_x, grav_y, -m_active_gravity,
1483 m_active_orig_client_bw, false);
1484
1485 int bw_changes = 0;
1450 // we need to change the size of the window 1486 // we need to change the size of the window
1451 // if the border width changes... 1487 // if the border width changes...
1452 if (m_use_titlebar) 1488 if (m_use_titlebar)
@@ -1455,21 +1491,13 @@ void FbWinFrame::setBorderWidth(unsigned int border_width) {
1455 bw_changes += static_cast<signed>(border_width - handle().borderWidth()); 1491 bw_changes += static_cast<signed>(border_width - handle().borderWidth());
1456 1492
1457 window().setBorderWidth(border_width); 1493 window().setBorderWidth(border_width);
1458 window().setBorderColor(theme()->border().color());
1459 1494
1460 setTabMode(NOTSET); 1495 setTabMode(NOTSET);
1461 1496
1462 titlebar().setBorderWidth(border_width); 1497 titlebar().setBorderWidth(border_width);
1463 titlebar().setBorderColor(theme()->border().color());
1464
1465 handle().setBorderWidth(border_width); 1498 handle().setBorderWidth(border_width);
1466 handle().setBorderColor(theme()->border().color());
1467
1468 gripLeft().setBorderWidth(border_width); 1499 gripLeft().setBorderWidth(border_width);
1469 gripLeft().setBorderColor(theme()->border().color());
1470
1471 gripRight().setBorderWidth(border_width); 1500 gripRight().setBorderWidth(border_width);
1472 gripRight().setBorderColor(theme()->border().color());
1473 1501
1474 if (bw_changes != 0) 1502 if (bw_changes != 0)
1475 resize(width(), height() + bw_changes); 1503 resize(width(), height() + bw_changes);
@@ -1477,11 +1505,16 @@ void FbWinFrame::setBorderWidth(unsigned int border_width) {
1477 if (m_tabmode == EXTERNAL) 1505 if (m_tabmode == EXTERNAL)
1478 alignTabs(); 1506 alignTabs();
1479 1507
1480 gravityTranslate(grav_x, grav_y, m_active_gravity, m_active_orig_client_bw, false); 1508 if (do_move) {
1481 // if the location changes, shift it 1509 frameExtentSig().notify();
1482 if (grav_x != 0 || grav_y != 0) 1510 gravityTranslate(grav_x, grav_y, m_active_gravity,
1483 move(grav_x + x(), grav_y + y()); 1511 m_active_orig_client_bw, false);
1512 // if the location changes, shift it
1513 if (grav_x != 0 || grav_y != 0)
1514 move(grav_x + x(), grav_y + y());
1515 }
1484 1516
1517 return true;
1485} 1518}
1486 1519
1487// this function translates its arguments according to win_gravity 1520// this function translates its arguments according to win_gravity