Added synchronous mouse support (shouldn't I lock the window ? why does it work without locking ?), now the thumb bitmap is drawn with B_OP_OVER, thus eliminating a visual glitch.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12504 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2005-04-29 08:12:25 +00:00
parent 55932743b4
commit e7467ada1a
+21 -12
View File
@@ -269,7 +269,10 @@ BChannelSlider::MouseDown(BPoint where)
}
}
if (fCurrentChannel != -1) {
// Click wasn't on a slider.
if (fCurrentChannel == -1)
return;
uint32 buttons = 0;
BMessage *currentMessage = Window()->CurrentMessage();
if (currentMessage != NULL)
@@ -298,12 +301,17 @@ BChannelSlider::MouseDown(BPoint where)
Flush();
}
MouseMovedCommon(where, where);
MouseMovedCommon(where, B_ORIGIN);
SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS | B_NO_POINTER_HISTORY);
} else {
debugger("BChannelSlider::MouseDown(): SYNCHRONOUS CONTROLS NOT YET SUPPORTED");
}
do {
snooze(30000);
GetMouse(&where, &buttons);
MouseMovedCommon(where, B_ORIGIN);
} while (buttons != 0);
FinishChange();
fCurrentChannel = -1;
fAllChannels = false;
}
}
}
@@ -474,25 +482,26 @@ BChannelSlider::DrawThumb(BView *into, int32 channel, BPoint where, bool pressed
where.x -= bitmapBounds.right / 2;
where.y -= bitmapBounds.bottom / 2;
into->PushState();
into->SetDrawingMode(B_OP_OVER);
into->DrawBitmapAsync(thumb, where);
if (pressed) {
into->PushState();
into->SetDrawingMode(B_OP_ALPHA);
rgb_color color = tint_color(into->ViewColor(), B_DARKEN_4_TINT);
color.alpha = 128;
into->SetHighColor(color);
BRect rect(where, where);
rect.right += bitmapBounds.right;
rect.bottom += bitmapBounds.bottom;
BRect destRect(where, where);
destRect.right += bitmapBounds.right;
destRect.bottom += bitmapBounds.bottom;
into->FillRect(rect);
into->FillRect(destRect);
}
into->PopState();
}
}