aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc55
1 files changed, 25 insertions, 30 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 2997794..65afd67 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -2788,20 +2788,23 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2788 2788
2789 int dx = me.x - m_button_grab_x; 2789 int dx = me.x - m_button_grab_x;
2790 int dy = me.y - m_button_grab_y; 2790 int dy = me.y - m_button_grab_y;
2791 switch (m_resize_corner) { 2791 if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM ||
2792 case LEFTTOP: 2792 m_resize_corner == LEFT) {
2793 m_last_resize_w = frame().width() - dx; 2793 m_last_resize_w = frame().width() - dx;
2794 m_last_resize_x = frame().x() + dx; 2794 m_last_resize_x = frame().x() + dx;
2795 // no break, use code below too 2795 }
2796 case RIGHTTOP: 2796 if (m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP ||
2797 m_resize_corner == TOP) {
2797 m_last_resize_h = frame().height() - dy; 2798 m_last_resize_h = frame().height() - dy;
2798 m_last_resize_y = frame().y() + dy; 2799 m_last_resize_y = frame().y() + dy;
2799 break; 2800 }
2800 case LEFTBOTTOM: 2801 if (m_resize_corner == LEFTBOTTOM || m_resize_corner == BOTTOM ||
2801 m_last_resize_w = frame().width() - dx; 2802 m_resize_corner == RIGHTBOTTOM)
2802 m_last_resize_x = frame().x() + dx; 2803 m_last_resize_h = frame().height() + dy;
2803 break; 2804 if (m_resize_corner == RIGHTBOTTOM || m_resize_corner == RIGHTTOP ||
2804 case ALLCORNERS: 2805 m_resize_corner == RIGHT)
2806 m_last_resize_w = frame().width() + dx;
2807 if (m_resize_corner == ALLCORNERS) {
2805 // dx or dy must be at least 2 2808 // dx or dy must be at least 2
2806 if (abs(dx) >= 2 || abs(dy) >= 2) { 2809 if (abs(dx) >= 2 || abs(dy) >= 2) {
2807 // take max and make it even 2810 // take max and make it even
@@ -2813,21 +2816,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2813 m_last_resize_x = frame().x() - diff/2; 2816 m_last_resize_x = frame().x() - diff/2;
2814 m_last_resize_y = frame().y() - diff/2; 2817 m_last_resize_y = frame().y() - diff/2;
2815 } 2818 }
2816 break; 2819 }
2817 default: // kill warning
2818 break;
2819 };
2820
2821 // if not on top or all corner then move bottom
2822
2823 if (!(m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP ||
2824 m_resize_corner == ALLCORNERS))
2825 m_last_resize_h = frame().height() + dy;
2826
2827 // if not top or left bottom or all corners then move right side
2828 if (!(m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM ||
2829 m_resize_corner == ALLCORNERS))
2830 m_last_resize_w = frame().width() + dx;
2831 2820
2832 fixsize(&gx, &gy); 2821 fixsize(&gx, &gy);
2833 2822
@@ -3402,7 +3391,7 @@ FluxboxWindow::ResizeDirection FluxboxWindow::getResizeDirection(int x, int y,
3402 if (model == CENTERRESIZE) 3391 if (model == CENTERRESIZE)
3403 return ALLCORNERS; 3392 return ALLCORNERS;
3404 if (model == NEARESTEDGERESIZE) { 3393 if (model == NEARESTEDGERESIZE) {
3405 if (abs(cy - abs(y - cy)) > abs(cx - abs(x - cx))) // y is nearest 3394 if (cy - abs(y - cy) < cx - abs(x - cx)) // y is nearest
3406 return (y > cy) ? BOTTOM : TOP; 3395 return (y > cy) ? BOTTOM : TOP;
3407 return (x > cx) ? RIGHT : LEFT; 3396 return (x > cx) ? RIGHT : LEFT;
3408 } 3397 }
@@ -3437,6 +3426,10 @@ void FluxboxWindow::startResizing(int x, int y, ResizeDirection dir) {
3437 const Cursor& cursor = (m_resize_corner == LEFTTOP) ? frame().theme().upperLeftAngleCursor() : 3426 const Cursor& cursor = (m_resize_corner == LEFTTOP) ? frame().theme().upperLeftAngleCursor() :
3438 (m_resize_corner == RIGHTTOP) ? frame().theme().upperRightAngleCursor() : 3427 (m_resize_corner == RIGHTTOP) ? frame().theme().upperRightAngleCursor() :
3439 (m_resize_corner == RIGHTBOTTOM) ? frame().theme().lowerRightAngleCursor() : 3428 (m_resize_corner == RIGHTBOTTOM) ? frame().theme().lowerRightAngleCursor() :
3429 (m_resize_corner == LEFT) ? frame().theme().leftSideCursor() :
3430 (m_resize_corner == RIGHT) ? frame().theme().rightSideCursor() :
3431 (m_resize_corner == TOP) ? frame().theme().topSideCursor() :
3432 (m_resize_corner == BOTTOM) ? frame().theme().bottomSideCursor() :
3440 frame().theme().lowerLeftAngleCursor(); 3433 frame().theme().lowerLeftAngleCursor();
3441 3434
3442 grabPointer(fbWindow().window(), 3435 grabPointer(fbWindow().window(),
@@ -3724,11 +3717,13 @@ void FluxboxWindow::fixsize(int *user_w, int *user_h, bool maximizing) {
3724 m_last_resize_h = dh + decoration_height; 3717 m_last_resize_h = dh + decoration_height;
3725 3718
3726 // move X if necessary 3719 // move X if necessary
3727 if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM) { 3720 if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM ||
3721 m_resize_corner == LEFT) {
3728 m_last_resize_x = frame().x() + frame().width() - m_last_resize_w; 3722 m_last_resize_x = frame().x() + frame().width() - m_last_resize_w;
3729 } 3723 }
3730 3724
3731 if (m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP) { 3725 if (m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP ||
3726 m_resize_corner == TOP) {
3732 m_last_resize_y = frame().y() + frame().height() - m_last_resize_h; 3727 m_last_resize_y = frame().y() + frame().height() - m_last_resize_h;
3733 } 3728 }
3734 3729