all repos — fluxbox @ daca07edafc2e75eb9ee04d35fe80759308a8583

custom fork of the fluxbox windowmanager

added edge resize modes
markt markt
commit

daca07edafc2e75eb9ee04d35fe80759308a8583

parent

474e2017454d3c6492eb9f428aee039d36d76e05

4 files changed, 40 insertions(+), 30 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,6 +1,9 @@

(Format: Year/Month/Day) Changes for 1.0.1: *07/12/11: + * Added new resize modes for key command StartResizing: NearestEdge, Left, + Right, Top, Bottom (Mark) + Window.cc * Only allow one menu to be open at a time (Mark) FbTk/Menu.cc/hh *07/12/09:
M src/FbWinFrameTheme.ccsrc/FbWinFrameTheme.cc

@@ -69,6 +69,10 @@ m_cursor_lower_left_angle = XCreateFontCursor(disp, XC_ll_angle);

m_cursor_lower_right_angle = XCreateFontCursor(disp, XC_lr_angle); m_cursor_upper_right_angle = XCreateFontCursor(disp, XC_ur_angle); m_cursor_upper_left_angle = XCreateFontCursor(disp, XC_ul_angle); + m_cursor_left_side = XCreateFontCursor(disp, XC_left_side); + m_cursor_top_side = XCreateFontCursor(disp, XC_top_side); + m_cursor_right_side = XCreateFontCursor(disp, XC_right_side); + m_cursor_bottom_side = XCreateFontCursor(disp, XC_bottom_side); reconfigTheme(); }
M src/FbWinFrameTheme.hhsrc/FbWinFrameTheme.hh

@@ -78,6 +78,10 @@ inline Cursor lowerLeftAngleCursor() const { return m_cursor_lower_left_angle; }

inline Cursor lowerRightAngleCursor() const { return m_cursor_lower_right_angle; } inline Cursor upperLeftAngleCursor() const { return m_cursor_upper_left_angle; } inline Cursor upperRightAngleCursor() const { return m_cursor_upper_right_angle; } + inline Cursor leftSideCursor() const { return m_cursor_left_side; } + inline Cursor rightSideCursor() const { return m_cursor_right_side; } + inline Cursor topSideCursor() const { return m_cursor_top_side; } + inline Cursor bottomSideCursor() const { return m_cursor_bottom_side; } inline Shape::ShapePlace shapePlace() const { return *m_shape_place; } inline const BorderTheme &border() const { return m_border; }

@@ -114,6 +118,10 @@ Cursor m_cursor_lower_left_angle;

Cursor m_cursor_lower_right_angle; Cursor m_cursor_upper_left_angle; Cursor m_cursor_upper_right_angle; + Cursor m_cursor_left_side; + Cursor m_cursor_right_side; + Cursor m_cursor_top_side; + Cursor m_cursor_bottom_side; unsigned char m_focused_alpha; unsigned char m_unfocused_alpha;
M src/Window.ccsrc/Window.cc

@@ -2788,20 +2788,23 @@ int gx = 0, gy = 0;

int dx = me.x - m_button_grab_x; int dy = me.y - m_button_grab_y; - switch (m_resize_corner) { - case LEFTTOP: - m_last_resize_w = frame().width() - dx; - m_last_resize_x = frame().x() + dx; - // no break, use code below too - case RIGHTTOP: + if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM || + m_resize_corner == LEFT) { + m_last_resize_w = frame().width() - dx; + m_last_resize_x = frame().x() + dx; + } + if (m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP || + m_resize_corner == TOP) { m_last_resize_h = frame().height() - dy; m_last_resize_y = frame().y() + dy; - break; - case LEFTBOTTOM: - m_last_resize_w = frame().width() - dx; - m_last_resize_x = frame().x() + dx; - break; - case ALLCORNERS: + } + if (m_resize_corner == LEFTBOTTOM || m_resize_corner == BOTTOM || + m_resize_corner == RIGHTBOTTOM) + m_last_resize_h = frame().height() + dy; + if (m_resize_corner == RIGHTBOTTOM || m_resize_corner == RIGHTTOP || + m_resize_corner == RIGHT) + m_last_resize_w = frame().width() + dx; + if (m_resize_corner == ALLCORNERS) { // dx or dy must be at least 2 if (abs(dx) >= 2 || abs(dy) >= 2) { // take max and make it even

@@ -2813,21 +2816,7 @@ m_last_resize_w = frame().width() + diff;

m_last_resize_x = frame().x() - diff/2; m_last_resize_y = frame().y() - diff/2; } - break; - default: // kill warning - break; - }; - - // if not on top or all corner then move bottom - - if (!(m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP || - m_resize_corner == ALLCORNERS)) - m_last_resize_h = frame().height() + dy; - - // if not top or left bottom or all corners then move right side - if (!(m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM || - m_resize_corner == ALLCORNERS)) - m_last_resize_w = frame().width() + dx; + } fixsize(&gx, &gy);

@@ -3402,7 +3391,7 @@ int cy = frame().height() / 2;

if (model == CENTERRESIZE) return ALLCORNERS; if (model == NEARESTEDGERESIZE) { - if (abs(cy - abs(y - cy)) > abs(cx - abs(x - cx))) // y is nearest + if (cy - abs(y - cy) < cx - abs(x - cx)) // y is nearest return (y > cy) ? BOTTOM : TOP; return (x > cx) ? RIGHT : LEFT; }

@@ -3437,6 +3426,10 @@

const Cursor& cursor = (m_resize_corner == LEFTTOP) ? frame().theme().upperLeftAngleCursor() : (m_resize_corner == RIGHTTOP) ? frame().theme().upperRightAngleCursor() : (m_resize_corner == RIGHTBOTTOM) ? frame().theme().lowerRightAngleCursor() : + (m_resize_corner == LEFT) ? frame().theme().leftSideCursor() : + (m_resize_corner == RIGHT) ? frame().theme().rightSideCursor() : + (m_resize_corner == TOP) ? frame().theme().topSideCursor() : + (m_resize_corner == BOTTOM) ? frame().theme().bottomSideCursor() : frame().theme().lowerLeftAngleCursor(); grabPointer(fbWindow().window(),

@@ -3724,11 +3717,13 @@ m_last_resize_w = dw;

m_last_resize_h = dh + decoration_height; // move X if necessary - if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM) { + if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM || + m_resize_corner == LEFT) { m_last_resize_x = frame().x() + frame().width() - m_last_resize_w; } - if (m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP) { + if (m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP || + m_resize_corner == TOP) { m_last_resize_y = frame().y() + frame().height() - m_last_resize_h; }