A couple bugfixes, some comment tweaks, and PortLink conversion for a couple functions

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5651 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm 2003-12-11 14:49:56 +00:00
parent 357ef4edac
commit ef94fcd875

View File

@ -58,6 +58,8 @@
#include <MessageUtils.h> #include <MessageUtils.h>
#include <Session.h> #include <Session.h>
#include <ColorUtils.h> #include <ColorUtils.h>
#include <AppServerLink.h>
#include <PortMessage.h>
#include <ServerProtocol.h> #include <ServerProtocol.h>
// Local Includes -------------------------------------------------------------- // Local Includes --------------------------------------------------------------
@ -388,7 +390,7 @@ BRect BView::Bounds() const{
if (fState->flags & B_VIEW_COORD_BIT) if (fState->flags & B_VIEW_COORD_BIT)
if (owner){ if (owner){
check_lock(); check_lock();
owner->session->WriteInt32( AS_LAYER_GET_COORD ); owner->session->WriteInt32( AS_LAYER_GET_COORD );
owner->session->Sync(); owner->session->Sync();
@ -706,12 +708,12 @@ BRect BView::Frame() const {
void void
BView::Hide() BView::Hide()
{ {
// TODO: You may hide it by relocating with -17000 coord units to the left???
// "I don't think you want to do that" - axeld.
if (owner && fShowLevel == 0) { if (owner && fShowLevel == 0) {
check_lock(); check_lock();
owner->session->WriteInt32(AS_LAYER_HIDE); owner->fServerLink->SetOpCode(AS_LAYER_HIDE);
// TODO: this probably needs the view's handler ID attached
owner->Flush();
} }
fShowLevel++; fShowLevel++;
@ -726,7 +728,9 @@ void BView::Show(){
if (owner && fShowLevel == 0){ if (owner && fShowLevel == 0){
check_lock(); check_lock();
owner->session->WriteInt32( AS_LAYER_SHOW ); owner->fServerLink->SetOpCode(AS_LAYER_SHOW);
// TODO: this probably needs the view's handler ID attached
owner->Flush();
} }
} }
@ -861,20 +865,20 @@ void BView::SetViewCursor(const BCursor *cursor, bool sync) {
if (!cursor) if (!cursor)
return; return;
if (!owner)
debugger("View method requires owner and doesn't have one");
check_lock(); check_lock();
// TODO: test: what happens if a view is NOT attached to a window?
// will this method have any effect??? if (sync){
// Info: I cannot test now... BApplication's looper must be started owner->session->WriteInt32( AS_LAYER_CURSOR );
if (owner) owner->session->WriteInt32( cursor->m_serverToken );
if (sync){ owner->session->Sync();
owner->session->WriteInt32( AS_LAYER_CURSOR ); }
owner->session->WriteInt32( cursor->m_serverToken ); else{
owner->session->Sync(); owner->session->WriteInt32( AS_LAYER_CURSOR );
} owner->session->WriteInt32( cursor->m_serverToken );
else{ }
owner->session->WriteInt32( AS_LAYER_CURSOR );
owner->session->WriteInt32( cursor->m_serverToken );
}
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -1072,13 +1076,13 @@ void BView::DragMessage(BMessage* aMessage, BRect dragRect,
int32 bufSize = aMessage->FlattenedSize(); int32 bufSize = aMessage->FlattenedSize();
char *buffer = new char[ bufSize ]; char *buffer = new char[ bufSize ];
aMessage->Flatten( buffer, bufSize ); aMessage->Flatten( buffer, bufSize );
owner->session->WriteInt32( AS_LAYER_DRAG_RECT ); owner->fServerLink->SetOpCode( AS_LAYER_DRAG_RECT );
owner->session->WriteRect( dragRect ); owner->fServerLink->Attach<BRect>( dragRect );
owner->session->WritePoint( offset ); owner->fServerLink->Attach<BPoint>( offset );
owner->session->WriteInt32( bufSize ); owner->fServerLink->Attach<int32>( bufSize );
owner->session->WriteData( buffer, bufSize ); owner->fServerLink->Attach( buffer, bufSize );
owner->session->Sync(); owner->fServerLink->Flush();
delete buffer; delete buffer;
} }
@ -1133,12 +1137,12 @@ void BView::DragMessage(BMessage* aMessage, BBitmap* anImage,
char *buffer = new char[ bufSize ]; char *buffer = new char[ bufSize ];
aMessage->Flatten( buffer, bufSize ); aMessage->Flatten( buffer, bufSize );
owner->session->WriteInt32( AS_LAYER_DRAG_IMAGE ); owner->fServerLink->SetOpCode( AS_LAYER_DRAG_IMAGE );
owner->session->WriteInt32( anImage->get_server_token() ); owner->fServerLink->Attach<int32>( anImage->get_server_token() );
owner->session->WriteInt32( (int32)dragMode ); owner->fServerLink->Attach<int32>( (int32)dragMode );
owner->session->WritePoint( offset ); owner->fServerLink->Attach<BPoint>( offset );
owner->session->WriteInt32( bufSize ); owner->fServerLink->Attach<int32>( bufSize );
owner->session->WriteData( buffer, bufSize ); owner->fServerLink->Attach( buffer, bufSize );
delete buffer; delete buffer;
/* TODO: in app_server the bitmap refCount must be incremented /* TODO: in app_server the bitmap refCount must be incremented