Renamed BAppServerLink to AppServerLink, BPortLink to PortLink, LinkMsgReader
to LinkReceiver, LinkMsgSender to LinkSender, and put everything into the BPrivate namespace. Made AppServerLink a cheap object - it will use the applications receiver/sender and not create its own buffers. Fixed broken communication stuff here and there (mostly Font.cpp). Put the newly introduced set|get_system_colors() into the BPrivate namespace - please don't introduce private functions into the public namespace!!! Also fixed their broken communication use, as Darkwyrm obviously forgot about it again: the sequence Flush(); GetNextMessage() without error checking is purely wrong and can make the app hang and/or crash! :-) Other minor cleanup. The input_server used some test mode with the haiku build target which is probably wrong. Hopefully I did not forget anything this time. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13128 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,37 +1,14 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: Application.h
|
||||
// Author: Erik Jaesler ([email protected])
|
||||
// Description: BApplication class is the center of the application
|
||||
// universe. The global be_app and be_app_messenger
|
||||
// variables are defined here as well.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Erik Jaesler ([email protected])
|
||||
*/
|
||||
#ifndef _APPLICATION_H
|
||||
#define _APPLICATION_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <AppDefs.h> // For convenience
|
||||
#include <InterfaceDefs.h>
|
||||
@@ -40,13 +17,6 @@
|
||||
#include <Point.h>
|
||||
#include <Rect.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
class BCursor;
|
||||
class BList;
|
||||
@@ -56,12 +26,15 @@ class BResources;
|
||||
class BMessageRunner;
|
||||
struct _server_heap_;
|
||||
struct _drag_data_;
|
||||
namespace BPrivate { class BAppServerLink; }
|
||||
|
||||
namespace BPrivate {
|
||||
class AppServerLink;
|
||||
class PortLink;
|
||||
}
|
||||
|
||||
|
||||
// BApplication class ----------------------------------------------------------
|
||||
class BApplication : public BLooper {
|
||||
|
||||
public:
|
||||
BApplication(const char* signature);
|
||||
BApplication(const char* signature,
|
||||
@@ -121,7 +94,6 @@ public:
|
||||
virtual status_t Perform(perform_code d, void* arg);
|
||||
|
||||
private:
|
||||
|
||||
typedef BLooper _inherited;
|
||||
|
||||
friend class BWindow;
|
||||
@@ -129,7 +101,7 @@ private:
|
||||
friend class BBitmap;
|
||||
friend class BScrollBar;
|
||||
friend class BPrivateScreen;
|
||||
friend class BPrivate::BAppServerLink;
|
||||
friend class BPrivate::AppServerLink;
|
||||
friend void _toggle_handles_(bool);
|
||||
|
||||
BApplication(uint32 signature);
|
||||
@@ -145,11 +117,9 @@ private:
|
||||
virtual void _ReservedApplication7();
|
||||
virtual void _ReservedApplication8();
|
||||
|
||||
virtual bool ScriptReceived(BMessage* msg,
|
||||
int32 index,
|
||||
BMessage* specifier,
|
||||
int32 form,
|
||||
const char* property);
|
||||
virtual bool ScriptReceived(BMessage* msg, int32 index,
|
||||
BMessage* specifier, int32 form,
|
||||
const char* property);
|
||||
void run_task();
|
||||
void InitData(const char* signature, status_t* error);
|
||||
void BeginRectTracking(BRect r, bool trackWhole);
|
||||
@@ -186,8 +156,10 @@ private:
|
||||
static BLocker _app_resources_lock;
|
||||
|
||||
const char* fAppName;
|
||||
int32 fServerFrom;
|
||||
int32 fServerTo;
|
||||
BPrivate::PortLink* fServerLink;
|
||||
// uint32 _unused0;
|
||||
// int32 fServerFrom;
|
||||
// int32 fServerTo;
|
||||
#ifndef FIX_FOR_4_6
|
||||
void* fCursorData;
|
||||
#else
|
||||
@@ -199,26 +171,14 @@ private:
|
||||
_drag_data_* fDraggedMessage;
|
||||
BMessageRunner* fPulseRunner;
|
||||
status_t fInitError;
|
||||
uint32 _reserved[11];
|
||||
uint32 _reserved[12];
|
||||
|
||||
bool fReadyToRunCalled;
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Global Objects --------------------------------------------------------------
|
||||
|
||||
extern _IMPEXP_BE BApplication* be_app;
|
||||
extern _IMPEXP_BE BMessenger be_app_messenger;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _APPLICATION_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -15,21 +15,24 @@
|
||||
#include <BeBuild.h>
|
||||
#include <Rect.h>
|
||||
|
||||
namespace BPrivate {
|
||||
class ServerLink;
|
||||
};
|
||||
|
||||
|
||||
/* Integer rect used to define a cliping rectangle. All bounds are included */
|
||||
/* Moved from DirectWindow.h */
|
||||
typedef struct {
|
||||
int32 left;
|
||||
int32 top;
|
||||
int32 right;
|
||||
int32 bottom;
|
||||
int32 left;
|
||||
int32 top;
|
||||
int32 right;
|
||||
int32 bottom;
|
||||
} clipping_rect;
|
||||
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- BRegion class --------------------------------------------*/
|
||||
|
||||
class BRegion {
|
||||
|
||||
public:
|
||||
BRegion();
|
||||
BRegion(const BRegion ®ion);
|
||||
@@ -64,11 +67,10 @@ clipping_rect RectAtInt(int32 index);
|
||||
class Support;
|
||||
|
||||
private:
|
||||
|
||||
friend class BView;
|
||||
friend class BDirectWindow;
|
||||
friend class Support;
|
||||
friend class BPortLink;
|
||||
friend class BView;
|
||||
friend class BDirectWindow;
|
||||
friend class Support;
|
||||
friend class BPrivate::ServerLink;
|
||||
|
||||
void _AddRect(clipping_rect r);
|
||||
void set_size(long new_size);
|
||||
@@ -80,7 +82,4 @@ private:
|
||||
clipping_rect *data;
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
#endif /* _REGION_H */
|
||||
|
||||
@@ -14,6 +14,11 @@
|
||||
#include <BeBuild.h>
|
||||
#include <Archivable.h>
|
||||
|
||||
namespace BPrivate {
|
||||
class ServerLink;
|
||||
};
|
||||
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- BShapeIterator class -------------------------------------*/
|
||||
|
||||
@@ -78,7 +83,7 @@ virtual void _ReservedShape4();
|
||||
friend class TPicture;
|
||||
friend class BView;
|
||||
friend class BFont;
|
||||
friend class BPortLink;
|
||||
friend class BPrivate::ServerLink;
|
||||
|
||||
void GetData(int32 *opCount, int32 *ptCount, uint32 **opList, BPoint **ptList);
|
||||
void SetData(int32 opCount, int32 ptCount, uint32 *opList, BPoint *ptList);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
// Copyright (c) 2001-2005, Haiku
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
@@ -28,23 +28,13 @@
|
||||
#ifndef _VIEW_H
|
||||
#define _VIEW_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <Font.h>
|
||||
#include <Handler.h>
|
||||
#include <InterfaceDefs.h>
|
||||
#include <Rect.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
|
||||
// view definitions ------------------------------------------------------------
|
||||
|
||||
@@ -675,10 +665,3 @@ inline void BView::SetLowColor(uchar r, uchar g, uchar b, uchar a)
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _VIEW_H
|
||||
|
||||
/*
|
||||
@log
|
||||
* added PrintToStream() method for debugging BView.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@@ -35,7 +35,9 @@
|
||||
#include <StorageDefs.h>
|
||||
#include <View.h>
|
||||
|
||||
class BPortLink;
|
||||
namespace BPrivate {
|
||||
class PortLink;
|
||||
};
|
||||
|
||||
|
||||
// window definitions ----------------------------------------------------------
|
||||
@@ -389,13 +391,9 @@ private:
|
||||
short fShowLevel;
|
||||
uint32 fFlags;
|
||||
|
||||
port_id send_port;
|
||||
port_id receive_port;
|
||||
|
||||
BView *top_view;
|
||||
BView *fFocus;
|
||||
BView *fLastMouseMovedView;
|
||||
void *a_session; // unusedm was _BSession_
|
||||
BMenuBar *fKeyMenuBar;
|
||||
BButton *fDefaultButton;
|
||||
BList accelList;
|
||||
@@ -419,11 +417,11 @@ private:
|
||||
ViewAttr *fCurDrawViewState; // not yet used
|
||||
window_feel fFeel;
|
||||
int32 fLastViewToken;
|
||||
BPortLink *fLink;
|
||||
BPrivate::PortLink *fLink;
|
||||
BMessageRunner *fPulseRunner;
|
||||
BRect fCurrentFrame; // not yet used
|
||||
|
||||
uint32 _reserved[2]; // was 8
|
||||
uint32 _reserved[5]; // was 8
|
||||
#if !_PR3_COMPATIBLE_
|
||||
uint32 _more_reserved[4];
|
||||
#endif
|
||||
|
||||
@@ -1,31 +1,11 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2005, Haiku
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: AppServerLink.h
|
||||
// Author(s): Erik Jaesler ([email protected])
|
||||
// Description: BAppServerLink provides proxied access to the application's
|
||||
// connection with the app_server. It has BAutolock semantics:
|
||||
// creating one locks the app_server connection; destroying one
|
||||
// unlocks the connection.
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Erik Jaesler (erik@cgsoftware.com)
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
#ifndef APPSERVERLINK_H
|
||||
#define APPSERVERLINK_H
|
||||
|
||||
@@ -35,12 +15,10 @@
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
class BAppServerLink : public BPortLink {
|
||||
class AppServerLink : public ServerLink {
|
||||
public:
|
||||
BAppServerLink(void);
|
||||
~BAppServerLink(void);
|
||||
|
||||
status_t FlushWithReply(int32 *code);
|
||||
AppServerLink(void);
|
||||
~AppServerLink(void);
|
||||
};
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
#include <OS.h>
|
||||
|
||||
|
||||
//namespace BPrivate {
|
||||
namespace BPrivate {
|
||||
|
||||
class LinkMsgReader {
|
||||
class LinkReceiver {
|
||||
public:
|
||||
LinkMsgReader(port_id port);
|
||||
virtual ~LinkMsgReader(void);
|
||||
LinkReceiver(port_id port);
|
||||
virtual ~LinkReceiver(void);
|
||||
|
||||
void SetPort(port_id port);
|
||||
port_id Port(void) { return fReceivePort; }
|
||||
@@ -53,6 +53,6 @@ class LinkMsgReader {
|
||||
status_t fReadError; //Read failed for current message
|
||||
};
|
||||
|
||||
//} // namespace BPrivate
|
||||
} // namespace BPrivate
|
||||
|
||||
#endif
|
||||
#endif // _LINKMSGREADER_H
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
#include <OS.h>
|
||||
|
||||
|
||||
//namespace BPrivate {
|
||||
namespace BPrivate {
|
||||
|
||||
class LinkMsgSender {
|
||||
class LinkSender {
|
||||
public:
|
||||
LinkMsgSender(port_id sendport);
|
||||
virtual ~LinkMsgSender(void);
|
||||
LinkSender(port_id sendport);
|
||||
virtual ~LinkSender(void);
|
||||
|
||||
void SetPort(port_id port);
|
||||
port_id Port() { return fPort; }
|
||||
@@ -58,6 +58,6 @@ class LinkMsgSender {
|
||||
status_t fCurrentStatus;
|
||||
};
|
||||
|
||||
//} // namespace BPrivate
|
||||
} // namespace BPrivate
|
||||
|
||||
#endif /* LINKMSGSENDER_H */
|
||||
|
||||
@@ -29,21 +29,17 @@
|
||||
|
||||
*/
|
||||
|
||||
// ToDo: put this into the private namespace
|
||||
//namespace BPrivate {
|
||||
namespace BPrivate {
|
||||
|
||||
//class LinkMsgReader;
|
||||
//class LinkMsgSender;
|
||||
|
||||
class BPortLink {
|
||||
class ServerLink {
|
||||
public:
|
||||
BPortLink(port_id send = -1, port_id reply = -1);
|
||||
virtual ~BPortLink();
|
||||
ServerLink();
|
||||
virtual ~ServerLink();
|
||||
|
||||
// send methods
|
||||
|
||||
void SetSendPort(port_id port);
|
||||
port_id SendPort();
|
||||
void SetSenderPort(port_id port);
|
||||
port_id SenderPort();
|
||||
|
||||
status_t StartMessage(int32 code, size_t minSize = 0);
|
||||
void CancelMessage();
|
||||
@@ -58,8 +54,8 @@ class BPortLink {
|
||||
|
||||
// receive methods
|
||||
|
||||
void SetReplyPort(port_id port);
|
||||
port_id ReplyPort();
|
||||
void SetReceiverPort(port_id port);
|
||||
port_id ReceiverPort();
|
||||
|
||||
status_t GetNextMessage(int32 &code, bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
bool NeedsReply() const;
|
||||
@@ -72,66 +68,75 @@ class BPortLink {
|
||||
// convenience methods
|
||||
|
||||
status_t FlushWithReply(int32 &code);
|
||||
LinkMsgReader &Reader() { return *fReader; }
|
||||
LinkMsgSender &Sender() { return *fSender; }
|
||||
LinkSender &Sender() { return *fSender; }
|
||||
LinkReceiver &Receiver() { return *fReceiver; }
|
||||
|
||||
protected:
|
||||
LinkMsgReader *fReader;
|
||||
LinkMsgSender *fSender;
|
||||
LinkSender *fSender;
|
||||
LinkReceiver *fReceiver;
|
||||
};
|
||||
|
||||
class PortLink : public ServerLink {
|
||||
public:
|
||||
PortLink(port_id sender = -1, port_id receiver = -1);
|
||||
virtual ~PortLink();
|
||||
|
||||
void SetTo(port_id sender, port_id receiver);
|
||||
};
|
||||
|
||||
|
||||
// sender inline functions
|
||||
|
||||
inline void
|
||||
BPortLink::SetSendPort(port_id port)
|
||||
ServerLink::SetSenderPort(port_id port)
|
||||
{
|
||||
fSender->SetPort(port);
|
||||
}
|
||||
|
||||
inline port_id
|
||||
BPortLink::SendPort()
|
||||
ServerLink::SenderPort()
|
||||
{
|
||||
return fSender->Port();
|
||||
}
|
||||
|
||||
inline status_t
|
||||
BPortLink::StartMessage(int32 code, size_t minSize)
|
||||
ServerLink::StartMessage(int32 code, size_t minSize)
|
||||
{
|
||||
return fSender->StartMessage(code, minSize);
|
||||
}
|
||||
|
||||
inline status_t
|
||||
BPortLink::EndMessage()
|
||||
ServerLink::EndMessage()
|
||||
{
|
||||
return fSender->EndMessage();
|
||||
}
|
||||
|
||||
inline void
|
||||
BPortLink::CancelMessage()
|
||||
ServerLink::CancelMessage()
|
||||
{
|
||||
fSender->CancelMessage();
|
||||
}
|
||||
|
||||
inline status_t
|
||||
BPortLink::Flush(bigtime_t timeout, bool needsReply)
|
||||
ServerLink::Flush(bigtime_t timeout, bool needsReply)
|
||||
{
|
||||
return fSender->Flush(timeout, needsReply);
|
||||
}
|
||||
|
||||
inline status_t
|
||||
BPortLink::Attach(const void *data, ssize_t size)
|
||||
ServerLink::Attach(const void *data, ssize_t size)
|
||||
{
|
||||
return fSender->Attach(data, size);
|
||||
}
|
||||
|
||||
inline status_t
|
||||
BPortLink::AttachString(const char *string, int32 length)
|
||||
ServerLink::AttachString(const char *string, int32 length)
|
||||
{
|
||||
return fSender->AttachString(string, length);
|
||||
}
|
||||
|
||||
template<class Type> status_t
|
||||
BPortLink::Attach(const Type &data)
|
||||
ServerLink::Attach(const Type &data)
|
||||
{
|
||||
return Attach(&data, sizeof(Type));
|
||||
}
|
||||
@@ -139,47 +144,47 @@ BPortLink::Attach(const Type &data)
|
||||
// #pragma mark - receiver inline functions
|
||||
|
||||
inline void
|
||||
BPortLink::SetReplyPort(port_id port)
|
||||
ServerLink::SetReceiverPort(port_id port)
|
||||
{
|
||||
fReader->SetPort(port);
|
||||
fReceiver->SetPort(port);
|
||||
}
|
||||
|
||||
inline port_id
|
||||
BPortLink::ReplyPort()
|
||||
ServerLink::ReceiverPort()
|
||||
{
|
||||
return fReader->Port();
|
||||
return fReceiver->Port();
|
||||
}
|
||||
|
||||
inline status_t
|
||||
BPortLink::GetNextMessage(int32 &code, bigtime_t timeout)
|
||||
ServerLink::GetNextMessage(int32 &code, bigtime_t timeout)
|
||||
{
|
||||
return fReader->GetNextMessage(code, timeout);
|
||||
return fReceiver->GetNextMessage(code, timeout);
|
||||
}
|
||||
|
||||
inline bool
|
||||
BPortLink::NeedsReply() const
|
||||
ServerLink::NeedsReply() const
|
||||
{
|
||||
return fReader->NeedsReply();
|
||||
return fReceiver->NeedsReply();
|
||||
}
|
||||
|
||||
inline status_t
|
||||
BPortLink::Read(void *data, ssize_t size)
|
||||
ServerLink::Read(void *data, ssize_t size)
|
||||
{
|
||||
return fReader->Read(data, size);
|
||||
return fReceiver->Read(data, size);
|
||||
}
|
||||
|
||||
inline status_t
|
||||
BPortLink::ReadString(char **string)
|
||||
ServerLink::ReadString(char **string)
|
||||
{
|
||||
return fReader->ReadString(string);
|
||||
return fReceiver->ReadString(string);
|
||||
}
|
||||
|
||||
template <class Type> status_t
|
||||
BPortLink::Read(Type *data)
|
||||
ServerLink::Read(Type *data)
|
||||
{
|
||||
return Read(data, sizeof(Type));
|
||||
}
|
||||
|
||||
//} // namespace BPrivate
|
||||
} // namespace BPrivate
|
||||
|
||||
#endif /* _PORTLINK_H */
|
||||
|
||||
@@ -40,8 +40,10 @@
|
||||
#include "PatternHandler.h"
|
||||
|
||||
class BRegion;
|
||||
class LinkMsgReader;
|
||||
class LinkMsgSender;
|
||||
namespace BPrivate {
|
||||
class LinkReceiver;
|
||||
class LinkSender;
|
||||
};
|
||||
|
||||
class DrawData {
|
||||
public:
|
||||
@@ -174,12 +176,12 @@ class LayerData : public DrawData {
|
||||
// convenience functions
|
||||
virtual void PrintToStream() const;
|
||||
|
||||
void ReadFontFromLink(LinkMsgReader& link);
|
||||
void ReadFontFromLink(BPrivate::LinkReceiver& link);
|
||||
// NOTE: ReadFromLink() does not read Font state!!
|
||||
// It was separate in ServerWindow, and I didn't
|
||||
// want to change it without knowing implications.
|
||||
void ReadFromLink(LinkMsgReader& link);
|
||||
void WriteToLink(LinkMsgSender& link) const;
|
||||
void ReadFromLink(BPrivate::LinkReceiver& link);
|
||||
void WriteToLink(BPrivate::LinkSender& link) const;
|
||||
|
||||
public:
|
||||
// used for the state stack
|
||||
|
||||
@@ -1,31 +1,12 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2005, Haiku
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: AppServerLink.cpp
|
||||
// Author(s): Erik Jaesler ([email protected])
|
||||
// Description: BAppServerLink provides proxied access to the application's
|
||||
// connection with the app_server. It has BAutolock semantics:
|
||||
// creating one locks the app_server connection; destroying one
|
||||
// unlocks the connection.
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Erik Jaesler (erik@cgsoftware.com)
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
|
||||
|
||||
#include <Application.h>
|
||||
#include <Locker.h>
|
||||
@@ -33,37 +14,35 @@
|
||||
#include <AppServerLink.h>
|
||||
|
||||
|
||||
/** AppServerLink provides proxied access to the application's
|
||||
* connection with the app_server.
|
||||
* It has BAutolock semantics:
|
||||
* creating one locks the app_server connection; destroying one
|
||||
* unlocks the connection.
|
||||
*/
|
||||
|
||||
|
||||
BLocker sLock;
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
namespace BPrivate {
|
||||
|
||||
BAppServerLink::BAppServerLink(void)
|
||||
AppServerLink::AppServerLink(void)
|
||||
{
|
||||
sLock.Lock();
|
||||
|
||||
// if there is no be_app, we can't do a whole lot, anyway
|
||||
if (be_app) {
|
||||
SetSendPort(be_app->fServerFrom);
|
||||
SetReplyPort(be_app->fServerTo);
|
||||
}
|
||||
fReceiver = &be_app->fServerLink->Receiver();
|
||||
fSender = &be_app->fServerLink->Sender();
|
||||
} else
|
||||
puts("Noooooooooooooooooooooooooooo");
|
||||
}
|
||||
|
||||
|
||||
BAppServerLink::~BAppServerLink()
|
||||
AppServerLink::~AppServerLink()
|
||||
{
|
||||
sLock.Unlock();
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BAppServerLink::FlushWithReply(int32 *code)
|
||||
{
|
||||
status_t status = Flush(B_INFINITE_TIMEOUT, true);
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
return GetNextMessage(*code);
|
||||
}
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
@@ -1,38 +1,17 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2005, Haiku, inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: Application.cpp
|
||||
// Author: Erik Jaesler ([email protected])
|
||||
// Description: BApplication class is the center of the application
|
||||
// universe. The global be_app and be_app_messenger
|
||||
// variables are defined here as well.
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Erik Jaesler (erik@cgsoftware.com)
|
||||
*/
|
||||
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
#include <new>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <Alert.h>
|
||||
#include <AppFileInfo.h>
|
||||
#include <Application.h>
|
||||
@@ -51,7 +30,6 @@
|
||||
#include <RosterPrivate.h>
|
||||
#include <Window.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
#include <AppServerLink.h>
|
||||
#include <LooperList.h>
|
||||
#include <MenuWindow.h>
|
||||
@@ -69,8 +47,7 @@ BResources *BApplication::_app_resources = NULL;
|
||||
BLocker BApplication::_app_resources_lock("_app_resources_lock");
|
||||
|
||||
|
||||
static property_info
|
||||
sPropertyInfo[] = {
|
||||
static property_info sPropertyInfo[] = {
|
||||
{
|
||||
"Window",
|
||||
{},
|
||||
@@ -234,13 +211,14 @@ BApplication::~BApplication()
|
||||
|
||||
#ifndef RUN_WITHOUT_APP_SERVER
|
||||
// tell app_server we're quitting...
|
||||
BPortLink link(fServerFrom);
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(B_QUIT_REQUESTED);
|
||||
link.Flush();
|
||||
#endif // RUN_WITHOUT_APP_SERVER
|
||||
|
||||
// ToDo: since we add the port, I guess we should remove it as well? -- axeld.
|
||||
//delete_port(fServerTo);
|
||||
delete_port(fServerLink->SenderPort());
|
||||
delete_port(fServerLink->ReceiverPort());
|
||||
delete fServerLink;
|
||||
|
||||
// uninitialize be_app, the be_app_messenger is invalidated automatically
|
||||
be_app = NULL;
|
||||
@@ -257,12 +235,12 @@ BApplication::operator=(const BApplication &rhs)
|
||||
void
|
||||
BApplication::InitData(const char *signature, status_t *_error)
|
||||
{
|
||||
DBG(OUT("BApplication::InitData(`%s', %p)\n", signature, _error));
|
||||
DBG(OUT("BApplication::InitData(`%s', %p)\n", signature, _error));
|
||||
// check whether there exists already an application
|
||||
if (be_app)
|
||||
debugger("2 BApplication objects were created. Only one is allowed.");
|
||||
|
||||
fServerFrom = fServerTo = -1;
|
||||
fServerLink = new BPrivate::PortLink(-1, -1);
|
||||
fServerHeap = NULL;
|
||||
fInitialWorkspace = 0;
|
||||
fDraggedMessage = NULL;
|
||||
@@ -420,7 +398,7 @@ DBG(OUT("BApplication::InitData(`%s', %p)\n", signature, _error));
|
||||
be_app = this;
|
||||
be_app_messenger = BMessenger(NULL, this);
|
||||
}
|
||||
|
||||
|
||||
// set the BHandler's name
|
||||
if (fInitError == B_OK)
|
||||
SetName(ref.name);
|
||||
@@ -433,7 +411,7 @@ DBG(OUT("BApplication::InitData(`%s', %p)\n", signature, _error));
|
||||
|
||||
#ifndef RUN_WITHOUT_APP_SERVER
|
||||
// Initialize the IK after we have set be_app because of a construction of a
|
||||
// BAppServerLink (which depends on be_app) nested inside the call to get_menu_info.
|
||||
// AppServerLink (which depends on be_app) nested inside the call to get_menu_info.
|
||||
if (fInitError == B_OK)
|
||||
fInitError = _init_interface_kit_();
|
||||
// create global system cursors
|
||||
@@ -660,7 +638,7 @@ BApplication::ResolveSpecifier(BMessage *msg, int32 index,
|
||||
void
|
||||
BApplication::ShowCursor()
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_SHOW_CURSOR);
|
||||
link.Flush();
|
||||
}
|
||||
@@ -669,7 +647,7 @@ BApplication::ShowCursor()
|
||||
void
|
||||
BApplication::HideCursor()
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_HIDE_CURSOR);
|
||||
link.Flush();
|
||||
}
|
||||
@@ -678,7 +656,7 @@ BApplication::HideCursor()
|
||||
void
|
||||
BApplication::ObscureCursor()
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_OBSCURE_CURSOR);
|
||||
link.Flush();
|
||||
}
|
||||
@@ -687,10 +665,10 @@ BApplication::ObscureCursor()
|
||||
bool
|
||||
BApplication::IsCursorHidden() const
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
int32 code = SERVER_FALSE;
|
||||
link.StartMessage(AS_QUERY_CURSOR_HIDDEN);
|
||||
link.FlushWithReply(&code);
|
||||
link.FlushWithReply(code);
|
||||
|
||||
return code == SERVER_TRUE;
|
||||
}
|
||||
@@ -710,14 +688,14 @@ BApplication::SetCursor(const void *cursor)
|
||||
void
|
||||
BApplication::SetCursor(const BCursor *cursor, bool sync)
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
int32 code = SERVER_FALSE;
|
||||
|
||||
link.StartMessage(AS_SET_CURSOR_BCURSOR);
|
||||
link.Attach<bool>(sync);
|
||||
link.Attach<int32>(cursor->m_serverToken);
|
||||
if (sync)
|
||||
link.FlushWithReply(&code);
|
||||
link.FlushWithReply(code);
|
||||
else
|
||||
link.Flush();
|
||||
}
|
||||
@@ -1018,7 +996,7 @@ BApplication::run_task()
|
||||
void
|
||||
BApplication::BeginRectTracking(BRect rect, bool trackWhole)
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_BEGIN_RECT_TRACKING);
|
||||
link.Attach<BRect>(rect);
|
||||
link.Attach<int32>(trackWhole);
|
||||
@@ -1029,7 +1007,7 @@ BApplication::BeginRectTracking(BRect rect, bool trackWhole)
|
||||
void
|
||||
BApplication::EndRectTracking()
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_END_RECT_TRACKING);
|
||||
link.Flush();
|
||||
}
|
||||
@@ -1071,20 +1049,20 @@ BApplication::global_ro_offs_to_ptr(uint32 offset)
|
||||
void
|
||||
BApplication::connect_to_app_server()
|
||||
{
|
||||
fServerFrom = find_port(SERVER_PORT_NAME);
|
||||
if (fServerFrom < B_OK) {
|
||||
fInitError = fServerFrom;
|
||||
port_id serverPort = find_port(SERVER_PORT_NAME);
|
||||
if (serverPort < B_OK) {
|
||||
fInitError = serverPort;
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the port so that the app_server knows where to send messages
|
||||
fServerTo = create_port(100, "a<fServerTo");
|
||||
if (fServerTo < B_OK) {
|
||||
fInitError = fServerTo;
|
||||
port_id clientPort = create_port(100, "a<app_server");
|
||||
if (clientPort < B_OK) {
|
||||
fInitError = clientPort;
|
||||
return;
|
||||
}
|
||||
|
||||
// We can't use BAppServerLink because be_app == NULL
|
||||
// We can't use AppServerLink because be_app == NULL
|
||||
|
||||
// AS_CREATE_APP:
|
||||
//
|
||||
@@ -1094,21 +1072,25 @@ BApplication::connect_to_app_server()
|
||||
// 3) team_id - team identification field
|
||||
// 4) int32 - handler ID token of the app
|
||||
// 5) char * - signature of the regular app
|
||||
BPortLink link(fServerFrom, fServerTo);
|
||||
fServerLink->SetTo(serverPort, clientPort);
|
||||
|
||||
fServerLink->StartMessage(AS_CREATE_APP);
|
||||
fServerLink->Attach<port_id>(clientPort);
|
||||
fServerLink->Attach<port_id>(_get_looper_port_(this));
|
||||
fServerLink->Attach<team_id>(Team());
|
||||
fServerLink->Attach<int32>(_get_object_token_(this));
|
||||
fServerLink->AttachString(fAppName);
|
||||
|
||||
int32 code;
|
||||
|
||||
link.StartMessage(AS_CREATE_APP);
|
||||
link.Attach<port_id>(fServerTo);
|
||||
link.Attach<port_id>(_get_looper_port_(this));
|
||||
link.Attach<team_id>(Team());
|
||||
link.Attach<int32>(_get_object_token_(this));
|
||||
link.AttachString(fAppName);
|
||||
|
||||
if (link.FlushWithReply(code) == B_OK
|
||||
&& code == SERVER_TRUE)
|
||||
link.Read<port_id>(&fServerFrom);
|
||||
else
|
||||
if (fServerLink->FlushWithReply(code) == B_OK
|
||||
&& code == SERVER_TRUE) {
|
||||
fServerLink->Read<port_id>(&serverPort);
|
||||
// ToDo: what are we supposed to do with this port?
|
||||
fServerLink->SetSenderPort(serverPort);
|
||||
} else {
|
||||
fServerLink->SetSenderPort(-1);
|
||||
debugger("BApplication: couldn't obtain new app_server comm port");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2004, Haiku
|
||||
// Copyright (c) 2001-2005, Haiku
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
@@ -58,13 +58,13 @@ BCursor::BCursor(const void *cursorData)
|
||||
return;
|
||||
|
||||
// Send data directly to server
|
||||
BPrivate::BAppServerLink serverlink;
|
||||
int32 code=SERVER_FALSE;
|
||||
BPrivate::AppServerLink serverlink;
|
||||
int32 code = SERVER_FALSE;
|
||||
|
||||
serverlink.StartMessage(AS_CREATE_BCURSOR);
|
||||
serverlink.Attach(cursorData, 68);
|
||||
serverlink.FlushWithReply(&code);
|
||||
if(code==SERVER_TRUE)
|
||||
serverlink.FlushWithReply(code);
|
||||
if (code == SERVER_TRUE)
|
||||
serverlink.Read<int32>(&m_serverToken);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ BCursor::BCursor(BMessage *data)
|
||||
BCursor::~BCursor()
|
||||
{
|
||||
// Notify server to deallocate server-side objects for this cursor
|
||||
BPrivate::BAppServerLink serverlink;
|
||||
BPrivate::AppServerLink serverlink;
|
||||
serverlink.StartMessage(AS_DELETE_BCURSOR);
|
||||
serverlink.Attach<int32>(m_serverToken);
|
||||
serverlink.Flush();
|
||||
|
||||
@@ -30,8 +30,9 @@ extern const char *bstrcode(int32 code);
|
||||
# define STRACE(x) ;
|
||||
#endif
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
LinkMsgReader::LinkMsgReader(port_id port)
|
||||
LinkReceiver::LinkReceiver(port_id port)
|
||||
:
|
||||
fReceivePort(port), fRecvBuffer(NULL), fRecvPosition(0), fRecvStart(0),
|
||||
fRecvBufferSize(0), fDataSize(0),
|
||||
@@ -40,28 +41,28 @@ LinkMsgReader::LinkMsgReader(port_id port)
|
||||
}
|
||||
|
||||
|
||||
LinkMsgReader::~LinkMsgReader()
|
||||
LinkReceiver::~LinkReceiver()
|
||||
{
|
||||
free(fRecvBuffer);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LinkMsgReader::SetPort(port_id port)
|
||||
LinkReceiver::SetPort(port_id port)
|
||||
{
|
||||
fReceivePort = port;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
LinkMsgReader::GetNextMessage(int32 &code, bigtime_t timeout)
|
||||
LinkReceiver::GetNextMessage(int32 &code, bigtime_t timeout)
|
||||
{
|
||||
int32 remaining;
|
||||
|
||||
fReadError = B_OK;
|
||||
|
||||
remaining = fDataSize - (fRecvStart + fReplySize);
|
||||
STRACE(("info: LinkMsgReader GetNextReply() reports %ld bytes remaining in buffer.\n", remaining));
|
||||
STRACE(("info: LinkReceiver GetNextReply() reports %ld bytes remaining in buffer.\n", remaining));
|
||||
|
||||
// find the position of the next message header in the buffer
|
||||
message_header *header;
|
||||
@@ -80,14 +81,14 @@ LinkMsgReader::GetNextMessage(int32 &code, bigtime_t timeout)
|
||||
// check we have a well-formed message
|
||||
if (remaining < (int32)sizeof(message_header)) {
|
||||
// we don't have enough data for a complete header
|
||||
STRACE(("error info: LinkMsgReader remaining %ld bytes is less than header size.\n", remaining));
|
||||
STRACE(("error info: LinkReceiver remaining %ld bytes is less than header size.\n", remaining));
|
||||
ResetBuffer();
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
fReplySize = header->size;
|
||||
if (fReplySize > remaining || fReplySize < (int32)sizeof(message_header)) {
|
||||
STRACE(("error info: LinkMsgReader message size of %ld bytes smaller than header size.\n", fReplySize));
|
||||
STRACE(("error info: LinkReceiver message size of %ld bytes smaller than header size.\n", fReplySize));
|
||||
ResetBuffer();
|
||||
return B_ERROR;
|
||||
}
|
||||
@@ -95,7 +96,7 @@ LinkMsgReader::GetNextMessage(int32 &code, bigtime_t timeout)
|
||||
code = header->code;
|
||||
fRecvPosition += sizeof(message_header);
|
||||
|
||||
STRACE(("info: LinkMsgReader got header %s [%ld %ld %ld] from port %ld.\n",
|
||||
STRACE(("info: LinkReceiver got header %s [%ld %ld %ld] from port %ld.\n",
|
||||
strcode(header->code), fReplySize, header->code, header->flags, fReceivePort));
|
||||
|
||||
return B_OK;
|
||||
@@ -103,7 +104,7 @@ LinkMsgReader::GetNextMessage(int32 &code, bigtime_t timeout)
|
||||
|
||||
|
||||
bool
|
||||
LinkMsgReader::NeedsReply() const
|
||||
LinkReceiver::NeedsReply() const
|
||||
{
|
||||
if (fReplySize == 0)
|
||||
return false;
|
||||
@@ -114,7 +115,7 @@ LinkMsgReader::NeedsReply() const
|
||||
|
||||
|
||||
void
|
||||
LinkMsgReader::ResetBuffer()
|
||||
LinkReceiver::ResetBuffer()
|
||||
{
|
||||
fRecvPosition = 0;
|
||||
fRecvStart = 0;
|
||||
@@ -124,7 +125,7 @@ LinkMsgReader::ResetBuffer()
|
||||
|
||||
|
||||
status_t
|
||||
LinkMsgReader::AdjustReplyBuffer(bigtime_t timeout)
|
||||
LinkReceiver::AdjustReplyBuffer(bigtime_t timeout)
|
||||
{
|
||||
// Here we take advantage of the compiler's dead-code elimination
|
||||
if (kInitialBufferSize == kMaxBufferSize) {
|
||||
@@ -139,13 +140,13 @@ LinkMsgReader::AdjustReplyBuffer(bigtime_t timeout)
|
||||
|
||||
fRecvBufferSize = kInitialBufferSize;
|
||||
} else {
|
||||
STRACE(("info: LinkMsgReader getting port_buffer_size().\n"));
|
||||
STRACE(("info: LinkReceiver getting port_buffer_size().\n"));
|
||||
ssize_t bufferSize;
|
||||
if (timeout == B_INFINITE_TIMEOUT)
|
||||
bufferSize = port_buffer_size(fReceivePort);
|
||||
else
|
||||
bufferSize = port_buffer_size_etc(fReceivePort, B_TIMEOUT, timeout);
|
||||
STRACE(("info: LinkMsgReader got port_buffer_size() = %ld.\n", bufferSize));
|
||||
STRACE(("info: LinkReceiver got port_buffer_size() = %ld.\n", bufferSize));
|
||||
|
||||
if (bufferSize < 0)
|
||||
return (status_t)bufferSize;
|
||||
@@ -159,7 +160,7 @@ LinkMsgReader::AdjustReplyBuffer(bigtime_t timeout)
|
||||
if (bufferSize > (ssize_t)kMaxBufferSize)
|
||||
return B_ERROR; // we can't continue
|
||||
|
||||
STRACE(("info: LinkMsgReader setting receive buffersize to %ld.\n", bufferSize));
|
||||
STRACE(("info: LinkReceiver setting receive buffersize to %ld.\n", bufferSize));
|
||||
char *buffer = (char *)malloc(bufferSize);
|
||||
if (buffer == NULL)
|
||||
return B_NO_MEMORY;
|
||||
@@ -175,7 +176,7 @@ LinkMsgReader::AdjustReplyBuffer(bigtime_t timeout)
|
||||
|
||||
|
||||
status_t
|
||||
LinkMsgReader::ReadFromPort(bigtime_t timeout)
|
||||
LinkReceiver::ReadFromPort(bigtime_t timeout)
|
||||
{
|
||||
// we are here so it means we finished reading the buffer contents
|
||||
ResetBuffer();
|
||||
@@ -187,7 +188,7 @@ LinkMsgReader::ReadFromPort(bigtime_t timeout)
|
||||
int32 code;
|
||||
ssize_t bytesRead;
|
||||
|
||||
STRACE(("info: LinkMsgReader reading port %ld.\n", fReceivePort));
|
||||
STRACE(("info: LinkReceiver reading port %ld.\n", fReceivePort));
|
||||
while (true) {
|
||||
if (timeout != B_INFINITE_TIMEOUT) {
|
||||
do {
|
||||
@@ -201,7 +202,7 @@ LinkMsgReader::ReadFromPort(bigtime_t timeout)
|
||||
} while (bytesRead == B_INTERRUPTED);
|
||||
}
|
||||
|
||||
STRACE(("info: LinkMsgReader read %ld bytes.\n", bytesRead));
|
||||
STRACE(("info: LinkReceiver read %ld bytes.\n", bytesRead));
|
||||
if (bytesRead < B_OK)
|
||||
return bytesRead;
|
||||
|
||||
@@ -222,9 +223,9 @@ LinkMsgReader::ReadFromPort(bigtime_t timeout)
|
||||
|
||||
|
||||
status_t
|
||||
LinkMsgReader::Read(void *data, ssize_t size)
|
||||
LinkReceiver::Read(void *data, ssize_t size)
|
||||
{
|
||||
// STRACE(("info: LinkMsgReader Read()ing %ld bytes...\n", size));
|
||||
// STRACE(("info: LinkReceiver Read()ing %ld bytes...\n", size));
|
||||
if (fReadError < B_OK)
|
||||
return fReadError;
|
||||
|
||||
@@ -249,7 +250,7 @@ LinkMsgReader::Read(void *data, ssize_t size)
|
||||
|
||||
|
||||
status_t
|
||||
LinkMsgReader::ReadString(char **_string)
|
||||
LinkReceiver::ReadString(char **_string)
|
||||
{
|
||||
int32 length = 0;
|
||||
status_t status;
|
||||
@@ -285,3 +286,4 @@ LinkMsgReader::ReadString(char **_string)
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
@@ -33,8 +33,9 @@
|
||||
static const size_t kWatermark = kInitialBufferSize - 24;
|
||||
// if a message is started after this mark, the buffer is flushed automatically
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
LinkMsgSender::LinkMsgSender(port_id port)
|
||||
LinkSender::LinkSender(port_id port)
|
||||
:
|
||||
fPort(port),
|
||||
fBuffer(NULL),
|
||||
@@ -47,21 +48,21 @@ LinkMsgSender::LinkMsgSender(port_id port)
|
||||
}
|
||||
|
||||
|
||||
LinkMsgSender::~LinkMsgSender()
|
||||
LinkSender::~LinkSender()
|
||||
{
|
||||
free(fBuffer);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LinkMsgSender::SetPort(port_id port)
|
||||
LinkSender::SetPort(port_id port)
|
||||
{
|
||||
fPort = port;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
LinkMsgSender::StartMessage(int32 code, size_t minSize)
|
||||
LinkSender::StartMessage(int32 code, size_t minSize)
|
||||
{
|
||||
// end previous message
|
||||
if (EndMessage() < B_OK)
|
||||
@@ -92,7 +93,7 @@ LinkMsgSender::StartMessage(int32 code, size_t minSize)
|
||||
header->code = code;
|
||||
header->flags = 0;
|
||||
|
||||
STRACE(("info: LinkMsgSender buffered header %s (%lx) [%lu %lu %lu].\n",
|
||||
STRACE(("info: LinkSender buffered header %s (%lx) [%lu %lu %lu].\n",
|
||||
strcode(code), code, header->size, header->code, header->flags));
|
||||
|
||||
fCurrentEnd += sizeof(message_header);
|
||||
@@ -101,7 +102,7 @@ LinkMsgSender::StartMessage(int32 code, size_t minSize)
|
||||
|
||||
|
||||
status_t
|
||||
LinkMsgSender::EndMessage(bool needsReply)
|
||||
LinkSender::EndMessage(bool needsReply)
|
||||
{
|
||||
if (fCurrentEnd == fCurrentStart || fCurrentStatus < B_OK)
|
||||
return fCurrentStatus;
|
||||
@@ -112,7 +113,7 @@ LinkMsgSender::EndMessage(bool needsReply)
|
||||
if (needsReply)
|
||||
header->flags |= needsReply;
|
||||
|
||||
STRACE(("info: LinkMsgSender EndMessage() of size %ld.\n", header->size));
|
||||
STRACE(("info: LinkSender EndMessage() of size %ld.\n", header->size));
|
||||
|
||||
// bump to start of next message
|
||||
fCurrentStart = fCurrentEnd;
|
||||
@@ -121,7 +122,7 @@ LinkMsgSender::EndMessage(bool needsReply)
|
||||
|
||||
|
||||
void
|
||||
LinkMsgSender::CancelMessage()
|
||||
LinkSender::CancelMessage()
|
||||
{
|
||||
fCurrentEnd = fCurrentStart;
|
||||
fCurrentStatus = B_OK;
|
||||
@@ -129,7 +130,7 @@ LinkMsgSender::CancelMessage()
|
||||
|
||||
|
||||
status_t
|
||||
LinkMsgSender::Attach(const void *data, size_t size)
|
||||
LinkSender::Attach(const void *data, size_t size)
|
||||
{
|
||||
if (fCurrentStatus < B_OK)
|
||||
return fCurrentStatus;
|
||||
@@ -156,7 +157,7 @@ LinkMsgSender::Attach(const void *data, size_t size)
|
||||
|
||||
|
||||
status_t
|
||||
LinkMsgSender::AttachString(const char *string, int32 length)
|
||||
LinkSender::AttachString(const char *string, int32 length)
|
||||
{
|
||||
if (string == NULL)
|
||||
string = "";
|
||||
@@ -179,7 +180,7 @@ LinkMsgSender::AttachString(const char *string, int32 length)
|
||||
|
||||
|
||||
status_t
|
||||
LinkMsgSender::AdjustBuffer(size_t newSize, char **_oldBuffer)
|
||||
LinkSender::AdjustBuffer(size_t newSize, char **_oldBuffer)
|
||||
{
|
||||
// make sure the new size is within bounds
|
||||
if (newSize <= kInitialBufferSize)
|
||||
@@ -214,7 +215,7 @@ LinkMsgSender::AdjustBuffer(size_t newSize, char **_oldBuffer)
|
||||
|
||||
|
||||
status_t
|
||||
LinkMsgSender::FlushCompleted(size_t newBufferSize)
|
||||
LinkSender::FlushCompleted(size_t newBufferSize)
|
||||
{
|
||||
// we need to hide the incomplete message so that it's not flushed
|
||||
int32 end = fCurrentEnd;
|
||||
@@ -245,7 +246,7 @@ LinkMsgSender::FlushCompleted(size_t newBufferSize)
|
||||
|
||||
|
||||
status_t
|
||||
LinkMsgSender::Flush(bigtime_t timeout, bool needsReply)
|
||||
LinkSender::Flush(bigtime_t timeout, bool needsReply)
|
||||
{
|
||||
if (fCurrentStatus < B_OK)
|
||||
return fCurrentStatus;
|
||||
@@ -254,7 +255,7 @@ LinkMsgSender::Flush(bigtime_t timeout, bool needsReply)
|
||||
if (fCurrentStart == 0)
|
||||
return B_OK;
|
||||
|
||||
STRACE(("info: LinkMsgSender Flush() waiting to send messages of %ld bytes on port %ld.\n",
|
||||
STRACE(("info: LinkSender Flush() waiting to send messages of %ld bytes on port %ld.\n",
|
||||
fCurrentEnd, fPort));
|
||||
|
||||
status_t err;
|
||||
@@ -270,12 +271,12 @@ LinkMsgSender::Flush(bigtime_t timeout, bool needsReply)
|
||||
}
|
||||
|
||||
if (err < B_OK) {
|
||||
STRACE(("error info: LinkMsgSender Flush() failed for %ld bytes (%s) on port %ld.\n",
|
||||
STRACE(("error info: LinkSender Flush() failed for %ld bytes (%s) on port %ld.\n",
|
||||
fCurrentEnd, strerror(err), fPort));
|
||||
return err;
|
||||
}
|
||||
|
||||
STRACE(("info: LinkMsgSender Flush() messages total of %ld bytes on port %ld.\n",
|
||||
STRACE(("info: LinkSender Flush() messages total of %ld bytes on port %ld.\n",
|
||||
fCurrentEnd, fPort));
|
||||
|
||||
fCurrentEnd = 0;
|
||||
@@ -284,6 +285,7 @@ LinkMsgSender::Flush(bigtime_t timeout, bool needsReply)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
+43
-19
@@ -21,33 +21,30 @@
|
||||
#include <ServerProtocol.h>
|
||||
|
||||
|
||||
BPortLink::BPortLink(port_id send, port_id receive)
|
||||
:
|
||||
fReader(new LinkMsgReader(receive)),
|
||||
fSender(new LinkMsgSender(send))
|
||||
namespace BPrivate {
|
||||
|
||||
ServerLink::ServerLink()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BPortLink::~BPortLink()
|
||||
ServerLink::~ServerLink()
|
||||
{
|
||||
delete fReader;
|
||||
delete fSender;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BPortLink::ReadRegion(BRegion *region)
|
||||
ServerLink::ReadRegion(BRegion *region)
|
||||
{
|
||||
fReader->Read(®ion->count, sizeof(long));
|
||||
fReader->Read(®ion->bound, sizeof(clipping_rect));
|
||||
fReceiver->Read(®ion->count, sizeof(long));
|
||||
fReceiver->Read(®ion->bound, sizeof(clipping_rect));
|
||||
region->set_size(region->count + 1);
|
||||
return fReader->Read(region->data, region->count * sizeof(clipping_rect));
|
||||
return fReceiver->Read(region->data, region->count * sizeof(clipping_rect));
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BPortLink::AttachRegion(const BRegion ®ion)
|
||||
ServerLink::AttachRegion(const BRegion ®ion)
|
||||
{
|
||||
fSender->Attach(®ion.count, sizeof(long));
|
||||
fSender->Attach(®ion.bound, sizeof(clipping_rect));
|
||||
@@ -56,17 +53,17 @@ BPortLink::AttachRegion(const BRegion ®ion)
|
||||
|
||||
|
||||
status_t
|
||||
BPortLink::ReadShape(BShape *shape)
|
||||
ServerLink::ReadShape(BShape *shape)
|
||||
{
|
||||
int32 opCount, ptCount;
|
||||
fReader->Read(&opCount, sizeof(int32));
|
||||
fReader->Read(&ptCount, sizeof(int32));
|
||||
fReceiver->Read(&opCount, sizeof(int32));
|
||||
fReceiver->Read(&ptCount, sizeof(int32));
|
||||
|
||||
uint32 opList[opCount];
|
||||
fReader->Read(opList, opCount * sizeof(uint32));
|
||||
fReceiver->Read(opList, opCount * sizeof(uint32));
|
||||
|
||||
BPoint ptList[ptCount];
|
||||
fReader->Read(ptList, ptCount * sizeof(BPoint));
|
||||
fReceiver->Read(ptList, ptCount * sizeof(BPoint));
|
||||
|
||||
shape->SetData(opCount, ptCount, opList, ptList);
|
||||
return B_OK;
|
||||
@@ -74,7 +71,7 @@ BPortLink::ReadShape(BShape *shape)
|
||||
|
||||
|
||||
status_t
|
||||
BPortLink::AttachShape(BShape &shape)
|
||||
ServerLink::AttachShape(BShape &shape)
|
||||
{
|
||||
int32 opCount, ptCount;
|
||||
uint32 *opList;
|
||||
@@ -90,7 +87,7 @@ BPortLink::AttachShape(BShape &shape)
|
||||
|
||||
|
||||
status_t
|
||||
BPortLink::FlushWithReply(int32 &code)
|
||||
ServerLink::FlushWithReply(int32 &code)
|
||||
{
|
||||
status_t status = Flush(B_INFINITE_TIMEOUT, true);
|
||||
if (status < B_OK)
|
||||
@@ -98,3 +95,30 @@ BPortLink::FlushWithReply(int32 &code)
|
||||
|
||||
return GetNextMessage(code);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
PortLink::PortLink(port_id send, port_id receive)
|
||||
{
|
||||
fSender = new LinkSender(send);
|
||||
fReceiver = new LinkReceiver(receive);
|
||||
}
|
||||
|
||||
|
||||
PortLink::~PortLink()
|
||||
{
|
||||
delete fReceiver;
|
||||
delete fSender;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PortLink::SetTo(port_id sender, port_id receiver)
|
||||
{
|
||||
fSender->SetPort(sender);
|
||||
fReceiver->SetPort(receiver);
|
||||
}
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, Haiku
|
||||
// Copyright (c) 2001-2005, Haiku
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
@@ -41,20 +41,20 @@
|
||||
|
||||
|
||||
ServerMemIO::ServerMemIO(size_t size)
|
||||
: fLen(0),
|
||||
fPhys(0),
|
||||
fPos(0)
|
||||
:
|
||||
fLen(0),
|
||||
fPhys(0),
|
||||
fPos(0)
|
||||
{
|
||||
if (size == 0)
|
||||
return;
|
||||
|
||||
BPrivate::BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_ACQUIRE_SERVERMEM);
|
||||
link.Attach<size_t>(size);
|
||||
link.Attach<port_id>(link.ReplyPort());
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(&code) == B_OK
|
||||
if (link.FlushWithReply(code) == B_OK
|
||||
&& code == SERVER_TRUE) {
|
||||
area_info info;
|
||||
|
||||
@@ -77,7 +77,7 @@ ServerMemIO::ServerMemIO(size_t size)
|
||||
// Destruction
|
||||
ServerMemIO::~ServerMemIO()
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_RELEASE_SERVERMEM);
|
||||
link.Attach<area_id>(fSourceArea);
|
||||
link.Attach<int32>(fOffset);
|
||||
@@ -91,10 +91,9 @@ ServerMemIO::ReadAt(off_t pos, void *buffer, size_t size)
|
||||
{
|
||||
if (buffer == NULL || pos < 0)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
|
||||
ssize_t sizeRead = 0;
|
||||
if (pos < fLen)
|
||||
{
|
||||
if (pos < fLen) {
|
||||
sizeRead = min_c(static_cast<off_t>(size), fLen - pos);
|
||||
memcpy(buffer, fBuf + pos, sizeRead);
|
||||
}
|
||||
@@ -108,17 +107,16 @@ ServerMemIO::WriteAt(off_t pos, const void *buffer, size_t size)
|
||||
{
|
||||
if (buffer == NULL || pos < 0)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
|
||||
ssize_t sizeWritten = 0;
|
||||
if (pos < fPhys)
|
||||
{
|
||||
if (pos < fPhys) {
|
||||
sizeWritten = min_c(static_cast<off_t>(size), fPhys - pos);
|
||||
memcpy(fBuf + pos, buffer, sizeWritten);
|
||||
}
|
||||
|
||||
|
||||
if (pos + sizeWritten > fLen)
|
||||
fLen = pos + sizeWritten;
|
||||
|
||||
|
||||
return sizeWritten;
|
||||
}
|
||||
|
||||
@@ -127,8 +125,7 @@ ServerMemIO::WriteAt(off_t pos, const void *buffer, size_t size)
|
||||
off_t
|
||||
ServerMemIO::Seek(off_t position, uint32 seek_mode)
|
||||
{
|
||||
switch (seek_mode)
|
||||
{
|
||||
switch (seek_mode) {
|
||||
case SEEK_SET:
|
||||
fPos = position;
|
||||
break;
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2005, Haiku, Inc.
|
||||
//
|
||||
// Distributed under the terms of the MIT license.
|
||||
//
|
||||
// File Name: Bitmap.cpp
|
||||
// Author: Ingo Weinhold ([email protected])
|
||||
// DarkWyrm <[email protected]>
|
||||
// Stephan Aßmus <[email protected]>
|
||||
// Description: BBitmap objects represent off-screen windows that
|
||||
// contain bitmap data.
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Ingo Weinhold (bonefish@users.sf.net)
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
*/
|
||||
|
||||
/** BBitmap objects represent off-screen windows that
|
||||
* contain bitmap data.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits.h>
|
||||
@@ -2219,7 +2220,7 @@ BBitmap::InitObject(BRect bounds, color_space colorSpace, uint32 flags,
|
||||
error = B_NO_MEMORY;
|
||||
} else {
|
||||
// Ask the server (via our owning application) to create a bitmap.
|
||||
BPrivate::BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
// Attach Data:
|
||||
// 1) BRect bounds
|
||||
@@ -2245,8 +2246,8 @@ BBitmap::InitObject(BRect bounds, color_space colorSpace, uint32 flags,
|
||||
// Reply Data:
|
||||
// None
|
||||
int32 code = SERVER_FALSE;
|
||||
error = link.FlushWithReply(&code);
|
||||
|
||||
error = link.FlushWithReply(code);
|
||||
|
||||
if (error >= B_OK) {
|
||||
// *communication* with server successful
|
||||
if (code == SERVER_TRUE) {
|
||||
@@ -2314,7 +2315,7 @@ BBitmap::CleanUp()
|
||||
if (fFlags & B_BITMAP_NO_SERVER_LINK) {
|
||||
free(fBasePtr);
|
||||
} else {
|
||||
BPrivate::BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
// AS_DELETE_BITMAP:
|
||||
// Attached Data:
|
||||
// 1) int32 server token
|
||||
@@ -2326,7 +2327,7 @@ BBitmap::CleanUp()
|
||||
int32 code = SERVER_FALSE;
|
||||
link.StartMessage(AS_DELETE_BITMAP);
|
||||
link.Attach<int32>(fServerToken);
|
||||
link.FlushWithReply(&code);
|
||||
link.FlushWithReply(code);
|
||||
if (code == SERVER_FALSE) {
|
||||
// TODO: Find out if "SERVER_FALSE if the buffer
|
||||
// was already deleted" is true. If not, maybe we
|
||||
|
||||
@@ -77,7 +77,7 @@ ClientFontList::ClientFontList(void)
|
||||
{
|
||||
STRACE(("ClientFontList()\n"));
|
||||
familylist = new BList(0);
|
||||
fontlock = create_sem(1,"fontlist_sem");
|
||||
fontlock = create_sem(1, "fontlist_sem");
|
||||
}
|
||||
|
||||
|
||||
@@ -105,11 +105,12 @@ ClientFontList::Update(bool checkOnly)
|
||||
// Open the font list kept in font list
|
||||
acquire_sem(fontlock);
|
||||
|
||||
// ToDo: can't we use BPrivate::AppServerLink here?
|
||||
// We're going to ask the server whether the list has changed
|
||||
port_id port = find_port(SERVER_PORT_NAME);
|
||||
|
||||
bool needsUpdate = true;
|
||||
BPortLink link(port);
|
||||
BPrivate::PortLink link(port);
|
||||
|
||||
if (port >= B_OK) {
|
||||
link.StartMessage(AS_QUERY_FONTS_CHANGED);
|
||||
|
||||
+251
-302
@@ -1,5 +1,5 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2004, Haiku
|
||||
// Copyright (c) 2001-2005, Haiku
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
@@ -75,28 +75,27 @@ _init_global_fonts()
|
||||
void
|
||||
_font_control_(BFont *font, int32 cmd, void *data)
|
||||
{
|
||||
if(!font || (cmd!=AS_SET_SYSFONT_PLAIN && cmd!=AS_SET_SYSFONT_BOLD &&
|
||||
cmd!=AS_SET_SYSFONT_FIXED) )
|
||||
{
|
||||
if (!font
|
||||
|| (cmd != AS_SET_SYSFONT_PLAIN && cmd != AS_SET_SYSFONT_BOLD
|
||||
&& cmd != AS_SET_SYSFONT_FIXED)) {
|
||||
// this shouldn't ever happen, but just in case....
|
||||
printf("DEBUG: Bad parameters in _font_control_()\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(cmd);
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
{
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE) {
|
||||
// Once again, this shouldn't ever happen, but I want to know about it
|
||||
// if it does
|
||||
printf("DEBUG: Couldn't initialize font in _font_control()\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// there really isn't that much data that we need to set for such cases -- most
|
||||
// of them need to be set to the defaults. The stuff that can change are family,
|
||||
// style/face, size, and height.
|
||||
@@ -121,15 +120,14 @@ void
|
||||
_set_system_font_(const char *which, font_family family, font_style style,
|
||||
float size)
|
||||
{
|
||||
if(!which)
|
||||
if (!which)
|
||||
return;
|
||||
|
||||
if( (strcmp(which,"plain")==0) ||
|
||||
(strcmp(which,"bold")==0) ||
|
||||
(strcmp(which,"fixed")==0) )
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
if (!strcmp(which,"plain")
|
||||
|| !strcmp(which,"bold")
|
||||
|| !strcmp(which,"fixed")) {
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_SET_SYSTEM_FONT);
|
||||
link.AttachString(which);
|
||||
link.AttachString(family);
|
||||
@@ -149,14 +147,14 @@ int32
|
||||
count_font_families(void)
|
||||
{
|
||||
int32 code, count;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_COUNT_FONT_FAMILIES);
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return -1;
|
||||
|
||||
|
||||
link.Read<int32>(&count);
|
||||
return count;
|
||||
}
|
||||
@@ -171,14 +169,14 @@ int32
|
||||
count_font_styles(font_family name)
|
||||
{
|
||||
int32 code, count;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_COUNT_FONT_STYLES);
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
&& code != SERVER_TRUE)
|
||||
return -1;
|
||||
|
||||
|
||||
link.Read<int32>(&count);
|
||||
return count;
|
||||
}
|
||||
@@ -196,24 +194,24 @@ status_t
|
||||
get_font_family(int32 index, font_family *name, uint32 *flags)
|
||||
{
|
||||
// Fix over R5, which does not check for NULL font family names - it just crashes
|
||||
if(!name)
|
||||
if (!name)
|
||||
return B_ERROR;
|
||||
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_FAMILY_NAME);
|
||||
link.Attach<int32>(index);
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return B_ERROR;
|
||||
|
||||
|
||||
link.Read<font_family>(name);
|
||||
|
||||
if(flags)
|
||||
if (flags)
|
||||
link.Read<uint32>(flags);
|
||||
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -234,19 +232,18 @@ get_font_style(font_family family, int32 index, font_style *name,
|
||||
return B_ERROR;
|
||||
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_STYLE_NAME);
|
||||
link.Attach(family,sizeof(font_family));
|
||||
link.Attach<int32>(index);
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return B_ERROR;
|
||||
|
||||
|
||||
link.Read<font_style>(name);
|
||||
if(flags)
|
||||
{
|
||||
if (flags) {
|
||||
uint16 face;
|
||||
link.Read<uint16>(&face);
|
||||
link.Read<uint32>(flags);
|
||||
@@ -275,21 +272,21 @@ get_font_style(font_family family, int32 index, font_style *name,
|
||||
return B_ERROR;
|
||||
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_STYLE_NAME);
|
||||
link.Attach(family,sizeof(font_family));
|
||||
link.Attach(family, sizeof(font_family));
|
||||
link.Attach<int32>(index);
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return B_ERROR;
|
||||
|
||||
|
||||
link.Read<font_style>(name);
|
||||
link.Read<uint16>(face);
|
||||
if(flags)
|
||||
if (flags)
|
||||
link.Read<uint32>(flags);
|
||||
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -305,15 +302,15 @@ update_font_families(bool check_only)
|
||||
{
|
||||
int32 code;
|
||||
bool value;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_QUERY_FONTS_CHANGED);
|
||||
link.Attach<bool>(check_only);
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return false;
|
||||
|
||||
|
||||
link.Read<bool>(&value);
|
||||
return value;
|
||||
}
|
||||
@@ -422,38 +419,35 @@ status_t
|
||||
BFont::SetFamilyAndStyle(const font_family family, const font_style style)
|
||||
{
|
||||
// R5 version always returns B_OK. That's a problem...
|
||||
if(!family)
|
||||
if (!family)
|
||||
return B_ERROR;
|
||||
|
||||
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
if(!style)
|
||||
{
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
if (!style) {
|
||||
// The BeBook states that a NULL style means set only the family
|
||||
link.StartMessage(AS_SET_FAMILY_NAME);
|
||||
link.Attach(family,sizeof(font_family));
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
link.Attach(family, sizeof(font_family));
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return B_ERROR;
|
||||
|
||||
|
||||
link.Read<uint16>(&fFamilyID);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
link.StartMessage(AS_SET_FAMILY_AND_STYLE);
|
||||
link.Attach(family,sizeof(font_family));
|
||||
link.Attach(style,sizeof(font_style));
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
link.Attach(family, sizeof(font_family));
|
||||
link.Attach(style, sizeof(font_style));
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return B_ERROR;
|
||||
|
||||
|
||||
link.Read<uint16>(&fFamilyID);
|
||||
link.Read<uint16>(&fStyleID);
|
||||
}
|
||||
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -473,19 +467,19 @@ BFont::SetFamilyAndStyle(uint32 fontcode)
|
||||
|
||||
uint16 family,style,face;
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
style = fontcode & 0xFFFF;
|
||||
family = (fontcode & 0xFFFF0000) >> 16;
|
||||
|
||||
|
||||
link.StartMessage(AS_SET_FAMILY_AND_STYLE_FROM_ID);
|
||||
link.Attach<uint16>(family);
|
||||
link.Attach<uint16>(style);
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return;
|
||||
|
||||
|
||||
link.Read<uint16>(&face);
|
||||
|
||||
fStyleID = style;
|
||||
@@ -493,8 +487,8 @@ BFont::SetFamilyAndStyle(uint32 fontcode)
|
||||
|
||||
// Mask off any references in the face to Bold/Normal/Italic and set the face
|
||||
// value to reflect the new font style
|
||||
fFace&=B_UNDERSCORE_FACE | B_NEGATIVE_FACE | B_OUTLINED_FACE | B_STRIKEOUT_FACE;
|
||||
fFace|=face;
|
||||
fFace &= B_UNDERSCORE_FACE | B_NEGATIVE_FACE | B_OUTLINED_FACE | B_STRIKEOUT_FACE;
|
||||
fFace |= face;
|
||||
}
|
||||
|
||||
|
||||
@@ -516,25 +510,23 @@ BFont::SetFamilyAndFace(const font_family family, uint16 face)
|
||||
| B_STRIKEOUT_FACE | B_BOLD_FACE | B_REGULAR_FACE) != 0)
|
||||
fFace = face;
|
||||
|
||||
if(family)
|
||||
{
|
||||
if (family) {
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_SET_FAMILY_AND_FACE);
|
||||
link.Attach(family,sizeof(font_family));
|
||||
link.Attach(family, sizeof(font_family));
|
||||
link.Attach<uint16>(face);
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return B_ERROR;
|
||||
|
||||
|
||||
link.Read<uint16>(&fFamilyID);
|
||||
link.Read<uint16>(&fStyleID);
|
||||
}
|
||||
else
|
||||
fFace=face;
|
||||
|
||||
} else
|
||||
fFace = face;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -591,20 +583,20 @@ BFont::SetFlags(uint32 flags)
|
||||
void
|
||||
BFont::GetFamilyAndStyle(font_family *family, font_style *style) const
|
||||
{
|
||||
if(!family || !style)
|
||||
if (!family || !style)
|
||||
return;
|
||||
|
||||
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_FAMILY_AND_STYLE);
|
||||
link.Attach<uint16>(fFamilyID);
|
||||
link.Attach<uint16>(fStyleID);
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return;
|
||||
|
||||
|
||||
link.Read<font_family>(family);
|
||||
link.Read<font_style>(style);
|
||||
}
|
||||
@@ -671,16 +663,16 @@ font_direction
|
||||
BFont::Direction(void) const
|
||||
{
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_FONT_DIRECTION);
|
||||
link.Attach<uint16>(fFamilyID);
|
||||
link.Attach<uint16>(fStyleID);
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return B_FONT_LEFT_TO_RIGHT;
|
||||
|
||||
|
||||
font_direction fdir;
|
||||
link.Read<font_direction>(&fdir);
|
||||
return fdir;
|
||||
@@ -691,16 +683,16 @@ bool
|
||||
BFont::IsFixed(void) const
|
||||
{
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_QUERY_FONT_FIXED);
|
||||
link.Attach<uint16>(fFamilyID);
|
||||
link.Attach<uint16>(fStyleID);
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return false;
|
||||
|
||||
|
||||
bool fixed;
|
||||
link.Read<bool>(&fixed);
|
||||
return fixed;
|
||||
@@ -725,16 +717,16 @@ BRect
|
||||
BFont::BoundingBox(void) const
|
||||
{
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_FONT_BOUNDING_BOX);
|
||||
link.Attach<uint16>(fFamilyID);
|
||||
link.Attach<uint16>(fStyleID);
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
return BRect(0,0,0,0);
|
||||
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return BRect(0, 0, 0 ,0);
|
||||
|
||||
BRect box;
|
||||
link.Read<BRect>(&box);
|
||||
return box;
|
||||
@@ -761,16 +753,16 @@ int32
|
||||
BFont::CountTuned(void) const
|
||||
{
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_TUNED_COUNT);
|
||||
link.Attach<uint16>(fFamilyID);
|
||||
link.Attach<uint16>(fStyleID);
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return -1;
|
||||
|
||||
|
||||
int32 count;
|
||||
link.Read<int32>(&count);
|
||||
return count;
|
||||
@@ -780,21 +772,21 @@ BFont::CountTuned(void) const
|
||||
void
|
||||
BFont::GetTunedInfo(int32 index, tuned_font_info *info) const
|
||||
{
|
||||
if(!info)
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_TUNED_INFO);
|
||||
link.Attach<uint16>(fFamilyID);
|
||||
link.Attach<uint16>(fStyleID);
|
||||
link.Attach<uint32>(index);
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return;
|
||||
|
||||
|
||||
link.Read<tuned_font_info>(info);
|
||||
}
|
||||
|
||||
@@ -872,8 +864,8 @@ BFont::StringWidth(const char *string, int32 length) const
|
||||
return 0.0;
|
||||
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_STRING_WIDTH);
|
||||
link.AttachString(string);
|
||||
link.Attach<int32>(length);
|
||||
@@ -881,11 +873,11 @@ BFont::StringWidth(const char *string, int32 length) const
|
||||
link.Attach<uint16>(fStyleID);
|
||||
link.Attach<float>(fSize);
|
||||
link.Attach<uint8>(fSpacing);
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if (code != SERVER_TRUE)
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return 0.0;
|
||||
|
||||
|
||||
float width;
|
||||
link.Read<float>(&width);
|
||||
return width;
|
||||
@@ -896,36 +888,32 @@ void
|
||||
BFont::GetStringWidths(const char *stringArray[], const int32 lengthArray[],
|
||||
int32 numStrings, float widthArray[]) const
|
||||
{
|
||||
if(!stringArray || !lengthArray || numStrings<1 || !widthArray)
|
||||
if (!stringArray || !lengthArray || numStrings < 1 || !widthArray)
|
||||
return;
|
||||
|
||||
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_STRING_WIDTHS);
|
||||
|
||||
link.Attach<int32>(numStrings);
|
||||
|
||||
for(int32 i=0; i<numStrings; i++)
|
||||
{
|
||||
|
||||
for (int32 i = 0; i < numStrings; i++) {
|
||||
link.AttachString(stringArray[i]);
|
||||
link.Attach<int32>(lengthArray[i]);
|
||||
}
|
||||
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return;
|
||||
|
||||
for(int32 i=0; i<numStrings; i++)
|
||||
link.Read<float>(&widthArray[i]);
|
||||
|
||||
link.Read(widthArray, sizeof(float) * numStrings);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BFont::GetEscapements(const char charArray[], int32 numChars, float escapementArray[]) const
|
||||
{
|
||||
GetEscapements(charArray, numChars,NULL,escapementArray);
|
||||
GetEscapements(charArray, numChars, NULL, escapementArray);
|
||||
}
|
||||
|
||||
|
||||
@@ -933,16 +921,15 @@ void
|
||||
BFont::GetEscapements(const char charArray[], int32 numChars, escapement_delta *delta,
|
||||
float escapementArray[]) const
|
||||
{
|
||||
if (!charArray || numChars<1 || !escapementArray)
|
||||
if (!charArray || numChars < 1 || !escapementArray)
|
||||
return;
|
||||
|
||||
// NOTE: The R5 implementation crashes if delta == NULL!
|
||||
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_ESCAPEMENTS_AS_FLOATS);
|
||||
|
||||
link.Attach<uint16>(fFamilyID);
|
||||
link.Attach<uint16>(fStyleID);
|
||||
link.Attach<float>(fSize);
|
||||
@@ -957,13 +944,10 @@ BFont::GetEscapements(const char charArray[], int32 numChars, escapement_delta *
|
||||
|
||||
uint32 bytesInBuffer = UTF8CountBytes(charArray, numChars);
|
||||
link.Attach<int32>(bytesInBuffer);
|
||||
|
||||
link.Attach(charArray, bytesInBuffer);
|
||||
|
||||
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if (code != SERVER_TRUE)
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return;
|
||||
|
||||
link.Read(escapementArray, numChars * sizeof(float));
|
||||
@@ -974,7 +958,7 @@ void
|
||||
BFont::GetEscapements(const char charArray[], int32 numChars, escapement_delta *delta,
|
||||
BPoint escapementArray[]) const
|
||||
{
|
||||
GetEscapements(charArray, numChars,delta,escapementArray,NULL);
|
||||
GetEscapements(charArray, numChars, delta, escapementArray, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -982,95 +966,83 @@ void
|
||||
BFont::GetEscapements(const char charArray[], int32 numChars, escapement_delta *delta,
|
||||
BPoint escapementArray[], BPoint offsetArray[]) const
|
||||
{
|
||||
if(!charArray || numChars<1 || !escapementArray)
|
||||
if (!charArray || numChars<1 || !escapementArray)
|
||||
return;
|
||||
|
||||
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_ESCAPEMENTS);
|
||||
|
||||
link.Attach<uint16>(fFamilyID);
|
||||
link.Attach<uint16>(fStyleID);
|
||||
link.Attach<float>(fSize);
|
||||
link.Attach<float>(fRotation);
|
||||
link.Attach<uint32>(fFlags);
|
||||
|
||||
|
||||
link.Attach<int32>(numChars);
|
||||
|
||||
|
||||
// TODO: Support UTF8 characters
|
||||
if(offsetArray)
|
||||
{
|
||||
for(int32 i=0; i<numChars; i++)
|
||||
{
|
||||
if (offsetArray) {
|
||||
for (int32 i = 0; i < numChars; i++) {
|
||||
link.Attach<char>(charArray[i]);
|
||||
link.Attach<BPoint>(offsetArray[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BPoint dummypt(0,0);
|
||||
|
||||
for(int32 i=0; i<numChars; i++)
|
||||
{
|
||||
} else {
|
||||
BPoint dummypt(0, 0);
|
||||
|
||||
for (int32 i = 0; i < numChars; i++) {
|
||||
link.Attach<char>(charArray[i]);
|
||||
link.Attach<BPoint>(dummypt);
|
||||
}
|
||||
}
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return;
|
||||
|
||||
for(int32 i=0; i<numChars; i++)
|
||||
link.Read<BPoint>(&escapementArray[i]);
|
||||
link.Read(escapementArray, sizeof(BPoint) * numChars);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BFont::GetEdges(const char charArray[], int32 numBytes, edge_info edgeArray[]) const
|
||||
{
|
||||
if(!charArray || numBytes<1 || !edgeArray)
|
||||
if (!charArray || numBytes < 1 || !edgeArray)
|
||||
return;
|
||||
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_EDGES);
|
||||
|
||||
link.Attach<int32>(numBytes);
|
||||
|
||||
for(int32 i=0; i<numBytes; i++)
|
||||
link.Attach<char>(charArray[i]);
|
||||
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
int32 code;
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_EDGES);
|
||||
link.Attach<int32>(numBytes);
|
||||
link.Attach(charArray, numBytes);
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return;
|
||||
|
||||
for(int32 i=0; i<numBytes; i++)
|
||||
link.Read<edge_info>(&edgeArray[i]);
|
||||
|
||||
link.Read(edgeArray, sizeof(edge_info) * numBytes);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BFont::GetHeight(font_height *height) const
|
||||
{
|
||||
if(height)
|
||||
{
|
||||
if (height) {
|
||||
// R5's version actually contacts the server in this call. The more and more
|
||||
// I work with this class, the more and more I can't wait for R2 to fix it. Yeesh.
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_FONT_HEIGHT);
|
||||
link.Attach<uint16>(fFamilyID);
|
||||
link.Attach<uint16>(fStyleID);
|
||||
link.Attach<float>(fSize);
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code==SERVER_FALSE)
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return;
|
||||
|
||||
|
||||
link.Read<font_height>(height);
|
||||
}
|
||||
}
|
||||
@@ -1088,38 +1060,30 @@ void
|
||||
BFont::GetBoundingBoxesAsString(const char charArray[], int32 numChars, font_metric_mode mode,
|
||||
escapement_delta *delta, BRect boundingBoxArray[]) const
|
||||
{
|
||||
if(!charArray || numChars<1 || !boundingBoxArray)
|
||||
if (!charArray || numChars < 1 || !boundingBoxArray)
|
||||
return;
|
||||
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_BOUNDINGBOXES_CHARS);
|
||||
|
||||
link.Attach<font_metric_mode>(mode);
|
||||
|
||||
if(delta)
|
||||
{
|
||||
link.Attach<escapement_delta>(*delta);
|
||||
}
|
||||
else
|
||||
{
|
||||
escapement_delta esd={0,0};
|
||||
link.Attach<escapement_delta>(esd);
|
||||
}
|
||||
|
||||
link.Attach<int32>(numChars);
|
||||
|
||||
for(int32 i=0; i<numChars; i++)
|
||||
link.Attach<char>(charArray[i]);
|
||||
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
int32 code;
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_BOUNDINGBOXES_CHARS);
|
||||
link.Attach<font_metric_mode>(mode);
|
||||
|
||||
if (delta) {
|
||||
link.Attach<escapement_delta>(*delta);
|
||||
} else {
|
||||
escapement_delta emptyDelta = {0, 0};
|
||||
link.Attach<escapement_delta>(emptyDelta);
|
||||
}
|
||||
|
||||
link.Attach<int32>(numChars);
|
||||
link.Attach(charArray, numChars);
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return;
|
||||
|
||||
for(int32 i=0; i<numChars; i++)
|
||||
link.Read<BRect>(&boundingBoxArray[i]);
|
||||
|
||||
link.Read(boundingBoxArray, sizeof(BRect) * numChars);
|
||||
}
|
||||
|
||||
|
||||
@@ -1127,42 +1091,35 @@ void
|
||||
BFont::GetBoundingBoxesForStrings(const char *stringArray[], int32 numStrings,
|
||||
font_metric_mode mode, escapement_delta deltas[], BRect boundingBoxArray[]) const
|
||||
{
|
||||
if(!stringArray || numStrings<1 || !boundingBoxArray)
|
||||
if (!stringArray || numStrings < 1 || !boundingBoxArray)
|
||||
return;
|
||||
|
||||
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_BOUNDINGBOXES_STRINGS);
|
||||
|
||||
link.Attach<font_metric_mode>(mode);
|
||||
link.Attach<int32>(numStrings);
|
||||
|
||||
if(deltas)
|
||||
{
|
||||
for(int32 i=0; i<numStrings; i++)
|
||||
{
|
||||
|
||||
if (deltas) {
|
||||
for (int32 i = 0; i < numStrings; i++) {
|
||||
link.AttachString(stringArray[i]);
|
||||
link.Attach<escapement_delta>(deltas[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
escapement_delta esd={0,0};
|
||||
|
||||
for(int32 i=0; i<numStrings; i++)
|
||||
{
|
||||
} else {
|
||||
escapement_delta emptyDelta = {0, 0};
|
||||
|
||||
for (int32 i = 0; i < numStrings; i++) {
|
||||
link.AttachString(stringArray[i]);
|
||||
link.Attach<escapement_delta>(esd);
|
||||
link.Attach<escapement_delta>(emptyDelta);
|
||||
}
|
||||
}
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return;
|
||||
|
||||
for(int32 i=0; i<numStrings; i++)
|
||||
link.Read<BRect>(&boundingBoxArray[i]);
|
||||
|
||||
link.Read(boundingBoxArray, sizeof(BRect) * numStrings);
|
||||
}
|
||||
|
||||
|
||||
@@ -1170,14 +1127,13 @@ void
|
||||
BFont::GetGlyphShapes(const char charArray[], int32 numChars, BShape *glyphShapeArray[]) const
|
||||
{
|
||||
// TODO: implement code specifically for passing BShapes to and from the server
|
||||
if(!charArray || numChars<1 || !glyphShapeArray)
|
||||
if (!charArray || numChars < 1 || !glyphShapeArray)
|
||||
return;
|
||||
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_GLYPH_SHAPES);
|
||||
|
||||
link.Attach<uint16>(fFamilyID);
|
||||
link.Attach<uint16>(fStyleID);
|
||||
link.Attach<float>(fSize);
|
||||
@@ -1186,42 +1142,35 @@ BFont::GetGlyphShapes(const char charArray[], int32 numChars, BShape *glyphShape
|
||||
link.Attach<uint32>(fFlags);
|
||||
|
||||
link.Attach<int32>(numChars);
|
||||
for(int32 i = 0; i < numChars; i++)
|
||||
link.Attach<char>(charArray[i]);
|
||||
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
link.Attach(charArray, numChars);
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return;
|
||||
|
||||
for(int32 i = 0; i < numChars; i++)
|
||||
|
||||
for (int32 i = 0; i < numChars; i++)
|
||||
link.ReadShape(glyphShapeArray[i]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
BFont::GetHasGlyphs(const char charArray[], int32 numChars, bool hasArray[]) const
|
||||
{
|
||||
if(!charArray || numChars<1 || !hasArray)
|
||||
if (!charArray || numChars < 1 || !hasArray)
|
||||
return;
|
||||
|
||||
int32 code;
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_HAS_GLYPHS);
|
||||
|
||||
link.Attach<int32>(numChars);
|
||||
|
||||
for(int32 i=0; i<numChars; i++)
|
||||
link.Attach<char>(charArray[i]);
|
||||
|
||||
link.FlushWithReply(&code);
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
if(code!=SERVER_TRUE)
|
||||
link.StartMessage(AS_GET_HAS_GLYPHS);
|
||||
link.Attach<int32>(numChars);
|
||||
link.Attach(charArray, numChars);
|
||||
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return;
|
||||
|
||||
for(int32 i=0; i<numChars; i++)
|
||||
link.Read<bool>(&hasArray[i]);
|
||||
|
||||
link.Read(hasArray, sizeof(bool) * numChars);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -209,14 +209,17 @@ get_scroll_bar_info(scroll_bar_info *info)
|
||||
if (info == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
BAppServerLink link;
|
||||
int32 code;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_GET_SCROLLBAR_INFO);
|
||||
link.FlushWithReply(&code);
|
||||
if(code==SERVER_TRUE)
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) == B_OK
|
||||
&& code == SERVER_TRUE) {
|
||||
link.Read<scroll_bar_info>(info);
|
||||
|
||||
return ((code==SERVER_TRUE)?B_OK:B_ERROR);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -226,13 +229,17 @@ set_scroll_bar_info(scroll_bar_info *info)
|
||||
if (info == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
int32 code;
|
||||
|
||||
link.StartMessage(AS_SET_SCROLLBAR_INFO);
|
||||
link.Attach<scroll_bar_info>(*info);
|
||||
link.FlushWithReply(&code);
|
||||
return ((code==SERVER_TRUE)?B_OK:B_ERROR);
|
||||
|
||||
if (link.FlushWithReply(code) == B_OK
|
||||
&& code == SERVER_TRUE)
|
||||
return B_OK;
|
||||
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
#endif // COMPILE_FOR_R5
|
||||
@@ -550,14 +557,15 @@ keyboard_navigation_color()
|
||||
_IMPEXP_BE int32
|
||||
count_workspaces()
|
||||
{
|
||||
int32 count=1;
|
||||
|
||||
BAppServerLink link;
|
||||
int32 code;
|
||||
int32 count = 1;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_COUNT_WORKSPACES);
|
||||
link.FlushWithReply(&code);
|
||||
if(code==SERVER_TRUE)
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) == B_OK && code == SERVER_TRUE)
|
||||
link.Read<int32>(&count);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -565,7 +573,7 @@ count_workspaces()
|
||||
_IMPEXP_BE void
|
||||
set_workspace_count(int32 count)
|
||||
{
|
||||
BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_SET_WORKSPACE_COUNT);
|
||||
link.Attach<int32>(count);
|
||||
link.Flush();
|
||||
@@ -577,12 +585,13 @@ current_workspace()
|
||||
{
|
||||
int32 index = 0;
|
||||
|
||||
BAppServerLink link;
|
||||
int32 code;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_CURRENT_WORKSPACE);
|
||||
if (link.FlushWithReply(&code) == B_OK && code == SERVER_TRUE)
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) == B_OK && code == SERVER_TRUE)
|
||||
link.Read<int32>(&index);
|
||||
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
@@ -590,7 +599,7 @@ current_workspace()
|
||||
_IMPEXP_BE void
|
||||
activate_workspace(int32 workspace)
|
||||
{
|
||||
BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_ACTIVATE_WORKSPACE);
|
||||
link.Attach<int32>(workspace);
|
||||
link.Flush();
|
||||
@@ -601,14 +610,14 @@ _IMPEXP_BE bigtime_t
|
||||
idle_time()
|
||||
{
|
||||
bigtime_t idletime = 0;
|
||||
|
||||
BAppServerLink link;
|
||||
int32 code;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_IDLE_TIME);
|
||||
link.FlushWithReply(&code);
|
||||
if(code==SERVER_TRUE)
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) == B_OK && code == SERVER_TRUE)
|
||||
link.Read<int64>(&idletime);
|
||||
|
||||
|
||||
return idletime;
|
||||
}
|
||||
|
||||
@@ -641,7 +650,7 @@ run_be_about()
|
||||
_IMPEXP_BE void
|
||||
set_focus_follows_mouse(bool follow)
|
||||
{
|
||||
BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_SET_FOCUS_FOLLOWS_MOUSE);
|
||||
link.Attach<bool>(follow);
|
||||
link.Flush();
|
||||
@@ -652,13 +661,14 @@ _IMPEXP_BE bool
|
||||
focus_follows_mouse()
|
||||
{
|
||||
bool ffm = false;
|
||||
|
||||
BAppServerLink link;
|
||||
int32 code;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_FOCUS_FOLLOWS_MOUSE);
|
||||
link.FlushWithReply(&code);
|
||||
if(code==SERVER_TRUE)
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) == B_OK && code == SERVER_TRUE)
|
||||
link.Read<bool>(&ffm);
|
||||
|
||||
return ffm;
|
||||
}
|
||||
|
||||
@@ -666,7 +676,7 @@ focus_follows_mouse()
|
||||
_IMPEXP_BE void
|
||||
set_mouse_mode(mode_mouse mode)
|
||||
{
|
||||
BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_SET_MOUSE_MODE);
|
||||
link.Attach<mode_mouse>(mode);
|
||||
link.Flush();
|
||||
@@ -676,14 +686,16 @@ set_mouse_mode(mode_mouse mode)
|
||||
_IMPEXP_BE mode_mouse
|
||||
mouse_mode()
|
||||
{
|
||||
// ToDo: what is mouse_mode? Get a default value over here now! :-)
|
||||
mode_mouse mode;
|
||||
|
||||
BAppServerLink link;
|
||||
int32 code;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_GET_MOUSE_MODE);
|
||||
link.FlushWithReply(&code);
|
||||
if(code==SERVER_TRUE)
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) == B_OK && code == SERVER_TRUE)
|
||||
link.Read<mode_mouse>(&mode);
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
@@ -692,14 +704,15 @@ _IMPEXP_BE rgb_color
|
||||
ui_color(color_which which)
|
||||
{
|
||||
rgb_color color;
|
||||
|
||||
BAppServerLink link;
|
||||
int32 code;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_GET_UI_COLOR);
|
||||
link.Attach<color_which>(which);
|
||||
link.FlushWithReply(&code);
|
||||
if(code==SERVER_TRUE)
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) == B_OK && code == SERVER_TRUE)
|
||||
link.Read<rgb_color>(&color);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -794,43 +807,47 @@ _fini_interface_kit_()
|
||||
void
|
||||
__set_window_decor(int32 theme)
|
||||
{
|
||||
BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_R5_SET_DECORATOR);
|
||||
link.Attach<int32>(theme);
|
||||
link.Flush();
|
||||
}
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
/*!
|
||||
\brief Private function to get the system's GUI colors as a set
|
||||
\param colors The recipient color set
|
||||
*/
|
||||
void get_system_colors(ColorSet *colors)
|
||||
void
|
||||
get_system_colors(ColorSet *colors)
|
||||
{
|
||||
if(!colors)
|
||||
if (!colors)
|
||||
return;
|
||||
|
||||
BAppServerLink link;
|
||||
int32 code;
|
||||
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_GET_UI_COLORS);
|
||||
link.Flush();
|
||||
link.GetNextMessage(code);
|
||||
link.Read<ColorSet>(colors);
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) == B_OK)
|
||||
link.Read<ColorSet>(colors);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Private function to set the system's GUI colors all at once
|
||||
\param colors The color set to use
|
||||
*/
|
||||
void set_system_colors(const ColorSet &colors)
|
||||
void
|
||||
set_system_colors(const ColorSet &colors)
|
||||
{
|
||||
BAppServerLink link;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_SET_UI_COLORS);
|
||||
link.Attach<ColorSet>(colors);
|
||||
link.Flush();
|
||||
}
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
// These methods were marked with "Danger, will Robinson!" in
|
||||
// the OpenTracker source, so we might not want to be compatible
|
||||
|
||||
+169
-158
@@ -1,5 +1,5 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
// Copyright (c) 2001-2005, Haiku
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
@@ -25,12 +25,11 @@
|
||||
// be "replayed" later.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <Picture.h>
|
||||
#include <Message.h>
|
||||
#include <ByteOrder.h>
|
||||
@@ -40,13 +39,6 @@
|
||||
#include <AppServerLink.h>
|
||||
#include <ServerProtocol.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
struct _BPictureExtent_ {
|
||||
void *fNewData;
|
||||
@@ -60,11 +52,12 @@ struct _BPictureExtent_ {
|
||||
status_t do_playback(void * data, int32 size, BList& pictures,
|
||||
void **callBackTable, int32 tableEntries, void *user);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
BPicture::BPicture()
|
||||
: token(-1),
|
||||
extent(NULL),
|
||||
usurped(NULL)
|
||||
:
|
||||
token(-1),
|
||||
extent(NULL),
|
||||
usurped(NULL)
|
||||
{
|
||||
extent = new _BPictureExtent_;
|
||||
extent->fNewData = NULL;
|
||||
@@ -72,53 +65,51 @@ BPicture::BPicture()
|
||||
extent->fOldData = NULL;
|
||||
extent->fOldSize = 0;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
BPicture::BPicture(const BPicture &picture)
|
||||
: token(-1),
|
||||
extent(NULL),
|
||||
usurped(NULL)
|
||||
|
||||
|
||||
BPicture::BPicture(const BPicture &otherPicture)
|
||||
:
|
||||
token(-1),
|
||||
extent(NULL),
|
||||
usurped(NULL)
|
||||
{
|
||||
init_data();
|
||||
|
||||
if (picture.token != -1)
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
int32 code=SERVER_FALSE;
|
||||
|
||||
if (otherPicture.token != -1) {
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_CLONE_PICTURE);
|
||||
link.Attach<int32>(picture.token);
|
||||
link.FlushWithReply(&code);
|
||||
if(code==SERVER_TRUE)
|
||||
link.Attach<int32>(otherPicture.token);
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) == B_OK
|
||||
&& code == SERVER_TRUE)
|
||||
link.Read<int32>(&token);
|
||||
}
|
||||
if (picture.extent->fNewData != NULL)
|
||||
{
|
||||
extent->fNewSize = picture.extent->fNewSize;
|
||||
|
||||
if (otherPicture.extent->fNewData != NULL) {
|
||||
extent->fNewSize = otherPicture.extent->fNewSize;
|
||||
extent->fNewData = malloc(extent->fNewSize);
|
||||
memcpy(extent->fNewData, picture.extent->fNewData, extent->fNewSize);
|
||||
memcpy(extent->fNewData, otherPicture.extent->fNewData, extent->fNewSize);
|
||||
|
||||
BPicture *pic;
|
||||
|
||||
for (int32 i = 0; i < picture.extent->fPictures.CountItems(); i++)
|
||||
{
|
||||
pic = new BPicture(*(BPicture*)picture.extent->fPictures.ItemAt(i));
|
||||
extent->fPictures.AddItem(pic);
|
||||
for (int32 i = 0; i < otherPicture.extent->fPictures.CountItems(); i++) {
|
||||
BPicture *picture = new BPicture(*(BPicture*)otherPicture.extent->fPictures.ItemAt(i));
|
||||
extent->fPictures.AddItem(picture);
|
||||
}
|
||||
}
|
||||
else if (picture.extent->fOldData != NULL)
|
||||
{
|
||||
extent->fOldSize = picture.extent->fOldSize;
|
||||
} else if (otherPicture.extent->fOldData != NULL) {
|
||||
extent->fOldSize = otherPicture.extent->fOldSize;
|
||||
extent->fOldData = malloc(extent->fOldSize);
|
||||
memcpy(extent->fOldData, picture.extent->fOldData, extent->fOldSize);
|
||||
memcpy(extent->fOldData, otherPicture.extent->fOldData, extent->fOldSize);
|
||||
|
||||
// In old data the sub pictures are inside the data
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
BPicture::BPicture(BMessage *archive)
|
||||
: token(-1),
|
||||
extent(NULL),
|
||||
usurped(NULL)
|
||||
:
|
||||
token(-1),
|
||||
extent(NULL),
|
||||
usurped(NULL)
|
||||
{
|
||||
init_data();
|
||||
|
||||
@@ -147,39 +138,36 @@ BPicture::BPicture(BMessage *archive)
|
||||
|
||||
if (version == 0)
|
||||
import_old_data(data, size);
|
||||
else if (version == 1)
|
||||
{
|
||||
else if (version == 1) {
|
||||
extent->fNewSize = size;
|
||||
extent->fNewData = malloc(extent->fNewSize);
|
||||
memcpy(extent->fNewData, data, extent->fNewSize);
|
||||
|
||||
// swap_data(extent->fNewData, extent->fNewSize);
|
||||
|
||||
if (extent->fNewSize != 0 && extent->fNewData != 0)
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
int32 code=SERVER_FALSE;
|
||||
BPicture *pic;
|
||||
|
||||
if (extent->fNewSize != 0 && extent->fNewData != 0) {
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_CREATE_PICTURE);
|
||||
link.Attach<int32>(extent->fPictures.CountItems());
|
||||
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
||||
{
|
||||
pic=(BPicture*)extent->fPictures.ItemAt(i);
|
||||
if(pic)
|
||||
link.Attach<int32>(pic->token);
|
||||
|
||||
for (int32 i = 0; i < extent->fPictures.CountItems(); i++) {
|
||||
BPicture *picture = (BPicture *)extent->fPictures.ItemAt(i);
|
||||
if (picture != NULL)
|
||||
link.Attach<int32>(picture->token);
|
||||
}
|
||||
link.Attach<int32>(extent->fNewSize);
|
||||
link.Attach(extent->fNewData,extent->fNewSize);
|
||||
link.FlushWithReply(&code);
|
||||
if(code==SERVER_TRUE)
|
||||
link.Attach(extent->fNewData, extent->fNewSize);
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) == B_OK
|
||||
&& code == SERVER_TRUE)
|
||||
link.Read<int32>(&token);
|
||||
}
|
||||
}
|
||||
|
||||
// Do we just free the data now?
|
||||
if (extent->fNewData)
|
||||
{
|
||||
if (extent->fNewData) {
|
||||
free(extent->fNewData);
|
||||
extent->fNewData = NULL;
|
||||
extent->fNewSize = 0;
|
||||
@@ -197,27 +185,25 @@ BPicture::BPicture(BMessage *archive)
|
||||
delete (BPicture *)extent->fPictures.ItemAt(i);
|
||||
extent->fPictures.MakeEmpty();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
BPicture::~BPicture()
|
||||
{
|
||||
if (token != -1)
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
if (token != -1) {
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_DELETE_PICTURE);
|
||||
link.Attach<int32>(token);
|
||||
link.Flush();
|
||||
}
|
||||
|
||||
if (extent->fNewData != NULL)
|
||||
{
|
||||
if (extent->fNewData != NULL) {
|
||||
free(extent->fNewData);
|
||||
extent->fNewData = NULL;
|
||||
extent->fNewSize = 0;
|
||||
}
|
||||
|
||||
if (extent->fOldData != NULL)
|
||||
{
|
||||
if (extent->fOldData != NULL) {
|
||||
free(extent->fOldData);
|
||||
extent->fOldData = NULL;
|
||||
extent->fOldSize = 0;
|
||||
@@ -229,56 +215,59 @@ BPicture::~BPicture()
|
||||
|
||||
free(extent);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
BArchivable *BPicture::Instantiate(BMessage *archive)
|
||||
|
||||
|
||||
BArchivable *
|
||||
BPicture::Instantiate(BMessage *archive)
|
||||
{
|
||||
if (validate_instantiation(archive, "BPicture"))
|
||||
return new BPicture(archive);
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
status_t BPicture::Archive(BMessage *archive, bool deep) const
|
||||
|
||||
|
||||
status_t
|
||||
BPicture::Archive(BMessage *archive, bool deep) const
|
||||
{
|
||||
if (!const_cast<BPicture*>(this)->assert_local_copy())
|
||||
return B_ERROR;
|
||||
|
||||
status_t err = BArchivable::Archive(archive, deep);
|
||||
|
||||
if (err != B_OK)
|
||||
return err;
|
||||
|
||||
err = archive->AddInt32("_ver", 1);
|
||||
|
||||
if (err != B_OK)
|
||||
return err;
|
||||
|
||||
err = archive->AddInt8("_endian", B_HOST_IS_BENDIAN);
|
||||
|
||||
if (err != B_OK)
|
||||
return err;
|
||||
|
||||
|
||||
err = archive->AddData("_data", B_RAW_TYPE, extent->fNewData,
|
||||
extent->fNewSize);
|
||||
|
||||
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
||||
{
|
||||
for (int32 i = 0; i < extent->fPictures.CountItems(); i++) {
|
||||
BMessage picMsg;
|
||||
|
||||
|
||||
((BPicture*)extent->fPictures.ItemAt(i))->Archive(&picMsg, deep);
|
||||
|
||||
archive->AddMessage("piclib", &picMsg);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
status_t BPicture::Perform(perform_code d, void *arg)
|
||||
|
||||
|
||||
status_t
|
||||
BPicture::Perform(perform_code d, void *arg)
|
||||
{
|
||||
return BArchivable::Perform(d, arg);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
status_t BPicture::Play(void **callBackTable, int32 tableEntries, void *user)
|
||||
|
||||
|
||||
status_t
|
||||
BPicture::Play(void **callBackTable, int32 tableEntries, void *user)
|
||||
{
|
||||
if (!assert_local_copy())
|
||||
return B_ERROR;
|
||||
@@ -286,8 +275,10 @@ status_t BPicture::Play(void **callBackTable, int32 tableEntries, void *user)
|
||||
return do_playback(extent->fNewData, extent->fNewSize, extent->fPictures,
|
||||
callBackTable, tableEntries, user);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
status_t BPicture::Flatten(BDataIO *stream)
|
||||
|
||||
|
||||
status_t
|
||||
BPicture::Flatten(BDataIO *stream)
|
||||
{
|
||||
if (!assert_local_copy())
|
||||
return B_ERROR;
|
||||
@@ -311,8 +302,10 @@ status_t BPicture::Flatten(BDataIO *stream)
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
status_t BPicture::Unflatten(BDataIO *stream)
|
||||
|
||||
|
||||
status_t
|
||||
BPicture::Unflatten(BDataIO *stream)
|
||||
{
|
||||
// TODO check the header
|
||||
int32 bla1 = 2;
|
||||
@@ -324,12 +317,10 @@ status_t BPicture::Unflatten(BDataIO *stream)
|
||||
|
||||
stream->Read(&count, 4);
|
||||
|
||||
for (int32 i = 0; i < count; i++)
|
||||
{
|
||||
for (int32 i = 0; i < count; i++) {
|
||||
BPicture *pic = new BPicture;
|
||||
|
||||
pic->Unflatten(stream);
|
||||
|
||||
extent->fPictures.AddItem(pic);
|
||||
}
|
||||
|
||||
@@ -339,26 +330,25 @@ status_t BPicture::Unflatten(BDataIO *stream)
|
||||
|
||||
// swap_data(extent->fNewData, extent->fNewSize);
|
||||
|
||||
BPrivate::BAppServerLink link;
|
||||
int32 code=SERVER_FALSE;
|
||||
BPicture *pic;
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_CREATE_PICTURE);
|
||||
link.Attach<int32>(extent->fPictures.CountItems());
|
||||
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
||||
{
|
||||
pic=(BPicture*)extent->fPictures.ItemAt(i);
|
||||
if(pic)
|
||||
link.Attach<int32>(pic->token);
|
||||
|
||||
for (int32 i = 0; i < extent->fPictures.CountItems(); i++) {
|
||||
BPicture *picture = (BPicture *)extent->fPictures.ItemAt(i);
|
||||
if (picture)
|
||||
link.Attach<int32>(picture->token);
|
||||
}
|
||||
link.Attach<int32>(extent->fNewSize);
|
||||
link.Attach(extent->fNewData, extent->fNewSize);
|
||||
link.FlushWithReply(&code);
|
||||
if(code==SERVER_TRUE)
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) == B_OK
|
||||
&& code == SERVER_TRUE)
|
||||
link.Read<int32>(&token);
|
||||
|
||||
if (extent->fNewData)
|
||||
{
|
||||
if (extent->fNewData) {
|
||||
free(extent->fNewData);
|
||||
extent->fNewData = NULL;
|
||||
extent->fNewSize = 0;
|
||||
@@ -366,17 +356,22 @@ status_t BPicture::Unflatten(BDataIO *stream)
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void BPicture::_ReservedPicture1() {}
|
||||
void BPicture::_ReservedPicture2() {}
|
||||
void BPicture::_ReservedPicture3() {}
|
||||
//------------------------------------------------------------------------------
|
||||
BPicture &BPicture::operator=(const BPicture &)
|
||||
|
||||
|
||||
BPicture &
|
||||
BPicture::operator=(const BPicture &)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void BPicture::init_data()
|
||||
|
||||
|
||||
void
|
||||
BPicture::init_data()
|
||||
{
|
||||
token = -1;
|
||||
usurped = NULL;
|
||||
@@ -387,15 +382,16 @@ void BPicture::init_data()
|
||||
extent->fOldData = NULL;
|
||||
extent->fOldSize = 0;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void BPicture::import_data(const void *data, int32 size, BPicture **subs,
|
||||
int32 subCount)
|
||||
|
||||
|
||||
void
|
||||
BPicture::import_data(const void *data, int32 size, BPicture **subs,
|
||||
int32 subCount)
|
||||
{
|
||||
if (data == NULL || size == 0)
|
||||
return;
|
||||
|
||||
BPrivate::BAppServerLink link;
|
||||
int32 code=SERVER_FALSE;
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_CREATE_PICTURE);
|
||||
link.Attach<int32>(subCount);
|
||||
@@ -405,12 +401,16 @@ void BPicture::import_data(const void *data, int32 size, BPicture **subs,
|
||||
|
||||
link.Attach<int32>(size);
|
||||
link.Attach(data, size);
|
||||
link.FlushWithReply(&code);
|
||||
if(code==SERVER_TRUE)
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) == B_OK
|
||||
&& code == SERVER_TRUE)
|
||||
link.Read<int32>(&token);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void BPicture::import_old_data(const void *data, int32 size)
|
||||
|
||||
|
||||
void
|
||||
BPicture::import_old_data(const void *data, int32 size)
|
||||
{
|
||||
// TODO: do we need to support old data, what is old data?
|
||||
/*if (data == NULL)
|
||||
@@ -438,13 +438,17 @@ void BPicture::import_old_data(const void *data, int32 size)
|
||||
extent->fOldData = 0;
|
||||
extent->fOldSize = 0;*/
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void BPicture::set_token(int32 _token)
|
||||
|
||||
|
||||
void
|
||||
BPicture::set_token(int32 _token)
|
||||
{
|
||||
token = _token;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
bool BPicture::assert_local_copy()
|
||||
|
||||
|
||||
bool
|
||||
BPicture::assert_local_copy()
|
||||
{
|
||||
if (extent->fNewData != NULL)
|
||||
return true;
|
||||
@@ -476,8 +480,10 @@ bool BPicture::assert_local_copy()
|
||||
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
bool BPicture::assert_old_local_copy()
|
||||
|
||||
|
||||
bool
|
||||
BPicture::assert_old_local_copy()
|
||||
{
|
||||
if (extent->fOldData != NULL)
|
||||
return true;
|
||||
@@ -490,8 +496,10 @@ bool BPicture::assert_old_local_copy()
|
||||
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
bool BPicture::assert_server_copy()
|
||||
|
||||
|
||||
bool
|
||||
BPicture::assert_server_copy()
|
||||
{
|
||||
if (token != -1)
|
||||
return true;
|
||||
@@ -516,55 +524,57 @@ bool BPicture::assert_server_copy()
|
||||
return token != -1;*/
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
BPicture::BPicture(const void *data, int32 size)
|
||||
{
|
||||
init_data();
|
||||
import_old_data(data, size);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
const void *BPicture::Data() const
|
||||
|
||||
|
||||
const void *
|
||||
BPicture::Data() const
|
||||
{
|
||||
if (extent->fNewData == NULL)
|
||||
{
|
||||
if (extent->fNewData == NULL) {
|
||||
const_cast<BPicture*>(this)->assert_local_copy();
|
||||
//convert_new_to_old(void *, long, void **, long *);
|
||||
}
|
||||
|
||||
return extent->fNewData;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
int32 BPicture::DataSize() const
|
||||
|
||||
|
||||
int32
|
||||
BPicture::DataSize() const
|
||||
{
|
||||
if (extent->fNewData == NULL)
|
||||
{
|
||||
if (extent->fNewData == NULL) {
|
||||
const_cast<BPicture*>(this)->assert_local_copy();
|
||||
//convert_new_to_old(void *, long, void **, long *);
|
||||
}
|
||||
|
||||
return extent->fNewSize;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void BPicture::usurp(BPicture *lameDuck)
|
||||
|
||||
|
||||
void
|
||||
BPicture::usurp(BPicture *lameDuck)
|
||||
{
|
||||
if (token != -1)
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
if (token != -1) {
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_DELETE_PICTURE);
|
||||
link.Attach<int32>(token);
|
||||
link.Flush();
|
||||
}
|
||||
|
||||
if (extent->fNewData != NULL)
|
||||
{
|
||||
if (extent->fNewData != NULL) {
|
||||
free(extent->fNewData);
|
||||
extent->fNewData = NULL;
|
||||
extent->fNewSize = 0;
|
||||
}
|
||||
|
||||
if (extent->fOldData != NULL)
|
||||
{
|
||||
if (extent->fOldData != NULL) {
|
||||
free(extent->fOldData);
|
||||
extent->fOldData = NULL;
|
||||
extent->fOldSize = 0;
|
||||
@@ -581,23 +591,24 @@ void BPicture::usurp(BPicture *lameDuck)
|
||||
// Do the usurping
|
||||
usurped = lameDuck;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
BPicture *BPicture::step_down()
|
||||
|
||||
|
||||
BPicture *
|
||||
BPicture::step_down()
|
||||
{
|
||||
BPicture *lameDuck = usurped;
|
||||
|
||||
usurped = NULL;
|
||||
|
||||
return lameDuck;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
status_t do_playback(void * data, int32 size, BList& pictures,
|
||||
|
||||
|
||||
status_t
|
||||
do_playback(void * data, int32 size, BList& pictures,
|
||||
void **callBackTable, int32 tableEntries, void *user)
|
||||
{
|
||||
TPicture pic(data, size, pictures);
|
||||
TPicture picture(data, size, pictures);
|
||||
|
||||
return pic.Play(callBackTable, tableEntries, user);
|
||||
return picture.Play(callBackTable, tableEntries, user);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ BPrivateScreen::RetraceSemaphore()
|
||||
sem_id id = B_BAD_SEM_ID;
|
||||
// TODO: Implement
|
||||
/*
|
||||
BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
PortMessage reply;
|
||||
link.SetOpCode(AS_GET_RETRACE_SEMAPHORE);
|
||||
link.Attach<screen_id>(ID());
|
||||
@@ -233,13 +233,13 @@ rgb_color
|
||||
BPrivateScreen::DesktopColor(uint32 workspace)
|
||||
{
|
||||
rgb_color color = { 51, 102, 152, 255 };
|
||||
BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_DESKTOP_COLOR);
|
||||
link.Attach<int32>(workspace);
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(&code) == B_OK
|
||||
if (link.FlushWithReply(code) == B_OK
|
||||
&& code == SERVER_TRUE)
|
||||
link.Read<rgb_color>(&color);
|
||||
|
||||
@@ -250,7 +250,7 @@ BPrivateScreen::DesktopColor(uint32 workspace)
|
||||
void
|
||||
BPrivateScreen::SetDesktopColor(rgb_color color, uint32 workspace, bool makeDefault)
|
||||
{
|
||||
BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_SET_DESKTOP_COLOR);
|
||||
link.Attach<rgb_color>(color);
|
||||
@@ -282,20 +282,19 @@ BPrivateScreen::GetMode(uint32 workspace, display_mode *mode)
|
||||
if (mode == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_SCREEN_GET_MODE);
|
||||
link.Attach<screen_id>(ID());
|
||||
link.Attach<uint32>(workspace);
|
||||
|
||||
int32 code = SERVER_FALSE;
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
if (code != SERVER_TRUE)
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) != B_OK
|
||||
|| code != SERVER_TRUE)
|
||||
return B_ERROR;
|
||||
|
||||
|
||||
display_mode currentMode;
|
||||
link.Read<display_mode>(¤tMode);
|
||||
|
||||
|
||||
status_t status = B_ERROR;
|
||||
link.Read<status_t>(&status);
|
||||
if (status == B_OK && mode)
|
||||
@@ -311,20 +310,18 @@ BPrivateScreen::SetMode(uint32 workspace, display_mode *mode, bool makeDefault)
|
||||
if (mode == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_SCREEN_SET_MODE);
|
||||
link.Attach<screen_id>(ID());
|
||||
link.Attach<uint32>(workspace);
|
||||
link.Attach<display_mode>(*mode);
|
||||
link.Attach<bool>(makeDefault);
|
||||
|
||||
int32 code = SERVER_FALSE;
|
||||
link.FlushWithReply(&code);
|
||||
|
||||
status_t status = B_ERROR;
|
||||
if (code == SERVER_TRUE)
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) == B_OK && code == SERVER_TRUE)
|
||||
link.Read<status_t>(&status);
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -358,7 +355,7 @@ BPrivateScreen::SetDPMS(uint32 dpmsState)
|
||||
{
|
||||
status_t status = B_ERROR;
|
||||
/*
|
||||
BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
PortMessage reply;
|
||||
link.SetOpCode(AS_SET_DPMS);
|
||||
link.Attach<screen_id>(ID());
|
||||
@@ -376,7 +373,7 @@ BPrivateScreen::DPMSState()
|
||||
// TODO: Implement
|
||||
uint32 state = 0;
|
||||
/*
|
||||
BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
PortMessage reply;
|
||||
link.SetOpCode(AS_GET_DPMS_STATE);
|
||||
link.Attach<screen_id>(ID());
|
||||
@@ -393,7 +390,7 @@ BPrivateScreen::DPMSCapabilites()
|
||||
// TODO: Implement
|
||||
uint32 capabilities = 0;
|
||||
/*
|
||||
BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
PortMessage reply;
|
||||
link.SetOpCode(AS_GET_DPMS_CAPABILITIES);
|
||||
link.Attach<screen_id>(ID());
|
||||
@@ -430,7 +427,7 @@ BPrivateScreen::get_screen_desc(screen_desc *desc)
|
||||
{
|
||||
status_t status = B_ERROR;
|
||||
/*
|
||||
BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
PortMessage reply;
|
||||
link.SetOpCode(AS_GET_SCREEN_DESC);
|
||||
link.Attach<screen_id>(ID());
|
||||
@@ -451,12 +448,12 @@ BPrivateScreen::BPrivateScreen()
|
||||
// TODO: BeOS R5 here gets the colormap pointer
|
||||
// (with BApplication::ro_offset_to_ptr() ?)
|
||||
// which is contained in a shared area created by the server.
|
||||
BAppServerLink link;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_SCREEN_GET_COLORMAP);
|
||||
link.Attach<screen_id>(ID());
|
||||
|
||||
int32 reply;
|
||||
link.FlushWithReply(&reply);
|
||||
if (reply == SERVER_TRUE) {
|
||||
if (link.FlushWithReply(reply) == B_OK && reply == SERVER_TRUE) {
|
||||
fColorMap = (color_map *)malloc(sizeof(color_map));
|
||||
fOwnsColorMap = true;
|
||||
link.Read<color_map>(fColorMap);
|
||||
|
||||
@@ -201,9 +201,7 @@ BWindow::BWindow(BRect frame, color_space depth,
|
||||
BWindow::~BWindow()
|
||||
{
|
||||
// the following lines, remove all existing shortcuts and delete accelList
|
||||
int32 noOfItems;
|
||||
|
||||
noOfItems = accelList.CountItems();
|
||||
int32 noOfItems = accelList.CountItems();
|
||||
for (int index = noOfItems-1; index >= 0; index--) {
|
||||
delete (_BCmdKey*)accelList.ItemAt(index);
|
||||
}
|
||||
@@ -221,8 +219,9 @@ BWindow::~BWindow()
|
||||
fLink->StartMessage(AS_DELETE_WINDOW);
|
||||
fLink->Flush();
|
||||
|
||||
delete_port(fLink->SenderPort());
|
||||
delete_port(fLink->ReceiverPort());
|
||||
delete fLink;
|
||||
delete_port(receive_port);
|
||||
}
|
||||
|
||||
|
||||
@@ -2054,8 +2053,8 @@ BWindow::InitData(BRect frame, const char* title, window_look look,
|
||||
// Here, we will contact app_server and let him know that a window has
|
||||
// been created
|
||||
|
||||
receive_port = create_port( B_LOOPER_PORT_DEFAULT_CAPACITY ,"w_rcv_port");
|
||||
if (receive_port < B_OK) {
|
||||
port_id receivePort = create_port( B_LOOPER_PORT_DEFAULT_CAPACITY ,"w_rcv_port");
|
||||
if (receivePort < B_OK) {
|
||||
debugger("Could not create BWindow's receive port, used for interacting with the app_server!");
|
||||
delete this;
|
||||
return;
|
||||
@@ -2064,8 +2063,8 @@ BWindow::InitData(BRect frame, const char* title, window_look look,
|
||||
STRACE(("BWindow::InitData(): contacting app_server...\n"));
|
||||
|
||||
// let app_server to know that a window has been created.
|
||||
fLink = new BPortLink(be_app->fServerFrom, receive_port);
|
||||
|
||||
fLink = new BPrivate::PortLink(be_app->fServerLink->SenderPort(), receivePort);
|
||||
|
||||
// HERE we are in BApplication's thread, so for locking we use be_app variable
|
||||
// we'll lock the be_app to be sure we're the only one writing at BApplication's server port
|
||||
bool locked = false;
|
||||
@@ -2074,8 +2073,6 @@ BWindow::InitData(BRect frame, const char* title, window_look look,
|
||||
locked = true;
|
||||
}
|
||||
|
||||
STRACE(("be_app->fServerTo is %ld\n", be_app->fServerFrom));
|
||||
|
||||
fLink->StartMessage(AS_CREATE_WINDOW);
|
||||
fLink->Attach<BRect>(fFrame);
|
||||
fLink->Attach<int32>((int32)fLook);
|
||||
@@ -2083,22 +2080,23 @@ BWindow::InitData(BRect frame, const char* title, window_look look,
|
||||
fLink->Attach<uint32>(fFlags);
|
||||
fLink->Attach<uint32>(workspace);
|
||||
fLink->Attach<int32>(_get_object_token_(this));
|
||||
fLink->Attach<port_id>(receive_port);
|
||||
fLink->Attach<port_id>(receivePort);
|
||||
fLink->Attach<port_id>(fMsgPort);
|
||||
fLink->AttachString(title);
|
||||
|
||||
port_id sendPort;
|
||||
int32 code;
|
||||
if (fLink->FlushWithReply(code) == B_OK
|
||||
&& code == SERVER_TRUE
|
||||
&& fLink->Read<port_id>(&send_port) == B_OK)
|
||||
fLink->SetSendPort(send_port);
|
||||
&& fLink->Read<port_id>(&sendPort) == B_OK)
|
||||
fLink->SetSenderPort(sendPort);
|
||||
else
|
||||
send_port = -1;
|
||||
sendPort = -1;
|
||||
|
||||
if (locked)
|
||||
be_app->Unlock();
|
||||
|
||||
STRACE(("Server says that our send port is %ld\n", send_port));
|
||||
STRACE(("Server says that our send port is %ld\n", sendPort));
|
||||
|
||||
STRACE(("Window locked?: %s\n", IsLocked() ? "True" : "False"));
|
||||
|
||||
@@ -2137,7 +2135,7 @@ void
|
||||
BWindow::task_looper()
|
||||
{
|
||||
STRACE(("info: BWindow::task_looper() started.\n"));
|
||||
|
||||
|
||||
// Check that looper is locked (should be)
|
||||
AssertLocked();
|
||||
// Unlock the looper
|
||||
@@ -2943,25 +2941,24 @@ BWindow::PrintToStream() const
|
||||
top_view name = %s\
|
||||
focus view name = %s\
|
||||
lastMouseMoved = %s\
|
||||
fLink = %s\
|
||||
fLink = %p\
|
||||
KeyMenuBar name = %s\
|
||||
DefaultButton = %s\
|
||||
# of shortcuts = %ld",
|
||||
Name(),
|
||||
fTitle!=NULL? fTitle:"NULL",
|
||||
Name(), fTitle,
|
||||
_get_object_token_(this),
|
||||
fInTransaction==true? "yes":"no",
|
||||
fActive==true? "yes":"no",
|
||||
fInTransaction == true ? "yes" : "no",
|
||||
fActive == true ? "yes" : "no",
|
||||
fShowLevel,
|
||||
fFlags,
|
||||
send_port,
|
||||
receive_port,
|
||||
top_view!=NULL? top_view->Name():"NULL",
|
||||
fFocus!=NULL? fFocus->Name():"NULL",
|
||||
fLastMouseMovedView!=NULL? fLastMouseMovedView->Name():"NULL",
|
||||
fLink!=NULL? "In place":"NULL",
|
||||
fKeyMenuBar!=NULL? fKeyMenuBar->Name():"NULL",
|
||||
fDefaultButton!=NULL? fDefaultButton->Name():"NULL",
|
||||
fLink->SenderPort(),
|
||||
fLink->ReceiverPort(),
|
||||
top_view != NULL ? top_view->Name() : "NULL",
|
||||
fFocus != NULL ? fFocus->Name() : "NULL",
|
||||
fLastMouseMovedView != NULL ? fLastMouseMovedView->Name() : "NULL",
|
||||
fLink,
|
||||
fKeyMenuBar != NULL ? fKeyMenuBar->Name() : "NULL",
|
||||
fDefaultButton != NULL ? fDefaultButton->Name() : "NULL",
|
||||
accelList.CountItems());
|
||||
/*
|
||||
for( int32 i=0; i<accelList.CountItems(); i++){
|
||||
|
||||
@@ -627,7 +627,7 @@ void APRView::LoadSettings(void)
|
||||
if(port!=B_NAME_NOT_FOUND)
|
||||
{
|
||||
STRACE(("Retrieving settings from app_server\n"));
|
||||
BPortLink link(port);
|
||||
BPrivate::PortLink link(port);
|
||||
int32 code;
|
||||
|
||||
link.StartMessage(AS_GET_UI_COLORS);
|
||||
@@ -701,7 +701,7 @@ void APRView::NotifyServer(void)
|
||||
if(port!=B_NAME_NOT_FOUND)
|
||||
{
|
||||
STRACE(("Notifying app_server\n"));
|
||||
BPortLink link(port);
|
||||
BPrivate::PortLink link(port);
|
||||
|
||||
link.StartMessage(AS_SET_UI_COLORS);
|
||||
link.Attach<ColorSet>(*currentset);
|
||||
|
||||
@@ -395,7 +395,7 @@ void CurView::SetDefaults(void)
|
||||
if(port==B_NAME_NOT_FOUND)
|
||||
return;
|
||||
|
||||
BPortLink link(port);
|
||||
BPrivate::PortLink link(port);
|
||||
int32 code;
|
||||
|
||||
link.StartMessage(AS_SET_SYSCURSOR_DEFAULTS);
|
||||
|
||||
@@ -264,7 +264,7 @@ void DecView::NotifyServer(void)
|
||||
return;
|
||||
|
||||
|
||||
BPortLink pl(serverport);
|
||||
BPrivate::PortLink pl(serverport);
|
||||
pl.StartMessage(AS_SET_DECORATOR);
|
||||
pl.AttachString(item->Text());
|
||||
pl.Flush();
|
||||
|
||||
@@ -39,7 +39,7 @@ cursor_which get_syscursor(void)
|
||||
if(server!=B_NAME_NOT_FOUND)
|
||||
{
|
||||
int32 code;
|
||||
BPortLink link(server);
|
||||
BPrivate::PortLink link(server);
|
||||
|
||||
link.StartMessage(AS_GET_SYSCURSOR);
|
||||
link.GetNextMessage(code);
|
||||
@@ -59,7 +59,7 @@ void setcursor(cursor_which which)
|
||||
port_id server=find_port(SERVER_PORT_NAME);
|
||||
if(server!=B_NAME_NOT_FOUND)
|
||||
{
|
||||
BPortLink link(server);
|
||||
BPrivate::PortLink link(server);
|
||||
link.StartMessage(AS_SET_CURSOR_SYSTEM);
|
||||
link.Flush();
|
||||
}
|
||||
|
||||
@@ -395,7 +395,7 @@ AppServer::Run(void)
|
||||
void
|
||||
AppServer::MainLoop(void)
|
||||
{
|
||||
BPortLink pmsg(-1, fMessagePort);
|
||||
BPrivate::PortLink pmsg(-1, fMessagePort);
|
||||
|
||||
while (1) {
|
||||
STRACE(("info: AppServer::MainLoop listening on port %ld.\n", fMessagePort));
|
||||
@@ -523,7 +523,7 @@ AppServer::InitDecorators(void)
|
||||
|
||||
*/
|
||||
void
|
||||
AppServer::DispatchMessage(int32 code, BPortLink &msg)
|
||||
AppServer::DispatchMessage(int32 code, BPrivate::PortLink &msg)
|
||||
{
|
||||
switch (code) {
|
||||
case AS_CREATE_APP:
|
||||
@@ -575,7 +575,7 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
|
||||
|
||||
release_sem(fAppListLock);
|
||||
|
||||
BPortLink replylink(clientReplyPort);
|
||||
BPrivate::PortLink replylink(clientReplyPort);
|
||||
replylink.StartMessage(SERVER_TRUE);
|
||||
replylink.Attach<int32>(serverListen);
|
||||
replylink.Flush();
|
||||
@@ -605,13 +605,11 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
|
||||
for (i = 0; i < appnum; i++) {
|
||||
srvapp = (ServerApp *)fAppList->ItemAt(i);
|
||||
|
||||
if(srvapp != NULL && srvapp->MonitorThreadID() == srvapp_id)
|
||||
{
|
||||
srvapp=(ServerApp *)fAppList->RemoveItem(i);
|
||||
if(srvapp)
|
||||
{
|
||||
if (srvapp != NULL && srvapp->MonitorThreadID() == srvapp_id) {
|
||||
srvapp = (ServerApp *)fAppList->RemoveItem(i);
|
||||
if (srvapp) {
|
||||
delete srvapp;
|
||||
srvapp= NULL;
|
||||
srvapp = NULL;
|
||||
}
|
||||
break; // jump out of our for() loop
|
||||
}
|
||||
@@ -646,7 +644,7 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
|
||||
port_id replyport;
|
||||
if (msg.Read<port_id>(&replyport) < B_OK)
|
||||
break;
|
||||
BPortLink replylink(replyport);
|
||||
BPrivate::PortLink replylink(replyport);
|
||||
replylink.StartMessage(needs_update ? SERVER_TRUE : SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
|
||||
@@ -662,36 +660,31 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
|
||||
|
||||
char *decname=NULL;
|
||||
msg.ReadString(&decname);
|
||||
if(decname)
|
||||
{
|
||||
if(strcmp(decname,"Default")!=0)
|
||||
{
|
||||
if (decname) {
|
||||
if (strcmp(decname, "Default") != 0) {
|
||||
BString decpath;
|
||||
decpath.SetTo(DECORATORS_DIR);
|
||||
decpath+=decname;
|
||||
if(LoadDecorator(decpath.String()))
|
||||
decpath += decname;
|
||||
if (LoadDecorator(decpath.String()))
|
||||
Broadcast(AS_UPDATE_DECORATOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
LoadDecorator(NULL);
|
||||
Broadcast(AS_UPDATE_DECORATOR);
|
||||
}
|
||||
}
|
||||
free(decname);
|
||||
|
||||
break;
|
||||
}
|
||||
case AS_GET_DECORATOR:
|
||||
{
|
||||
// Attached Data:
|
||||
// 1) port_id reply port
|
||||
|
||||
port_id replyport=-1;
|
||||
if(msg.Read<port_id>(&replyport)<B_OK)
|
||||
|
||||
port_id replyport = -1;
|
||||
if (msg.Read<port_id>(&replyport)<B_OK)
|
||||
return;
|
||||
|
||||
BPortLink replylink(replyport);
|
||||
|
||||
BPrivate::PortLink replylink(replyport);
|
||||
replylink.StartMessage(AS_GET_DECORATOR);
|
||||
replylink.AttachString(fDecoratorName.String());
|
||||
replylink.Flush();
|
||||
@@ -705,14 +698,13 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
|
||||
// Attached Data:
|
||||
// char * name of the decorator in the decorators path to use
|
||||
|
||||
int32 decindex=0;
|
||||
if(msg.Read<int32>(&decindex)<B_OK)
|
||||
int32 decindex = 0;
|
||||
if (msg.Read<int32>(&decindex)<B_OK)
|
||||
break;
|
||||
|
||||
|
||||
BString decpath;
|
||||
decpath.SetTo(DECORATORS_DIR);
|
||||
switch(decindex)
|
||||
{
|
||||
switch(decindex) {
|
||||
case 0: decpath+="BeOS"; break;
|
||||
case 1: decpath+="AmigaOS"; break;
|
||||
case 2: decpath+="Windows"; break;
|
||||
@@ -720,7 +712,7 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(LoadDecorator(decpath.String()))
|
||||
if (LoadDecorator(decpath.String()))
|
||||
Broadcast(AS_UPDATE_DECORATOR);
|
||||
|
||||
break;
|
||||
@@ -805,16 +797,16 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
|
||||
void
|
||||
AppServer::Broadcast(int32 code)
|
||||
{
|
||||
ServerApp *app= NULL;
|
||||
|
||||
acquire_sem(fAppListLock);
|
||||
for(int32 i= 0; i < fAppList->CountItems(); i++)
|
||||
{
|
||||
app=(ServerApp*)fAppList->ItemAt(i);
|
||||
if(!app)
|
||||
|
||||
for (int32 i = 0; i < fAppList->CountItems(); i++) {
|
||||
ServerApp *app = (ServerApp *)fAppList->ItemAt(i);
|
||||
|
||||
if (!app)
|
||||
{ printf("PANIC in AppServer::Broadcast()\n"); continue; }
|
||||
app->PostMessage(code);
|
||||
}
|
||||
|
||||
release_sem(fAppListLock);
|
||||
}
|
||||
|
||||
@@ -829,7 +821,7 @@ AppServer::Broadcast(int32 code)
|
||||
ServerApp *
|
||||
AppServer::FindApp(const char *sig)
|
||||
{
|
||||
if(!sig)
|
||||
if (!sig)
|
||||
return NULL;
|
||||
|
||||
ServerApp *foundapp=NULL;
|
||||
|
||||
@@ -20,10 +20,13 @@ class Layer;
|
||||
class BMessage;
|
||||
class ServerApp;
|
||||
class DisplayDriver;
|
||||
class BPortLink;
|
||||
class CursorManager;
|
||||
class BitmapManager;
|
||||
|
||||
namespace BPrivate {
|
||||
class PortLink;
|
||||
};
|
||||
|
||||
/*!
|
||||
\class AppServer AppServer.h
|
||||
\brief main manager object for the app_server
|
||||
@@ -50,7 +53,7 @@ public:
|
||||
bool LoadDecorator(const char *path);
|
||||
void InitDecorators(void);
|
||||
|
||||
void DispatchMessage(int32 code, BPortLink &link);
|
||||
void DispatchMessage(int32 code, BPrivate::PortLink &link);
|
||||
void Broadcast(int32 code);
|
||||
|
||||
ServerApp* FindApp(const char *sig);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, Haiku, Inc.
|
||||
// Copyright (c) 2001-2005, Haiku, Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
@@ -106,7 +106,7 @@ Desktop::AddDriver(DisplayDriver *driver)
|
||||
// The driver is now owned by the screen
|
||||
|
||||
// TODO: be careful of screen initialization - monitor may not support 640x480
|
||||
screen->SetMode(640, 480, B_RGB32, 60.f);
|
||||
screen->SetMode(800, 600, B_RGB32, 60.f);
|
||||
|
||||
fScreenList.AddItem(screen);
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, Haiku, Inc.
|
||||
// Copyright (c) 2001-2005, Haiku, Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
@@ -984,7 +984,7 @@ Layer::MoveBy(float x, float y)
|
||||
return;
|
||||
}
|
||||
|
||||
BPortLink msg(-1, -1);
|
||||
BPrivate::PortLink msg(-1, -1);
|
||||
msg.StartMessage(AS_ROOTLAYER_LAYER_MOVE);
|
||||
msg.Attach<Layer*>(this);
|
||||
msg.Attach<float>(x);
|
||||
@@ -1005,7 +1005,7 @@ Layer::ResizeBy(float x, float y)
|
||||
return;
|
||||
}
|
||||
|
||||
BPortLink msg(-1, -1);
|
||||
BPrivate::PortLink msg(-1, -1);
|
||||
msg.StartMessage(AS_ROOTLAYER_LAYER_RESIZE);
|
||||
msg.Attach<Layer*>(this);
|
||||
msg.Attach<float>(x);
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "LayerData.h"
|
||||
|
||||
|
||||
// constructor
|
||||
DrawData::DrawData()
|
||||
: fOrigin(0.0, 0.0),
|
||||
@@ -377,7 +378,7 @@ LayerData::PrintToStream() const
|
||||
|
||||
// ReadFontFromLink
|
||||
void
|
||||
LayerData::ReadFontFromLink(LinkMsgReader& link)
|
||||
LayerData::ReadFontFromLink(BPrivate::LinkReceiver& link)
|
||||
{
|
||||
uint16 mask;
|
||||
link.Read<uint16>(&mask);
|
||||
@@ -433,7 +434,7 @@ LayerData::ReadFontFromLink(LinkMsgReader& link)
|
||||
|
||||
// ReadFromLink
|
||||
void
|
||||
LayerData::ReadFromLink(LinkMsgReader& link)
|
||||
LayerData::ReadFromLink(BPrivate::LinkReceiver& link)
|
||||
{
|
||||
rgb_color highColor;
|
||||
rgb_color lowColor;
|
||||
@@ -478,7 +479,7 @@ LayerData::ReadFromLink(LinkMsgReader& link)
|
||||
|
||||
// WriteToLink
|
||||
void
|
||||
LayerData::WriteToLink(LinkMsgSender& link) const
|
||||
LayerData::WriteToLink(BPrivate::LinkSender& link) const
|
||||
{
|
||||
rgb_color hc = fHighColor.GetColor32();
|
||||
rgb_color lc = fLowColor.GetColor32();
|
||||
|
||||
@@ -2,20 +2,16 @@
|
||||
#include <malloc.h>
|
||||
|
||||
RAMLinkMsgReader::RAMLinkMsgReader(int8 *buffer)
|
||||
: LinkMsgReader(B_ERROR)
|
||||
: BPrivate::LinkReceiver(-1)
|
||||
{
|
||||
SetBuffer(buffer);
|
||||
}
|
||||
|
||||
|
||||
RAMLinkMsgReader::RAMLinkMsgReader(void)
|
||||
: LinkMsgReader(B_ERROR)
|
||||
: BPrivate::LinkReceiver(-1)
|
||||
{
|
||||
fBuffer=NULL;
|
||||
fAttachStart=NULL;
|
||||
fPosition=NULL;
|
||||
fAttachSize=0;
|
||||
fCode=B_ERROR;
|
||||
SetBuffer(NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,23 +24,22 @@ RAMLinkMsgReader::~RAMLinkMsgReader(void)
|
||||
void
|
||||
RAMLinkMsgReader::SetBuffer(int8 *buffer)
|
||||
{
|
||||
if(!buffer)
|
||||
{
|
||||
fBuffer=NULL;
|
||||
fAttachStart=NULL;
|
||||
fPosition=NULL;
|
||||
fAttachSize=0;
|
||||
fCode=B_ERROR;
|
||||
if (!buffer) {
|
||||
fBuffer = NULL;
|
||||
fAttachStart = NULL;
|
||||
fPosition = NULL;
|
||||
fAttachSize = 0;
|
||||
fCode = B_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
fBuffer=buffer;
|
||||
fPosition=fBuffer+4;
|
||||
|
||||
fCode=*((int32*)fBuffer);
|
||||
fAttachSize=*( (size_t*) fPosition);
|
||||
fPosition+=sizeof(size_t);
|
||||
fAttachStart=fPosition;
|
||||
|
||||
fBuffer = buffer;
|
||||
fPosition = fBuffer + 4;
|
||||
|
||||
fCode = *((int32*)fBuffer);
|
||||
fAttachSize = *((size_t *)fPosition);
|
||||
fPosition += sizeof(size_t);
|
||||
fAttachStart = fPosition;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
size_t buffer size
|
||||
[data buffer]
|
||||
*/
|
||||
class RAMLinkMsgReader : public LinkMsgReader {
|
||||
class RAMLinkMsgReader : public BPrivate::LinkReceiver {
|
||||
public:
|
||||
RAMLinkMsgReader(int8 *buffer);
|
||||
RAMLinkMsgReader(void);
|
||||
|
||||
@@ -178,7 +178,7 @@ RootLayer::~RootLayer()
|
||||
{
|
||||
fQuiting = true;
|
||||
|
||||
BPortLink msg(fListenPort, -1);
|
||||
BPrivate::PortLink msg(fListenPort, -1);
|
||||
msg.StartMessage(B_QUIT_REQUESTED);
|
||||
msg.EndMessage();
|
||||
msg.Flush();
|
||||
@@ -222,7 +222,7 @@ RootLayer::WorkingThread(void *data)
|
||||
int32 code = 0;
|
||||
status_t err = B_OK;
|
||||
RootLayer *oneRootLayer = (RootLayer*)data;
|
||||
BPortLink messageQueue(-1, oneRootLayer->fListenPort);
|
||||
BPrivate::PortLink messageQueue(-1, oneRootLayer->fListenPort);
|
||||
|
||||
// first make sure we are actualy visible
|
||||
oneRootLayer->Lock();
|
||||
@@ -372,7 +372,7 @@ RootLayer::WorkingThread(void *data)
|
||||
void
|
||||
RootLayer::GoInvalidate(const Layer *layer, const BRegion ®ion)
|
||||
{
|
||||
BPortLink msg(fListenPort, -1);
|
||||
BPrivate::PortLink msg(fListenPort, -1);
|
||||
msg.StartMessage(AS_ROOTLAYER_DO_INVALIDATE);
|
||||
msg.Attach<const Layer*>(layer);
|
||||
msg.AttachRegion(region);
|
||||
@@ -390,48 +390,62 @@ void RootLayer::invalidate_layer(Layer *layer, const BRegion ®ion)
|
||||
layer->FullInvalidate(region);
|
||||
}
|
||||
|
||||
status_t RootLayer::EnqueueMessage(BPortLink &message)
|
||||
|
||||
status_t
|
||||
RootLayer::EnqueueMessage(BPrivate::PortLink &message)
|
||||
{
|
||||
message.SetSendPort(fListenPort);
|
||||
message.SetSenderPort(fListenPort);
|
||||
message.Flush();
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
void RootLayer::GoRedraw(const Layer *layer, const BRegion ®ion)
|
||||
|
||||
void
|
||||
RootLayer::GoRedraw(const Layer *layer, const BRegion ®ion)
|
||||
{
|
||||
BPortLink msg(fListenPort, -1);
|
||||
BPrivate::PortLink msg(fListenPort, -1);
|
||||
msg.StartMessage(AS_ROOTLAYER_DO_REDRAW);
|
||||
msg.Attach<const Layer*>(layer);
|
||||
msg.AttachRegion(region);
|
||||
msg.Flush();
|
||||
}
|
||||
|
||||
void RootLayer::redraw_layer(Layer *layer, const BRegion ®ion)
|
||||
|
||||
void
|
||||
RootLayer::redraw_layer(Layer *layer, const BRegion ®ion)
|
||||
{
|
||||
// NOTE: our thread (WorkingThread) is locked here.
|
||||
|
||||
layer->Invalidate(region);
|
||||
}
|
||||
|
||||
void RootLayer::GoChangeWinBorderFeel(const WinBorder *winBorder, int32 newFeel)
|
||||
|
||||
void
|
||||
RootLayer::GoChangeWinBorderFeel(const WinBorder *winBorder, int32 newFeel)
|
||||
{
|
||||
BPortLink msg(fListenPort, -1);
|
||||
BPrivate::PortLink msg(fListenPort, -1);
|
||||
msg.StartMessage(AS_ROOTLAYER_DO_CHANGE_WINBORDER_FEEL);
|
||||
msg.Attach<const WinBorder*>(winBorder);
|
||||
msg.Attach<int32>(newFeel);
|
||||
msg.Flush();
|
||||
}
|
||||
|
||||
void RootLayer::MoveBy(float x, float y)
|
||||
|
||||
void
|
||||
RootLayer::MoveBy(float x, float y)
|
||||
{
|
||||
}
|
||||
|
||||
void RootLayer::ResizeBy(float x, float y)
|
||||
|
||||
void
|
||||
RootLayer::ResizeBy(float x, float y)
|
||||
{
|
||||
// TODO: implement
|
||||
}
|
||||
|
||||
Layer* RootLayer::VirtualTopChild() const
|
||||
|
||||
Layer *
|
||||
RootLayer::VirtualTopChild() const
|
||||
{
|
||||
fWinBorderIndex = fWinBorderCount-1;
|
||||
|
||||
@@ -914,23 +928,29 @@ void RootLayer::SaveWorkspaceData(const char *path)
|
||||
}
|
||||
|
||||
|
||||
void RootLayer::HideWinBorder(WinBorder* winBorder)
|
||||
void
|
||||
RootLayer::HideWinBorder(WinBorder* winBorder)
|
||||
{
|
||||
BPortLink msg(fListenPort, -1);
|
||||
BPrivate::PortLink msg(fListenPort, -1);
|
||||
msg.StartMessage(AS_ROOTLAYER_HIDE_WINBORDER);
|
||||
msg.Attach<WinBorder*>(winBorder);
|
||||
msg.Flush();
|
||||
}
|
||||
|
||||
void RootLayer::ShowWinBorder(WinBorder* winBorder)
|
||||
|
||||
void
|
||||
RootLayer::ShowWinBorder(WinBorder* winBorder)
|
||||
{
|
||||
BPortLink msg(fListenPort, -1);
|
||||
BPrivate::PortLink msg(fListenPort, -1);
|
||||
msg.StartMessage(AS_ROOTLAYER_SHOW_WINBORDER);
|
||||
msg.Attach<WinBorder*>(winBorder);
|
||||
msg.Flush();
|
||||
}
|
||||
|
||||
WinBorder* RootLayer::WinBorderAt(const BPoint& pt) const{
|
||||
|
||||
WinBorder *
|
||||
RootLayer::WinBorderAt(const BPoint& pt) const
|
||||
{
|
||||
for (int32 i = 0; i < fWinBorderCount; i++)
|
||||
{
|
||||
if (fWinBorderList[i]->fFullVisible.Contains(pt))
|
||||
@@ -1004,7 +1024,7 @@ RootLayer::SetScreenMode(int32 width, int32 height, uint32 colorSpace, float fre
|
||||
// Input related methods
|
||||
//---------------------------------------------------------------------------
|
||||
inline void
|
||||
RootLayer::MouseEventHandler(int32 code, BPortLink& msg)
|
||||
RootLayer::MouseEventHandler(int32 code, BPrivate::PortLink& msg)
|
||||
{
|
||||
switch(code) {
|
||||
case B_MOUSE_DOWN: {
|
||||
@@ -1376,7 +1396,7 @@ fprintf(stderr, "mouse position changed in B_MOUSE_UP (%.1f, %.1f) from last B_M
|
||||
}
|
||||
|
||||
inline
|
||||
void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg)
|
||||
void RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
|
||||
{
|
||||
|
||||
switch(code)
|
||||
|
||||
@@ -43,7 +43,10 @@ class Screen;
|
||||
class WinBorder;
|
||||
class Desktop;
|
||||
class DisplayDriver;
|
||||
class BPortLink;
|
||||
|
||||
namespace BPrivate {
|
||||
class PortLink;
|
||||
};
|
||||
|
||||
#ifndef DISPLAY_HAIKU_LOGO
|
||||
#define DISPLAY_HAIKU_LOGO 1
|
||||
@@ -127,7 +130,7 @@ public:
|
||||
void Unlock() { fAllRegionsLock.Unlock(); }
|
||||
bool IsLocked() { return fAllRegionsLock.IsLocked(); }
|
||||
void RunThread();
|
||||
status_t EnqueueMessage(BPortLink &message);
|
||||
status_t EnqueueMessage(BPrivate::PortLink &message);
|
||||
void GoInvalidate(const Layer *layer, const BRegion ®ion);
|
||||
void GoRedraw(const Layer *layer, const BRegion ®ion);
|
||||
void GoChangeWinBorderFeel(const WinBorder *winBorder, int32 newFeel);
|
||||
@@ -168,8 +171,8 @@ friend class Desktop;
|
||||
void show_final_scene(WinBorder *exFocus, WinBorder *exActive);
|
||||
|
||||
// Input related methods
|
||||
void MouseEventHandler(int32 code, BPortLink& link);
|
||||
void KeyboardEventHandler(int32 code, BPortLink& link);
|
||||
void MouseEventHandler(int32 code, BPrivate::PortLink& link);
|
||||
void KeyboardEventHandler(int32 code, BPrivate::PortLink& link);
|
||||
|
||||
Desktop* fDesktop;
|
||||
BMessage* fDragMessage;
|
||||
|
||||
@@ -190,8 +190,8 @@ bool
|
||||
ServerApp::PingTarget(void)
|
||||
{
|
||||
team_info tinfo;
|
||||
if (get_team_info(fClientTeamID,&tinfo) == B_BAD_TEAM_ID) {
|
||||
LinkMsgSender link(gAppServerPort);
|
||||
if (get_team_info(fClientTeamID, &tinfo) == B_BAD_TEAM_ID) {
|
||||
BPrivate::LinkSender link(gAppServerPort);
|
||||
link.StartMessage(AS_DELETE_APP);
|
||||
link.Attach(&fMonitorThreadID, sizeof(thread_id));
|
||||
link.Flush();
|
||||
@@ -207,7 +207,7 @@ ServerApp::PingTarget(void)
|
||||
void
|
||||
ServerApp::PostMessage(int32 code)
|
||||
{
|
||||
LinkMsgSender link(fMessagePort);
|
||||
BPrivate::LinkSender link(fMessagePort);
|
||||
link.StartMessage(code);
|
||||
link.Flush();
|
||||
}
|
||||
@@ -268,7 +268,7 @@ ServerApp::MonitorApp(void *data)
|
||||
// Message-dispatching loop for the ServerApp
|
||||
|
||||
ServerApp *app = (ServerApp *)data;
|
||||
LinkMsgReader &reader = app->fLink.Reader();
|
||||
BPrivate::LinkReceiver &reader = app->fLink.Receiver();
|
||||
|
||||
int32 code;
|
||||
status_t err = B_OK;
|
||||
@@ -280,7 +280,7 @@ ServerApp::MonitorApp(void *data)
|
||||
STRACE(("ServerApp::MonitorApp(): GetNextMessage returned %s\n", strerror(err)));
|
||||
|
||||
// ToDo: this should kill the app, but it doesn't work
|
||||
LinkMsgSender link(gAppServerPort);
|
||||
BPrivate::LinkSender link(gAppServerPort);
|
||||
link.StartMessage(AS_DELETE_APP);
|
||||
link.Attach(&app->fMonitorThreadID, sizeof(thread_id));
|
||||
link.Flush();
|
||||
@@ -362,7 +362,7 @@ ServerApp::MonitorApp(void *data)
|
||||
STRACE(("ServerApp %s: B_QUIT_REQUESTED\n",app->fSignature.String()));
|
||||
// Our BApplication sent us this message when it quit.
|
||||
// We need to ask the app_server to delete ourself.
|
||||
LinkMsgSender sender(gAppServerPort);
|
||||
BPrivate::LinkSender sender(gAppServerPort);
|
||||
sender.StartMessage(AS_DELETE_APP);
|
||||
sender.Attach(&app->fMonitorThreadID, sizeof(thread_id));
|
||||
sender.Flush();
|
||||
@@ -390,7 +390,7 @@ ServerApp::MonitorApp(void *data)
|
||||
matter of casting and incrementing an index variable to access them.
|
||||
*/
|
||||
void
|
||||
ServerApp::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
ServerApp::DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
{
|
||||
LayerData ld;
|
||||
|
||||
@@ -963,7 +963,6 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
// 1) font_family - name of family
|
||||
// 2) uint32 - flags of font family (B_IS_FIXED || B_HAS_TUNED_FONT)
|
||||
int32 id;
|
||||
debugger("");
|
||||
link.Read<int32>(&id);
|
||||
|
||||
fontserver->Lock();
|
||||
|
||||
@@ -36,13 +36,16 @@
|
||||
|
||||
class AreaPool;
|
||||
class BMessage;
|
||||
class BPortLink;
|
||||
class BList;
|
||||
class DisplayDriver;
|
||||
class ServerPicture;
|
||||
class ServerCursor;
|
||||
class ServerBitmap;
|
||||
|
||||
namespace BPrivate {
|
||||
class PortLink;
|
||||
};
|
||||
|
||||
/*!
|
||||
\class ServerApp ServerApp.h
|
||||
\brief Counterpart to BApplication within the app_server
|
||||
@@ -90,7 +93,7 @@ public:
|
||||
FMWList fAppFMWList;
|
||||
|
||||
private:
|
||||
void DispatchMessage(int32 code, LinkMsgReader &link);
|
||||
void DispatchMessage(int32 code, BPrivate::LinkReceiver &link);
|
||||
|
||||
static int32 MonitorApp(void *data);
|
||||
|
||||
@@ -109,7 +112,7 @@ private:
|
||||
thread_id fMonitorThreadID;
|
||||
team_id fClientTeamID;
|
||||
|
||||
BPortLink fLink;
|
||||
BPrivate::PortLink fLink;
|
||||
|
||||
// TODO:
|
||||
// - Are really Bitmaps and Pictures stored per application and not globally ?
|
||||
@@ -136,4 +139,4 @@ private:
|
||||
bool fQuitting;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // _SERVERAPP_H_
|
||||
|
||||
@@ -107,8 +107,8 @@ ServerWindow::ServerWindow(const char *string, ServerApp *winapp,
|
||||
// fMessagePort is the port to which the app sends messages for the server
|
||||
fMessagePort = create_port(30, fName);
|
||||
|
||||
fMsgSender = new LinkMsgSender(fClientWinPort);
|
||||
fMsgReader = new LinkMsgReader(fMessagePort);
|
||||
fMsgSender = new BPrivate::LinkSender(fClientWinPort);
|
||||
fMsgReceiver = new BPrivate::LinkReceiver(fMessagePort);
|
||||
|
||||
// Send a reply to our window - it is expecting fMessagePort port.
|
||||
fMsgSender->StartMessage(SERVER_TRUE);
|
||||
@@ -143,7 +143,7 @@ ServerWindow::~ServerWindow(void)
|
||||
|
||||
delete fWinBorder;
|
||||
delete fMsgSender;
|
||||
delete fMsgReader;
|
||||
delete fMsgReceiver;
|
||||
|
||||
STRACE(("#ServerWindow(%s) will exit NOW\n", fName));
|
||||
}
|
||||
@@ -290,7 +290,7 @@ ServerWindow::IsLocked() const
|
||||
\param layer The layer to set the font
|
||||
*/
|
||||
inline void
|
||||
ServerWindow::SetLayerFontState(Layer *layer, LinkMsgReader &link)
|
||||
ServerWindow::SetLayerFontState(Layer *layer, BPrivate::LinkReceiver &link)
|
||||
{
|
||||
STRACE(("ServerWindow %s: SetLayerFontStateMessage for layer %s\n",
|
||||
fName, layer->fName->String()));
|
||||
@@ -301,7 +301,7 @@ ServerWindow::SetLayerFontState(Layer *layer, LinkMsgReader &link)
|
||||
|
||||
|
||||
inline void
|
||||
ServerWindow::SetLayerState(Layer *layer, LinkMsgReader &link)
|
||||
ServerWindow::SetLayerState(Layer *layer, BPrivate::LinkReceiver &link)
|
||||
{
|
||||
STRACE(("ServerWindow %s: SetLayerState for layer %s\n",fName,
|
||||
layer->fName->String()));
|
||||
@@ -313,7 +313,7 @@ ServerWindow::SetLayerState(Layer *layer, LinkMsgReader &link)
|
||||
|
||||
|
||||
inline Layer*
|
||||
ServerWindow::CreateLayerTree(Layer *localRoot, LinkMsgReader &link)
|
||||
ServerWindow::CreateLayerTree(Layer *localRoot, BPrivate::LinkReceiver &link)
|
||||
{
|
||||
// NOTE: no need to check for a lock. This is a private method.
|
||||
|
||||
@@ -362,7 +362,7 @@ ServerWindow::CreateLayerTree(Layer *localRoot, LinkMsgReader &link)
|
||||
|
||||
|
||||
void
|
||||
ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
ServerWindow::DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
{
|
||||
if (fCurrentLayer == NULL && code != AS_LAYER_CREATE_ROOT) {
|
||||
printf("ServerWindow %s received unexpected code - message offset %ld before top_view attached.\n",fName, code - SERVER_TRUE);
|
||||
@@ -1087,21 +1087,19 @@ ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
|
||||
link.Read<int32>(&mainToken);
|
||||
link.Read(&teamID, sizeof(team_id));
|
||||
|
||||
|
||||
wb = gDesktop->FindWinBorderByServerWindowTokenAndTeamID(mainToken, teamID);
|
||||
if(wb)
|
||||
{
|
||||
if (wb) {
|
||||
fMsgSender->StartMessage(SERVER_TRUE);
|
||||
fMsgSender->Flush();
|
||||
|
||||
BPortLink msg(-1, -1);
|
||||
// ToDo: this is a pretty expensive and complicated way to send a message...
|
||||
BPrivate::PortLink msg(-1, -1);
|
||||
msg.StartMessage(AS_ROOTLAYER_ADD_TO_SUBSET);
|
||||
msg.Attach<WinBorder*>(fWinBorder);
|
||||
msg.Attach<WinBorder*>(wb);
|
||||
fWinBorder->GetRootLayer()->EnqueueMessage(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
fMsgSender->StartMessage(SERVER_FALSE);
|
||||
fMsgSender->Flush();
|
||||
}
|
||||
@@ -1118,19 +1116,16 @@ ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
link.Read(&teamID, sizeof(team_id));
|
||||
|
||||
wb = gDesktop->FindWinBorderByServerWindowTokenAndTeamID(mainToken, teamID);
|
||||
if(wb)
|
||||
{
|
||||
if (wb) {
|
||||
fMsgSender->StartMessage(SERVER_TRUE);
|
||||
fMsgSender->Flush();
|
||||
|
||||
BPortLink msg(-1, -1);
|
||||
|
||||
BPrivate::PortLink msg(-1, -1);
|
||||
msg.StartMessage(AS_ROOTLAYER_REMOVE_FROM_SUBSET);
|
||||
msg.Attach<WinBorder*>(fWinBorder);
|
||||
msg.Attach<WinBorder*>(wb);
|
||||
fWinBorder->GetRootLayer()->EnqueueMessage(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
fMsgSender->StartMessage(SERVER_FALSE);
|
||||
fMsgSender->Flush();
|
||||
}
|
||||
@@ -1151,7 +1146,7 @@ ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
case AS_SET_FEEL:
|
||||
{
|
||||
STRACE(("ServerWindow %s: Message AS_SET_FEEL\n",fName));
|
||||
int32 newFeel;
|
||||
int32 newFeel;
|
||||
link.Read<int32>(&newFeel);
|
||||
myRootLayer->GoChangeWinBorderFeel(fWinBorder, newFeel);
|
||||
break;
|
||||
@@ -1180,10 +1175,10 @@ ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
{
|
||||
// TODO: Implement AS_SET_WORKSPACES
|
||||
STRACE(("ServerWindow %s: Message Set_Workspaces unimplemented\n",fName));
|
||||
uint32 newWorkspaces;
|
||||
uint32 newWorkspaces;
|
||||
link.Read<uint32>(&newWorkspaces);
|
||||
|
||||
BPortLink msg(-1, -1);
|
||||
BPrivate::PortLink msg(-1, -1);
|
||||
msg.StartMessage(AS_ROOTLAYER_WINBORDER_SET_WORKSPACES);
|
||||
msg.Attach<WinBorder*>(fWinBorder);
|
||||
msg.Attach<uint32>(fWinBorder->Workspaces());
|
||||
@@ -1421,10 +1416,12 @@ ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------- Graphics messages ----------------------------------
|
||||
|
||||
inline
|
||||
void
|
||||
ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
|
||||
ServerWindow::DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
{
|
||||
fWinBorder->GetRootLayer()->Lock();
|
||||
BRegion rreg(fCurrentLayer->fVisible);
|
||||
@@ -1951,7 +1948,7 @@ int32
|
||||
ServerWindow::MonitorWin(void *data)
|
||||
{
|
||||
ServerWindow *win = (ServerWindow *)data;
|
||||
LinkMsgReader *ses = win->fMsgReader;
|
||||
BPrivate::LinkReceiver *ses = win->fMsgReceiver;
|
||||
|
||||
bool quitting = false;
|
||||
int32 code;
|
||||
|
||||
@@ -119,14 +119,14 @@ public:
|
||||
private:
|
||||
|
||||
// methods for retrieving and creating a tree strcture of Layers.
|
||||
Layer* CreateLayerTree(Layer *localRoot, LinkMsgReader &link);
|
||||
void SetLayerState(Layer *layer, LinkMsgReader &link);
|
||||
void SetLayerFontState(Layer *layer, LinkMsgReader &link);
|
||||
Layer* CreateLayerTree(Layer *localRoot, BPrivate::LinkReceiver &link);
|
||||
void SetLayerState(Layer *layer, BPrivate::LinkReceiver &link);
|
||||
void SetLayerFontState(Layer *layer, BPrivate::LinkReceiver &link);
|
||||
void ClientDied(bool crashed);
|
||||
|
||||
// message handle methods.
|
||||
void DispatchMessage(int32 code, LinkMsgReader &link);
|
||||
void DispatchGraphicsMessage(int32 code, LinkMsgReader &link);
|
||||
void DispatchMessage(int32 code, BPrivate::LinkReceiver &link);
|
||||
void DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link);
|
||||
static int32 MonitorWin(void *data);
|
||||
|
||||
// used by CopyBits and Scrolling
|
||||
@@ -153,9 +153,9 @@ private:
|
||||
port_id fMessagePort;
|
||||
port_id fClientWinPort;
|
||||
port_id fClientLooperPort;
|
||||
|
||||
LinkMsgReader* fMsgReader;
|
||||
LinkMsgSender* fMsgSender;
|
||||
|
||||
BPrivate::LinkReceiver* fMsgReceiver;
|
||||
BPrivate::LinkSender* fMsgSender;
|
||||
|
||||
BMessage fClientViewsWithInvalidCoords;
|
||||
|
||||
@@ -166,4 +166,4 @@ private:
|
||||
Layer* fCurrentLayer;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // _SERVERWIN_H_
|
||||
|
||||
@@ -45,7 +45,7 @@ set_syscursor(cursor_which which, const BCursor *cursor)
|
||||
if (server < B_OK)
|
||||
return;
|
||||
|
||||
BPortLink link(server);
|
||||
BPrivate::PortLink link(server);
|
||||
link.StartMessage(AS_SET_SYSCURSOR_BCURSOR);
|
||||
link.Attach<cursor_which>(which);
|
||||
|
||||
@@ -72,7 +72,7 @@ set_syscursor(cursor_which which, const BBitmap *bitmap)
|
||||
if (server < B_OK)
|
||||
return;
|
||||
|
||||
BPortLink link(server);
|
||||
BPrivate::PortLink link(server);
|
||||
link.StartMessage(AS_SET_SYSCURSOR_BBITMAP);
|
||||
link.Attach<cursor_which>(which);
|
||||
|
||||
@@ -94,12 +94,11 @@ get_syscursor(void)
|
||||
port_id server = find_port(SERVER_PORT_NAME);
|
||||
if (server >= B_OK) {
|
||||
int32 code = SERVER_FALSE;
|
||||
BPrivate::BAppServerLink link;
|
||||
BPrivate::PortLink link(server);
|
||||
cursor_which which;
|
||||
|
||||
link.SetSendPort(server);
|
||||
link.StartMessage(AS_GET_SYSCURSOR);
|
||||
link.FlushWithReply(&code);
|
||||
link.FlushWithReply(code);
|
||||
|
||||
if (code == SERVER_TRUE
|
||||
&& link.Read<cursor_which>(&which) == B_OK)
|
||||
@@ -119,7 +118,7 @@ setcursor(cursor_which which)
|
||||
if (server < B_OK)
|
||||
return;
|
||||
|
||||
BPortLink link(server);
|
||||
BPrivate::PortLink link(server);
|
||||
link.StartMessage(AS_SET_CURSOR_SYSTEM);
|
||||
link.Flush();
|
||||
}
|
||||
|
||||
@@ -109,14 +109,14 @@ class CardView : public BView {
|
||||
// CardView
|
||||
void SetBitmap(const BBitmap* bimtap);
|
||||
|
||||
inline BPortLink* ServerLink() const
|
||||
inline BPrivate::PortLink* ServerLink() const
|
||||
{ return fServerLink; }
|
||||
|
||||
void ForwardMessage();
|
||||
void ForwardMessage();
|
||||
|
||||
private:
|
||||
port_id fInputPort;
|
||||
BPortLink* fServerLink;
|
||||
BPrivate::PortLink* fServerLink;
|
||||
const BBitmap* fBitmap;
|
||||
};
|
||||
|
||||
@@ -153,7 +153,7 @@ CardView::CardView(BRect bounds)
|
||||
// This link for sending mouse messages to the Haiku app_server.
|
||||
// This is only to take the place of the input_server.
|
||||
port_id input_port = find_port(SERVER_INPUT_PORT);
|
||||
fServerLink = new BPortLink(input_port);
|
||||
fServerLink = new BPrivate::PortLink(input_port);
|
||||
#else
|
||||
fInputPort = create_port(100, "ViewInputDevice");
|
||||
#endif
|
||||
@@ -329,7 +329,7 @@ CardWindow::QuitRequested()
|
||||
port_id serverport = find_port(SERVER_PORT_NAME);
|
||||
|
||||
if (serverport >= 0) {
|
||||
BPortLink link(serverport);
|
||||
BPrivate::PortLink link(serverport);
|
||||
link.StartMessage(B_QUIT_REQUESTED);
|
||||
link.Flush();
|
||||
} else
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
// send_mouse_down
|
||||
void
|
||||
send_mouse_down(BPortLink* serverLink, BPoint pt,
|
||||
send_mouse_down(BPrivate::PortLink* serverLink, BPoint pt,
|
||||
BMessage* currentMessage)
|
||||
{
|
||||
// Attach data:
|
||||
@@ -53,7 +53,7 @@ send_mouse_down(BPortLink* serverLink, BPoint pt,
|
||||
|
||||
// send_mouse_moved
|
||||
void
|
||||
send_mouse_moved(BPortLink* serverLink, BPoint pt,
|
||||
send_mouse_moved(BPrivate::PortLink* serverLink, BPoint pt,
|
||||
BMessage* currentMessage)
|
||||
{
|
||||
// Attach data:
|
||||
@@ -76,7 +76,7 @@ send_mouse_moved(BPortLink* serverLink, BPoint pt,
|
||||
|
||||
// send_mouse_up
|
||||
void
|
||||
send_mouse_up(BPortLink* serverLink, BPoint pt,
|
||||
send_mouse_up(BPrivate::PortLink* serverLink, BPoint pt,
|
||||
BMessage* currentMessage)
|
||||
{
|
||||
// Attach data:
|
||||
@@ -99,7 +99,7 @@ send_mouse_up(BPortLink* serverLink, BPoint pt,
|
||||
|
||||
// handle_message
|
||||
bool
|
||||
handle_message(BPortLink* serverLink, BMessage* msg)
|
||||
handle_message(BPrivate::PortLink* serverLink, BMessage* msg)
|
||||
{
|
||||
bool handled = true;
|
||||
switch (msg->what)
|
||||
|
||||
@@ -13,22 +13,24 @@
|
||||
|
||||
#include <Point.h>
|
||||
|
||||
class BPortLink;
|
||||
namespace BPrivate {
|
||||
class PortLink;
|
||||
};
|
||||
class BMessage;
|
||||
|
||||
void
|
||||
send_mouse_down(BPortLink* serverLink, BPoint pt,
|
||||
send_mouse_down(BPrivate::PortLink* serverLink, BPoint pt,
|
||||
BMessage* currentMessage);
|
||||
|
||||
void
|
||||
send_mouse_moved(BPortLink* serverLink, BPoint pt,
|
||||
send_mouse_moved(BPrivate::PortLink* serverLink, BPoint pt,
|
||||
BMessage* currentMessage);
|
||||
|
||||
void
|
||||
send_mouse_up(BPortLink* serverLink, BPoint pt,
|
||||
send_mouse_up(BPrivate::PortLink* serverLink, BPoint pt,
|
||||
BMessage* currentMessage);
|
||||
|
||||
bool
|
||||
handle_message(BPortLink* serverLink, BMessage* msg);
|
||||
handle_message(BPrivate::PortLink* serverLink, BMessage* msg);
|
||||
|
||||
#endif // FAKE_INPUT_SERVER_H
|
||||
|
||||
@@ -184,7 +184,7 @@ InputServer::InputServer(void) : BApplication(INPUTSERVER_SIGNATURE),
|
||||
port_id input_port = find_port(SERVER_INPUT_PORT);
|
||||
if (input_port == B_NAME_NOT_FOUND)
|
||||
PRINTERR(("input_server couldn't find app_server's input port\n"));
|
||||
fAppServerLink = new BPortLink(input_port);
|
||||
fAppServerLink = new BPrivate::PortLink(input_port);
|
||||
#endif
|
||||
|
||||
InitKeyboardMouseStates();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// This is the primary application class for the Haiku input_server.
|
||||
//
|
||||
//
|
||||
// Copyright (c) 2001-2004 Haiku Project
|
||||
// Copyright (c) 2001-2005 Haiku Project
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
@@ -54,8 +54,8 @@
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#define APPSERVER_PORTLINK_COMM
|
||||
//#define R5_CURSOR_COMM // define this when R5 cursor communication should be used
|
||||
// #define APPSERVER_R5_COMM // define this when R5 app_server communication should be used
|
||||
#define R5_CURSOR_COMM // define this when R5 cursor communication should be used
|
||||
//#define APPSERVER_R5_COMM // define this when R5 app_server communication should be used
|
||||
|
||||
#define INPUTSERVER_SIGNATURE "application/x-vnd.Be-input_server" // use this when target should replace R5 input_server
|
||||
|
||||
@@ -65,7 +65,9 @@
|
||||
#endif
|
||||
|
||||
#ifdef APPSERVER_PORTLINK_COMM
|
||||
class BPortLink;
|
||||
namespace BPrivate {
|
||||
class PortLink;
|
||||
};
|
||||
#endif
|
||||
|
||||
class InputDeviceListItem
|
||||
@@ -241,7 +243,7 @@ private:
|
||||
|
||||
#ifdef APPSERVER_PORTLINK_COMM
|
||||
// added this to communicate via portlink
|
||||
BPortLink *fAppServerLink;
|
||||
BPrivate::PortLink *fAppServerLink;
|
||||
#endif
|
||||
#ifdef R5_CURSOR_COMM
|
||||
sem_id fCursorSem;
|
||||
|
||||
@@ -47,7 +47,7 @@ if $(TARGET_PLATFORM) != haiku {
|
||||
SubDirC++Flags -DAPPSERVER_R5_COMM ;
|
||||
}
|
||||
} else {
|
||||
APPSERVER_TEST_MODE = 1 ;
|
||||
APPSERVER_TEST_MODE = 0 ;
|
||||
}
|
||||
|
||||
Server input_server :
|
||||
|
||||
@@ -137,7 +137,7 @@ AppServer::Run(void)
|
||||
void
|
||||
AppServer::MainLoop(void)
|
||||
{
|
||||
BPortLink pmsg(-1,fMessagePort);
|
||||
BPrivate::PortLink pmsg(-1,fMessagePort);
|
||||
int32 code=0;
|
||||
status_t err=B_OK;
|
||||
|
||||
@@ -178,7 +178,7 @@ AppServer::MainLoop(void)
|
||||
|
||||
|
||||
void
|
||||
AppServer::DispatchMessage(int32 code, BPortLink &msg)
|
||||
AppServer::DispatchMessage(int32 code, BPrivate::PortLink &msg)
|
||||
{
|
||||
switch(code)
|
||||
{
|
||||
@@ -226,12 +226,12 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
|
||||
|
||||
release_sem(fAppListLock);
|
||||
|
||||
BPortLink replylink(app_port);
|
||||
BPrivate::PortLink replylink(app_port);
|
||||
replylink.StartMessage(SERVER_TRUE);
|
||||
replylink.Attach<int32>(newapp->fMessagePort);
|
||||
replylink.Flush();
|
||||
|
||||
// This is necessary because BPortLink::ReadString allocates memory
|
||||
// This is necessary because BPrivate::PortLink::ReadString allocates memory
|
||||
if(app_signature)
|
||||
free(app_signature);
|
||||
|
||||
@@ -281,12 +281,12 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
|
||||
#endif
|
||||
case AS_QUERY_FONTS_CHANGED:
|
||||
{
|
||||
// Seeing how the client merely wants an answer, we'll skip the BPortLink
|
||||
// Seeing how the client merely wants an answer, we'll skip the BPrivate::PortLink
|
||||
// and all its overhead and just write the code to port.
|
||||
port_id replyport;
|
||||
if (msg.Read<port_id>(&replyport) < B_OK)
|
||||
break;
|
||||
BPortLink replylink(replyport);
|
||||
BPrivate::PortLink replylink(replyport);
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
break;
|
||||
@@ -300,7 +300,7 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
|
||||
if(msg.Read<port_id>(&replyport)<B_OK)
|
||||
return;
|
||||
|
||||
BPortLink replylink(replyport);
|
||||
BPrivate::PortLink replylink(replyport);
|
||||
replylink.StartMessage(AS_GET_DECORATOR);
|
||||
replylink.AttachString("none");
|
||||
replylink.Flush();
|
||||
|
||||
@@ -14,12 +14,14 @@ class Layer;
|
||||
class BMessage;
|
||||
class ServerApp;
|
||||
class DisplayDriver;
|
||||
class BPortLink;
|
||||
class CursorManager;
|
||||
class BitmapManager;
|
||||
|
||||
class AppServer
|
||||
{
|
||||
namespace BPrivate {
|
||||
class PortLink;
|
||||
};
|
||||
|
||||
class AppServer {
|
||||
public:
|
||||
AppServer(void);
|
||||
~AppServer(void);
|
||||
@@ -29,7 +31,7 @@ public:
|
||||
thread_id Run(void);
|
||||
void MainLoop(void);
|
||||
|
||||
void DispatchMessage(int32 code, BPortLink &link);
|
||||
void DispatchMessage(int32 code, BPrivate::PortLink &link);
|
||||
|
||||
private:
|
||||
port_id fMessagePort;
|
||||
|
||||
@@ -107,8 +107,8 @@ ServerApp::ServerApp(port_id sendport, port_id rcvport, port_id clientLooperPort
|
||||
// fMessagePort is the port we receive messages from our BApplication
|
||||
fMessagePort=rcvport;
|
||||
|
||||
fMsgReader = new LinkMsgReader(fMessagePort);
|
||||
fMsgSender = new LinkMsgSender(fClientAppPort);
|
||||
fMsgReader = new BPrivate::LinkReceiver(fMessagePort);
|
||||
fMsgSender = new BPrivate::LinkSender(fClientAppPort);
|
||||
|
||||
fIsActive=false;
|
||||
|
||||
@@ -186,7 +186,7 @@ ServerApp::PingTarget(void)
|
||||
*/
|
||||
void ServerApp::PostMessage(int32 code)
|
||||
{
|
||||
BPortLink link(fMessagePort);
|
||||
BPrivate::PortLink link(fMessagePort);
|
||||
link.StartMessage(code);
|
||||
link.Flush();
|
||||
}
|
||||
@@ -239,7 +239,7 @@ int32 ServerApp::MonitorApp(void *data)
|
||||
// Message-dispatching loop for the ServerApp
|
||||
|
||||
ServerApp *app = (ServerApp *)data;
|
||||
LinkMsgReader msgqueue(app->fMessagePort);
|
||||
BPrivate::LinkReceiver msgqueue(app->fMessagePort);
|
||||
|
||||
bool quitting = false;
|
||||
int32 code;
|
||||
@@ -340,9 +340,9 @@ int32 ServerApp::MonitorApp(void *data)
|
||||
All attachments are placed in the buffer via a PortLink, so it will be a
|
||||
matter of casting and incrementing an index variable to access them.
|
||||
*/
|
||||
void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
void ServerApp::DispatchMessage(int32 code, BPrivate::LinkReceiver &msg)
|
||||
{
|
||||
BPortLink replylink;
|
||||
BPrivate::PortLink replylink;
|
||||
|
||||
switch(code)
|
||||
{
|
||||
@@ -371,7 +371,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
|
||||
void *sharedmem=fSharedMem->GetBuffer(memsize);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
if(memsize<1 || sharedmem==NULL)
|
||||
{
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
@@ -460,7 +460,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
STRACE(("ServerApp %s: Create Bitmap (%.1f,%.1f,%.1f,%.1f)\n",
|
||||
fSignature.String(),r.left,r.top,r.right,r.bottom));
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
/* if(sbmp)
|
||||
{
|
||||
fBitmapList->AddItem(sbmp);
|
||||
@@ -495,7 +495,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
msg.Read<int32>(&bmp_id);
|
||||
msg.Read<int32>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
replylink.StartMessage(SERVER_TRUE);
|
||||
replylink.Flush();
|
||||
break;
|
||||
@@ -549,7 +549,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
int32 replyport;
|
||||
msg.Read<int32>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
replylink.StartMessage(fCursorHidden ? SERVER_TRUE : SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
break;
|
||||
@@ -571,7 +571,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
msg.Read<int32>(&replyport);
|
||||
|
||||
// Synchronous message - BApplication is waiting on the cursor's ID
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
replylink.StartMessage(SERVER_TRUE);
|
||||
replylink.Attach<int32>(-1);
|
||||
replylink.Flush();
|
||||
@@ -597,7 +597,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
port_id replyport;
|
||||
msg.Read<int32>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
replylink.StartMessage(SERVER_TRUE);
|
||||
replylink.Attach<scroll_bar_info>(sbi);
|
||||
replylink.Flush();
|
||||
@@ -621,7 +621,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
port_id replyport;
|
||||
msg.Read<int32>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
replylink.StartMessage(SERVER_TRUE);
|
||||
replylink.Attach<bool>(true);
|
||||
replylink.Flush();
|
||||
@@ -658,7 +658,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
port_id replyport = -1;
|
||||
msg.Read<int32>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
replylink.StartMessage(SERVER_TRUE);
|
||||
replylink.Attach<mode_mouse>(mmode);
|
||||
replylink.Flush();
|
||||
@@ -675,7 +675,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
msg.Read<int32>(&whichcolor);
|
||||
msg.Read<port_id>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
replylink.StartMessage(SERVER_TRUE);
|
||||
replylink.Attach<rgb_color>(color);
|
||||
replylink.Flush();
|
||||
@@ -714,7 +714,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
msg.Read<int32>(&famid);
|
||||
msg.Read<port_id>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
@@ -741,7 +741,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
msg.Read<int32>(&styid);
|
||||
msg.Read<port_id>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
@@ -765,7 +765,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
msg.Read<uint16>(&styid);
|
||||
msg.Read<port_id>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
@@ -793,7 +793,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
msg.Read<int32>(&styid);
|
||||
msg.Read<port_id>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
|
||||
/* fontserver->Lock();
|
||||
FontStyle *fstyle=fontserver->GetStyle(famid,styid);
|
||||
@@ -843,7 +843,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
msg.Read<uint8>(&spacing);
|
||||
msg.Read<port_id>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
break;
|
||||
@@ -878,7 +878,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
msg.Read<int32>(&styid);
|
||||
msg.Read<port_id>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
@@ -914,7 +914,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
msg.Read<int32>(&styid);
|
||||
msg.Read<port_id>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
@@ -936,7 +936,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
msg.Read(fam,sizeof(font_family));
|
||||
msg.Read<port_id>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
@@ -962,7 +962,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
msg.Read(sty,sizeof(font_style));
|
||||
msg.Read<port_id>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
@@ -986,7 +986,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
msg.Read<uint16>(&sty);
|
||||
msg.Read<port_id>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
@@ -1019,7 +1019,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
|
||||
msg.Read<port_id>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
replylink.StartMessage(SERVER_TRUE);
|
||||
replylink.Attach<int32>(0);
|
||||
replylink.Flush();
|
||||
@@ -1040,7 +1040,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
msg.Read(fam,sizeof(font_family));
|
||||
msg.Read<port_id>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
break;
|
||||
@@ -1060,7 +1060,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
|
||||
port_id replyport;
|
||||
msg.Read<port_id>(&replyport);
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
@@ -1083,7 +1083,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
msg.Read<float>(&ptsize);
|
||||
msg.Read<port_id>(&replyport);
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
@@ -1104,7 +1104,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
|
||||
port_id replyport;
|
||||
msg.Read<port_id>(&replyport);
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
@@ -1125,7 +1125,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
|
||||
port_id replyport;
|
||||
msg.Read<port_id>(&replyport);
|
||||
replylink.SetSendPort(replyport);
|
||||
replylink.SetSenderPort(replyport);
|
||||
|
||||
replylink.StartMessage(SERVER_FALSE);
|
||||
replylink.Flush();
|
||||
|
||||
@@ -36,13 +36,16 @@
|
||||
|
||||
class AppServer;
|
||||
class BMessage;
|
||||
class BPortLink;
|
||||
class BList;
|
||||
class DisplayDriver;
|
||||
class ServerCursor;
|
||||
class ServerBitmap;
|
||||
class AreaPool;
|
||||
|
||||
namespace BPrivate {
|
||||
class PortLink;
|
||||
};
|
||||
|
||||
/*!
|
||||
\class ServerApp ServerApp.h
|
||||
\brief Counterpart to BApplication within the app_server
|
||||
@@ -81,7 +84,7 @@ protected:
|
||||
friend class AppServer;
|
||||
friend class ServerWindow;
|
||||
|
||||
void DispatchMessage(int32 code, LinkMsgReader &link);
|
||||
void DispatchMessage(int32 code, BPrivate::LinkReceiver &link);
|
||||
|
||||
port_id fClientAppPort,
|
||||
fMessagePort,
|
||||
@@ -94,9 +97,9 @@ protected:
|
||||
|
||||
team_id fClientTeamID;
|
||||
|
||||
LinkMsgReader *fMsgReader;
|
||||
LinkMsgSender *fMsgSender;
|
||||
|
||||
BPrivate::LinkReceiver *fMsgReader;
|
||||
BPrivate::LinkSender *fMsgSender;
|
||||
|
||||
/* BList *fSWindowList,
|
||||
*fBitmapList,
|
||||
*fPictureList;
|
||||
|
||||
Reference in New Issue
Block a user