From e0091c79d8ee3453705c684c1e31966f32ba8e04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 28 Sep 2006 12:11:45 +0000 Subject: [PATCH] * 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 --- src/kits/interface/View.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index baf3b93e15..0c58bd498e 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -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)