aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-08-15 11:24:03 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-08-15 11:24:03 (GMT)
commite5c61a72799485d6751000a127163bd6390d44ba (patch)
tree06846dffe135e57f958dc69e9731e1f68fb56615 /src/Window.cc
parent1dab657708cd8246c2ce5a6aaa05cc5733e09c54 (diff)
downloadfluxbox-e5c61a72799485d6751000a127163bd6390d44ba.zip
fluxbox-e5c61a72799485d6751000a127163bd6390d44ba.tar.bz2
move some frame size calculations to FbWinFrame
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc35
1 files changed, 7 insertions, 28 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 2a2dbd9..ef6cd73 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -1690,7 +1690,7 @@ void FluxboxWindow::setMaximizedState(int type) {
1690 if (!screen().getMaxIgnoreIncrement() || !maximized) { 1690 if (!screen().getMaxIgnoreIncrement() || !maximized) {
1691 ResizeDirection old_resize_corner = m_resize_corner; 1691 ResizeDirection old_resize_corner = m_resize_corner;
1692 m_resize_corner = NOCORNER; 1692 m_resize_corner = NOCORNER;
1693 fixsize(0, 0, (maximized ? true : false)); 1693 fixsize(maximized ? true : false);
1694 m_resize_corner = old_resize_corner; 1694 m_resize_corner = old_resize_corner;
1695 } 1695 }
1696 1696
@@ -2835,9 +2835,6 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2835 unsigned int old_resize_w = m_last_resize_w; 2835 unsigned int old_resize_w = m_last_resize_w;
2836 unsigned int old_resize_h = m_last_resize_h; 2836 unsigned int old_resize_h = m_last_resize_h;
2837 2837
2838 // move rectangle
2839 int gx = 0, gy = 0;
2840
2841 int dx = me.x - m_button_grab_x; 2838 int dx = me.x - m_button_grab_x;
2842 int dy = me.y - m_button_grab_y; 2839 int dy = me.y - m_button_grab_y;
2843 if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM || 2840 if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM ||
@@ -2870,7 +2867,8 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2870 } 2867 }
2871 } 2868 }
2872 2869
2873 fixsize(&gx, &gy); 2870 fixsize();
2871 frame().displaySize(m_last_resize_w, m_last_resize_h);
2874 2872
2875 if (old_resize_x != m_last_resize_x || 2873 if (old_resize_x != m_last_resize_x ||
2876 old_resize_y != m_last_resize_y || 2874 old_resize_y != m_last_resize_y ||
@@ -2889,7 +2887,6 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2889 m_last_resize_w - 1 + 2 * frame().window().borderWidth(), 2887 m_last_resize_w - 1 + 2 * frame().window().borderWidth(),
2890 m_last_resize_h - 1 + 2 * frame().window().borderWidth()); 2888 m_last_resize_h - 1 + 2 * frame().window().borderWidth());
2891 2889
2892 screen().showGeometry(gx, gy);
2893 } 2890 }
2894 } 2891 }
2895 } else if (m_attaching_tab != 0) { 2892 } else if (m_attaching_tab != 0) {
@@ -3413,7 +3410,6 @@ void FluxboxWindow::startResizing(int x, int y, ResizeDirection dir) {
3413 false, ButtonMotionMask | ButtonReleaseMask, 3410 false, ButtonMotionMask | ButtonReleaseMask,
3414 GrabModeAsync, GrabModeAsync, None, cursor, CurrentTime); 3411 GrabModeAsync, GrabModeAsync, None, cursor, CurrentTime);
3415 3412
3416 int gx = 0, gy = 0;
3417 m_button_grab_x = x; 3413 m_button_grab_x = x;
3418 m_button_grab_y = y; 3414 m_button_grab_y = y;
3419 m_last_resize_x = frame().x(); 3415 m_last_resize_x = frame().x();
@@ -3421,9 +3417,8 @@ void FluxboxWindow::startResizing(int x, int y, ResizeDirection dir) {
3421 m_last_resize_w = frame().width(); 3417 m_last_resize_w = frame().width();
3422 m_last_resize_h = frame().height(); 3418 m_last_resize_h = frame().height();
3423 3419
3424 fixsize(&gx, &gy); 3420 fixsize();
3425 3421 frame().displaySize(m_last_resize_w, m_last_resize_h);
3426 screen().showGeometry(gx, gy);
3427 3422
3428 parent().drawRectangle(screen().rootTheme()->opGC(), 3423 parent().drawRectangle(screen().rootTheme()->opGC(),
3429 m_last_resize_x, m_last_resize_y, 3424 m_last_resize_x, m_last_resize_y,
@@ -3720,23 +3715,8 @@ unsigned int FluxboxWindow::normalHeight() const {
3720 3715
3721int FluxboxWindow::initialState() const { return m_client->initial_state; } 3716int FluxboxWindow::initialState() const { return m_client->initial_state; }
3722 3717
3723void FluxboxWindow::fixsize(int *user_w, int *user_h, bool maximizing) { 3718void FluxboxWindow::fixsize(bool maximizing) {
3724 int decoration_height = frame().titlebarHeight() + frame().handleHeight(); 3719 frame().applySizeHints(m_last_resize_w, m_last_resize_h, maximizing);
3725
3726 // dx is new width = current width + difference between new and old x values
3727 //int dx = frame().width() + frame().x() - m_last_resize_x;
3728 unsigned int dw = m_last_resize_w;
3729
3730 // dy = new height (w/o decorations), similarly
3731 unsigned int dh = m_last_resize_h - decoration_height;
3732
3733 frame().sizeHints().apply(dw, dh, maximizing);
3734 if (user_w && user_h)
3735 frame().sizeHints().displaySize(*user_w, *user_h, dw, dh);
3736
3737 // update last resize
3738 m_last_resize_w = dw;
3739 m_last_resize_h = dh + decoration_height;
3740 3720
3741 // move X if necessary 3721 // move X if necessary
3742 if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM || 3722 if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM ||
@@ -3748,7 +3728,6 @@ void FluxboxWindow::fixsize(int *user_w, int *user_h, bool maximizing) {
3748 m_resize_corner == TOP) { 3728 m_resize_corner == TOP) {
3749 m_last_resize_y = frame().y() + frame().height() - m_last_resize_h; 3729 m_last_resize_y = frame().y() + frame().height() - m_last_resize_h;
3750 } 3730 }
3751
3752} 3731}
3753 3732
3754void FluxboxWindow::moveResizeClient(WinClient &client, int x, int y, 3733void FluxboxWindow::moveResizeClient(WinClient &client, int x, int y,