diff --git a/src/kits/app/Clipboard.cpp b/src/kits/app/Clipboard.cpp index 6fed1dcd34..5b606f42be 100644 --- a/src/kits/app/Clipboard.cpp +++ b/src/kits/app/Clipboard.cpp @@ -47,7 +47,10 @@ //------------------------------------------------------------------------------ BClipboard::BClipboard(const char *name, bool transient = false) { - fName = strdup(name); + if ( name ) + fName = strdup(name); + else + fName = strdup("system"); fData = new BMessage(); fCount = 0; fSystemCount = 0; diff --git a/src/kits/app/Cursor.cpp b/src/kits/app/Cursor.cpp index 072cbe6afb..0367d06dc2 100644 --- a/src/kits/app/Cursor.cpp +++ b/src/kits/app/Cursor.cpp @@ -21,6 +21,7 @@ // // File Name: Cursor.cpp // Author: Frans van Nispen (xlr8@tref.nl) +// Gabe Yoder (gyoder@stny.rr.com) // Description: BCursor describes a view-wide or application-wide cursor. //------------------------------------------------------------------------------ /** @@ -29,12 +30,19 @@ */ // Standard Includes ----------------------------------------------------------- -#include // System Includes ------------------------------------------------------------- #include +#include +#include // Project Includes ------------------------------------------------------------ +// Needed from app server +#if 0 +#include +#else +#define SET_CURSOR_BCURSOR 'sscb' +#endif // Local Includes -------------------------------------------------------------- @@ -46,13 +54,39 @@ //------------------------------------------------------------------------------ BCursor::BCursor(const void *cursorData) { -// uint8 data[68]; -// memcpy(&data, cursorData, 68); + int8 *data = (int8 *)cursorData; + m_serverToken = 0; + if ( sizeof(cursorData) < 68 ) + return; + if ( data[0] != 16 ) + return; + if ( data[1] != 1 ) + return; + if ( (data[2] >= 16) || (data[3] >= 16) ) + return; + + ssize_t buffersize; + status_t status; + int32 returncode; + int8 *buffer; + + // Send data directly to server + BPrivate::BAppServerLink *serverlink = new BPrivate::BAppServerLink; + serverlink->Init(); + serverlink->portlink->SetOpCode(SET_CURSOR_BCURSOR); + serverlink->portlink->Attach((void *)cursorData,68); + + //Rumor has it that this API will be cleaned up later + buffer=serverlink->portlink->FlushWithReply(&returncode,&status,&buffersize); + m_serverToken=*((int32*)buffer); + + delete serverlink; } //------------------------------------------------------------------------------ // undefined on BeOS BCursor::BCursor(BMessage *data) { + m_serverToken = 0; } //------------------------------------------------------------------------------ BCursor::~BCursor() @@ -73,7 +107,9 @@ BArchivable *BCursor::Instantiate(BMessage *data) //------------------------------------------------------------------------------ status_t BCursor::Perform(perform_code d, void *arg) { + /* printf("perform %d\n", (int)d); + */ return B_OK; } //------------------------------------------------------------------------------ @@ -101,3 +137,4 @@ void BCursor::_ReservedCursor4() * */ + diff --git a/src/servers/registrar/ClipboardHandler.cpp b/src/servers/registrar/ClipboardHandler.cpp index 79e8cf388b..0200335b6f 100644 --- a/src/servers/registrar/ClipboardHandler.cpp +++ b/src/servers/registrar/ClipboardHandler.cpp @@ -40,12 +40,12 @@ ClipboardHandler::MessageReceived(BMessage *message) { if ( message->FindString("name",&name) != B_OK ) { - reply.AddInt32("result",0); + reply.AddInt32("result",B_BAD_VALUE); } else { fClipboardTree.AddNode(name); - reply.AddInt32("result",1); + reply.AddInt32("result",B_OK); } reply.what = B_REG_RESULT; message->SendReply(&reply); @@ -55,7 +55,7 @@ ClipboardHandler::MessageReceived(BMessage *message) { if ( message->FindString("name",&name) != B_OK ) { - reply.AddInt32("result",0); + reply.AddInt32("result",B_BAD_VALUE); } else { @@ -63,10 +63,10 @@ ClipboardHandler::MessageReceived(BMessage *message) if ( node ) { reply.AddInt32("count",(uint32)(node->GetCount())); - reply.AddInt32("result",1); + reply.AddInt32("result",B_OK); } else - reply.AddInt32("result",0); + reply.AddInt32("result",B_BAD_VALUE); } reply.what = B_REG_RESULT; message->SendReply(&reply); @@ -78,15 +78,15 @@ ClipboardHandler::MessageReceived(BMessage *message) if ( (message->FindString("name",&name) != B_OK) || (message->FindMessenger("target",&target) != B_OK) ) { - reply.AddInt32("result",0); + reply.AddInt32("result",B_BAD_VALUE); } else { ClipboardTree *node = fClipboardTree.GetNode(name); if ( node && node->AddWatcher(&target) ) - reply.AddInt32("result",1); + reply.AddInt32("result",B_OK); else - reply.AddInt32("result",0); + reply.AddInt32("result",B_BAD_VALUE); } reply.what = B_REG_RESULT; message->SendReply(&reply); @@ -98,15 +98,15 @@ ClipboardHandler::MessageReceived(BMessage *message) if ( (message->FindString("name",&name) != B_OK) || (message->FindMessenger("target",&target) != B_OK) ) { - reply.AddInt32("result",0); + reply.AddInt32("result",B_BAD_VALUE); } else { ClipboardTree *node = fClipboardTree.GetNode(name); if ( node && node->RemoveWatcher(&target) ) - reply.AddInt32("result",1); + reply.AddInt32("result",B_OK); else - reply.AddInt32("result",0); + reply.AddInt32("result",B_BAD_VALUE); } reply.what = B_REG_RESULT; message->SendReply(&reply); @@ -116,7 +116,7 @@ ClipboardHandler::MessageReceived(BMessage *message) { if ( message->FindString("name",&name) != B_OK ) { - reply.AddInt32("result",0); + reply.AddInt32("result",B_BAD_VALUE); } else { @@ -126,10 +126,10 @@ ClipboardHandler::MessageReceived(BMessage *message) reply.AddMessage("data",node->GetData()); reply.AddMessenger("data source",*node->GetDataSource()); reply.AddInt32("count",(uint32)(node->GetCount())); - reply.AddInt32("result",1); + reply.AddInt32("result",B_OK); } else - reply.AddInt32("result",0); + reply.AddInt32("result",B_BAD_VALUE); } reply.what = B_REG_RESULT; message->SendReply(&reply); @@ -144,7 +144,7 @@ ClipboardHandler::MessageReceived(BMessage *message) (message->FindMessage("data",&data) != B_OK) || (message->FindMessenger("data source",&dataSource) != B_OK) ) { - reply.AddInt32("result",0); + reply.AddInt32("result",B_BAD_VALUE); } else { @@ -154,10 +154,10 @@ ClipboardHandler::MessageReceived(BMessage *message) node->SetData(&data); node->SetDataSource(&dataSource); reply.AddInt32("count",(uint32)(node->IncrementCount())); - reply.AddInt32("result",1); + reply.AddInt32("result",B_OK); } else - reply.AddInt32("result",0); + reply.AddInt32("result",B_BAD_VALUE); } reply.what = B_REG_RESULT; message->SendReply(&reply); @@ -172,3 +172,4 @@ ClipboardHandler::MessageReceived(BMessage *message) } + diff --git a/src/servers/registrar/ClipboardTree.cpp b/src/servers/registrar/ClipboardTree.cpp index e588d3f9b1..65b38288c3 100644 --- a/src/servers/registrar/ClipboardTree.cpp +++ b/src/servers/registrar/ClipboardTree.cpp @@ -108,7 +108,7 @@ bool ClipboardTree::AddWatcher(BMessenger *watcher) bool ClipboardTree::RemoveWatcher(BMessenger *watcher) { - return fWatchingService.RemoveWatcher(*watcher,true); + return fWatchingService.RemoveWatcher(*watcher,false); } void ClipboardTree::NotifyWatchers() @@ -117,3 +117,4 @@ void ClipboardTree::NotifyWatchers() fWatchingService.NotifyWatchers(&message,NULL); } +