twin: 25% zones for active corners

Added special checks that make corner activation easier: we assume
a 25% zone on the edge of each border where instead of half size
tiling we perform quarter size tiling. The rest 50% is left for
normal half size tiling.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/371/head
Mavridis Philippe 11 months ago
parent 91cb203685
commit becae3055b
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

@ -2556,11 +2556,25 @@ void Workspace::checkActiveBorder(const TQPoint &pos, Time now)
} }
} }
// These checks take activation distance into account, creating a
// virtual "activation band" for easier border/corner activation.
bool active_left = pos.x() < activeLeft + activation_distance, bool active_left = pos.x() < activeLeft + activation_distance,
active_right = pos.x() > activeRight - activation_distance, active_right = pos.x() > activeRight - activation_distance,
active_top = pos.y() < activeTop + activation_distance, active_top = pos.y() < activeTop + activation_distance,
active_bottom = pos.y() > activeBottom - activation_distance; active_bottom = pos.y() > activeBottom - activation_distance;
// These checks are used to make corner activation easier: we assume
// a 25% zone on the edge of each border where instead of half size
// tiling we perform quarter size tiling. The rest 50% is left for
// normal half size tiling.
uint active_width_quart = activeRight / 4,
active_height_quart = activeBottom / 4;
bool active_qleft = pos.x() < activeLeft + active_width_quart,
active_qright = pos.x() > activeRight - active_width_quart,
active_qtop = pos.y() < activeTop + active_height_quart,
active_qbottom = pos.y() > activeBottom - active_height_quart;
if (!active_left && !active_right && !active_top && !active_bottom) if (!active_left && !active_right && !active_top && !active_bottom)
return; return;
@ -2568,24 +2582,39 @@ void Workspace::checkActiveBorder(const TQPoint &pos, Time now)
<< pos.x() << ":" << pos.y() << endl; << pos.x() << ":" << pos.y() << endl;
ActiveBorder border = ActiveNone; ActiveBorder border = ActiveNone;
if (active_left && active_top) if (active_left && active_top) {
border = ActiveTopLeft; border = ActiveTopLeft;
else if (active_right && active_top) }
else if (active_right && active_top) {
border = ActiveTopRight; border = ActiveTopRight;
else if (active_left && active_bottom) }
else if (active_left && active_bottom) {
border = ActiveBottomLeft; border = ActiveBottomLeft;
else if (active_right && active_bottom) }
else if (active_right && active_bottom) {
border = ActiveBottomRight; border = ActiveBottomRight;
else if (active_left) }
border = ActiveLeft; else if (active_left) {
else if (active_right) border = active_qtop ? ActiveTopLeft
border = ActiveRight; : (active_qbottom ? ActiveBottomLeft
else if (active_top) : ActiveLeft);
border = ActiveTop; }
else if (active_bottom) else if (active_right) {
border = ActiveBottom; border = active_qtop ? ActiveTopRight
else : (active_qbottom ? ActiveBottomRight
abort(); : ActiveRight);
}
else if (active_top) {
border = active_qleft ? ActiveTopLeft
: (active_qright ? ActiveTopRight
: ActiveTop);
}
else if (active_bottom) {
border = active_qleft ? ActiveBottomLeft
: (active_qright ? ActiveBottomRight
: ActiveBottom);
}
else abort();
if( active_windows[border] == None ) if( active_windows[border] == None )
return; return;

Loading…
Cancel
Save