Checkin for Gabe Yoder

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1826 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm 2002-11-02 23:33:33 +00:00
parent ad68e9c90b
commit e4840f5bd2
4 changed files with 64 additions and 22 deletions

View File

@ -47,7 +47,10 @@
//------------------------------------------------------------------------------
BClipboard::BClipboard(const char *name, bool transient = false)
{
if ( name )
fName = strdup(name);
else
fName = strdup("system");
fData = new BMessage();
fCount = 0;
fSystemCount = 0;

View File

@ -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 <stdio.h>
// System Includes -------------------------------------------------------------
#include <Cursor.h>
#include <PortLink.h>
#include <AppServerLink.h>
// Project Includes ------------------------------------------------------------
// Needed from app server
#if 0
#include <ServerProtocol.h>
#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()
*
*/

View File

@ -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)
}

View File

@ -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);
}