diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2008-08-16 07:22:12 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-08-16 07:22:12 (GMT) |
commit | fe412dbeef7af324a376cba338bff8c24e032d2e (patch) | |
tree | eab03ffc2e6b94e70d78c29ae3384b2c265e7a18 /src/FbWinFrame.cc | |
parent | 1d8dfcdf9ad5405f4eef18dc009ce8cfe6d27f29 (diff) | |
download | fluxbox_pavel-fe412dbeef7af324a376cba338bff8c24e032d2e.zip fluxbox_pavel-fe412dbeef7af324a376cba338bff8c24e032d2e.tar.bz2 |
move interpretation of normal hints to size hint class
Diffstat (limited to 'src/FbWinFrame.cc')
-rw-r--r-- | src/FbWinFrame.cc | 67 |
1 files changed, 60 insertions, 7 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 36d2942..c7eaef3 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc | |||
@@ -85,7 +85,6 @@ FbWinFrame::FbWinFrame(BScreen &screen, | |||
85 | m_visible(false), | 85 | m_visible(false), |
86 | m_button_pm(0), | 86 | m_button_pm(0), |
87 | m_tabmode(screen.getDefaultInternalTabs()?INTERNAL:EXTERNAL), | 87 | m_tabmode(screen.getDefaultInternalTabs()?INTERNAL:EXTERNAL), |
88 | m_active_gravity(0), | ||
89 | m_active_orig_client_bw(0), | 88 | m_active_orig_client_bw(0), |
90 | m_need_render(true), | 89 | m_need_render(true), |
91 | m_button_size(1), | 90 | m_button_size(1), |
@@ -846,7 +845,7 @@ void FbWinFrame::reconfigure() { | |||
846 | 845 | ||
847 | int grav_x=0, grav_y=0; | 846 | int grav_x=0, grav_y=0; |
848 | // negate gravity | 847 | // negate gravity |
849 | gravityTranslate(grav_x, grav_y, -m_active_gravity, m_active_orig_client_bw, false); | 848 | gravityTranslate(grav_x, grav_y, -sizeHints().win_gravity, m_active_orig_client_bw, false); |
850 | 849 | ||
851 | m_bevel = theme()->bevelWidth(); | 850 | m_bevel = theme()->bevelWidth(); |
852 | setBorderWidth(); | 851 | setBorderWidth(); |
@@ -941,7 +940,7 @@ void FbWinFrame::reconfigure() { | |||
941 | m_window.width(), client_height); | 940 | m_window.width(), client_height); |
942 | } | 941 | } |
943 | 942 | ||
944 | gravityTranslate(grav_x, grav_y, m_active_gravity, m_active_orig_client_bw, false); | 943 | gravityTranslate(grav_x, grav_y, sizeHints().win_gravity, m_active_orig_client_bw, false); |
945 | // if the location changes, shift it | 944 | // if the location changes, shift it |
946 | if (grav_x != 0 || grav_y != 0) | 945 | if (grav_x != 0 || grav_y != 0) |
947 | move(grav_x + x(), grav_y + y()); | 946 | move(grav_x + x(), grav_y + y()); |
@@ -1456,7 +1455,7 @@ bool FbWinFrame::useHandle() const { | |||
1456 | void FbWinFrame::applyDecorations() { | 1455 | void FbWinFrame::applyDecorations() { |
1457 | int grav_x=0, grav_y=0; | 1456 | int grav_x=0, grav_y=0; |
1458 | // negate gravity | 1457 | // negate gravity |
1459 | gravityTranslate(grav_x, grav_y, -m_active_gravity, m_active_orig_client_bw, | 1458 | gravityTranslate(grav_x, grav_y, -sizeHints().win_gravity, m_active_orig_client_bw, |
1460 | false); | 1459 | false); |
1461 | 1460 | ||
1462 | bool client_move = setBorderWidth(false); | 1461 | bool client_move = setBorderWidth(false); |
@@ -1488,7 +1487,7 @@ void FbWinFrame::applyDecorations() { | |||
1488 | client_move |= hideHandle(); | 1487 | client_move |= hideHandle(); |
1489 | 1488 | ||
1490 | // apply gravity once more | 1489 | // apply gravity once more |
1491 | gravityTranslate(grav_x, grav_y, m_active_gravity, m_active_orig_client_bw, | 1490 | gravityTranslate(grav_x, grav_y, sizeHints().win_gravity, m_active_orig_client_bw, |
1492 | false); | 1491 | false); |
1493 | 1492 | ||
1494 | // if the location changes, shift it | 1493 | // if the location changes, shift it |
@@ -1523,7 +1522,7 @@ bool FbWinFrame::setBorderWidth(bool do_move) { | |||
1523 | int grav_x=0, grav_y=0; | 1522 | int grav_x=0, grav_y=0; |
1524 | // negate gravity | 1523 | // negate gravity |
1525 | if (do_move) | 1524 | if (do_move) |
1526 | gravityTranslate(grav_x, grav_y, -m_active_gravity, | 1525 | gravityTranslate(grav_x, grav_y, -sizeHints().win_gravity, |
1527 | m_active_orig_client_bw, false); | 1526 | m_active_orig_client_bw, false); |
1528 | 1527 | ||
1529 | int bw_changes = 0; | 1528 | int bw_changes = 0; |
@@ -1551,7 +1550,7 @@ bool FbWinFrame::setBorderWidth(bool do_move) { | |||
1551 | 1550 | ||
1552 | if (do_move) { | 1551 | if (do_move) { |
1553 | frameExtentSig().notify(); | 1552 | frameExtentSig().notify(); |
1554 | gravityTranslate(grav_x, grav_y, m_active_gravity, | 1553 | gravityTranslate(grav_x, grav_y, sizeHints().win_gravity, |
1555 | m_active_orig_client_bw, false); | 1554 | m_active_orig_client_bw, false); |
1556 | // if the location changes, shift it | 1555 | // if the location changes, shift it |
1557 | if (grav_x != 0 || grav_y != 0) | 1556 | if (grav_x != 0 || grav_y != 0) |
@@ -1725,6 +1724,60 @@ void FbWinFrame::displaySize(unsigned int width, unsigned int height) const { | |||
1725 | m_screen.showGeometry(i, j); | 1724 | m_screen.showGeometry(i, j); |
1726 | } | 1725 | } |
1727 | 1726 | ||
1727 | void FbWinFrame::SizeHints::reset(const XSizeHints &sizehint) { | ||
1728 | if (sizehint.flags & PMinSize) { | ||
1729 | min_width = sizehint.min_width; | ||
1730 | min_height = sizehint.min_height; | ||
1731 | } else | ||
1732 | min_width = min_height = 1; | ||
1733 | |||
1734 | if (sizehint.flags & PBaseSize) { | ||
1735 | base_width = sizehint.base_width; | ||
1736 | base_height = sizehint.base_height; | ||
1737 | if (!(sizehint.flags & PMinSize)) { | ||
1738 | min_width = base_width; | ||
1739 | min_height = base_height; | ||
1740 | } | ||
1741 | } else | ||
1742 | base_width = base_height = 0; | ||
1743 | |||
1744 | if (sizehint.flags & PMaxSize) { | ||
1745 | max_width = sizehint.max_width; | ||
1746 | max_height = sizehint.max_height; | ||
1747 | } else | ||
1748 | max_width = max_height = 0; // unbounded | ||
1749 | |||
1750 | if (sizehint.flags & PResizeInc) { | ||
1751 | width_inc = sizehint.width_inc; | ||
1752 | height_inc = sizehint.height_inc; | ||
1753 | } else | ||
1754 | width_inc = height_inc = 1; | ||
1755 | |||
1756 | if (sizehint.flags & PAspect) { | ||
1757 | min_aspect_x = sizehint.min_aspect.x; | ||
1758 | min_aspect_y = sizehint.min_aspect.y; | ||
1759 | max_aspect_x = sizehint.max_aspect.x; | ||
1760 | max_aspect_y = sizehint.max_aspect.y; | ||
1761 | } else | ||
1762 | min_aspect_x = min_aspect_y = max_aspect_x = max_aspect_y = 0; | ||
1763 | |||
1764 | if (sizehint.flags & PWinGravity) | ||
1765 | win_gravity = sizehint.win_gravity; | ||
1766 | else | ||
1767 | win_gravity = NorthWestGravity; | ||
1768 | |||
1769 | // some sanity checks | ||
1770 | if (width_inc == 0) | ||
1771 | width_inc = 1; | ||
1772 | if (height_inc == 0) | ||
1773 | height_inc = 1; | ||
1774 | |||
1775 | if (base_width > min_width) | ||
1776 | min_width = base_width; | ||
1777 | if (base_height > min_height) | ||
1778 | min_height = base_height; | ||
1779 | } | ||
1780 | |||
1728 | /* For aspect ratios | 1781 | /* For aspect ratios |
1729 | Note that its slightly simplified in that only the | 1782 | Note that its slightly simplified in that only the |
1730 | line gradient is given - this is because for aspect | 1783 | line gradient is given - this is because for aspect |