* Drag messages can now also be started with a NULL bitmap pointer and an invalid

drag rectangle - this fixes bug #596, as Cortex obviously relies on this.
* Added a comment on how dragging without a bitmap should be done (app_server should
  directly support this without needing to drag real bitmaps).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18964 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-09-28 12:11:45 +00:00
parent 456b127176
commit e0091c79d8

View File

@ -1265,7 +1265,7 @@ BView::EndRectTracking()
void
BView::DragMessage(BMessage *message, BRect dragRect, BHandler *replyTo)
{
if (!message || !dragRect.IsValid())
if (!message)
return;
do_owner_check_no_pick();
@ -1278,6 +1278,14 @@ BView::DragMessage(BMessage *message, BRect dragRect, BHandler *replyTo)
GetMouse(&offset, &buttons, false);
offset -= dragRect.LeftTop();
if (!dragRect.IsValid()) {
DragMessage(message, NULL, B_OP_BLEND, offset, replyTo);
return;
}
// TODO: that's not really what should happen - the app_server should take the chance
// *NOT* to need to drag a whole bitmap around but just a frame.
// create a drag bitmap for the rect
BBitmap *bitmap = new BBitmap(dragRect, B_RGBA32);
uint32 *bits = (uint32*)bitmap->Bits();
@ -1320,8 +1328,13 @@ void
BView::DragMessage(BMessage *message, BBitmap *image,
drawing_mode dragMode, BPoint offset, BHandler *replyTo)
{
// ToDo: is this correct? Isn't \a image allowed to be NULL?
if (message == NULL || image == NULL)
if (message == NULL)
return;
// TODO: workaround for drags without a bitmap - should not be necessary if
// we move the rectangle dragging into the app_server
image = new (nothrow) BBitmap(BRect(0, 0, 0, 0), B_RGBA32);
if (image == NULL)
return;
if (replyTo == NULL)