diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2008-05-25 23:08:40 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-05-25 23:08:40 (GMT) |
commit | 130012c01056250e969d02bc82a26e4a28899e1a (patch) | |
tree | b04ae1db16c683e31b9166160d3c69c4b3b76a8e | |
parent | c1d400b436e38b6f989adfc2a3d7f1de4f1d13d1 (diff) | |
download | fluxbox-130012c01056250e969d02bc82a26e4a28899e1a.zip fluxbox-130012c01056250e969d02bc82a26e4a28899e1a.tar.bz2 |
simplify gravity calculations
-rw-r--r-- | src/FbWinFrame.cc | 56 |
1 files changed, 21 insertions, 35 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index a31c327..684fcbc 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc | |||
@@ -1557,44 +1557,30 @@ void FbWinFrame::gravityTranslate(int &x, int &y, | |||
1557 | // Note that the client window's x,y is offset by it's borderWidth, which | 1557 | // Note that the client window's x,y is offset by it's borderWidth, which |
1558 | // is removed by fluxbox, so the gravity needs to account for this change | 1558 | // is removed by fluxbox, so the gravity needs to account for this change |
1559 | 1559 | ||
1560 | // unsigned int width_offset = 0; // no side decorations | ||
1561 | |||
1562 | // these functions already check if the title/handle is used | 1560 | // these functions already check if the title/handle is used |
1563 | int height_offset = - titlebarHeight() - handleHeight(); | ||
1564 | |||
1565 | int bw_diff = client_bw - m_window.borderWidth(); | 1561 | int bw_diff = client_bw - m_window.borderWidth(); |
1562 | int height_diff = 2*bw_diff - titlebarHeight() - handleHeight(); | ||
1563 | int width_diff = 2*bw_diff; | ||
1566 | 1564 | ||
1567 | // mostly no X offset, since we don't have extra frame on the sides | 1565 | if (win_gravity == SouthWestGravity || win_gravity == SouthGravity || |
1568 | switch (win_gravity) { | 1566 | win_gravity == SouthEastGravity) |
1569 | case NorthEastGravity: | 1567 | y_offset = height_diff; |
1570 | x_offset += bw_diff; | 1568 | |
1571 | case NorthGravity: | 1569 | if (win_gravity == WestGravity || win_gravity == CenterGravity || |
1572 | x_offset += bw_diff; | 1570 | win_gravity == EastGravity) |
1573 | case NorthWestGravity: | 1571 | y_offset = height_diff/2; |
1574 | // no offset, since the top point is still the same | 1572 | |
1575 | break; | 1573 | if (win_gravity == NorthEastGravity || win_gravity == EastGravity || |
1576 | case SouthEastGravity: | 1574 | win_gravity == SouthEastGravity) |
1577 | x_offset += bw_diff; | 1575 | x_offset = width_diff; |
1578 | case SouthGravity: | 1576 | |
1579 | x_offset += bw_diff; | 1577 | if (win_gravity == NorthGravity || win_gravity == CenterGravity || |
1580 | case SouthWestGravity: | 1578 | win_gravity == SouthGravity) |
1581 | // window shifted down by height of titlebar, and the handle | 1579 | x_offset = width_diff/2; |
1582 | // since that's necessary to get the bottom of the frame | 1580 | |
1583 | // all the way up | 1581 | if (win_gravity == StaticGravity) { |
1584 | y_offset += 2*bw_diff + height_offset; | 1582 | x_offset = bw_diff; |
1585 | break; | 1583 | y_offset = bw_diff - titlebarHeight(); |
1586 | case EastGravity: | ||
1587 | x_offset += bw_diff; | ||
1588 | case CenterGravity: | ||
1589 | x_offset += bw_diff; | ||
1590 | case WestGravity: | ||
1591 | // these centered ones are a little more interesting | ||
1592 | y_offset += bw_diff + height_offset/2; | ||
1593 | break; | ||
1594 | case StaticGravity: | ||
1595 | x_offset += bw_diff; | ||
1596 | y_offset += -titlebarHeight() + bw_diff; | ||
1597 | break; | ||
1598 | } | 1584 | } |
1599 | 1585 | ||
1600 | if (invert) { | 1586 | if (invert) { |