diff options
author | markt <markt> | 2007-12-11 19:31:24 (GMT) |
---|---|---|
committer | markt <markt> | 2007-12-11 19:31:24 (GMT) |
commit | daca07edafc2e75eb9ee04d35fe80759308a8583 (patch) | |
tree | 380465a1d1c3e0bd2ae18a0d509fa7aa9d4f4526 /src | |
parent | 474e2017454d3c6492eb9f428aee039d36d76e05 (diff) | |
download | fluxbox_lack-daca07edafc2e75eb9ee04d35fe80759308a8583.zip fluxbox_lack-daca07edafc2e75eb9ee04d35fe80759308a8583.tar.bz2 |
added edge resize modes
Diffstat (limited to 'src')
-rw-r--r-- | src/FbWinFrameTheme.cc | 4 | ||||
-rw-r--r-- | src/FbWinFrameTheme.hh | 8 | ||||
-rw-r--r-- | src/Window.cc | 55 |
3 files changed, 37 insertions, 30 deletions
diff --git a/src/FbWinFrameTheme.cc b/src/FbWinFrameTheme.cc index 6f7f9ef..33a45a8 100644 --- a/src/FbWinFrameTheme.cc +++ b/src/FbWinFrameTheme.cc | |||
@@ -69,6 +69,10 @@ FbWinFrameTheme::FbWinFrameTheme(int screen_num): | |||
69 | m_cursor_lower_right_angle = XCreateFontCursor(disp, XC_lr_angle); | 69 | m_cursor_lower_right_angle = XCreateFontCursor(disp, XC_lr_angle); |
70 | m_cursor_upper_right_angle = XCreateFontCursor(disp, XC_ur_angle); | 70 | m_cursor_upper_right_angle = XCreateFontCursor(disp, XC_ur_angle); |
71 | m_cursor_upper_left_angle = XCreateFontCursor(disp, XC_ul_angle); | 71 | m_cursor_upper_left_angle = XCreateFontCursor(disp, XC_ul_angle); |
72 | m_cursor_left_side = XCreateFontCursor(disp, XC_left_side); | ||
73 | m_cursor_top_side = XCreateFontCursor(disp, XC_top_side); | ||
74 | m_cursor_right_side = XCreateFontCursor(disp, XC_right_side); | ||
75 | m_cursor_bottom_side = XCreateFontCursor(disp, XC_bottom_side); | ||
72 | 76 | ||
73 | reconfigTheme(); | 77 | reconfigTheme(); |
74 | } | 78 | } |
diff --git a/src/FbWinFrameTheme.hh b/src/FbWinFrameTheme.hh index 04d6ee4..a48f8b6 100644 --- a/src/FbWinFrameTheme.hh +++ b/src/FbWinFrameTheme.hh | |||
@@ -78,6 +78,10 @@ public: | |||
78 | inline Cursor lowerRightAngleCursor() const { return m_cursor_lower_right_angle; } | 78 | inline Cursor lowerRightAngleCursor() const { return m_cursor_lower_right_angle; } |
79 | inline Cursor upperLeftAngleCursor() const { return m_cursor_upper_left_angle; } | 79 | inline Cursor upperLeftAngleCursor() const { return m_cursor_upper_left_angle; } |
80 | inline Cursor upperRightAngleCursor() const { return m_cursor_upper_right_angle; } | 80 | inline Cursor upperRightAngleCursor() const { return m_cursor_upper_right_angle; } |
81 | inline Cursor leftSideCursor() const { return m_cursor_left_side; } | ||
82 | inline Cursor rightSideCursor() const { return m_cursor_right_side; } | ||
83 | inline Cursor topSideCursor() const { return m_cursor_top_side; } | ||
84 | inline Cursor bottomSideCursor() const { return m_cursor_bottom_side; } | ||
81 | 85 | ||
82 | inline Shape::ShapePlace shapePlace() const { return *m_shape_place; } | 86 | inline Shape::ShapePlace shapePlace() const { return *m_shape_place; } |
83 | inline const BorderTheme &border() const { return m_border; } | 87 | inline const BorderTheme &border() const { return m_border; } |
@@ -114,6 +118,10 @@ private: | |||
114 | Cursor m_cursor_lower_right_angle; | 118 | Cursor m_cursor_lower_right_angle; |
115 | Cursor m_cursor_upper_left_angle; | 119 | Cursor m_cursor_upper_left_angle; |
116 | Cursor m_cursor_upper_right_angle; | 120 | Cursor m_cursor_upper_right_angle; |
121 | Cursor m_cursor_left_side; | ||
122 | Cursor m_cursor_right_side; | ||
123 | Cursor m_cursor_top_side; | ||
124 | Cursor m_cursor_bottom_side; | ||
117 | unsigned char m_focused_alpha; | 125 | unsigned char m_focused_alpha; |
118 | unsigned char m_unfocused_alpha; | 126 | unsigned char m_unfocused_alpha; |
119 | 127 | ||
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 | ||