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, 41 insertions, 14 deletions
diff --git a/src/Window.cc b/src/Window.cc
index a3b20f9..e6db450 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -2814,9 +2814,12 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2814 m_resize_corner = RIGHTBOTTOM; 2814 m_resize_corner = RIGHTBOTTOM;
2815 else if (me.window == frame().gripLeft()) 2815 else if (me.window == frame().gripLeft())
2816 m_resize_corner = LEFTBOTTOM; 2816 m_resize_corner = LEFTBOTTOM;
2817 else if (screen().getResizeModel() != BScreen::QUADRANTRESIZE) 2817 else if (screen().getResizeModel() != BScreen::QUADRANTRESIZE) {
2818 m_resize_corner = RIGHTBOTTOM; 2818 if (screen().getResizeModel() == BScreen::CENTERRESIZE)
2819 else if (me.x < cx) 2819 m_resize_corner = ALLCORNERS;
2820 else
2821 m_resize_corner = RIGHTBOTTOM;
2822 } else if (me.x < cx)
2820 m_resize_corner = (me.y < cy) ? LEFTTOP : LEFTBOTTOM; 2823 m_resize_corner = (me.y < cy) ? LEFTTOP : LEFTBOTTOM;
2821 else 2824 else
2822 m_resize_corner = (me.y < cy) ? RIGHTTOP : RIGHTBOTTOM; 2825 m_resize_corner = (me.y < cy) ? RIGHTTOP : RIGHTBOTTOM;
@@ -2835,21 +2838,45 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2835 2838
2836 int dx = me.x - m_button_grab_x; 2839 int dx = me.x - m_button_grab_x;
2837 int dy = me.y - m_button_grab_y; 2840 int dy = me.y - m_button_grab_y;
2838 2841 switch (m_resize_corner) {
2839 if (m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP) { 2842 case LEFTTOP:
2843 m_last_resize_w = frame().width() - dx;
2844 m_last_resize_x = frame().x() + dx;
2845 // no break, use code below too
2846 case RIGHTTOP:
2840 m_last_resize_h = frame().height() - dy; 2847 m_last_resize_h = frame().height() - dy;
2841 m_last_resize_y = frame().y() + dy; 2848 m_last_resize_y = frame().y() + dy;
2842 } else { 2849 break;
2843 m_last_resize_h = frame().height() + dy; 2850 case LEFTBOTTOM:
2844 }
2845
2846 if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM) {
2847 m_last_resize_w = frame().width() - dx; 2851 m_last_resize_w = frame().width() - dx;
2848 m_last_resize_x = frame().x() + dx; 2852 m_last_resize_x = frame().x() + dx;
2849 } else { 2853 break;
2850 m_last_resize_w = frame().width() + dx; 2854 case ALLCORNERS:
2851 } 2855 // dx or dy must be at least 2
2856 if (abs(dx) >= 2 || abs(dy) >= 2) {
2857 // take max and make it even
2858 int diff = 2 * (max(dx, dy) / 2);
2859
2860 m_last_resize_h = frame().height() + diff;
2861
2862 m_last_resize_w = frame().width() + diff;
2863 m_last_resize_x = frame().x() - diff/2;
2864 m_last_resize_y = frame().y() - diff/2;
2865 }
2866 break;
2867 };
2852 2868
2869 // if not on top or all corner then move bottom
2870
2871 if (!(m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP ||
2872 m_resize_corner == ALLCORNERS))
2873 m_last_resize_h = frame().height() + dy;
2874
2875 // if not top or left bottom or all corners then move right side
2876 if (!(m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM ||
2877 m_resize_corner == ALLCORNERS))
2878 m_last_resize_w = frame().width() + dx;
2879
2853 fixsize(&gx, &gy); 2880 fixsize(&gx, &gy);
2854 2881
2855 if (old_resize_x != m_last_resize_x || 2882 if (old_resize_x != m_last_resize_x ||
@@ -3692,7 +3719,7 @@ void FluxboxWindow::fixsize(int *user_w, int *user_h) {
3692 // move X if necessary 3719 // move X if necessary
3693 if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM) { 3720 if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM) {
3694 m_last_resize_x = frame().x() + frame().width() - m_last_resize_w; 3721 m_last_resize_x = frame().x() + frame().width() - m_last_resize_w;
3695 } 3722 }
3696 3723
3697 if (m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP) { 3724 if (m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP) {
3698 m_last_resize_y = frame().y() + frame().height() - m_last_resize_h; 3725 m_last_resize_y = frame().y() + frame().height() - m_last_resize_h;