* Cleaned up MouseDown(), and fixed crash #5121 based on a patch by DarkWyrm,

thanks!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36389 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-04-21 07:46:12 +00:00
parent d6e973e978
commit 33da1e6516

View File

@ -302,15 +302,13 @@ TExpandoMenuBar::MouseDown(BPoint where)
TTeamMenuItem* item = TeamItemAtPoint(where, &menuItem); TTeamMenuItem* item = TeamItemAtPoint(where, &menuItem);
// check for three finger salute, a.k.a. Vulcan Death Grip // check for three finger salute, a.k.a. Vulcan Death Grip
if (message != NULL) { if (message != NULL && item != NULL && !fBarView->Dragging()) {
int32 modifiers = 0; int32 modifiers = 0;
message->FindInt32("modifiers", &modifiers); message->FindInt32("modifiers", &modifiers);
if ((modifiers & B_COMMAND_KEY) != 0 if ((modifiers & B_COMMAND_KEY) != 0
&& (modifiers & B_OPTION_KEY) != 0 && (modifiers & B_OPTION_KEY) != 0
&& (modifiers & B_SHIFT_KEY) != 0 && (modifiers & B_SHIFT_KEY) != 0) {
&& !fBarView->Dragging()
&& item != NULL) {
const BList* teams = item->Teams(); const BList* teams = item->Teams();
int32 teamCount = teams->CountItems(); int32 teamCount = teams->CountItems();
@ -324,14 +322,9 @@ TExpandoMenuBar::MouseDown(BPoint where)
return; return;
} }
}
// control click - show all/hide all shortcut // control click - show all/hide all shortcut
int32 modifiers; if ((modifiers & B_CONTROL_KEY) != 0) {
if (message != NULL && message->FindInt32("modifiers", &modifiers) == B_OK
&& (modifiers & B_CONTROL_KEY) != 0
&& !fBarView->Dragging()
&& item != NULL) {
// show/hide item's teams // show/hide item's teams
BMessage showMessage((modifiers & B_SHIFT_KEY) != 0 BMessage showMessage((modifiers & B_SHIFT_KEY) != 0
? kMinimizeTeam : kBringTeamToFront); ? kMinimizeTeam : kBringTeamToFront);
@ -341,8 +334,7 @@ TExpandoMenuBar::MouseDown(BPoint where)
} }
// Check the bounds of the expand Team icon // Check the bounds of the expand Team icon
if (fShowTeamExpander && fVertical && !fBarView->Dragging() if (fShowTeamExpander && fVertical) {
&& item != NULL) {
BRect expanderRect = item->ExpanderBounds(); BRect expanderRect = item->ExpanderBounds();
if (expanderRect.Contains(where)) { if (expanderRect.Contains(where)) {
// Let the update thread wait... // Let the update thread wait...
@ -359,15 +351,15 @@ TExpandoMenuBar::MouseDown(BPoint where)
// double-click on an item brings the team to front // double-click on an item brings the team to front
int32 clicks; int32 clicks;
if (message != NULL && message->FindInt32("clicks", &clicks) == B_OK if (message->FindInt32("clicks", &clicks) == B_OK && clicks > 1
&& clicks > 1) { && item == menuItem && item == fLastClickItem) {
if (item == menuItem && item == fLastClickItem) {
// activate this team // activate this team
be_roster->ActivateApp((team_id)item->Teams()->ItemAt(0)); be_roster->ActivateApp((team_id)item->Teams()->ItemAt(0));
return; return;
} }
} else
fLastClickItem = item; fLastClickItem = item;
}
BMenuBar::MouseDown(where); BMenuBar::MouseDown(where);
} }