From 6eea7aabb84a88571d953c45459065ddc73f0014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Fri, 9 May 2008 01:15:25 +0000 Subject: [PATCH] Handle any dropped message. This makes dropping from Pe working for ex, as well as the BeOS BColorControl. Color drop is currently disabled, for now it just pastes it as text if provided (#rrggbb form from BColorControl). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25388 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/terminal/TermView.cpp | 50 ++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp index 3f278b12e5..9a813c71d3 100644 --- a/src/apps/terminal/TermView.cpp +++ b/src/apps/terminal/TermView.cpp @@ -1638,6 +1638,37 @@ TermView::MessageReceived(BMessage *msg) entry_ref ref; char *ctrl_l = " "; + // first check for any dropped message + if (msg->WasDropped()) { + char *text; + int32 numBytes; + //rgb_color *color; + + int32 i = 0; + + if (msg->FindRef("refs", i++, &ref) == B_OK) { + _DoFileDrop(ref); + + while (msg->FindRef("refs", i++, &ref) == B_OK) { + _WritePTY((const uchar*)" ", 1); + _DoFileDrop(ref); + } + return; +#if 0 + } else if (msg->FindData("RGBColor", B_RGB_COLOR_TYPE, + (const void **)&color, &numBytes) == B_OK + && numBytes == sizeof(color)) { + // TODO: handle color drop + // maybe only on replicants ? + return; +#endif + } else if (msg->FindData("text/plain", B_MIME_TYPE, + (const void **)&text, &numBytes) == B_OK) { + _WritePTY((uchar *)text, numBytes); + return; + } + } + switch (msg->what){ case B_ABOUT_REQUESTED: // (replicant) about box requested @@ -1645,7 +1676,9 @@ TermView::MessageReceived(BMessage *msg) break; case B_SIMPLE_DATA: + case B_REFS_RECEIVED: { + // handle refs if they weren't dropped int32 i = 0; if (msg->FindRef("refs", i++, &ref) == B_OK) { _DoFileDrop(ref); @@ -1659,23 +1692,6 @@ TermView::MessageReceived(BMessage *msg) break; } - case B_MIME_DATA: - { - char *text; - int32 numBytes; - status_t sts; - - if (msg->WasDropped()) { - sts = msg->FindData("text/plain", - B_MIME_TYPE, (const void **)&text, &numBytes); - if (sts != B_OK) - break; - - _WritePTY((uchar *)text, numBytes); - } - break; - } - case B_COPY: Copy(be_clipboard); break;