* 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:
@@ -25,7 +25,7 @@
|
|||||||
bigtime_t kActivationDelay = 40000;
|
bigtime_t kActivationDelay = 40000;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MSG_TOGGLE_LAYOUT = 'tgll'
|
MSG_TOGGLE_LAYOUT = 'tgll'
|
||||||
};
|
};
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
@@ -148,45 +148,51 @@ PadView::MessageReceived(BMessage* message)
|
|||||||
void
|
void
|
||||||
PadView::MouseDown(BPoint where)
|
PadView::MouseDown(BPoint where)
|
||||||
{
|
{
|
||||||
if (BWindow* window = Window()) {
|
BWindow* window = Window();
|
||||||
BRegion region;
|
if (window == NULL)
|
||||||
GetClippingRegion(®ion);
|
return;
|
||||||
if (region.Contains(where)) {
|
|
||||||
bool handle = true;
|
BRegion region;
|
||||||
for (int32 i = 0; BView* child = ChildAt(i); i++) {
|
GetClippingRegion(®ion);
|
||||||
if (child->Frame().Contains(where)) {
|
if (!region.Contains(where))
|
||||||
handle = false;
|
return;
|
||||||
break;
|
|
||||||
}
|
bool handle = true;
|
||||||
}
|
for (int32 i = 0; BView* child = ChildAt(i); i++) {
|
||||||
if (handle) {
|
if (child->Frame().Contains(where)) {
|
||||||
if (BMessage* message = window->CurrentMessage()) {
|
handle = false;
|
||||||
uint32 buttons;
|
break;
|
||||||
message->FindInt32("buttons", (int32*)&buttons);
|
}
|
||||||
if (buttons & B_SECONDARY_MOUSE_BUTTON) {
|
}
|
||||||
BRect r = Bounds();
|
if (!handle)
|
||||||
r.InsetBy(2.0, 2.0);
|
return;
|
||||||
r.top += 6.0;
|
|
||||||
if (r.Contains(where)) {
|
BMessage* message = window->CurrentMessage();
|
||||||
DisplayMenu(where);
|
if (message == NULL)
|
||||||
} else {
|
return;
|
||||||
// sends the window to the back
|
|
||||||
window->Activate(false);
|
uint32 buttons;
|
||||||
}
|
message->FindInt32("buttons", (int32*)&buttons);
|
||||||
} else {
|
if (buttons & B_SECONDARY_MOUSE_BUTTON) {
|
||||||
if (system_time() - fClickTime < kActivationDelay) {
|
BRect r = Bounds();
|
||||||
window->Minimize(true);
|
r.InsetBy(2.0, 2.0);
|
||||||
fClickTime = 0;
|
r.top += 6.0;
|
||||||
} else {
|
if (r.Contains(where)) {
|
||||||
window->Activate();
|
DisplayMenu(where);
|
||||||
fDragOffset = ConvertToScreen(where) - window->Frame().LeftTop();
|
} else {
|
||||||
fDragging = true;
|
// sends the window to the back
|
||||||
SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
|
window->Activate(false);
|
||||||
fClickTime = system_time();
|
}
|
||||||
}
|
} else {
|
||||||
}
|
if (system_time() - fClickTime < kActivationDelay) {
|
||||||
}
|
window->Minimize(true);
|
||||||
}
|
fClickTime = 0;
|
||||||
|
} else {
|
||||||
|
window->Activate();
|
||||||
|
fDragOffset = ConvertToScreen(where) - window->Frame().LeftTop();
|
||||||
|
fDragging = true;
|
||||||
|
SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
|
||||||
|
fClickTime = system_time();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user