aboutsummaryrefslogtreecommitdiff
path: root/src/FbWinFrame.cc
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-08-22 12:52:23 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-08-22 12:52:23 (GMT)
commit0ae3ca9e8a2a3398cf07789e0d141887d40dcb6f (patch)
tree4e4d66fc15fea3956106affb772ea28f3bc909dd /src/FbWinFrame.cc
parent8681220f5361fef500d7eda28d9f22bbf0a006e4 (diff)
downloadfluxbox-0ae3ca9e8a2a3398cf07789e0d141887d40dcb6f.zip
fluxbox-0ae3ca9e8a2a3398cf07789e0d141887d40dcb6f.tar.bz2
move fullscreen and maximization handling to FbWinFrame
Diffstat (limited to 'src/FbWinFrame.cc')
-rw-r--r--src/FbWinFrame.cc72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index f050a6d..03f7420 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -529,8 +529,60 @@ void FbWinFrame::setFullscreen(bool newvalue) {
529 if (newvalue == m_state.fullscreen) 529 if (newvalue == m_state.fullscreen)
530 return; 530 return;
531 531
532 saveGeometry();
532 m_state.fullscreen = newvalue; 533 m_state.fullscreen = newvalue;
534 applyState();
535}
536
537void FbWinFrame::setMaximized(int value) {
538 if (value == m_state.maximized)
539 return;
540
541 saveGeometry();
542 m_state.maximized = value;
543 applyState();
544}
545
546void FbWinFrame::saveGeometry() {
547 if (m_state.fullscreen || m_state.maximized)
548 return;
549
550 m_state.x = x();
551 m_state.y = y();
552 m_state.width = width();
553 m_state.height = height();
554}
555
556void FbWinFrame::applyState() {
533 applyDecorations(); 557 applyDecorations();
558
559 if (m_state.fullscreen) {
560 const int head = m_screen.getHead(window());
561 moveResize(m_screen.getHeadX(head), m_screen.getHeadY(head),
562 m_screen.getHeadWidth(head), m_screen.getHeadHeight(head));
563 } else if (m_state.maximized) {
564 const int head = m_screen.getHead(window());
565 int new_x = m_state.x, new_y = m_state.y;
566 unsigned int new_w = m_state.width, new_h = m_state.height;
567 if (m_state.maximized & MAX_VERT) {
568 new_y = m_screen.maxTop(head);
569 new_h = m_screen.maxBottom(head) - new_y - 2*window().borderWidth();
570 }
571 if (m_state.maximized & MAX_HORZ) {
572 new_x = m_screen.maxLeft(head);
573 new_w = m_screen.maxRight(head) - new_x - 2*window().borderWidth();
574 }
575 if (!m_screen.getMaxOverTabs()) {
576 new_y += yOffset();
577 new_h -= heightOffset();
578 new_x += xOffset();
579 new_w -= widthOffset();
580 }
581 moveResize(new_x, new_y, new_w, new_h);
582 } else
583 moveResize(m_state.x, m_state.y, m_state.width, m_state.height);
584
585 frameExtentSig().notify();
534} 586}
535 587
536void FbWinFrame::setAlpha(bool focused, unsigned char alpha) { 588void FbWinFrame::setAlpha(bool focused, unsigned char alpha) {
@@ -1662,7 +1714,27 @@ void FbWinFrame::gravityTranslate(int &x, int &y,
1662 } 1714 }
1663} 1715}
1664 1716
1717int FbWinFrame::normalX() const {
1718 if ((m_state.maximized & MAX_HORZ) || m_state.fullscreen)
1719 return m_state.x;
1720 return x();
1721}
1722
1723int FbWinFrame::normalY() const {
1724 if ((m_state.maximized & MAX_VERT) || m_state.fullscreen)
1725 return m_state.y;
1726 return y();
1727}
1728
1729unsigned int FbWinFrame::normalWidth() const {
1730 if ((m_state.maximized & MAX_HORZ) || m_state.fullscreen)
1731 return m_state.width;
1732 return width();
1733}
1734
1665unsigned int FbWinFrame::normalHeight() const { 1735unsigned int FbWinFrame::normalHeight() const {
1736 if ((m_state.maximized & MAX_VERT) || m_state.fullscreen)
1737 return m_state.height;
1666 if (m_state.shaded) 1738 if (m_state.shaded)
1667 return m_height_before_shade; 1739 return m_height_before_shade;
1668 return height(); 1740 return height();