* Reworded MouseDown() to avoid all these nested conditions...

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28094 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2008-10-14 17:23:00 +00:00
parent 700de23e38
commit 80e1925251
+14 -8
View File
@@ -148,10 +148,15 @@ PadView::MessageReceived(BMessage* message)
void void
PadView::MouseDown(BPoint where) PadView::MouseDown(BPoint where)
{ {
if (BWindow* window = Window()) { BWindow* window = Window();
if (window == NULL)
return;
BRegion region; BRegion region;
GetClippingRegion(&region); GetClippingRegion(&region);
if (region.Contains(where)) { if (!region.Contains(where))
return;
bool handle = true; bool handle = true;
for (int32 i = 0; BView* child = ChildAt(i); i++) { for (int32 i = 0; BView* child = ChildAt(i); i++) {
if (child->Frame().Contains(where)) { if (child->Frame().Contains(where)) {
@@ -159,8 +164,13 @@ PadView::MouseDown(BPoint where)
break; break;
} }
} }
if (handle) { if (!handle)
if (BMessage* message = window->CurrentMessage()) { return;
BMessage* message = window->CurrentMessage();
if (message == NULL)
return;
uint32 buttons; uint32 buttons;
message->FindInt32("buttons", (int32*)&buttons); message->FindInt32("buttons", (int32*)&buttons);
if (buttons & B_SECONDARY_MOUSE_BUTTON) { if (buttons & B_SECONDARY_MOUSE_BUTTON) {
@@ -186,10 +196,6 @@ PadView::MouseDown(BPoint where)
} }
} }
} }
}
}
}
}
// MouseUp // MouseUp
void void