* The default decorator now remembers its last mouse down action, and only
recognizes a double click as double click if the action didn't change. * This fixes bug #6699. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39064 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -190,31 +190,27 @@ DefaultDecorator::MouseAction(const BMessage* message, BPoint point,
|
|||||||
printf("\tButtons: %ld, Modifiers: 0x%lx\n", buttons, modifiers);
|
printf("\tButtons: %ld, Modifiers: 0x%lx\n", buttons, modifiers);
|
||||||
#endif // DEBUG_DECORATOR
|
#endif // DEBUG_DECORATOR
|
||||||
|
|
||||||
if (buttons != 0)
|
click_type action = CLICK_NONE;
|
||||||
fWasDoubleClick = message->FindInt32("clicks") == 2;
|
|
||||||
|
|
||||||
// In checking for hit test stuff, we start with the smallest rectangles
|
// We start with the smallest rectangles the user might be clicking
|
||||||
// the user might be clicking on and gradually work our way out into larger
|
// on and gradually work our way out into larger rectangles.
|
||||||
// rectangles.
|
|
||||||
if (!(fFlags & B_NOT_CLOSABLE) && fCloseRect.Contains(point))
|
if (!(fFlags & B_NOT_CLOSABLE) && fCloseRect.Contains(point))
|
||||||
return CLICK_CLOSE;
|
action = CLICK_CLOSE;
|
||||||
|
else if (!(fFlags & B_NOT_ZOOMABLE) && fZoomRect.Contains(point))
|
||||||
if (!(fFlags & B_NOT_ZOOMABLE) && fZoomRect.Contains(point))
|
action = CLICK_ZOOM;
|
||||||
return CLICK_ZOOM;
|
else if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0)
|
||||||
|
action = CLICK_MOVE_TO_BACK;
|
||||||
if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0)
|
else if (fLook == B_DOCUMENT_WINDOW_LOOK && fResizeRect.Contains(point))
|
||||||
return CLICK_MOVE_TO_BACK;
|
action = CLICK_RESIZE;
|
||||||
|
else if (fTabRect.Contains(point)) {
|
||||||
if (fLook == B_DOCUMENT_WINDOW_LOOK && fResizeRect.Contains(point))
|
|
||||||
return CLICK_RESIZE;
|
|
||||||
|
|
||||||
if (fTabRect.Contains(point)) {
|
|
||||||
// Clicked in the tab
|
// Clicked in the tab
|
||||||
|
|
||||||
// tab sliding in any case if either shift key is held down
|
// tab sliding in any case if either shift key is held down
|
||||||
// except sliding up-down by moving mouse left-right would look strange
|
// except sliding up-down by moving mouse left-right would look strange
|
||||||
if ((modifiers & B_SHIFT_KEY) != 0 && fLook != kLeftTitledWindowLook)
|
if ((modifiers & B_SHIFT_KEY) != 0 && fLook != kLeftTitledWindowLook)
|
||||||
return CLICK_SLIDE_TAB;
|
action = CLICK_SLIDE_TAB;
|
||||||
|
else
|
||||||
|
action = CLICK_DRAG;
|
||||||
} else if (fLeftBorder.Contains(point) || fRightBorder.Contains(point)
|
} else if (fLeftBorder.Contains(point) || fRightBorder.Contains(point)
|
||||||
|| fTopBorder.Contains(point) || fBottomBorder.Contains(point)) {
|
|| fTopBorder.Contains(point) || fBottomBorder.Contains(point)) {
|
||||||
// Clicked on border
|
// Clicked on border
|
||||||
@@ -229,19 +225,25 @@ DefaultDecorator::MouseAction(const BMessage* message, BPoint point,
|
|||||||
fBottomBorder.bottom - kBorderResizeLength),
|
fBottomBorder.bottom - kBorderResizeLength),
|
||||||
fBottomBorder.RightBottom());
|
fBottomBorder.RightBottom());
|
||||||
if (resizeRect.Contains(point))
|
if (resizeRect.Contains(point))
|
||||||
return CLICK_RESIZE;
|
action = CLICK_RESIZE;
|
||||||
}
|
} else
|
||||||
} else {
|
action = CLICK_DRAG;
|
||||||
// Guess user didn't click anything
|
|
||||||
return CLICK_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Either tab or border was clicked
|
if (buttons != 0) {
|
||||||
|
fWasDoubleClick = message->FindInt32("clicks") == 2
|
||||||
|
&& fLastAction == action;
|
||||||
|
}
|
||||||
|
|
||||||
if (fWasDoubleClick && !(fFlags & B_NOT_MINIMIZABLE))
|
// Transform double clicks on the border to minimize, if allowed
|
||||||
return CLICK_MINIMIZE;
|
if (action == CLICK_DRAG && fWasDoubleClick
|
||||||
|
&& (fFlags & B_NOT_MINIMIZABLE) == 0)
|
||||||
|
action = CLICK_MINIMIZE;
|
||||||
|
|
||||||
return CLICK_DRAG;
|
if (message->what == B_MOUSE_DOWN)
|
||||||
|
fLastAction = action;
|
||||||
|
|
||||||
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ protected:
|
|||||||
int32 fTruncatedTitleLength;
|
int32 fTruncatedTitleLength;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
click_type fLastAction;
|
||||||
bool fWasDoubleClick;
|
bool fWasDoubleClick;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user