app_server memory management: use ObjectDeleter to mark ownership
Make object ownership explicit by use of ObjectDeleter where possible. Change-Id: I499a00aa3390d1510ae284419e73faffa5166430 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2695 Reviewed-by: Adrien Destugues <[email protected]> Reviewed-by: Alex von Gluck IV <[email protected]>
This commit is contained in:
@@ -465,8 +465,6 @@ Desktop::Desktop(uid_t userID, const char* targetScreen)
|
|||||||
|
|
||||||
Desktop::~Desktop()
|
Desktop::~Desktop()
|
||||||
{
|
{
|
||||||
delete fSettings;
|
|
||||||
|
|
||||||
delete_area(fSharedReadOnlyArea);
|
delete_area(fSharedReadOnlyArea);
|
||||||
delete_port(fMessagePort);
|
delete_port(fMessagePort);
|
||||||
gFontManager->DetachUser(fUserID);
|
gFontManager->DetachUser(fUserID);
|
||||||
@@ -504,7 +502,7 @@ Desktop::Init()
|
|||||||
|
|
||||||
gFontManager->AttachUser(fUserID);
|
gFontManager->AttachUser(fUserID);
|
||||||
|
|
||||||
fSettings = new DesktopSettingsPrivate(fServerReadOnlyMemory);
|
fSettings.SetTo(new DesktopSettingsPrivate(fServerReadOnlyMemory));
|
||||||
|
|
||||||
for (int32 i = 0; i < kMaxWorkspaces; i++) {
|
for (int32 i = 0; i < kMaxWorkspaces; i++) {
|
||||||
_Windows(i).SetIndex(i);
|
_Windows(i).SetIndex(i);
|
||||||
@@ -2562,10 +2560,10 @@ Desktop::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
if (link.ReadString(&appSignature) != B_OK)
|
if (link.ReadString(&appSignature) != B_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ServerApp* app = new (std::nothrow) ServerApp(this, clientReplyPort,
|
ObjectDeleter<ServerApp> app(new (std::nothrow) ServerApp(this, clientReplyPort,
|
||||||
clientLooperPort, clientTeamID, htoken, appSignature);
|
clientLooperPort, clientTeamID, htoken, appSignature));
|
||||||
status_t status = B_OK;
|
status_t status = B_OK;
|
||||||
if (app == NULL)
|
if (app.Get() == NULL)
|
||||||
status = B_NO_MEMORY;
|
status = B_NO_MEMORY;
|
||||||
if (status == B_OK)
|
if (status == B_OK)
|
||||||
status = app->InitCheck();
|
status = app->InitCheck();
|
||||||
@@ -2574,11 +2572,9 @@ Desktop::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
// add the new ServerApp to the known list of ServerApps
|
// add the new ServerApp to the known list of ServerApps
|
||||||
fApplicationsLock.Lock();
|
fApplicationsLock.Lock();
|
||||||
fApplications.AddItem(app);
|
fApplications.AddItem(app.Detach());
|
||||||
fApplicationsLock.Unlock();
|
fApplicationsLock.Unlock();
|
||||||
} else {
|
} else {
|
||||||
delete app;
|
|
||||||
|
|
||||||
// if everything went well, ServerApp::Run() will notify
|
// if everything went well, ServerApp::Run() will notify
|
||||||
// the client - but since it didn't, we do it here
|
// the client - but since it didn't, we do it here
|
||||||
BPrivate::LinkSender reply(clientReplyPort);
|
BPrivate::LinkSender reply(clientReplyPort);
|
||||||
@@ -3773,13 +3769,11 @@ Desktop::_SetWorkspace(int32 index, bool moveFocusWindow)
|
|||||||
} else {
|
} else {
|
||||||
// We need to remember the previous visible region of the
|
// We need to remember the previous visible region of the
|
||||||
// window if they changed their order
|
// window if they changed their order
|
||||||
BRegion* region = new (std::nothrow)
|
ObjectDeleter<BRegion> region(new (std::nothrow)
|
||||||
BRegion(window->VisibleRegion());
|
BRegion(window->VisibleRegion()));
|
||||||
if (region != NULL) {
|
if (region.Get() != NULL) {
|
||||||
if (previousRegions.AddItem(region))
|
if (previousRegions.AddItem(region.Detach()))
|
||||||
windows.AddWindow(window);
|
windows.AddWindow(window);
|
||||||
else
|
|
||||||
delete region;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,12 +15,14 @@
|
|||||||
#define DESKTOP_H
|
#define DESKTOP_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
#include <Autolock.h>
|
#include <Autolock.h>
|
||||||
#include <InterfaceDefs.h>
|
#include <InterfaceDefs.h>
|
||||||
#include <List.h>
|
#include <List.h>
|
||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
#include <ObjectList.h>
|
#include <ObjectList.h>
|
||||||
#include <Region.h>
|
#include <Region.h>
|
||||||
|
#include <String.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
#include <ServerProtocolStructs.h>
|
#include <ServerProtocolStructs.h>
|
||||||
@@ -326,7 +328,8 @@ private:
|
|||||||
uid_t fUserID;
|
uid_t fUserID;
|
||||||
char* fTargetScreen;
|
char* fTargetScreen;
|
||||||
::VirtualScreen fVirtualScreen;
|
::VirtualScreen fVirtualScreen;
|
||||||
DesktopSettingsPrivate* fSettings;
|
ObjectDeleter<DesktopSettingsPrivate>
|
||||||
|
fSettings;
|
||||||
port_id fMessagePort;
|
port_id fMessagePort;
|
||||||
::EventDispatcher fEventDispatcher;
|
::EventDispatcher fEventDispatcher;
|
||||||
area_id fSharedReadOnlyArea;
|
area_id fSharedReadOnlyArea;
|
||||||
|
|||||||
@@ -830,7 +830,7 @@ DesktopSettingsPrivate::_ValidateWorkspacesLayout(int32& columns,
|
|||||||
|
|
||||||
DesktopSettings::DesktopSettings(Desktop* desktop)
|
DesktopSettings::DesktopSettings(Desktop* desktop)
|
||||||
:
|
:
|
||||||
fSettings(desktop->fSettings)
|
fSettings(desktop->fSettings.Get())
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ DrawState::DrawState()
|
|||||||
fCombinedScale(1.0f),
|
fCombinedScale(1.0f),
|
||||||
fTransform(),
|
fTransform(),
|
||||||
fCombinedTransform(),
|
fCombinedTransform(),
|
||||||
fClippingRegion(NULL),
|
|
||||||
fAlphaMask(NULL),
|
fAlphaMask(NULL),
|
||||||
|
|
||||||
fHighColor((rgb_color){ 0, 0, 0, 255 }),
|
fHighColor((rgb_color){ 0, 0, 0, 255 }),
|
||||||
@@ -63,8 +62,7 @@ DrawState::DrawState()
|
|||||||
fLineCapMode(B_BUTT_CAP),
|
fLineCapMode(B_BUTT_CAP),
|
||||||
fLineJoinMode(B_MITER_JOIN),
|
fLineJoinMode(B_MITER_JOIN),
|
||||||
fMiterLimit(B_DEFAULT_MITER_LIMIT),
|
fMiterLimit(B_DEFAULT_MITER_LIMIT),
|
||||||
fFillRule(B_NONZERO),
|
fFillRule(B_NONZERO)
|
||||||
fPreviousState(NULL)
|
|
||||||
{
|
{
|
||||||
fUnscaledFontSize = fFont.Size();
|
fUnscaledFontSize = fFont.Size();
|
||||||
}
|
}
|
||||||
@@ -118,8 +116,6 @@ DrawState::DrawState(const DrawState& other)
|
|||||||
|
|
||||||
DrawState::~DrawState()
|
DrawState::~DrawState()
|
||||||
{
|
{
|
||||||
delete fClippingRegion;
|
|
||||||
delete fPreviousState;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -133,7 +129,7 @@ DrawState::PushState()
|
|||||||
next->fOrigin = BPoint(0.0, 0.0);
|
next->fOrigin = BPoint(0.0, 0.0);
|
||||||
next->fScale = 1.0;
|
next->fScale = 1.0;
|
||||||
next->fTransform.Reset();
|
next->fTransform.Reset();
|
||||||
next->fPreviousState = this;
|
next->fPreviousState.SetTo(this);
|
||||||
next->SetAlphaMask(fAlphaMask);
|
next->SetAlphaMask(fAlphaMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,12 +140,7 @@ DrawState::PushState()
|
|||||||
DrawState*
|
DrawState*
|
||||||
DrawState::PopState()
|
DrawState::PopState()
|
||||||
{
|
{
|
||||||
DrawState* previous = PreviousState();
|
return fPreviousState.Detach();
|
||||||
|
|
||||||
fPreviousState = NULL;
|
|
||||||
delete this;
|
|
||||||
|
|
||||||
return previous;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -253,7 +244,7 @@ DrawState::ReadFromLink(BPrivate::LinkReceiver& link)
|
|||||||
fAlphaFncMode = info.alphaFunctionMode;
|
fAlphaFncMode = info.alphaFunctionMode;
|
||||||
fFontAliasing = info.fontAntialiasing;
|
fFontAliasing = info.fontAntialiasing;
|
||||||
|
|
||||||
if (fPreviousState != NULL) {
|
if (fPreviousState.Get() != NULL) {
|
||||||
fCombinedOrigin = fPreviousState->fCombinedOrigin + fOrigin;
|
fCombinedOrigin = fPreviousState->fCombinedOrigin + fOrigin;
|
||||||
fCombinedScale = fPreviousState->fCombinedScale * fScale;
|
fCombinedScale = fPreviousState->fCombinedScale * fScale;
|
||||||
fCombinedTransform = fPreviousState->fCombinedTransform * fTransform;
|
fCombinedTransform = fPreviousState->fCombinedTransform * fTransform;
|
||||||
@@ -332,7 +323,7 @@ DrawState::WriteToLink(BPrivate::LinkSender& link) const
|
|||||||
|
|
||||||
// TODO: Could be optimized, but is low prio, since most views do not
|
// TODO: Could be optimized, but is low prio, since most views do not
|
||||||
// use a custom clipping region...
|
// use a custom clipping region...
|
||||||
if (fClippingRegion != NULL) {
|
if (fClippingRegion.Get() != NULL) {
|
||||||
int32 clippingRectCount = fClippingRegion->CountRects();
|
int32 clippingRectCount = fClippingRegion->CountRects();
|
||||||
link.Attach<int32>(clippingRectCount);
|
link.Attach<int32>(clippingRectCount);
|
||||||
for (int i = 0; i < clippingRectCount; i++)
|
for (int i = 0; i < clippingRectCount; i++)
|
||||||
@@ -351,7 +342,7 @@ DrawState::SetOrigin(BPoint origin)
|
|||||||
|
|
||||||
// NOTE: the origins of earlier states are never expected to
|
// NOTE: the origins of earlier states are never expected to
|
||||||
// change, only the topmost state ever changes
|
// change, only the topmost state ever changes
|
||||||
if (fPreviousState != NULL) {
|
if (fPreviousState.Get() != NULL) {
|
||||||
fCombinedOrigin.x = fPreviousState->fCombinedOrigin.x
|
fCombinedOrigin.x = fPreviousState->fCombinedOrigin.x
|
||||||
+ fOrigin.x * fPreviousState->fCombinedScale;
|
+ fOrigin.x * fPreviousState->fCombinedScale;
|
||||||
fCombinedOrigin.y = fPreviousState->fCombinedOrigin.y
|
fCombinedOrigin.y = fPreviousState->fCombinedOrigin.y
|
||||||
@@ -372,7 +363,7 @@ DrawState::SetScale(float scale)
|
|||||||
|
|
||||||
// NOTE: the scales of earlier states are never expected to
|
// NOTE: the scales of earlier states are never expected to
|
||||||
// change, only the topmost state ever changes
|
// change, only the topmost state ever changes
|
||||||
if (fPreviousState != NULL)
|
if (fPreviousState.Get() != NULL)
|
||||||
fCombinedScale = fPreviousState->fCombinedScale * fScale;
|
fCombinedScale = fPreviousState->fCombinedScale * fScale;
|
||||||
else
|
else
|
||||||
fCombinedScale = fScale;
|
fCombinedScale = fScale;
|
||||||
@@ -394,7 +385,7 @@ DrawState::SetTransform(BAffineTransform transform)
|
|||||||
|
|
||||||
// NOTE: the transforms of earlier states are never expected to
|
// NOTE: the transforms of earlier states are never expected to
|
||||||
// change, only the topmost state ever changes
|
// change, only the topmost state ever changes
|
||||||
if (fPreviousState != NULL)
|
if (fPreviousState.Get() != NULL)
|
||||||
fCombinedTransform = fPreviousState->fCombinedTransform * fTransform;
|
fCombinedTransform = fPreviousState->fCombinedTransform * fTransform;
|
||||||
else
|
else
|
||||||
fCombinedTransform = fTransform;
|
fCombinedTransform = fTransform;
|
||||||
@@ -429,13 +420,12 @@ void
|
|||||||
DrawState::SetClippingRegion(const BRegion* region)
|
DrawState::SetClippingRegion(const BRegion* region)
|
||||||
{
|
{
|
||||||
if (region) {
|
if (region) {
|
||||||
if (fClippingRegion != NULL)
|
if (fClippingRegion.Get() != NULL)
|
||||||
*fClippingRegion = *region;
|
*fClippingRegion.Get() = *region;
|
||||||
else
|
else
|
||||||
fClippingRegion = new(nothrow) BRegion(*region);
|
fClippingRegion.SetTo(new(nothrow) BRegion(*region));
|
||||||
} else {
|
} else {
|
||||||
delete fClippingRegion;
|
fClippingRegion.Unset();
|
||||||
fClippingRegion = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -443,9 +433,9 @@ DrawState::SetClippingRegion(const BRegion* region)
|
|||||||
bool
|
bool
|
||||||
DrawState::HasClipping() const
|
DrawState::HasClipping() const
|
||||||
{
|
{
|
||||||
if (fClippingRegion != NULL)
|
if (fClippingRegion.Get() != NULL)
|
||||||
return true;
|
return true;
|
||||||
if (fPreviousState != NULL)
|
if (fPreviousState.Get() != NULL)
|
||||||
return fPreviousState->HasClipping();
|
return fPreviousState->HasClipping();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -454,26 +444,26 @@ DrawState::HasClipping() const
|
|||||||
bool
|
bool
|
||||||
DrawState::HasAdditionalClipping() const
|
DrawState::HasAdditionalClipping() const
|
||||||
{
|
{
|
||||||
return fClippingRegion != NULL;
|
return fClippingRegion.Get() != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DrawState::GetCombinedClippingRegion(BRegion* region) const
|
DrawState::GetCombinedClippingRegion(BRegion* region) const
|
||||||
{
|
{
|
||||||
if (fClippingRegion != NULL) {
|
if (fClippingRegion.Get() != NULL) {
|
||||||
BRegion localTransformedClipping(*fClippingRegion);
|
BRegion localTransformedClipping(*fClippingRegion.Get());
|
||||||
SimpleTransform penTransform;
|
SimpleTransform penTransform;
|
||||||
Transform(penTransform);
|
Transform(penTransform);
|
||||||
penTransform.Apply(&localTransformedClipping);
|
penTransform.Apply(&localTransformedClipping);
|
||||||
if (fPreviousState != NULL
|
if (fPreviousState.Get() != NULL
|
||||||
&& fPreviousState->GetCombinedClippingRegion(region)) {
|
&& fPreviousState->GetCombinedClippingRegion(region)) {
|
||||||
localTransformedClipping.IntersectWith(region);
|
localTransformedClipping.IntersectWith(region);
|
||||||
}
|
}
|
||||||
*region = localTransformedClipping;
|
*region = localTransformedClipping;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (fPreviousState != NULL)
|
if (fPreviousState.Get() != NULL)
|
||||||
return fPreviousState->GetCombinedClippingRegion(region);
|
return fPreviousState->GetCombinedClippingRegion(region);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -516,16 +506,16 @@ DrawState::ClipToRect(BRect rect, bool inverse)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inverse) {
|
if (inverse) {
|
||||||
if (fClippingRegion == NULL) {
|
if (fClippingRegion.Get() == NULL) {
|
||||||
fClippingRegion = new(nothrow) BRegion(BRect(
|
fClippingRegion.SetTo(new(nothrow) BRegion(BRect(
|
||||||
-(1 << 16), -(1 << 16), (1 << 16), (1 << 16)));
|
-(1 << 16), -(1 << 16), (1 << 16), (1 << 16))));
|
||||||
// TODO: we should have a definition for a rect (or region)
|
// TODO: we should have a definition for a rect (or region)
|
||||||
// with "infinite" area. For now, this region size should do...
|
// with "infinite" area. For now, this region size should do...
|
||||||
}
|
}
|
||||||
fClippingRegion->Exclude(rect);
|
fClippingRegion->Exclude(rect);
|
||||||
} else {
|
} else {
|
||||||
if (fClippingRegion == NULL)
|
if (fClippingRegion.Get() == NULL)
|
||||||
fClippingRegion = new(nothrow) BRegion(rect);
|
fClippingRegion.SetTo(new(nothrow) BRegion(rect));
|
||||||
else {
|
else {
|
||||||
BRegion rectRegion(rect);
|
BRegion rectRegion(rect);
|
||||||
fClippingRegion->IntersectWith(&rectRegion);
|
fClippingRegion->IntersectWith(&rectRegion);
|
||||||
@@ -837,7 +827,7 @@ DrawState::PrintToStream() const
|
|||||||
printf("\t LineCap: %d\t LineJoin: %d\t MiterLimit: %.2f\n",
|
printf("\t LineCap: %d\t LineJoin: %d\t MiterLimit: %.2f\n",
|
||||||
(int16)fLineCapMode, (int16)fLineJoinMode, fMiterLimit);
|
(int16)fLineCapMode, (int16)fLineJoinMode, fMiterLimit);
|
||||||
|
|
||||||
if (fClippingRegion != NULL)
|
if (fClippingRegion.Get() != NULL)
|
||||||
fClippingRegion->PrintToStream();
|
fClippingRegion->PrintToStream();
|
||||||
|
|
||||||
printf("\t ===== Font Data =====\n");
|
printf("\t ===== Font Data =====\n");
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#define _DRAW_STATE_H_
|
#define _DRAW_STATE_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
#include <AffineTransform.h>
|
#include <AffineTransform.h>
|
||||||
#include <GraphicsDefs.h>
|
#include <GraphicsDefs.h>
|
||||||
#include <InterfaceDefs.h>
|
#include <InterfaceDefs.h>
|
||||||
@@ -44,7 +45,8 @@ public:
|
|||||||
|
|
||||||
DrawState* PushState();
|
DrawState* PushState();
|
||||||
DrawState* PopState();
|
DrawState* PopState();
|
||||||
DrawState* PreviousState() const { return fPreviousState; }
|
DrawState* PreviousState() const
|
||||||
|
{ return fPreviousState.Get(); }
|
||||||
|
|
||||||
uint16 ReadFontFromLink(BPrivate::LinkReceiver& link);
|
uint16 ReadFontFromLink(BPrivate::LinkReceiver& link);
|
||||||
// NOTE: ReadFromLink() does not read Font state!!
|
// NOTE: ReadFromLink() does not read Font state!!
|
||||||
@@ -176,7 +178,8 @@ protected:
|
|||||||
BAffineTransform fTransform;
|
BAffineTransform fTransform;
|
||||||
BAffineTransform fCombinedTransform;
|
BAffineTransform fCombinedTransform;
|
||||||
|
|
||||||
BRegion* fClippingRegion;
|
ObjectDeleter<BRegion>
|
||||||
|
fClippingRegion;
|
||||||
|
|
||||||
BReference<AlphaMask> fAlphaMask;
|
BReference<AlphaMask> fAlphaMask;
|
||||||
|
|
||||||
@@ -220,7 +223,8 @@ protected:
|
|||||||
// of the font (again) when the scale changes
|
// of the font (again) when the scale changes
|
||||||
float fUnscaledFontSize;
|
float fUnscaledFontSize;
|
||||||
|
|
||||||
DrawState* fPreviousState;
|
ObjectDeleter<DrawState>
|
||||||
|
fPreviousState;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _DRAW_STATE_H_
|
#endif // _DRAW_STATE_H_
|
||||||
|
|||||||
@@ -343,9 +343,9 @@ EventDispatcher::RemoveTarget(EventTarget& target)
|
|||||||
if (fPreviousMouseTarget == &target)
|
if (fPreviousMouseTarget == &target)
|
||||||
fPreviousMouseTarget = NULL;
|
fPreviousMouseTarget = NULL;
|
||||||
|
|
||||||
if (fKeyboardFilter != NULL)
|
if (fKeyboardFilter.Get() != NULL)
|
||||||
fKeyboardFilter->RemoveTarget(&target);
|
fKeyboardFilter->RemoveTarget(&target);
|
||||||
if (fMouseFilter != NULL)
|
if (fMouseFilter.Get() != NULL)
|
||||||
fMouseFilter->RemoveTarget(&target);
|
fMouseFilter->RemoveTarget(&target);
|
||||||
|
|
||||||
fTargets.RemoveItem(&target);
|
fTargets.RemoveItem(&target);
|
||||||
@@ -468,11 +468,10 @@ EventDispatcher::SetMouseFilter(EventFilter* filter)
|
|||||||
{
|
{
|
||||||
BAutolock _(this);
|
BAutolock _(this);
|
||||||
|
|
||||||
if (fMouseFilter == filter)
|
if (fMouseFilter.Get() == filter)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
delete fMouseFilter;
|
fMouseFilter.SetTo(filter);
|
||||||
fMouseFilter = filter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -481,11 +480,10 @@ EventDispatcher::SetKeyboardFilter(EventFilter* filter)
|
|||||||
{
|
{
|
||||||
BAutolock _(this);
|
BAutolock _(this);
|
||||||
|
|
||||||
if (fKeyboardFilter == filter)
|
if (fKeyboardFilter.Get() == filter)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
delete fKeyboardFilter;
|
fKeyboardFilter.SetTo(filter);
|
||||||
fKeyboardFilter = filter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -814,7 +812,7 @@ EventDispatcher::_EventLoop()
|
|||||||
#endif
|
#endif
|
||||||
pointerEvent = true;
|
pointerEvent = true;
|
||||||
|
|
||||||
if (fMouseFilter == NULL)
|
if (fMouseFilter.Get() == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
EventTarget* mouseTarget = fPreviousMouseTarget;
|
EventTarget* mouseTarget = fPreviousMouseTarget;
|
||||||
@@ -892,7 +890,7 @@ EventDispatcher::_EventLoop()
|
|||||||
case B_INPUT_METHOD_EVENT:
|
case B_INPUT_METHOD_EVENT:
|
||||||
ETRACE(("key event, focus = %p\n", fFocus));
|
ETRACE(("key event, focus = %p\n", fFocus));
|
||||||
|
|
||||||
if (fKeyboardFilter != NULL
|
if (fKeyboardFilter.Get() != NULL
|
||||||
&& fKeyboardFilter->Filter(event, &fFocus)
|
&& fKeyboardFilter->Filter(event, &fFocus)
|
||||||
== B_SKIP_MESSAGE) {
|
== B_SKIP_MESSAGE) {
|
||||||
break;
|
break;
|
||||||
@@ -994,7 +992,7 @@ void
|
|||||||
EventDispatcher::_CursorLoop()
|
EventDispatcher::_CursorLoop()
|
||||||
{
|
{
|
||||||
BPoint where;
|
BPoint where;
|
||||||
const bigtime_t toolTipDelay = BToolTipManager::Manager()->ShowDelay();
|
const bigtime_t toolTipDelay = BToolTipManager::Manager()->ShowDelay();
|
||||||
bool mouseIdleSent = true;
|
bool mouseIdleSent = true;
|
||||||
status_t status = B_OK;
|
status_t status = B_OK;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#define EVENT_DISPATCHER_H
|
#define EVENT_DISPATCHER_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
#include <Locker.h>
|
#include <Locker.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <MessageFilter.h>
|
#include <MessageFilter.h>
|
||||||
@@ -137,8 +138,10 @@ class EventDispatcher : public BLocker {
|
|||||||
EventTarget* fFocus;
|
EventTarget* fFocus;
|
||||||
bool fSuspendFocus;
|
bool fSuspendFocus;
|
||||||
|
|
||||||
EventFilter* fMouseFilter;
|
ObjectDeleter <EventFilter>
|
||||||
EventFilter* fKeyboardFilter;
|
fMouseFilter;
|
||||||
|
ObjectDeleter<EventFilter>
|
||||||
|
fKeyboardFilter;
|
||||||
|
|
||||||
BObjectList<EventTarget> fTargets;
|
BObjectList<EventTarget> fTargets;
|
||||||
|
|
||||||
|
|||||||
@@ -31,11 +31,11 @@ OffscreenWindow::OffscreenWindow(ServerBitmap* bitmap,
|
|||||||
fBitmap(bitmap),
|
fBitmap(bitmap),
|
||||||
fHWInterface(new (nothrow) BitmapHWInterface(fBitmap))
|
fHWInterface(new (nothrow) BitmapHWInterface(fBitmap))
|
||||||
{
|
{
|
||||||
if (!fHWInterface || !GetDrawingEngine())
|
if (fHWInterface.Get() == NULL || !GetDrawingEngine())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fHWInterface->Initialize();
|
fHWInterface->Initialize();
|
||||||
GetDrawingEngine()->SetHWInterface(fHWInterface);
|
GetDrawingEngine()->SetHWInterface(fHWInterface.Get());
|
||||||
|
|
||||||
fVisibleRegion.Set(fFrame);
|
fVisibleRegion.Set(fFrame);
|
||||||
fVisibleContentRegion.Set(fFrame);
|
fVisibleContentRegion.Set(fFrame);
|
||||||
@@ -50,11 +50,10 @@ OffscreenWindow::~OffscreenWindow()
|
|||||||
if (GetDrawingEngine())
|
if (GetDrawingEngine())
|
||||||
GetDrawingEngine()->SetHWInterface(NULL);
|
GetDrawingEngine()->SetHWInterface(NULL);
|
||||||
|
|
||||||
if (fHWInterface) {
|
if (fHWInterface.Get() != NULL) {
|
||||||
fHWInterface->LockExclusiveAccess();
|
fHWInterface->LockExclusiveAccess();
|
||||||
fHWInterface->Shutdown();
|
fHWInterface->Shutdown();
|
||||||
fHWInterface->UnlockExclusiveAccess();
|
fHWInterface->UnlockExclusiveAccess();
|
||||||
delete fHWInterface;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
#include "Window.h"
|
#include "Window.h"
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
|
|
||||||
|
|
||||||
class BitmapHWInterface;
|
class BitmapHWInterface;
|
||||||
class ServerBitmap;
|
class ServerBitmap;
|
||||||
@@ -26,7 +28,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
ServerBitmap* fBitmap;
|
ServerBitmap* fBitmap;
|
||||||
BitmapHWInterface* fHWInterface;
|
ObjectDeleter<BitmapHWInterface>
|
||||||
|
fHWInterface;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // OFFSCREEN_WINDOW_H
|
#endif // OFFSCREEN_WINDOW_H
|
||||||
|
|||||||
@@ -50,9 +50,7 @@ Screen::Screen(::HWInterface *interface, int32 id)
|
|||||||
|
|
||||||
Screen::Screen()
|
Screen::Screen()
|
||||||
:
|
:
|
||||||
fID(-1),
|
fID(-1)
|
||||||
fDriver(NULL),
|
|
||||||
fHWInterface(NULL)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,8 +58,6 @@ Screen::Screen()
|
|||||||
Screen::~Screen()
|
Screen::~Screen()
|
||||||
{
|
{
|
||||||
Shutdown();
|
Shutdown();
|
||||||
delete fDriver;
|
|
||||||
delete fHWInterface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -71,7 +67,7 @@ Screen::~Screen()
|
|||||||
status_t
|
status_t
|
||||||
Screen::Initialize()
|
Screen::Initialize()
|
||||||
{
|
{
|
||||||
if (fHWInterface) {
|
if (fHWInterface.Get() != NULL) {
|
||||||
// init the graphics hardware
|
// init the graphics hardware
|
||||||
return fHWInterface->Initialize();
|
return fHWInterface->Initialize();
|
||||||
}
|
}
|
||||||
@@ -83,7 +79,7 @@ Screen::Initialize()
|
|||||||
void
|
void
|
||||||
Screen::Shutdown()
|
Screen::Shutdown()
|
||||||
{
|
{
|
||||||
if (fHWInterface)
|
if (fHWInterface.Get() != NULL)
|
||||||
fHWInterface->Shutdown();
|
fHWInterface->Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#define SCREEN_H
|
#define SCREEN_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
#include <Accelerant.h>
|
#include <Accelerant.h>
|
||||||
#include <GraphicsDefs.h>
|
#include <GraphicsDefs.h>
|
||||||
#include <Point.h>
|
#include <Point.h>
|
||||||
@@ -50,9 +51,9 @@ public:
|
|||||||
color_space ColorSpace() const;
|
color_space ColorSpace() const;
|
||||||
|
|
||||||
inline DrawingEngine* GetDrawingEngine() const
|
inline DrawingEngine* GetDrawingEngine() const
|
||||||
{ return fDriver; }
|
{ return fDriver.Get(); }
|
||||||
inline ::HWInterface* HWInterface() const
|
inline ::HWInterface* HWInterface() const
|
||||||
{ return fHWInterface; }
|
{ return fHWInterface.Get(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32 _FindBestMode(const display_mode* modeList,
|
int32 _FindBestMode(const display_mode* modeList,
|
||||||
@@ -60,8 +61,10 @@ private:
|
|||||||
uint32 colorspace, float frequency) const;
|
uint32 colorspace, float frequency) const;
|
||||||
|
|
||||||
int32 fID;
|
int32 fID;
|
||||||
DrawingEngine* fDriver;
|
ObjectDeleter<DrawingEngine>
|
||||||
::HWInterface* fHWInterface;
|
fDriver;
|
||||||
|
ObjectDeleter< ::HWInterface>
|
||||||
|
fHWInterface;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SCREEN_H */
|
#endif /* SCREEN_H */
|
||||||
|
|||||||
@@ -85,8 +85,6 @@ ScreenManager::~ScreenManager()
|
|||||||
for (int32 i = 0; i < fScreenList.CountItems(); i++) {
|
for (int32 i = 0; i < fScreenList.CountItems(); i++) {
|
||||||
screen_item* item = fScreenList.ItemAt(i);
|
screen_item* item = fScreenList.ItemAt(i);
|
||||||
|
|
||||||
delete item->screen;
|
|
||||||
delete item->listener;
|
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,7 +98,7 @@ ScreenManager::ScreenAt(int32 index) const
|
|||||||
|
|
||||||
screen_item* item = fScreenList.ItemAt(index);
|
screen_item* item = fScreenList.ItemAt(index);
|
||||||
if (item != NULL)
|
if (item != NULL)
|
||||||
return item->screen;
|
return item->screen.Get();
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -128,7 +126,7 @@ ScreenManager::AcquireScreens(ScreenOwner* owner, int32* wishList,
|
|||||||
for (int32 i = 0; i < fScreenList.CountItems(); i++) {
|
for (int32 i = 0; i < fScreenList.CountItems(); i++) {
|
||||||
screen_item* item = fScreenList.ItemAt(i);
|
screen_item* item = fScreenList.ItemAt(i);
|
||||||
|
|
||||||
if (item->owner == NULL && list.AddItem(item->screen)) {
|
if (item->owner == NULL && list.AddItem(item->screen.Get())) {
|
||||||
item->owner = owner;
|
item->owner = owner;
|
||||||
added++;
|
added++;
|
||||||
}
|
}
|
||||||
@@ -146,7 +144,7 @@ ScreenManager::AcquireScreens(ScreenOwner* owner, int32* wishList,
|
|||||||
#endif
|
#endif
|
||||||
if (interface != NULL) {
|
if (interface != NULL) {
|
||||||
screen_item* item = _AddHWInterface(interface);
|
screen_item* item = _AddHWInterface(interface);
|
||||||
if (item != NULL && list.AddItem(item->screen)) {
|
if (item != NULL && list.AddItem(item->screen.Get())) {
|
||||||
item->owner = owner;
|
item->owner = owner;
|
||||||
added++;
|
added++;
|
||||||
}
|
}
|
||||||
@@ -168,7 +166,7 @@ ScreenManager::ReleaseScreens(ScreenList& list)
|
|||||||
for (int32 j = 0; j < list.CountItems(); j++) {
|
for (int32 j = 0; j < list.CountItems(); j++) {
|
||||||
Screen* screen = list.ItemAt(j);
|
Screen* screen = list.ItemAt(j);
|
||||||
|
|
||||||
if (item->screen == screen)
|
if (item->screen.Get() == screen)
|
||||||
item->owner = NULL;
|
item->owner = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -182,7 +180,7 @@ ScreenManager::ScreenChanged(Screen* screen)
|
|||||||
|
|
||||||
for (int32 i = 0; i < fScreenList.CountItems(); i++) {
|
for (int32 i = 0; i < fScreenList.CountItems(); i++) {
|
||||||
screen_item* item = fScreenList.ItemAt(i);
|
screen_item* item = fScreenList.ItemAt(i);
|
||||||
if (item->screen == screen)
|
if (item->screen.Get() == screen)
|
||||||
item->owner->ScreenChanged(screen);
|
item->owner->ScreenChanged(screen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -232,18 +230,18 @@ ScreenManager::_AddHWInterface(HWInterface* interface)
|
|||||||
screen_item* item = new(nothrow) screen_item;
|
screen_item* item = new(nothrow) screen_item;
|
||||||
|
|
||||||
if (item != NULL) {
|
if (item != NULL) {
|
||||||
item->screen = screen;
|
item->screen.SetTo(screen);
|
||||||
item->owner = NULL;
|
item->owner = NULL;
|
||||||
item->listener = new(nothrow) ScreenChangeListener(*this, screen);
|
item->listener.SetTo(
|
||||||
if (item->listener != NULL
|
new(nothrow) ScreenChangeListener(*this, screen));
|
||||||
&& interface->AddListener(item->listener)) {
|
if (item->listener.Get() != NULL
|
||||||
|
&& interface->AddListener(item->listener.Get())) {
|
||||||
if (fScreenList.AddItem(item))
|
if (fScreenList.AddItem(item))
|
||||||
return item;
|
return item;
|
||||||
|
|
||||||
interface->RemoveListener(item->listener);
|
interface->RemoveListener(item->listener.Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
delete item->listener;
|
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#define SCREEN_MANAGER_H
|
#define SCREEN_MANAGER_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
#include <Looper.h>
|
#include <Looper.h>
|
||||||
#include <ObjectList.h>
|
#include <ObjectList.h>
|
||||||
|
|
||||||
@@ -54,9 +55,10 @@ class ScreenManager : public BLooper {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
struct screen_item {
|
struct screen_item {
|
||||||
Screen* screen;
|
ObjectDeleter<Screen> screen;
|
||||||
ScreenOwner* owner;
|
ScreenOwner* owner;
|
||||||
HWInterfaceListener* listener;
|
ObjectDeleter<HWInterfaceListener>
|
||||||
|
listener;
|
||||||
};
|
};
|
||||||
|
|
||||||
void _ScanDrivers();
|
void _ScanDrivers();
|
||||||
|
|||||||
@@ -111,9 +111,6 @@ ServerBitmap::~ServerBitmap()
|
|||||||
delete fMemory;
|
delete fMemory;
|
||||||
} else
|
} else
|
||||||
delete[] fBuffer;
|
delete[] fBuffer;
|
||||||
|
|
||||||
delete fOverlay;
|
|
||||||
// deleting the overlay will also free the overlay buffer
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -181,14 +178,14 @@ ServerBitmap::AreaOffset() const
|
|||||||
void
|
void
|
||||||
ServerBitmap::SetOverlay(::Overlay* overlay)
|
ServerBitmap::SetOverlay(::Overlay* overlay)
|
||||||
{
|
{
|
||||||
fOverlay = overlay;
|
fOverlay.SetTo(overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
::Overlay*
|
::Overlay*
|
||||||
ServerBitmap::Overlay() const
|
ServerBitmap::Overlay() const
|
||||||
{
|
{
|
||||||
return fOverlay;
|
return fOverlay.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#define SERVER_BITMAP_H
|
#define SERVER_BITMAP_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
#include <GraphicsDefs.h>
|
#include <GraphicsDefs.h>
|
||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
@@ -96,7 +97,8 @@ protected:
|
|||||||
protected:
|
protected:
|
||||||
ClientMemory fClientMemory;
|
ClientMemory fClientMemory;
|
||||||
AreaMemory* fMemory;
|
AreaMemory* fMemory;
|
||||||
::Overlay* fOverlay;
|
ObjectDeleter< ::Overlay>
|
||||||
|
fOverlay;
|
||||||
uint8* fBuffer;
|
uint8* fBuffer;
|
||||||
|
|
||||||
int32 fWidth;
|
int32 fWidth;
|
||||||
|
|||||||
@@ -163,7 +163,6 @@ ServerWindow::ServerWindow(const char* title, ServerApp* app,
|
|||||||
fTitle(NULL),
|
fTitle(NULL),
|
||||||
fDesktop(app->GetDesktop()),
|
fDesktop(app->GetDesktop()),
|
||||||
fServerApp(app),
|
fServerApp(app),
|
||||||
fWindow(NULL),
|
|
||||||
fWindowAddedToDesktop(false),
|
fWindowAddedToDesktop(false),
|
||||||
|
|
||||||
fClientTeam(app->ClientTeam()),
|
fClientTeam(app->ClientTeam()),
|
||||||
@@ -178,7 +177,6 @@ ServerWindow::ServerWindow(const char* title, ServerApp* app,
|
|||||||
fCurrentDrawingRegion(),
|
fCurrentDrawingRegion(),
|
||||||
fCurrentDrawingRegionValid(false),
|
fCurrentDrawingRegionValid(false),
|
||||||
|
|
||||||
fDirectWindowInfo(NULL),
|
|
||||||
fIsDirectlyAccessing(false)
|
fIsDirectlyAccessing(false)
|
||||||
{
|
{
|
||||||
STRACE(("ServerWindow(%s)::ServerWindow()\n", title));
|
STRACE(("ServerWindow(%s)::ServerWindow()\n", title));
|
||||||
@@ -206,7 +204,7 @@ ServerWindow::~ServerWindow()
|
|||||||
|
|
||||||
if (!fWindow->IsOffscreenWindow()) {
|
if (!fWindow->IsOffscreenWindow()) {
|
||||||
fWindowAddedToDesktop = false;
|
fWindowAddedToDesktop = false;
|
||||||
fDesktop->RemoveWindow(fWindow);
|
fDesktop->RemoveWindow(fWindow.Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (App() != NULL) {
|
if (App() != NULL) {
|
||||||
@@ -214,14 +212,14 @@ ServerWindow::~ServerWindow()
|
|||||||
fServerApp = NULL;
|
fServerApp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete fWindow;
|
fWindow.Unset(); // TODO: is it really needed?
|
||||||
|
|
||||||
free(fTitle);
|
free(fTitle);
|
||||||
delete_port(fMessagePort);
|
delete_port(fMessagePort);
|
||||||
|
|
||||||
BPrivate::gDefaultTokens.RemoveToken(fServerToken);
|
BPrivate::gDefaultTokens.RemoveToken(fServerToken);
|
||||||
|
|
||||||
delete fDirectWindowInfo;
|
fDirectWindowInfo.Unset(); // TODO: is it really needed?
|
||||||
STRACE(("ServerWindow(%p) will exit NOW\n", this));
|
STRACE(("ServerWindow(%p) will exit NOW\n", this));
|
||||||
|
|
||||||
delete_sem(fDeathSemaphore);
|
delete_sem(fDeathSemaphore);
|
||||||
@@ -281,15 +279,14 @@ ServerWindow::Init(BRect frame, window_look look, window_feel feel,
|
|||||||
|
|
||||||
// We cannot call MakeWindow in the constructor, since it
|
// We cannot call MakeWindow in the constructor, since it
|
||||||
// is a virtual function!
|
// is a virtual function!
|
||||||
fWindow = MakeWindow(frame, fTitle, look, feel, flags, workspace);
|
fWindow.SetTo(MakeWindow(frame, fTitle, look, feel, flags, workspace));
|
||||||
if (!fWindow || fWindow->InitCheck() != B_OK) {
|
if (fWindow.Get() == NULL || fWindow->InitCheck() != B_OK) {
|
||||||
delete fWindow;
|
fWindow.Unset();
|
||||||
fWindow = NULL;
|
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fWindow->IsOffscreenWindow()) {
|
if (!fWindow->IsOffscreenWindow()) {
|
||||||
fDesktop->AddWindow(fWindow);
|
fDesktop->AddWindow(fWindow.Get());
|
||||||
fWindowAddedToDesktop = true;
|
fWindowAddedToDesktop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,7 +305,7 @@ ServerWindow::Window() const
|
|||||||
if (!fWindowAddedToDesktop)
|
if (!fWindowAddedToDesktop)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return fWindow;
|
return fWindow.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -351,8 +348,8 @@ ServerWindow::_Show()
|
|||||||
// TODO: Maybe we need to dispatch a message to the desktop to show/hide us
|
// TODO: Maybe we need to dispatch a message to the desktop to show/hide us
|
||||||
// instead of doing it from this thread.
|
// instead of doing it from this thread.
|
||||||
fDesktop->UnlockSingleWindow();
|
fDesktop->UnlockSingleWindow();
|
||||||
fDesktop->ShowWindow(fWindow);
|
fDesktop->ShowWindow(fWindow.Get());
|
||||||
if (fDirectWindowInfo && fDirectWindowInfo->IsFullScreen())
|
if (fDirectWindowInfo.Get() != NULL && fDirectWindowInfo->IsFullScreen())
|
||||||
_ResizeToFullScreen();
|
_ResizeToFullScreen();
|
||||||
|
|
||||||
fDesktop->LockSingleWindow();
|
fDesktop->LockSingleWindow();
|
||||||
@@ -371,7 +368,7 @@ ServerWindow::_Hide()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
fDesktop->UnlockSingleWindow();
|
fDesktop->UnlockSingleWindow();
|
||||||
fDesktop->HideWindow(fWindow);
|
fDesktop->HideWindow(fWindow.Get());
|
||||||
fDesktop->LockSingleWindow();
|
fDesktop->LockSingleWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,8 +408,8 @@ ServerWindow::SetTitle(const char* newTitle)
|
|||||||
rename_thread(Thread(), name);
|
rename_thread(Thread(), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fWindow != NULL)
|
if (fWindow.Get() != NULL)
|
||||||
fDesktop->SetWindowTitle(fWindow, newTitle);
|
fDesktop->SetWindowTitle(fWindow.Get(), newTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -627,7 +624,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
"minimize: %d\n", Title(), minimize));
|
"minimize: %d\n", Title(), minimize));
|
||||||
|
|
||||||
fDesktop->UnlockSingleWindow();
|
fDesktop->UnlockSingleWindow();
|
||||||
fDesktop->MinimizeWindow(fWindow, minimize);
|
fDesktop->MinimizeWindow(fWindow.Get(), minimize);
|
||||||
fDesktop->LockSingleWindow();
|
fDesktop->LockSingleWindow();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -645,9 +642,9 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
fDesktop->UnlockSingleWindow();
|
fDesktop->UnlockSingleWindow();
|
||||||
|
|
||||||
if (activate)
|
if (activate)
|
||||||
fDesktop->SelectWindow(fWindow);
|
fDesktop->SelectWindow(fWindow.Get());
|
||||||
else
|
else
|
||||||
fDesktop->SendWindowBehind(fWindow, NULL);
|
fDesktop->SendWindowBehind(fWindow.Get(), NULL);
|
||||||
|
|
||||||
fDesktop->LockSingleWindow();
|
fDesktop->LockSingleWindow();
|
||||||
break;
|
break;
|
||||||
@@ -668,7 +665,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
Title(), behindOf != NULL ? behindOf->Title() : "NULL"));
|
Title(), behindOf != NULL ? behindOf->Title() : "NULL"));
|
||||||
|
|
||||||
if (behindOf != NULL || token == -1) {
|
if (behindOf != NULL || token == -1) {
|
||||||
fDesktop->SendWindowBehind(fWindow, behindOf);
|
fDesktop->SendWindowBehind(fWindow.Get(), behindOf);
|
||||||
status = B_OK;
|
status = B_OK;
|
||||||
} else
|
} else
|
||||||
status = B_NAME_NOT_FOUND;
|
status = B_NAME_NOT_FOUND;
|
||||||
@@ -730,7 +727,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
if (window == NULL || window->Feel() != B_NORMAL_WINDOW_FEEL) {
|
if (window == NULL || window->Feel() != B_NORMAL_WINDOW_FEEL) {
|
||||||
status = B_BAD_VALUE;
|
status = B_BAD_VALUE;
|
||||||
} else {
|
} else {
|
||||||
status = fDesktop->AddWindowToSubset(fWindow, window)
|
status = fDesktop->AddWindowToSubset(fWindow.Get(), window)
|
||||||
? B_OK : B_NO_MEMORY;
|
? B_OK : B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -750,7 +747,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
::Window* window = fDesktop->FindWindowByClientToken(token,
|
::Window* window = fDesktop->FindWindowByClientToken(token,
|
||||||
App()->ClientTeam());
|
App()->ClientTeam());
|
||||||
if (window != NULL) {
|
if (window != NULL) {
|
||||||
fDesktop->RemoveWindowFromSubset(fWindow, window);
|
fDesktop->RemoveWindowFromSubset(fWindow.Get(), window);
|
||||||
status = B_OK;
|
status = B_OK;
|
||||||
} else
|
} else
|
||||||
status = B_BAD_VALUE;
|
status = B_BAD_VALUE;
|
||||||
@@ -775,7 +772,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status == B_OK && !fWindow->IsOffscreenWindow())
|
if (status == B_OK && !fWindow->IsOffscreenWindow())
|
||||||
fDesktop->SetWindowLook(fWindow, (window_look)look);
|
fDesktop->SetWindowLook(fWindow.Get(), (window_look)look);
|
||||||
|
|
||||||
fLink.StartMessage(status);
|
fLink.StartMessage(status);
|
||||||
fLink.Flush();
|
fLink.Flush();
|
||||||
@@ -795,7 +792,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status == B_OK && !fWindow->IsOffscreenWindow())
|
if (status == B_OK && !fWindow->IsOffscreenWindow())
|
||||||
fDesktop->SetWindowFeel(fWindow, (window_feel)feel);
|
fDesktop->SetWindowFeel(fWindow.Get(), (window_feel)feel);
|
||||||
|
|
||||||
fLink.StartMessage(status);
|
fLink.StartMessage(status);
|
||||||
fLink.Flush();
|
fLink.Flush();
|
||||||
@@ -815,7 +812,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status == B_OK && !fWindow->IsOffscreenWindow())
|
if (status == B_OK && !fWindow->IsOffscreenWindow())
|
||||||
fDesktop->SetWindowFlags(fWindow, flags);
|
fDesktop->SetWindowFlags(fWindow.Get(), flags);
|
||||||
|
|
||||||
fLink.StartMessage(status);
|
fLink.StartMessage(status);
|
||||||
fLink.Flush();
|
fLink.Flush();
|
||||||
@@ -839,7 +836,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
#endif
|
#endif
|
||||||
case AS_IS_FRONT_WINDOW:
|
case AS_IS_FRONT_WINDOW:
|
||||||
{
|
{
|
||||||
bool isFront = fDesktop->FrontWindow() == fWindow;
|
bool isFront = fDesktop->FrontWindow() == fWindow.Get();
|
||||||
DTRACE(("ServerWindow %s: Message AS_IS_FRONT_WINDOW: %d\n",
|
DTRACE(("ServerWindow %s: Message AS_IS_FRONT_WINDOW: %d\n",
|
||||||
Title(), isFront));
|
Title(), isFront));
|
||||||
fLink.StartMessage(isFront ? B_OK : B_ERROR);
|
fLink.StartMessage(isFront ? B_OK : B_ERROR);
|
||||||
@@ -866,7 +863,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
DTRACE(("ServerWindow %s: Message AS_SET_WORKSPACES %" B_PRIx32 "\n",
|
DTRACE(("ServerWindow %s: Message AS_SET_WORKSPACES %" B_PRIx32 "\n",
|
||||||
Title(), newWorkspaces));
|
Title(), newWorkspaces));
|
||||||
|
|
||||||
fDesktop->SetWindowWorkspaces(fWindow, newWorkspaces);
|
fDesktop->SetWindowWorkspaces(fWindow.Get(), newWorkspaces);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_WINDOW_RESIZE:
|
case AS_WINDOW_RESIZE:
|
||||||
@@ -888,7 +885,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
// pragmatically set window bounds
|
// pragmatically set window bounds
|
||||||
// fLink.StartMessage(B_BUSY);
|
// fLink.StartMessage(B_BUSY);
|
||||||
// } else {
|
// } else {
|
||||||
fDesktop->ResizeWindowBy(fWindow,
|
fDesktop->ResizeWindowBy(fWindow.Get(),
|
||||||
xResizeTo - fWindow->Frame().Width(),
|
xResizeTo - fWindow->Frame().Width(),
|
||||||
yResizeTo - fWindow->Frame().Height());
|
yResizeTo - fWindow->Frame().Height());
|
||||||
fLink.StartMessage(B_OK);
|
fLink.StartMessage(B_OK);
|
||||||
@@ -913,7 +910,8 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
// pragmatically set window positions
|
// pragmatically set window positions
|
||||||
fLink.StartMessage(B_BUSY);
|
fLink.StartMessage(B_BUSY);
|
||||||
} else {
|
} else {
|
||||||
fDesktop->MoveWindowBy(fWindow, xMoveTo - fWindow->Frame().left,
|
fDesktop->MoveWindowBy(fWindow.Get(),
|
||||||
|
xMoveTo - fWindow->Frame().left,
|
||||||
yMoveTo - fWindow->Frame().top);
|
yMoveTo - fWindow->Frame().top);
|
||||||
fLink.StartMessage(B_OK);
|
fLink.StartMessage(B_OK);
|
||||||
}
|
}
|
||||||
@@ -962,7 +960,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
|
|
||||||
fLink.Flush();
|
fLink.Flush();
|
||||||
|
|
||||||
fDesktop->NotifySizeLimitsChanged(fWindow, minWidth, maxWidth,
|
fDesktop->NotifySizeLimitsChanged(fWindow.Get(), minWidth, maxWidth,
|
||||||
minHeight, maxHeight);
|
minHeight, maxHeight);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -974,12 +972,13 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
Title()));
|
Title()));
|
||||||
|
|
||||||
int32 size;
|
int32 size;
|
||||||
if (fWindow && link.Read<int32>(&size) == B_OK) {
|
if (fWindow.Get() != NULL && link.Read<int32>(&size) == B_OK) {
|
||||||
char buffer[size];
|
char buffer[size];
|
||||||
if (link.Read(buffer, size) == B_OK) {
|
if (link.Read(buffer, size) == B_OK) {
|
||||||
BMessage settings;
|
BMessage settings;
|
||||||
if (settings.Unflatten(buffer) == B_OK)
|
if (settings.Unflatten(buffer) == B_OK)
|
||||||
fDesktop->SetWindowDecoratorSettings(fWindow, settings);
|
fDesktop->SetWindowDecoratorSettings(
|
||||||
|
fWindow.Get(), settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1014,7 +1013,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
case AS_SYSTEM_FONT_CHANGED:
|
case AS_SYSTEM_FONT_CHANGED:
|
||||||
{
|
{
|
||||||
// Has the all-window look
|
// Has the all-window look
|
||||||
fDesktop->FontsChanged(fWindow);
|
fDesktop->FontsChanged(fWindow.Get());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1097,7 +1096,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
link.Read<bool>(&enable);
|
link.Read<bool>(&enable);
|
||||||
|
|
||||||
status_t status = B_OK;
|
status_t status = B_OK;
|
||||||
if (fDirectWindowInfo != NULL)
|
if (fDirectWindowInfo.Get() != NULL)
|
||||||
_DirectWindowSetFullScreen(enable);
|
_DirectWindowSetFullScreen(enable);
|
||||||
else
|
else
|
||||||
status = B_BAD_TYPE;
|
status = B_BAD_TYPE;
|
||||||
@@ -1170,7 +1169,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
|
|
||||||
case AS_TALK_TO_DESKTOP_LISTENER:
|
case AS_TALK_TO_DESKTOP_LISTENER:
|
||||||
{
|
{
|
||||||
if (fDesktop->MessageForListener(fWindow, fLink.Receiver(),
|
if (fDesktop->MessageForListener(fWindow.Get(), fLink.Receiver(),
|
||||||
fLink.Sender()))
|
fLink.Sender()))
|
||||||
break;
|
break;
|
||||||
// unhandled message at least send an error if needed
|
// unhandled message at least send an error if needed
|
||||||
@@ -1352,7 +1351,7 @@ fDesktop->UnlockSingleWindow();
|
|||||||
// TODO: possible deadlock
|
// TODO: possible deadlock
|
||||||
if (eventMask != 0 || options != 0) {
|
if (eventMask != 0 || options != 0) {
|
||||||
if (options & B_LOCK_WINDOW_FOCUS)
|
if (options & B_LOCK_WINDOW_FOCUS)
|
||||||
fDesktop->SetFocusLocked(fWindow);
|
fDesktop->SetFocusLocked(fWindow.Get());
|
||||||
fDesktop->EventDispatcher().AddTemporaryListener(EventTarget(),
|
fDesktop->EventDispatcher().AddTemporaryListener(EventTarget(),
|
||||||
fCurrentView->Token(), eventMask, options);
|
fCurrentView->Token(), eventMask, options);
|
||||||
} else {
|
} else {
|
||||||
@@ -4290,7 +4289,7 @@ ServerWindow::ScreenChanged(const BMessage* message)
|
|||||||
{
|
{
|
||||||
SendMessageToClient(message);
|
SendMessageToClient(message);
|
||||||
|
|
||||||
if (fDirectWindowInfo != NULL && fDirectWindowInfo->IsFullScreen())
|
if (fDirectWindowInfo.Get() != NULL && fDirectWindowInfo->IsFullScreen())
|
||||||
_ResizeToFullScreen();
|
_ResizeToFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4324,7 +4323,7 @@ ServerWindow::HandleDirectConnection(int32 bufferState, int32 driverState)
|
|||||||
{
|
{
|
||||||
ASSERT_MULTI_LOCKED(fDesktop->WindowLocker());
|
ASSERT_MULTI_LOCKED(fDesktop->WindowLocker());
|
||||||
|
|
||||||
if (fDirectWindowInfo == NULL)
|
if (fDirectWindowInfo.Get() == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
STRACE(("HandleDirectConnection(bufferState = %" B_PRId32 ", driverState = "
|
STRACE(("HandleDirectConnection(bufferState = %" B_PRId32 ", driverState = "
|
||||||
@@ -4345,8 +4344,7 @@ ServerWindow::HandleDirectConnection(int32 bufferState, int32 driverState)
|
|||||||
// The client application didn't release the semaphore
|
// The client application didn't release the semaphore
|
||||||
// within the given timeout. Or something else went wrong.
|
// within the given timeout. Or something else went wrong.
|
||||||
// Deleting this member should make it crash.
|
// Deleting this member should make it crash.
|
||||||
delete fDirectWindowInfo;
|
fDirectWindowInfo.Unset();
|
||||||
fDirectWindowInfo = NULL;
|
|
||||||
} else if ((bufferState & B_DIRECT_MODE_MASK) == B_DIRECT_START)
|
} else if ((bufferState & B_DIRECT_MODE_MASK) == B_DIRECT_START)
|
||||||
fIsDirectlyAccessing = true;
|
fIsDirectlyAccessing = true;
|
||||||
else if ((bufferState & B_DIRECT_MODE_MASK) == B_DIRECT_STOP)
|
else if ((bufferState & B_DIRECT_MODE_MASK) == B_DIRECT_STOP)
|
||||||
@@ -4465,10 +4463,10 @@ ServerWindow::_ResizeToFullScreen()
|
|||||||
screenFrame = fWindow->Screen()->Frame();
|
screenFrame = fWindow->Screen()->Frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
fDesktop->MoveWindowBy(fWindow,
|
fDesktop->MoveWindowBy(fWindow.Get(),
|
||||||
screenFrame.left - fWindow->Frame().left,
|
screenFrame.left - fWindow->Frame().left,
|
||||||
screenFrame.top - fWindow->Frame().top);
|
screenFrame.top - fWindow->Frame().top);
|
||||||
fDesktop->ResizeWindowBy(fWindow,
|
fDesktop->ResizeWindowBy(fWindow.Get(),
|
||||||
screenFrame.Width() - fWindow->Frame().Width(),
|
screenFrame.Width() - fWindow->Frame().Width(),
|
||||||
screenFrame.Height() - fWindow->Frame().Height());
|
screenFrame.Height() - fWindow->Frame().Height());
|
||||||
}
|
}
|
||||||
@@ -4477,7 +4475,7 @@ ServerWindow::_ResizeToFullScreen()
|
|||||||
status_t
|
status_t
|
||||||
ServerWindow::_EnableDirectWindowMode()
|
ServerWindow::_EnableDirectWindowMode()
|
||||||
{
|
{
|
||||||
if (fDirectWindowInfo != NULL) {
|
if (fDirectWindowInfo.Get() != NULL) {
|
||||||
// already in direct window mode
|
// already in direct window mode
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
@@ -4487,14 +4485,13 @@ ServerWindow::_EnableDirectWindowMode()
|
|||||||
return B_UNSUPPORTED;
|
return B_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
fDirectWindowInfo = new(std::nothrow) DirectWindowInfo;
|
fDirectWindowInfo.SetTo(new(std::nothrow) DirectWindowInfo);
|
||||||
if (fDirectWindowInfo == NULL)
|
if (fDirectWindowInfo.Get() == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
status_t status = fDirectWindowInfo->InitCheck();
|
status_t status = fDirectWindowInfo->InitCheck();
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
delete fDirectWindowInfo;
|
fDirectWindowInfo.Unset();
|
||||||
fDirectWindowInfo = NULL;
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -4519,15 +4516,15 @@ ServerWindow::_DirectWindowSetFullScreen(bool enable)
|
|||||||
fDirectWindowInfo->DisableFullScreen();
|
fDirectWindowInfo->DisableFullScreen();
|
||||||
|
|
||||||
// Resize window back to its original size
|
// Resize window back to its original size
|
||||||
fDesktop->MoveWindowBy(fWindow,
|
fDesktop->MoveWindowBy(fWindow.Get(),
|
||||||
originalFrame.left - fWindow->Frame().left,
|
originalFrame.left - fWindow->Frame().left,
|
||||||
originalFrame.top - fWindow->Frame().top);
|
originalFrame.top - fWindow->Frame().top);
|
||||||
fDesktop->ResizeWindowBy(fWindow,
|
fDesktop->ResizeWindowBy(fWindow.Get(),
|
||||||
originalFrame.Width() - fWindow->Frame().Width(),
|
originalFrame.Width() - fWindow->Frame().Width(),
|
||||||
originalFrame.Height() - fWindow->Frame().Height());
|
originalFrame.Height() - fWindow->Frame().Height());
|
||||||
|
|
||||||
fDesktop->HWInterface()->SetCursorVisible(true);
|
fDesktop->HWInterface()->SetCursorVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
fDesktop->SetWindowFeel(fWindow, feel);
|
fDesktop->SetWindowFeel(fWindow.Get(), feel);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#define SERVER_WINDOW_H
|
#define SERVER_WINDOW_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
#include <GraphicsDefs.h>
|
#include <GraphicsDefs.h>
|
||||||
#include <Locker.h>
|
#include <Locker.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
@@ -106,7 +107,7 @@ public:
|
|||||||
void HandleDirectConnection(int32 bufferState,
|
void HandleDirectConnection(int32 bufferState,
|
||||||
int32 driverState = 0);
|
int32 driverState = 0);
|
||||||
bool HasDirectFrameBufferAccess() const
|
bool HasDirectFrameBufferAccess() const
|
||||||
{ return fDirectWindowInfo != NULL; }
|
{ return fDirectWindowInfo.Get() != NULL; }
|
||||||
bool IsDirectlyAccessing() const
|
bool IsDirectlyAccessing() const
|
||||||
{ return fIsDirectlyAccessing; }
|
{ return fIsDirectlyAccessing; }
|
||||||
|
|
||||||
@@ -152,7 +153,8 @@ private:
|
|||||||
|
|
||||||
::Desktop* fDesktop;
|
::Desktop* fDesktop;
|
||||||
ServerApp* fServerApp;
|
ServerApp* fServerApp;
|
||||||
::Window* fWindow;
|
ObjectDeleter< ::Window>
|
||||||
|
fWindow;
|
||||||
bool fWindowAddedToDesktop;
|
bool fWindowAddedToDesktop;
|
||||||
|
|
||||||
team_id fClientTeam;
|
team_id fClientTeam;
|
||||||
@@ -173,7 +175,8 @@ private:
|
|||||||
BRegion fCurrentDrawingRegion;
|
BRegion fCurrentDrawingRegion;
|
||||||
bool fCurrentDrawingRegionValid;
|
bool fCurrentDrawingRegionValid;
|
||||||
|
|
||||||
DirectWindowInfo* fDirectWindowInfo;
|
ObjectDeleter<DirectWindowInfo>
|
||||||
|
fDirectWindowInfo;
|
||||||
bool fIsDirectlyAccessing;
|
bool fIsDirectlyAccessing;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+21
-26
@@ -90,8 +90,6 @@ Window::Window(const BRect& frame, const char *name,
|
|||||||
|
|
||||||
fRegionPool(),
|
fRegionPool(),
|
||||||
|
|
||||||
fWindowBehaviour(NULL),
|
|
||||||
fTopView(NULL),
|
|
||||||
fWindow(window),
|
fWindow(window),
|
||||||
fDrawingEngine(drawingEngine),
|
fDrawingEngine(drawingEngine),
|
||||||
fDesktop(window->Desktop()),
|
fDesktop(window->Desktop()),
|
||||||
@@ -140,7 +138,7 @@ Window::Window(const BRect& frame, const char *name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fFeel != kOffscreenWindowFeel)
|
if (fFeel != kOffscreenWindowFeel)
|
||||||
fWindowBehaviour = gDecorManager.AllocateWindowBehaviour(this);
|
fWindowBehaviour.SetTo(gDecorManager.AllocateWindowBehaviour(this));
|
||||||
|
|
||||||
// do we need to change our size to let the decorator fit?
|
// do we need to change our size to let the decorator fit?
|
||||||
// _ResizeBy() will adapt the frame for validity before resizing
|
// _ResizeBy() will adapt the frame for validity before resizing
|
||||||
@@ -169,16 +167,12 @@ Window::Window(const BRect& frame, const char *name,
|
|||||||
|
|
||||||
Window::~Window()
|
Window::~Window()
|
||||||
{
|
{
|
||||||
if (fTopView) {
|
if (fTopView.Get() != NULL) {
|
||||||
fTopView->DetachedFromWindow();
|
fTopView->DetachedFromWindow();
|
||||||
delete fTopView;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DetachFromWindowStack(false);
|
DetachFromWindowStack(false);
|
||||||
|
|
||||||
delete fWindowBehaviour;
|
|
||||||
delete fDrawingEngine;
|
|
||||||
|
|
||||||
gDecorManager.CleanupForWindow(this);
|
gDecorManager.CleanupForWindow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,8 +180,8 @@ Window::~Window()
|
|||||||
status_t
|
status_t
|
||||||
Window::InitCheck() const
|
Window::InitCheck() const
|
||||||
{
|
{
|
||||||
if (fDrawingEngine == NULL
|
if (GetDrawingEngine() == NULL
|
||||||
|| (fFeel != kOffscreenWindowFeel && fWindowBehaviour == NULL))
|
|| (fFeel != kOffscreenWindowFeel && fWindowBehaviour.Get() == NULL))
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
// TODO: anything else?
|
// TODO: anything else?
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -304,7 +298,7 @@ Window::MoveBy(int32 x, int32 y, bool moveStack)
|
|||||||
|
|
||||||
fEffectiveDrawingRegionValid = false;
|
fEffectiveDrawingRegionValid = false;
|
||||||
|
|
||||||
if (fTopView != NULL) {
|
if (fTopView.Get() != NULL) {
|
||||||
fTopView->MoveBy(x, y, NULL);
|
fTopView->MoveBy(x, y, NULL);
|
||||||
fTopView->UpdateOverlay();
|
fTopView->UpdateOverlay();
|
||||||
}
|
}
|
||||||
@@ -371,7 +365,7 @@ Window::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion, bool resizeStack)
|
|||||||
fContentRegionValid = false;
|
fContentRegionValid = false;
|
||||||
fEffectiveDrawingRegionValid = false;
|
fEffectiveDrawingRegionValid = false;
|
||||||
|
|
||||||
if (fTopView != NULL) {
|
if (fTopView.Get() != NULL) {
|
||||||
fTopView->ResizeBy(x, y, dirtyRegion);
|
fTopView->ResizeBy(x, y, dirtyRegion);
|
||||||
fTopView->UpdateOverlay();
|
fTopView->UpdateOverlay();
|
||||||
}
|
}
|
||||||
@@ -405,7 +399,7 @@ Window::ScrollViewBy(View* view, int32 dx, int32 dy)
|
|||||||
// this is executed in ServerWindow with the Readlock
|
// this is executed in ServerWindow with the Readlock
|
||||||
// held
|
// held
|
||||||
|
|
||||||
if (!view || view == fTopView || (dx == 0 && dy == 0))
|
if (!view || view == fTopView.Get() || (dx == 0 && dy == 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BRegion* dirty = fRegionPool.GetRegion();
|
BRegion* dirty = fRegionPool.GetRegion();
|
||||||
@@ -521,9 +515,13 @@ Window::CopyContents(BRegion* region, int32 xOffset, int32 yOffset)
|
|||||||
void
|
void
|
||||||
Window::SetTopView(View* topView)
|
Window::SetTopView(View* topView)
|
||||||
{
|
{
|
||||||
fTopView = topView;
|
if (fTopView.Get() != NULL) {
|
||||||
|
fTopView->DetachedFromWindow();
|
||||||
|
}
|
||||||
|
|
||||||
if (fTopView) {
|
fTopView.SetTo(topView);
|
||||||
|
|
||||||
|
if (fTopView.Get() != NULL) {
|
||||||
// the top view is special, it has a coordinate system
|
// the top view is special, it has a coordinate system
|
||||||
// as if it was attached directly to the desktop, therefor,
|
// as if it was attached directly to the desktop, therefor,
|
||||||
// the coordinate conversion through the view tree works
|
// the coordinate conversion through the view tree works
|
||||||
@@ -621,8 +619,7 @@ Window::ReloadDecor()
|
|||||||
|
|
||||||
stack->SetDecorator(decorator);
|
stack->SetDecorator(decorator);
|
||||||
|
|
||||||
delete fWindowBehaviour;
|
fWindowBehaviour.SetTo(windowBehaviour);
|
||||||
fWindowBehaviour = windowBehaviour;
|
|
||||||
|
|
||||||
// set the correct focus and top layer tab
|
// set the correct focus and top layer tab
|
||||||
for (int32 i = 0; i < stack->CountWindows(); i++) {
|
for (int32 i = 0; i < stack->CountWindows(); i++) {
|
||||||
@@ -1121,7 +1118,7 @@ Window::IsVisible() const
|
|||||||
bool
|
bool
|
||||||
Window::IsDragging() const
|
Window::IsDragging() const
|
||||||
{
|
{
|
||||||
if (!fWindowBehaviour)
|
if (fWindowBehaviour.Get() == NULL)
|
||||||
return false;
|
return false;
|
||||||
return fWindowBehaviour->IsDragging();
|
return fWindowBehaviour->IsDragging();
|
||||||
}
|
}
|
||||||
@@ -1130,7 +1127,7 @@ Window::IsDragging() const
|
|||||||
bool
|
bool
|
||||||
Window::IsResizing() const
|
Window::IsResizing() const
|
||||||
{
|
{
|
||||||
if (!fWindowBehaviour)
|
if (fWindowBehaviour.Get() == NULL)
|
||||||
return false;
|
return false;
|
||||||
return fWindowBehaviour->IsResizing();
|
return fWindowBehaviour->IsResizing();
|
||||||
}
|
}
|
||||||
@@ -1917,7 +1914,7 @@ Window::BeginUpdate(BPrivate::PortLink& link)
|
|||||||
if (fDrawingEngine->LockParallelAccess()) {
|
if (fDrawingEngine->LockParallelAccess()) {
|
||||||
fDrawingEngine->SuspendAutoSync();
|
fDrawingEngine->SuspendAutoSync();
|
||||||
|
|
||||||
fTopView->Draw(fDrawingEngine, dirty, &fContentRegion, true);
|
fTopView->Draw(GetDrawingEngine(), dirty, &fContentRegion, true);
|
||||||
|
|
||||||
fDrawingEngine->Sync();
|
fDrawingEngine->Sync();
|
||||||
fDrawingEngine->UnlockParallelAccess();
|
fDrawingEngine->UnlockParallelAccess();
|
||||||
@@ -2108,7 +2105,7 @@ Window::DetachFromWindowStack(bool ownStackNeeded)
|
|||||||
Window* remainingTop = fCurrentStack->TopLayerWindow();
|
Window* remainingTop = fCurrentStack->TopLayerWindow();
|
||||||
if (remainingTop != NULL) {
|
if (remainingTop != NULL) {
|
||||||
if (decorator != NULL)
|
if (decorator != NULL)
|
||||||
decorator->SetDrawingEngine(remainingTop->fDrawingEngine);
|
decorator->SetDrawingEngine(remainingTop->GetDrawingEngine());
|
||||||
// propagate focus to the decorator
|
// propagate focus to the decorator
|
||||||
remainingTop->SetFocus(remainingTop->IsFocus());
|
remainingTop->SetFocus(remainingTop->IsFocus());
|
||||||
remainingTop->SetLook(remainingTop->Look(), NULL);
|
remainingTop->SetLook(remainingTop->Look(), NULL);
|
||||||
@@ -2220,7 +2217,7 @@ Window::MoveToTopStackLayer()
|
|||||||
::Decorator* decorator = Decorator();
|
::Decorator* decorator = Decorator();
|
||||||
if (decorator == NULL)
|
if (decorator == NULL)
|
||||||
return false;
|
return false;
|
||||||
decorator->SetDrawingEngine(fDrawingEngine);
|
decorator->SetDrawingEngine(GetDrawingEngine());
|
||||||
SetLook(Look(), NULL);
|
SetLook(Look(), NULL);
|
||||||
decorator->SetTopTab(PositionInStack());
|
decorator->SetTopTab(PositionInStack());
|
||||||
return fCurrentStack->MoveToTopLayer(this);
|
return fCurrentStack->MoveToTopLayer(this);
|
||||||
@@ -2277,22 +2274,20 @@ WindowStack::WindowStack(::Decorator* decorator)
|
|||||||
|
|
||||||
WindowStack::~WindowStack()
|
WindowStack::~WindowStack()
|
||||||
{
|
{
|
||||||
delete fDecorator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowStack::SetDecorator(::Decorator* decorator)
|
WindowStack::SetDecorator(::Decorator* decorator)
|
||||||
{
|
{
|
||||||
delete fDecorator;
|
fDecorator.SetTo(decorator);
|
||||||
fDecorator = decorator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
::Decorator*
|
::Decorator*
|
||||||
WindowStack::Decorator()
|
WindowStack::Decorator()
|
||||||
{
|
{
|
||||||
return fDecorator;
|
return fDecorator.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "View.h"
|
#include "View.h"
|
||||||
#include "WindowList.h"
|
#include "WindowList.h"
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
#include <ObjectList.h>
|
#include <ObjectList.h>
|
||||||
#include <Referenceable.h>
|
#include <Referenceable.h>
|
||||||
#include <Region.h>
|
#include <Region.h>
|
||||||
@@ -53,7 +54,8 @@ public:
|
|||||||
bool MoveToTopLayer(Window* window);
|
bool MoveToTopLayer(Window* window);
|
||||||
bool Move(int32 from, int32 to);
|
bool Move(int32 from, int32 to);
|
||||||
private:
|
private:
|
||||||
::Decorator* fDecorator;
|
ObjectDeleter< ::Decorator>
|
||||||
|
fDecorator;
|
||||||
|
|
||||||
StackWindows fWindowList;
|
StackWindows fWindowList;
|
||||||
StackWindows fWindowLayerOrder;
|
StackWindows fWindowLayerOrder;
|
||||||
@@ -133,7 +135,7 @@ public:
|
|||||||
void ScrollViewBy(View* view, int32 dx, int32 dy);
|
void ScrollViewBy(View* view, int32 dx, int32 dy);
|
||||||
|
|
||||||
void SetTopView(View* topView);
|
void SetTopView(View* topView);
|
||||||
View* TopView() const { return fTopView; }
|
View* TopView() const { return fTopView.Get(); }
|
||||||
View* ViewAt(const BPoint& where);
|
View* ViewAt(const BPoint& where);
|
||||||
|
|
||||||
virtual bool IsOffscreenWindow() const { return false; }
|
virtual bool IsOffscreenWindow() const { return false; }
|
||||||
@@ -167,7 +169,7 @@ public:
|
|||||||
{ return fUpdateRequested; }
|
{ return fUpdateRequested; }
|
||||||
|
|
||||||
DrawingEngine* GetDrawingEngine() const
|
DrawingEngine* GetDrawingEngine() const
|
||||||
{ return fDrawingEngine; }
|
{ return fDrawingEngine.Get(); }
|
||||||
|
|
||||||
// managing a region pool
|
// managing a region pool
|
||||||
::RegionPool* RegionPool()
|
::RegionPool* RegionPool()
|
||||||
@@ -362,10 +364,12 @@ protected:
|
|||||||
|
|
||||||
BObjectList<Window> fSubsets;
|
BObjectList<Window> fSubsets;
|
||||||
|
|
||||||
WindowBehaviour* fWindowBehaviour;
|
ObjectDeleter<WindowBehaviour>
|
||||||
View* fTopView;
|
fWindowBehaviour;
|
||||||
|
ObjectDeleter<View> fTopView;
|
||||||
::ServerWindow* fWindow;
|
::ServerWindow* fWindow;
|
||||||
DrawingEngine* fDrawingEngine;
|
ObjectDeleter<DrawingEngine>
|
||||||
|
fDrawingEngine;
|
||||||
::Desktop* fDesktop;
|
::Desktop* fDesktop;
|
||||||
|
|
||||||
// The synchronization, which client drawing commands
|
// The synchronization, which client drawing commands
|
||||||
|
|||||||
@@ -685,7 +685,6 @@ DefaultWindowBehaviour::DefaultWindowBehaviour(Window* window)
|
|||||||
:
|
:
|
||||||
fWindow(window),
|
fWindow(window),
|
||||||
fDesktop(window->Desktop()),
|
fDesktop(window->Desktop()),
|
||||||
fState(NULL),
|
|
||||||
fLastModifiers(0)
|
fLastModifiers(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -693,7 +692,6 @@ DefaultWindowBehaviour::DefaultWindowBehaviour(Window* window)
|
|||||||
|
|
||||||
DefaultWindowBehaviour::~DefaultWindowBehaviour()
|
DefaultWindowBehaviour::~DefaultWindowBehaviour()
|
||||||
{
|
{
|
||||||
delete fState;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -726,7 +724,7 @@ DefaultWindowBehaviour::MouseDown(BMessage* message, BPoint where,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if a state is active, let it do the job
|
// if a state is active, let it do the job
|
||||||
if (fState != NULL) {
|
if (fState.Get() != NULL) {
|
||||||
bool unhandled = false;
|
bool unhandled = false;
|
||||||
bool result = fState->MouseDown(message, where, unhandled);
|
bool result = fState->MouseDown(message, where, unhandled);
|
||||||
if (!unhandled)
|
if (!unhandled)
|
||||||
@@ -919,7 +917,7 @@ DefaultWindowBehaviour::MouseDown(BMessage* message, BPoint where,
|
|||||||
void
|
void
|
||||||
DefaultWindowBehaviour::MouseUp(BMessage* message, BPoint where)
|
DefaultWindowBehaviour::MouseUp(BMessage* message, BPoint where)
|
||||||
{
|
{
|
||||||
if (fState != NULL)
|
if (fState.Get() != NULL)
|
||||||
fState->MouseUp(message, where);
|
fState->MouseUp(message, where);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -927,7 +925,7 @@ DefaultWindowBehaviour::MouseUp(BMessage* message, BPoint where)
|
|||||||
void
|
void
|
||||||
DefaultWindowBehaviour::MouseMoved(BMessage* message, BPoint where, bool isFake)
|
DefaultWindowBehaviour::MouseMoved(BMessage* message, BPoint where, bool isFake)
|
||||||
{
|
{
|
||||||
if (fState != NULL) {
|
if (fState.Get() != NULL) {
|
||||||
fState->MouseMoved(message, where, isFake);
|
fState->MouseMoved(message, where, isFake);
|
||||||
} else {
|
} else {
|
||||||
// If the window modifiers are hold, enter the window management state.
|
// If the window modifiers are hold, enter the window management state.
|
||||||
@@ -954,7 +952,7 @@ DefaultWindowBehaviour::ModifiersChanged(int32 modifiers)
|
|||||||
int32 buttons;
|
int32 buttons;
|
||||||
fDesktop->GetLastMouseState(&where, &buttons);
|
fDesktop->GetLastMouseState(&where, &buttons);
|
||||||
|
|
||||||
if (fState != NULL) {
|
if (fState.Get() != NULL) {
|
||||||
fState->ModifiersChanged(where, modifiers);
|
fState->ModifiersChanged(where, modifiers);
|
||||||
} else {
|
} else {
|
||||||
// If the window modifiers are hold, enter the window management state.
|
// If the window modifiers are hold, enter the window management state.
|
||||||
@@ -1166,21 +1164,19 @@ void
|
|||||||
DefaultWindowBehaviour::_NextState(State* state)
|
DefaultWindowBehaviour::_NextState(State* state)
|
||||||
{
|
{
|
||||||
// exit the old state
|
// exit the old state
|
||||||
if (fState != NULL)
|
if (fState.Get() != NULL)
|
||||||
fState->ExitState(state);
|
fState->ExitState(state);
|
||||||
|
|
||||||
// set and enter the new state
|
// set and enter the new state
|
||||||
State* oldState = fState;
|
ObjectDeleter<State> oldState(fState.Detach());
|
||||||
fState = state;
|
fState.SetTo(state);
|
||||||
|
|
||||||
if (fState != NULL) {
|
if (fState.Get() != NULL) {
|
||||||
fState->EnterState(oldState);
|
fState->EnterState(oldState.Get());
|
||||||
fDesktop->SetMouseEventWindow(fWindow);
|
fDesktop->SetMouseEventWindow(fWindow);
|
||||||
} else if (oldState != NULL) {
|
} else if (oldState.Get() != NULL) {
|
||||||
// no state anymore -- reset the mouse event window, if it's still us
|
// no state anymore -- reset the mouse event window, if it's still us
|
||||||
if (fDesktop->MouseEventWindow() == fWindow)
|
if (fDesktop->MouseEventWindow() == fWindow)
|
||||||
fDesktop->SetMouseEventWindow(NULL);
|
fDesktop->SetMouseEventWindow(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete oldState;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
#include "MagneticBorder.h"
|
#include "MagneticBorder.h"
|
||||||
#include "ServerCursor.h"
|
#include "ServerCursor.h"
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
|
|
||||||
|
|
||||||
class Desktop;
|
class Desktop;
|
||||||
class Window;
|
class Window;
|
||||||
@@ -107,7 +109,8 @@ private:
|
|||||||
protected:
|
protected:
|
||||||
Window* fWindow;
|
Window* fWindow;
|
||||||
Desktop* fDesktop;
|
Desktop* fDesktop;
|
||||||
State* fState;
|
ObjectDeleter<State>
|
||||||
|
fState;
|
||||||
int32 fLastModifiers;
|
int32 fLastModifiers;
|
||||||
|
|
||||||
MagneticBorder fMagneticBorder;
|
MagneticBorder fMagneticBorder;
|
||||||
|
|||||||
@@ -394,7 +394,6 @@ PictureAlphaMask::PictureAlphaMask(AlphaMask* previousMask,
|
|||||||
|
|
||||||
PictureAlphaMask::~PictureAlphaMask()
|
PictureAlphaMask::~PictureAlphaMask()
|
||||||
{
|
{
|
||||||
delete fDrawState;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -409,7 +408,7 @@ BRect
|
|||||||
PictureAlphaMask::DetermineBoundingBox() const
|
PictureAlphaMask::DetermineBoundingBox() const
|
||||||
{
|
{
|
||||||
BRect boundingBox;
|
BRect boundingBox;
|
||||||
PictureBoundingBoxPlayer::Play(fPicture, fDrawState, &boundingBox);
|
PictureBoundingBoxPlayer::Play(fPicture, fDrawState.Get(), &boundingBox);
|
||||||
|
|
||||||
if (!boundingBox.IsValid())
|
if (!boundingBox.IsValid())
|
||||||
return boundingBox;
|
return boundingBox;
|
||||||
@@ -428,7 +427,7 @@ PictureAlphaMask::DetermineBoundingBox() const
|
|||||||
const DrawState&
|
const DrawState&
|
||||||
PictureAlphaMask::GetDrawState() const
|
PictureAlphaMask::GetDrawState() const
|
||||||
{
|
{
|
||||||
return *fDrawState;
|
return *fDrawState.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
BReference<ServerPicture> fPicture;
|
BReference<ServerPicture> fPicture;
|
||||||
DrawState* fDrawState;
|
ObjectDeleter<DrawState> fDrawState;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ BBitmapBuffer::BBitmapBuffer(BBitmap* bitmap)
|
|||||||
// destructor
|
// destructor
|
||||||
BBitmapBuffer::~BBitmapBuffer()
|
BBitmapBuffer::~BBitmapBuffer()
|
||||||
{
|
{
|
||||||
delete fBitmap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitCheck
|
// InitCheck
|
||||||
@@ -21,7 +20,7 @@ status_t
|
|||||||
BBitmapBuffer::InitCheck() const
|
BBitmapBuffer::InitCheck() const
|
||||||
{
|
{
|
||||||
status_t ret = B_NO_INIT;
|
status_t ret = B_NO_INIT;
|
||||||
if (fBitmap)
|
if (fBitmap.Get() != NULL)
|
||||||
ret = fBitmap->InitCheck();
|
ret = fBitmap->InitCheck();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include "RenderingBuffer.h"
|
#include "RenderingBuffer.h"
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
|
|
||||||
class BBitmap;
|
class BBitmap;
|
||||||
|
|
||||||
class BBitmapBuffer : public RenderingBuffer {
|
class BBitmapBuffer : public RenderingBuffer {
|
||||||
@@ -22,10 +24,11 @@ class BBitmapBuffer : public RenderingBuffer {
|
|||||||
|
|
||||||
// BBitmapBuffer
|
// BBitmapBuffer
|
||||||
const BBitmap* Bitmap() const
|
const BBitmap* Bitmap() const
|
||||||
{ return fBitmap; }
|
{ return fBitmap.Get(); }
|
||||||
private:
|
private:
|
||||||
|
|
||||||
BBitmap* fBitmap;
|
ObjectDeleter<BBitmap>
|
||||||
|
fBitmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // B_BITMAP_BUFFER_H
|
#endif // B_BITMAP_BUFFER_H
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ BitmapHWInterface::BitmapHWInterface(ServerBitmap* bitmap)
|
|||||||
|
|
||||||
BitmapHWInterface::~BitmapHWInterface()
|
BitmapHWInterface::~BitmapHWInterface()
|
||||||
{
|
{
|
||||||
delete fBackBuffer;
|
|
||||||
delete fFrontBuffer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -56,12 +54,11 @@ BitmapHWInterface::Initialize()
|
|||||||
&& fFrontBuffer->ColorSpace() != B_RGBA32) {
|
&& fFrontBuffer->ColorSpace() != B_RGBA32) {
|
||||||
BBitmap* backBitmap = new BBitmap(fFrontBuffer->Bounds(),
|
BBitmap* backBitmap = new BBitmap(fFrontBuffer->Bounds(),
|
||||||
B_BITMAP_NO_SERVER_LINK, B_RGBA32);
|
B_BITMAP_NO_SERVER_LINK, B_RGBA32);
|
||||||
fBackBuffer = new BBitmapBuffer(backBitmap);
|
fBackBuffer.SetTo(new BBitmapBuffer(backBitmap));
|
||||||
|
|
||||||
ret = fBackBuffer->InitCheck();
|
ret = fBackBuffer->InitCheck();
|
||||||
if (ret < B_OK) {
|
if (ret < B_OK) {
|
||||||
delete fBackBuffer;
|
fBackBuffer.Unset();
|
||||||
fBackBuffer = NULL;
|
|
||||||
} else {
|
} else {
|
||||||
// import the current contents of the bitmap
|
// import the current contents of the bitmap
|
||||||
// into the back bitmap
|
// into the back bitmap
|
||||||
@@ -193,14 +190,14 @@ BitmapHWInterface::GetBrightness(float*)
|
|||||||
RenderingBuffer*
|
RenderingBuffer*
|
||||||
BitmapHWInterface::FrontBuffer() const
|
BitmapHWInterface::FrontBuffer() const
|
||||||
{
|
{
|
||||||
return fFrontBuffer;
|
return fFrontBuffer.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RenderingBuffer*
|
RenderingBuffer*
|
||||||
BitmapHWInterface::BackBuffer() const
|
BitmapHWInterface::BackBuffer() const
|
||||||
{
|
{
|
||||||
return fBackBuffer;
|
return fBackBuffer.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -208,8 +205,8 @@ bool
|
|||||||
BitmapHWInterface::IsDoubleBuffered() const
|
BitmapHWInterface::IsDoubleBuffered() const
|
||||||
{
|
{
|
||||||
// overwrite double buffered preference
|
// overwrite double buffered preference
|
||||||
if (fFrontBuffer)
|
if (fFrontBuffer.Get() != NULL)
|
||||||
return fBackBuffer != NULL;
|
return fBackBuffer.Get() != NULL;
|
||||||
|
|
||||||
return HWInterface::IsDoubleBuffered();
|
return HWInterface::IsDoubleBuffered();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
#include "HWInterface.h"
|
#include "HWInterface.h"
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
|
|
||||||
class BitmapBuffer;
|
class BitmapBuffer;
|
||||||
class MallocBuffer;
|
class MallocBuffer;
|
||||||
class ServerBitmap;
|
class ServerBitmap;
|
||||||
@@ -60,8 +62,10 @@ public:
|
|||||||
virtual bool IsDoubleBuffered() const;
|
virtual bool IsDoubleBuffered() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BBitmapBuffer* fBackBuffer;
|
ObjectDeleter<BBitmapBuffer>
|
||||||
BitmapBuffer* fFrontBuffer;
|
fBackBuffer;
|
||||||
|
ObjectDeleter<BitmapBuffer>
|
||||||
|
fFrontBuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BITMAP_HW_INTERFACE_H
|
#endif // BITMAP_HW_INTERFACE_H
|
||||||
|
|||||||
@@ -356,8 +356,6 @@ DWindowHWInterface::~DWindowHWInterface()
|
|||||||
delete[] fRectParams;
|
delete[] fRectParams;
|
||||||
delete[] fBlitParams;
|
delete[] fBlitParams;
|
||||||
|
|
||||||
delete fFrontBuffer;
|
|
||||||
|
|
||||||
be_app->Lock();
|
be_app->Lock();
|
||||||
be_app->Quit();
|
be_app->Quit();
|
||||||
delete be_app;
|
delete be_app;
|
||||||
@@ -655,7 +653,7 @@ DWindowHWInterface::SetMode(const display_mode& mode)
|
|||||||
|
|
||||||
status_t ret = B_OK;
|
status_t ret = B_OK;
|
||||||
// prevent from doing the unnecessary
|
// prevent from doing the unnecessary
|
||||||
if (fFrontBuffer
|
if (fFrontBuffer.Get() != NULL
|
||||||
&& fDisplayMode.virtual_width == mode.virtual_width
|
&& fDisplayMode.virtual_width == mode.virtual_width
|
||||||
&& fDisplayMode.virtual_height == mode.virtual_height
|
&& fDisplayMode.virtual_height == mode.virtual_height
|
||||||
&& fDisplayMode.space == mode.space)
|
&& fDisplayMode.space == mode.space)
|
||||||
@@ -709,7 +707,7 @@ DWindowHWInterface::SetMode(const display_mode& mode)
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
fWindow = new DWindow(frame.OffsetByCopy(fXOffset, fYOffset), this,
|
fWindow = new DWindow(frame.OffsetByCopy(fXOffset, fYOffset), this,
|
||||||
fFrontBuffer);
|
fFrontBuffer.Get());
|
||||||
|
|
||||||
// fire up the window thread but don't show it on screen yet
|
// fire up the window thread but don't show it on screen yet
|
||||||
fWindow->Hide();
|
fWindow->Hide();
|
||||||
@@ -774,7 +772,7 @@ DWindowHWInterface::GetDeviceInfo(accelerant_device_info* info)
|
|||||||
status_t
|
status_t
|
||||||
DWindowHWInterface::GetFrameBufferConfig(frame_buffer_config& config)
|
DWindowHWInterface::GetFrameBufferConfig(frame_buffer_config& config)
|
||||||
{
|
{
|
||||||
if (fFrontBuffer == NULL)
|
if (fFrontBuffer.Get() == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
config.frame_buffer = fFrontBuffer->Bits();
|
config.frame_buffer = fFrontBuffer->Bits();
|
||||||
@@ -1071,14 +1069,14 @@ DWindowHWInterface::Sync()
|
|||||||
RenderingBuffer*
|
RenderingBuffer*
|
||||||
DWindowHWInterface::FrontBuffer() const
|
DWindowHWInterface::FrontBuffer() const
|
||||||
{
|
{
|
||||||
return fFrontBuffer;
|
return fFrontBuffer.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RenderingBuffer*
|
RenderingBuffer*
|
||||||
DWindowHWInterface::BackBuffer() const
|
DWindowHWInterface::BackBuffer() const
|
||||||
{
|
{
|
||||||
return fFrontBuffer;
|
return fFrontBuffer.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include "HWInterface.h"
|
#include "HWInterface.h"
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
#include <Accelerant.h>
|
#include <Accelerant.h>
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
#include <Region.h>
|
#include <Region.h>
|
||||||
@@ -81,7 +82,8 @@ public:
|
|||||||
void SetOffset(int32 left, int32 top);
|
void SetOffset(int32 left, int32 top);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DWindowBuffer* fFrontBuffer;
|
ObjectDeleter<DWindowBuffer>
|
||||||
|
fFrontBuffer;
|
||||||
|
|
||||||
DWindow* fWindow;
|
DWindow* fWindow;
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,6 @@ DrawingEngine::DrawingEngine(HWInterface* interface)
|
|||||||
DrawingEngine::~DrawingEngine()
|
DrawingEngine::~DrawingEngine()
|
||||||
{
|
{
|
||||||
SetHWInterface(NULL);
|
SetHWInterface(NULL);
|
||||||
delete fPainter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#define DRAWING_ENGINE_H_
|
#define DRAWING_ENGINE_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
#include <Accelerant.h>
|
#include <Accelerant.h>
|
||||||
#include <Font.h>
|
#include <Font.h>
|
||||||
#include <Locker.h>
|
#include <Locker.h>
|
||||||
@@ -206,7 +207,8 @@ private:
|
|||||||
|
|
||||||
inline void _CopyToFront(const BRect& frame);
|
inline void _CopyToFront(const BRect& frame);
|
||||||
|
|
||||||
Painter* fPainter;
|
ObjectDeleter<Painter>
|
||||||
|
fPainter;
|
||||||
HWInterface* fGraphicsCard;
|
HWInterface* fGraphicsCard;
|
||||||
uint32 fAvailableHWAccleration;
|
uint32 fAvailableHWAccleration;
|
||||||
int32 fSuspendSyncLevel;
|
int32 fSuspendSyncLevel;
|
||||||
|
|||||||
@@ -411,9 +411,6 @@ ViewHWInterface::~ViewHWInterface()
|
|||||||
fWindow->Quit();
|
fWindow->Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete fBackBuffer;
|
|
||||||
delete fFrontBuffer;
|
|
||||||
|
|
||||||
be_app->Lock();
|
be_app->Lock();
|
||||||
be_app->Quit();
|
be_app->Quit();
|
||||||
}
|
}
|
||||||
@@ -440,7 +437,7 @@ ViewHWInterface::SetMode(const display_mode& mode)
|
|||||||
|
|
||||||
status_t ret = B_OK;
|
status_t ret = B_OK;
|
||||||
// prevent from doing the unnecessary
|
// prevent from doing the unnecessary
|
||||||
if (fBackBuffer && fFrontBuffer
|
if (fBackBuffer.Get() != NULL && fFrontBuffer.Get() != NULL
|
||||||
&& fDisplayMode.virtual_width == mode.virtual_width
|
&& fDisplayMode.virtual_width == mode.virtual_width
|
||||||
&& fDisplayMode.virtual_height == mode.virtual_height
|
&& fDisplayMode.virtual_height == mode.virtual_height
|
||||||
&& fDisplayMode.space == mode.space)
|
&& fDisplayMode.space == mode.space)
|
||||||
@@ -508,9 +505,8 @@ ViewHWInterface::SetMode(const display_mode& mode)
|
|||||||
|
|
||||||
// free and reallocate the bitmaps while the window is locked,
|
// free and reallocate the bitmaps while the window is locked,
|
||||||
// so that the view does not accidentally draw a freed bitmap
|
// so that the view does not accidentally draw a freed bitmap
|
||||||
delete fBackBuffer;
|
fBackBuffer.Unset();
|
||||||
fBackBuffer = NULL;
|
fFrontBuffer.Unset();
|
||||||
delete fFrontBuffer;
|
|
||||||
|
|
||||||
// NOTE: backbuffer is always B_RGBA32, this simplifies the
|
// NOTE: backbuffer is always B_RGBA32, this simplifies the
|
||||||
// drawing backend implementation tremendously for the time
|
// drawing backend implementation tremendously for the time
|
||||||
@@ -526,12 +522,11 @@ ViewHWInterface::SetMode(const display_mode& mode)
|
|||||||
|
|
||||||
BBitmap* frontBitmap
|
BBitmap* frontBitmap
|
||||||
= new BBitmap(frame, 0, (color_space)fDisplayMode.space);
|
= new BBitmap(frame, 0, (color_space)fDisplayMode.space);
|
||||||
fFrontBuffer = new BBitmapBuffer(frontBitmap);
|
fFrontBuffer.SetTo(new BBitmapBuffer(frontBitmap));
|
||||||
|
|
||||||
status_t err = fFrontBuffer->InitCheck();
|
status_t err = fFrontBuffer->InitCheck();
|
||||||
if (err < B_OK) {
|
if (err < B_OK) {
|
||||||
delete fFrontBuffer;
|
fFrontBuffer.Unset();
|
||||||
fFrontBuffer = NULL;
|
|
||||||
ret = err;
|
ret = err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,12 +535,11 @@ ViewHWInterface::SetMode(const display_mode& mode)
|
|||||||
// since we override IsDoubleBuffered(), the drawing buffer
|
// since we override IsDoubleBuffered(), the drawing buffer
|
||||||
// is in effect also always B_RGBA32.
|
// is in effect also always B_RGBA32.
|
||||||
BBitmap* backBitmap = new BBitmap(frame, 0, B_RGBA32);
|
BBitmap* backBitmap = new BBitmap(frame, 0, B_RGBA32);
|
||||||
fBackBuffer = new BBitmapBuffer(backBitmap);
|
fBackBuffer.SetTo(new BBitmapBuffer(backBitmap));
|
||||||
|
|
||||||
err = fBackBuffer->InitCheck();
|
err = fBackBuffer->InitCheck();
|
||||||
if (err < B_OK) {
|
if (err < B_OK) {
|
||||||
delete fBackBuffer;
|
fBackBuffer.Unset();
|
||||||
fBackBuffer = NULL;
|
|
||||||
ret = err;
|
ret = err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -555,7 +549,7 @@ ViewHWInterface::SetMode(const display_mode& mode)
|
|||||||
if (ret >= B_OK) {
|
if (ret >= B_OK) {
|
||||||
// clear out buffers, alpha is 255 this way
|
// clear out buffers, alpha is 255 this way
|
||||||
// TODO: maybe this should handle different color spaces in different ways
|
// TODO: maybe this should handle different color spaces in different ways
|
||||||
if (fBackBuffer)
|
if (fBackBuffer.Get() != NULL)
|
||||||
memset(fBackBuffer->Bits(), 255, fBackBuffer->BitsLength());
|
memset(fBackBuffer->Bits(), 255, fBackBuffer->BitsLength());
|
||||||
memset(fFrontBuffer->Bits(), 255, fFrontBuffer->BitsLength());
|
memset(fFrontBuffer->Bits(), 255, fFrontBuffer->BitsLength());
|
||||||
|
|
||||||
@@ -609,7 +603,7 @@ ViewHWInterface::GetDeviceInfo(accelerant_device_info* info)
|
|||||||
status_t
|
status_t
|
||||||
ViewHWInterface::GetFrameBufferConfig(frame_buffer_config& config)
|
ViewHWInterface::GetFrameBufferConfig(frame_buffer_config& config)
|
||||||
{
|
{
|
||||||
if (fFrontBuffer == NULL)
|
if (fFrontBuffer.Get() == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
config.frame_buffer = fFrontBuffer->Bits();
|
config.frame_buffer = fFrontBuffer->Bits();
|
||||||
@@ -769,22 +763,22 @@ ViewHWInterface::WaitForRetrace(bigtime_t timeout)
|
|||||||
RenderingBuffer*
|
RenderingBuffer*
|
||||||
ViewHWInterface::FrontBuffer() const
|
ViewHWInterface::FrontBuffer() const
|
||||||
{
|
{
|
||||||
return fFrontBuffer;
|
return fFrontBuffer.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RenderingBuffer*
|
RenderingBuffer*
|
||||||
ViewHWInterface::BackBuffer() const
|
ViewHWInterface::BackBuffer() const
|
||||||
{
|
{
|
||||||
return fBackBuffer;
|
return fBackBuffer.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ViewHWInterface::IsDoubleBuffered() const
|
ViewHWInterface::IsDoubleBuffered() const
|
||||||
{
|
{
|
||||||
if (fFrontBuffer)
|
if (fFrontBuffer.Get() != NULL)
|
||||||
return fBackBuffer != NULL;
|
return fBackBuffer.Get() != NULL;
|
||||||
|
|
||||||
return HWInterface::IsDoubleBuffered();
|
return HWInterface::IsDoubleBuffered();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "HWInterface.h"
|
#include "HWInterface.h"
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
|
|
||||||
class BBitmap;
|
class BBitmap;
|
||||||
class BBitmapBuffer;
|
class BBitmapBuffer;
|
||||||
@@ -63,8 +64,10 @@ public:
|
|||||||
virtual status_t CopyBackToFront(const BRect& frame);
|
virtual status_t CopyBackToFront(const BRect& frame);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BBitmapBuffer* fBackBuffer;
|
ObjectDeleter<BBitmapBuffer>
|
||||||
BBitmapBuffer* fFrontBuffer;
|
fBackBuffer;
|
||||||
|
ObjectDeleter<BBitmapBuffer>
|
||||||
|
fFrontBuffer;
|
||||||
|
|
||||||
CardWindow* fWindow;
|
CardWindow* fWindow;
|
||||||
|
|
||||||
|
|||||||
@@ -177,9 +177,6 @@ AccelerantHWInterface::AccelerantHWInterface()
|
|||||||
|
|
||||||
AccelerantHWInterface::~AccelerantHWInterface()
|
AccelerantHWInterface::~AccelerantHWInterface()
|
||||||
{
|
{
|
||||||
delete fBackBuffer;
|
|
||||||
delete fFrontBuffer;
|
|
||||||
|
|
||||||
delete[] fRectParams;
|
delete[] fRectParams;
|
||||||
delete[] fBlitParams;
|
delete[] fBlitParams;
|
||||||
|
|
||||||
@@ -567,7 +564,7 @@ AccelerantHWInterface::SetMode(const display_mode& mode)
|
|||||||
// error.
|
// error.
|
||||||
|
|
||||||
// prevent from doing the unnecessary
|
// prevent from doing the unnecessary
|
||||||
if (fModeCount > 0 && fFrontBuffer && fDisplayMode == mode) {
|
if (fModeCount > 0 && fFrontBuffer.Get() != NULL && fDisplayMode == mode) {
|
||||||
// TODO: better comparison of display modes
|
// TODO: better comparison of display modes
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -577,7 +574,7 @@ AccelerantHWInterface::SetMode(const display_mode& mode)
|
|||||||
if (!_IsValidMode(mode))
|
if (!_IsValidMode(mode))
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
if (fFrontBuffer == NULL)
|
if (fFrontBuffer.Get() == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
// just try to set the mode - we let the graphics driver
|
// just try to set the mode - we let the graphics driver
|
||||||
@@ -683,17 +680,17 @@ AccelerantHWInterface::SetMode(const display_mode& mode)
|
|||||||
fOffscreenBackBuffer = false;
|
fOffscreenBackBuffer = false;
|
||||||
|
|
||||||
// update backbuffer if neccessary
|
// update backbuffer if neccessary
|
||||||
if (!fBackBuffer || fBackBuffer->Width() != fFrontBuffer->Width()
|
if (fBackBuffer.Get() == NULL
|
||||||
|
|| fBackBuffer->Width() != fFrontBuffer->Width()
|
||||||
|| fBackBuffer->Height() != fFrontBuffer->Height()
|
|| fBackBuffer->Height() != fFrontBuffer->Height()
|
||||||
|| fOffscreenBackBuffer
|
|| fOffscreenBackBuffer
|
||||||
|| (fFrontBuffer->ColorSpace() == B_RGB32 && fBackBuffer != NULL
|
|| (fFrontBuffer->ColorSpace() == B_RGB32 && fBackBuffer.Get() != NULL
|
||||||
&& !HWInterface::IsDoubleBuffered())) {
|
&& !HWInterface::IsDoubleBuffered())) {
|
||||||
// NOTE: backbuffer is always B_RGBA32, this simplifies the
|
// NOTE: backbuffer is always B_RGBA32, this simplifies the
|
||||||
// drawing backend implementation tremendously for the time
|
// drawing backend implementation tremendously for the time
|
||||||
// being. The color space conversion is handled in CopyBackToFront()
|
// being. The color space conversion is handled in CopyBackToFront()
|
||||||
|
|
||||||
delete fBackBuffer;
|
fBackBuffer.Unset();
|
||||||
fBackBuffer = NULL;
|
|
||||||
|
|
||||||
// TODO: Above not true anymore for single buffered mode!!!
|
// TODO: Above not true anymore for single buffered mode!!!
|
||||||
// -> fall back to double buffer for fDisplayMode.space != B_RGB32
|
// -> fall back to double buffer for fDisplayMode.space != B_RGB32
|
||||||
@@ -709,17 +706,17 @@ AccelerantHWInterface::SetMode(const display_mode& mode)
|
|||||||
|
|
||||||
if (doubleBuffered) {
|
if (doubleBuffered) {
|
||||||
if (fOffscreenBackBuffer) {
|
if (fOffscreenBackBuffer) {
|
||||||
fBackBuffer = new(nothrow) AccelerantBuffer(*fFrontBuffer,
|
fBackBuffer.SetTo(
|
||||||
true);
|
new(nothrow) AccelerantBuffer(*fFrontBuffer.Get(), true));
|
||||||
} else {
|
} else {
|
||||||
fBackBuffer = new(nothrow) MallocBuffer(fFrontBuffer->Width(),
|
fBackBuffer.SetTo(new(nothrow) MallocBuffer(
|
||||||
fFrontBuffer->Height());
|
fFrontBuffer->Width(), fFrontBuffer->Height()));
|
||||||
}
|
}
|
||||||
|
|
||||||
status = fBackBuffer ? fBackBuffer->InitCheck() : B_NO_MEMORY;
|
status = fBackBuffer.Get() != NULL
|
||||||
|
? fBackBuffer->InitCheck() : B_NO_MEMORY;
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
delete fBackBuffer;
|
fBackBuffer.Unset();
|
||||||
fBackBuffer = NULL;
|
|
||||||
fOffscreenBackBuffer = false;
|
fOffscreenBackBuffer = false;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -1519,21 +1516,21 @@ AccelerantHWInterface::MoveCursorTo(float x, float y)
|
|||||||
RenderingBuffer*
|
RenderingBuffer*
|
||||||
AccelerantHWInterface::FrontBuffer() const
|
AccelerantHWInterface::FrontBuffer() const
|
||||||
{
|
{
|
||||||
return fFrontBuffer;
|
return fFrontBuffer.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RenderingBuffer*
|
RenderingBuffer*
|
||||||
AccelerantHWInterface::BackBuffer() const
|
AccelerantHWInterface::BackBuffer() const
|
||||||
{
|
{
|
||||||
return fBackBuffer;
|
return fBackBuffer.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
AccelerantHWInterface::IsDoubleBuffered() const
|
AccelerantHWInterface::IsDoubleBuffered() const
|
||||||
{
|
{
|
||||||
return fBackBuffer != NULL;
|
return fBackBuffer.Get() != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "HWInterface.h"
|
#include "HWInterface.h"
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
#include <video_overlay.h>
|
#include <video_overlay.h>
|
||||||
|
|
||||||
@@ -181,8 +182,10 @@ private:
|
|||||||
int fModeCount;
|
int fModeCount;
|
||||||
display_mode* fModeList;
|
display_mode* fModeList;
|
||||||
|
|
||||||
RenderingBuffer* fBackBuffer;
|
ObjectDeleter<RenderingBuffer>
|
||||||
AccelerantBuffer* fFrontBuffer;
|
fBackBuffer;
|
||||||
|
ObjectDeleter<AccelerantBuffer>
|
||||||
|
fFrontBuffer;
|
||||||
bool fOffscreenBackBuffer;
|
bool fOffscreenBackBuffer;
|
||||||
|
|
||||||
display_mode fDisplayMode;
|
display_mode fDisplayMode;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ NetReceiver::NetReceiver(BNetEndpoint *listener, StreamingRingBuffer *target,
|
|||||||
NetReceiver::~NetReceiver()
|
NetReceiver::~NetReceiver()
|
||||||
{
|
{
|
||||||
fStopThread = true;
|
fStopThread = true;
|
||||||
delete fEndpoint;
|
fEndpoint.Unset();
|
||||||
|
|
||||||
suspend_thread(fReceiverThread);
|
suspend_thread(fReceiverThread);
|
||||||
resume_thread(fReceiverThread);
|
resume_thread(fReceiverThread);
|
||||||
@@ -69,14 +69,8 @@ NetReceiver::_Listen()
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (!fStopThread) {
|
while (!fStopThread) {
|
||||||
if (fEndpoint != NULL) {
|
fEndpoint.SetTo(fListener->Accept(5000));
|
||||||
TRACE("closing previous connection\n");
|
if (fEndpoint.Get() == NULL) {
|
||||||
delete fEndpoint;
|
|
||||||
fEndpoint = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
fEndpoint = fListener->Accept(5000);
|
|
||||||
if (fEndpoint == NULL) {
|
|
||||||
TRACE("got NULL endpoint from accept\n");
|
TRACE("got NULL endpoint from accept\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -84,7 +78,8 @@ NetReceiver::_Listen()
|
|||||||
TRACE("new endpoint connection: %p\n", fEndpoint);
|
TRACE("new endpoint connection: %p\n", fEndpoint);
|
||||||
|
|
||||||
if (fNewConnectionCallback != NULL
|
if (fNewConnectionCallback != NULL
|
||||||
&& fNewConnectionCallback(fNewConnectionCookie, *fEndpoint) != B_OK)
|
&& fNewConnectionCallback(
|
||||||
|
fNewConnectionCookie, *fEndpoint.Get()) != B_OK)
|
||||||
{
|
{
|
||||||
TRACE("connection callback rejected connection\n");
|
TRACE("connection callback rejected connection\n");
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#ifndef NET_RECEIVER_H
|
#ifndef NET_RECEIVER_H
|
||||||
#define NET_RECEIVER_H
|
#define NET_RECEIVER_H
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ public:
|
|||||||
void *newConnectionCookie = NULL);
|
void *newConnectionCookie = NULL);
|
||||||
~NetReceiver();
|
~NetReceiver();
|
||||||
|
|
||||||
BNetEndpoint * Endpoint() { return fEndpoint; }
|
BNetEndpoint * Endpoint() { return fEndpoint.Get(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int32 _NetworkReceiverEntry(void *data);
|
static int32 _NetworkReceiverEntry(void *data);
|
||||||
@@ -41,7 +42,8 @@ static int32 _NetworkReceiverEntry(void *data);
|
|||||||
NewConnectionCallback fNewConnectionCallback;
|
NewConnectionCallback fNewConnectionCallback;
|
||||||
void * fNewConnectionCookie;
|
void * fNewConnectionCookie;
|
||||||
|
|
||||||
BNetEndpoint * fEndpoint;
|
ObjectDeleter<BNetEndpoint>
|
||||||
|
fEndpoint;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NET_RECEIVER_H
|
#endif // NET_RECEIVER_H
|
||||||
|
|||||||
@@ -49,8 +49,6 @@ RemoteDrawingEngine::~RemoteDrawingEngine()
|
|||||||
message.Add(fToken);
|
message.Add(fToken);
|
||||||
message.Flush();
|
message.Flush();
|
||||||
|
|
||||||
delete fBitmapDrawingEngine;
|
|
||||||
|
|
||||||
if (fCallbackAdded)
|
if (fCallbackAdded)
|
||||||
fHWInterface->RemoveCallback(fToken);
|
fHWInterface->RemoveCallback(fToken);
|
||||||
if (fResultNotify >= 0)
|
if (fResultNotify >= 0)
|
||||||
@@ -1109,10 +1107,10 @@ RemoteDrawingEngine::_ExtractBitmapRegions(ServerBitmap& bitmap, uint32 options,
|
|||||||
* (int32)(sourceRect.Height() + 1.5))) {
|
* (int32)(sourceRect.Height() + 1.5))) {
|
||||||
// the target bitmap is smaller than the source, scale it locally
|
// the target bitmap is smaller than the source, scale it locally
|
||||||
// and send over the smaller version to avoid sending any extra data
|
// and send over the smaller version to avoid sending any extra data
|
||||||
if (fBitmapDrawingEngine == NULL) {
|
if (fBitmapDrawingEngine.Get() == NULL) {
|
||||||
fBitmapDrawingEngine
|
fBitmapDrawingEngine.SetTo(
|
||||||
= new(std::nothrow) BitmapDrawingEngine(B_RGBA32);
|
new(std::nothrow) BitmapDrawingEngine(B_RGBA32));
|
||||||
if (fBitmapDrawingEngine == NULL)
|
if (fBitmapDrawingEngine.Get() == NULL)
|
||||||
result = B_NO_MEMORY;
|
result = B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
#include "RemoteHWInterface.h"
|
#include "RemoteHWInterface.h"
|
||||||
#include "ServerFont.h"
|
#include "ServerFont.h"
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
|
|
||||||
class BPoint;
|
class BPoint;
|
||||||
class BRect;
|
class BRect;
|
||||||
class BRegion;
|
class BRegion;
|
||||||
@@ -175,7 +177,7 @@ private:
|
|||||||
float fStringWidthResult;
|
float fStringWidthResult;
|
||||||
BBitmap* fReadBitmapResult;
|
BBitmap* fReadBitmapResult;
|
||||||
|
|
||||||
BitmapDrawingEngine*
|
ObjectDeleter<BitmapDrawingEngine>
|
||||||
fBitmapDrawingEngine;
|
fBitmapDrawingEngine;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ RemoteHWInterface::RemoteHWInterface(const char* target)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fListenEndpoint = new(std::nothrow) BNetEndpoint();
|
fListenEndpoint.SetTo(new(std::nothrow) BNetEndpoint());
|
||||||
if (fListenEndpoint == NULL) {
|
if (fListenEndpoint.Get() == NULL) {
|
||||||
fInitStatus = B_NO_MEMORY;
|
fInitStatus = B_NO_MEMORY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -76,8 +76,8 @@ RemoteHWInterface::RemoteHWInterface(const char* target)
|
|||||||
if (fInitStatus != B_OK)
|
if (fInitStatus != B_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fSendBuffer = new(std::nothrow) StreamingRingBuffer(16 * 1024);
|
fSendBuffer.SetTo(new(std::nothrow) StreamingRingBuffer(16 * 1024));
|
||||||
if (fSendBuffer == NULL) {
|
if (fSendBuffer.Get() == NULL) {
|
||||||
fInitStatus = B_NO_MEMORY;
|
fInitStatus = B_NO_MEMORY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -86,8 +86,8 @@ RemoteHWInterface::RemoteHWInterface(const char* target)
|
|||||||
if (fInitStatus != B_OK)
|
if (fInitStatus != B_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fReceiveBuffer = new(std::nothrow) StreamingRingBuffer(16 * 1024);
|
fReceiveBuffer.SetTo(new(std::nothrow) StreamingRingBuffer(16 * 1024));
|
||||||
if (fReceiveBuffer == NULL) {
|
if (fReceiveBuffer.Get() == NULL) {
|
||||||
fInitStatus = B_NO_MEMORY;
|
fInitStatus = B_NO_MEMORY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -96,15 +96,15 @@ RemoteHWInterface::RemoteHWInterface(const char* target)
|
|||||||
if (fInitStatus != B_OK)
|
if (fInitStatus != B_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fReceiver = new(std::nothrow) NetReceiver(fListenEndpoint, fReceiveBuffer,
|
fReceiver.SetTo(new(std::nothrow) NetReceiver(fListenEndpoint.Get(), fReceiveBuffer.Get(),
|
||||||
_NewConnectionCallback, this);
|
_NewConnectionCallback, this));
|
||||||
if (fReceiver == NULL) {
|
if (fReceiver.Get() == NULL) {
|
||||||
fInitStatus = B_NO_MEMORY;
|
fInitStatus = B_NO_MEMORY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fEventStream = new(std::nothrow) RemoteEventStream();
|
fEventStream.SetTo(new(std::nothrow) RemoteEventStream());
|
||||||
if (fEventStream == NULL) {
|
if (fEventStream.Get() == NULL) {
|
||||||
fInitStatus = B_NO_MEMORY;
|
fInitStatus = B_NO_MEMORY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -122,15 +122,16 @@ RemoteHWInterface::RemoteHWInterface(const char* target)
|
|||||||
|
|
||||||
RemoteHWInterface::~RemoteHWInterface()
|
RemoteHWInterface::~RemoteHWInterface()
|
||||||
{
|
{
|
||||||
delete fReceiver;
|
//TODO: check order
|
||||||
delete fReceiveBuffer;
|
fReceiver.Unset();
|
||||||
|
fReceiveBuffer.Unset();
|
||||||
|
|
||||||
delete fSendBuffer;
|
fSendBuffer.Unset();
|
||||||
delete fSender;
|
fSender.Unset();
|
||||||
|
|
||||||
delete fListenEndpoint;
|
fListenEndpoint.Unset();
|
||||||
|
|
||||||
delete fEventStream;
|
fEventStream.Unset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -159,7 +160,7 @@ RemoteHWInterface::CreateDrawingEngine()
|
|||||||
EventStream*
|
EventStream*
|
||||||
RemoteHWInterface::CreateEventStream()
|
RemoteHWInterface::CreateEventStream()
|
||||||
{
|
{
|
||||||
return fEventStream;
|
return fEventStream.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -230,7 +231,7 @@ RemoteHWInterface::_EventThreadEntry(void* data)
|
|||||||
status_t
|
status_t
|
||||||
RemoteHWInterface::_EventThread()
|
RemoteHWInterface::_EventThread()
|
||||||
{
|
{
|
||||||
RemoteMessage message(fReceiveBuffer, NULL);
|
RemoteMessage message(fReceiveBuffer.Get(), NULL);
|
||||||
while (true) {
|
while (true) {
|
||||||
uint16 code;
|
uint16 code;
|
||||||
status_t result = message.NextMessage(code);
|
status_t result = message.NextMessage(code);
|
||||||
@@ -252,7 +253,7 @@ RemoteHWInterface::_EventThread()
|
|||||||
switch (code) {
|
switch (code) {
|
||||||
case RP_INIT_CONNECTION:
|
case RP_INIT_CONNECTION:
|
||||||
{
|
{
|
||||||
RemoteMessage reply(NULL, fSendBuffer);
|
RemoteMessage reply(NULL, fSendBuffer.Get());
|
||||||
reply.Start(RP_INIT_CONNECTION);
|
reply.Start(RP_INIT_CONNECTION);
|
||||||
status_t result = reply.Flush();
|
status_t result = reply.Flush();
|
||||||
(void)result;
|
(void)result;
|
||||||
@@ -280,7 +281,7 @@ RemoteHWInterface::_EventThread()
|
|||||||
|
|
||||||
case RP_GET_SYSTEM_PALETTE:
|
case RP_GET_SYSTEM_PALETTE:
|
||||||
{
|
{
|
||||||
RemoteMessage reply(NULL, fSendBuffer);
|
RemoteMessage reply(NULL, fSendBuffer.Get());
|
||||||
reply.Start(RP_GET_SYSTEM_PALETTE_RESULT);
|
reply.Start(RP_GET_SYSTEM_PALETTE_RESULT);
|
||||||
|
|
||||||
const color_map *map = SystemColorMap();
|
const color_map *map = SystemColorMap();
|
||||||
@@ -325,10 +326,7 @@ RemoteHWInterface::_NewConnectionCallback(void *cookie, BNetEndpoint &endpoint)
|
|||||||
status_t
|
status_t
|
||||||
RemoteHWInterface::_NewConnection(BNetEndpoint &endpoint)
|
RemoteHWInterface::_NewConnection(BNetEndpoint &endpoint)
|
||||||
{
|
{
|
||||||
if (fSender != NULL) {
|
fSender.Unset();
|
||||||
delete fSender;
|
|
||||||
fSender = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
fSendBuffer->MakeEmpty();
|
fSendBuffer->MakeEmpty();
|
||||||
|
|
||||||
@@ -336,8 +334,8 @@ RemoteHWInterface::_NewConnection(BNetEndpoint &endpoint)
|
|||||||
if (sendEndpoint == NULL)
|
if (sendEndpoint == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
fSender = new(std::nothrow) NetSender(sendEndpoint, fSendBuffer);
|
fSender.SetTo(new(std::nothrow) NetSender(sendEndpoint, fSendBuffer.Get()));
|
||||||
if (fSender == NULL) {
|
if (fSender.Get() == NULL) {
|
||||||
delete sendEndpoint;
|
delete sendEndpoint;
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
@@ -350,13 +348,13 @@ void
|
|||||||
RemoteHWInterface::_Disconnect()
|
RemoteHWInterface::_Disconnect()
|
||||||
{
|
{
|
||||||
if (fIsConnected) {
|
if (fIsConnected) {
|
||||||
RemoteMessage message(NULL, fSendBuffer);
|
RemoteMessage message(NULL, fSendBuffer.Get());
|
||||||
message.Start(RP_CLOSE_CONNECTION);
|
message.Start(RP_CLOSE_CONNECTION);
|
||||||
message.Flush();
|
message.Flush();
|
||||||
fIsConnected = false;
|
fIsConnected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fListenEndpoint != NULL)
|
if (fListenEndpoint.Get() != NULL)
|
||||||
fListenEndpoint->Close();
|
fListenEndpoint->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,7 +515,7 @@ void
|
|||||||
RemoteHWInterface::SetCursor(ServerCursor* cursor)
|
RemoteHWInterface::SetCursor(ServerCursor* cursor)
|
||||||
{
|
{
|
||||||
HWInterface::SetCursor(cursor);
|
HWInterface::SetCursor(cursor);
|
||||||
RemoteMessage message(NULL, fSendBuffer);
|
RemoteMessage message(NULL, fSendBuffer.Get());
|
||||||
message.Start(RP_SET_CURSOR);
|
message.Start(RP_SET_CURSOR);
|
||||||
message.AddCursor(CursorAndDragBitmap().Get());
|
message.AddCursor(CursorAndDragBitmap().Get());
|
||||||
}
|
}
|
||||||
@@ -527,7 +525,7 @@ void
|
|||||||
RemoteHWInterface::SetCursorVisible(bool visible)
|
RemoteHWInterface::SetCursorVisible(bool visible)
|
||||||
{
|
{
|
||||||
HWInterface::SetCursorVisible(visible);
|
HWInterface::SetCursorVisible(visible);
|
||||||
RemoteMessage message(NULL, fSendBuffer);
|
RemoteMessage message(NULL, fSendBuffer.Get());
|
||||||
message.Start(RP_SET_CURSOR_VISIBLE);
|
message.Start(RP_SET_CURSOR_VISIBLE);
|
||||||
message.Add(visible);
|
message.Add(visible);
|
||||||
}
|
}
|
||||||
@@ -537,7 +535,7 @@ void
|
|||||||
RemoteHWInterface::MoveCursorTo(float x, float y)
|
RemoteHWInterface::MoveCursorTo(float x, float y)
|
||||||
{
|
{
|
||||||
HWInterface::MoveCursorTo(x, y);
|
HWInterface::MoveCursorTo(x, y);
|
||||||
RemoteMessage message(NULL, fSendBuffer);
|
RemoteMessage message(NULL, fSendBuffer.Get());
|
||||||
message.Start(RP_MOVE_CURSOR_TO);
|
message.Start(RP_MOVE_CURSOR_TO);
|
||||||
message.Add(x);
|
message.Add(x);
|
||||||
message.Add(y);
|
message.Add(y);
|
||||||
@@ -549,7 +547,7 @@ RemoteHWInterface::SetDragBitmap(const ServerBitmap* bitmap,
|
|||||||
const BPoint& offsetFromCursor)
|
const BPoint& offsetFromCursor)
|
||||||
{
|
{
|
||||||
HWInterface::SetDragBitmap(bitmap, offsetFromCursor);
|
HWInterface::SetDragBitmap(bitmap, offsetFromCursor);
|
||||||
RemoteMessage message(NULL, fSendBuffer);
|
RemoteMessage message(NULL, fSendBuffer.Get());
|
||||||
message.Start(RP_SET_CURSOR);
|
message.Start(RP_SET_CURSOR);
|
||||||
message.AddCursor(CursorAndDragBitmap().Get());
|
message.AddCursor(CursorAndDragBitmap().Get());
|
||||||
}
|
}
|
||||||
@@ -579,7 +577,7 @@ RemoteHWInterface::IsDoubleBuffered() const
|
|||||||
status_t
|
status_t
|
||||||
RemoteHWInterface::InvalidateRegion(BRegion& region)
|
RemoteHWInterface::InvalidateRegion(BRegion& region)
|
||||||
{
|
{
|
||||||
RemoteMessage message(NULL, fSendBuffer);
|
RemoteMessage message(NULL, fSendBuffer.Get());
|
||||||
message.Start(RP_INVALIDATE_REGION);
|
message.Start(RP_INVALIDATE_REGION);
|
||||||
message.AddRegion(region);
|
message.AddRegion(region);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -589,7 +587,7 @@ RemoteHWInterface::InvalidateRegion(BRegion& region)
|
|||||||
status_t
|
status_t
|
||||||
RemoteHWInterface::Invalidate(const BRect& frame)
|
RemoteHWInterface::Invalidate(const BRect& frame)
|
||||||
{
|
{
|
||||||
RemoteMessage message(NULL, fSendBuffer);
|
RemoteMessage message(NULL, fSendBuffer.Get());
|
||||||
message.Start(RP_INVALIDATE_RECT);
|
message.Start(RP_INVALIDATE_RECT);
|
||||||
message.Add(frame);
|
message.Add(frame);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "HWInterface.h"
|
#include "HWInterface.h"
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
#include <Locker.h>
|
#include <Locker.h>
|
||||||
#include <ObjectList.h>
|
#include <ObjectList.h>
|
||||||
|
|
||||||
@@ -80,8 +81,9 @@ virtual status_t Invalidate(const BRect& frame);
|
|||||||
virtual status_t CopyBackToFront(const BRect& frame);
|
virtual status_t CopyBackToFront(const BRect& frame);
|
||||||
|
|
||||||
// drawing engine interface
|
// drawing engine interface
|
||||||
StreamingRingBuffer* ReceiveBuffer() { return fReceiveBuffer; }
|
StreamingRingBuffer* ReceiveBuffer()
|
||||||
StreamingRingBuffer* SendBuffer() { return fSendBuffer; }
|
{ return fReceiveBuffer.Get(); }
|
||||||
|
StreamingRingBuffer* SendBuffer() { return fSendBuffer.Get(); }
|
||||||
|
|
||||||
typedef bool (*CallbackFunction)(void* cookie, RemoteMessage& message);
|
typedef bool (*CallbackFunction)(void* cookie, RemoteMessage& message);
|
||||||
|
|
||||||
@@ -116,15 +118,18 @@ static status_t _NewConnectionCallback(void *cookie,
|
|||||||
display_mode fClientMode;
|
display_mode fClientMode;
|
||||||
uint16 fListenPort;
|
uint16 fListenPort;
|
||||||
|
|
||||||
BNetEndpoint* fListenEndpoint;
|
ObjectDeleter<BNetEndpoint> fListenEndpoint;
|
||||||
StreamingRingBuffer* fSendBuffer;
|
ObjectDeleter<StreamingRingBuffer>
|
||||||
StreamingRingBuffer* fReceiveBuffer;
|
fSendBuffer;
|
||||||
|
ObjectDeleter<StreamingRingBuffer>
|
||||||
|
fReceiveBuffer;
|
||||||
|
|
||||||
NetSender* fSender;
|
ObjectDeleter<NetSender> fSender;
|
||||||
NetReceiver* fReceiver;
|
ObjectDeleter<NetReceiver> fReceiver;
|
||||||
|
|
||||||
thread_id fEventThread;
|
thread_id fEventThread;
|
||||||
RemoteEventStream* fEventStream;
|
ObjectDeleter<RemoteEventStream>
|
||||||
|
fEventStream;
|
||||||
|
|
||||||
BLocker fCallbackLocker;
|
BLocker fCallbackLocker;
|
||||||
BObjectList<callback_info> fCallbacks;
|
BObjectList<callback_info> fCallbacks;
|
||||||
|
|||||||
@@ -143,14 +143,13 @@ FontCacheEntry::FontCacheEntry()
|
|||||||
FontCacheEntry::~FontCacheEntry()
|
FontCacheEntry::~FontCacheEntry()
|
||||||
{
|
{
|
||||||
//printf("~FontCacheEntry()\n");
|
//printf("~FontCacheEntry()\n");
|
||||||
delete fGlyphCache;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
FontCacheEntry::Init(const ServerFont& font, bool forceVector)
|
FontCacheEntry::Init(const ServerFont& font, bool forceVector)
|
||||||
{
|
{
|
||||||
if (fGlyphCache == NULL)
|
if (fGlyphCache.Get() == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
glyph_rendering renderingType = _RenderTypeFor(font, forceVector);
|
glyph_rendering renderingType = _RenderTypeFor(font, forceVector);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#define FONT_CACHE_ENTRY_H
|
#define FONT_CACHE_ENTRY_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
#include <Locker.h>
|
#include <Locker.h>
|
||||||
|
|
||||||
#include <agg_conv_curve.h>
|
#include <agg_conv_curve.h>
|
||||||
@@ -144,7 +145,8 @@ class FontCacheEntry : public MultiLocker, public BReferenceable {
|
|||||||
|
|
||||||
class GlyphCachePool;
|
class GlyphCachePool;
|
||||||
|
|
||||||
GlyphCachePool* fGlyphCache;
|
ObjectDeleter<GlyphCachePool>
|
||||||
|
fGlyphCache;
|
||||||
FontEngine fEngine;
|
FontEngine fEngine;
|
||||||
|
|
||||||
static BLocker sUsageUpdateLock;
|
static BLocker sUsageUpdateLock;
|
||||||
|
|||||||
@@ -124,8 +124,8 @@ FontManager::FontManager()
|
|||||||
|
|
||||||
if (fInitStatus == B_OK) {
|
if (fInitStatus == B_OK) {
|
||||||
// Precache the plain and bold fonts
|
// Precache the plain and bold fonts
|
||||||
_PrecacheFontFile(fDefaultPlainFont);
|
_PrecacheFontFile(fDefaultPlainFont.Get());
|
||||||
_PrecacheFontFile(fDefaultBoldFont);
|
_PrecacheFontFile(fDefaultBoldFont.Get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,9 +134,9 @@ FontManager::FontManager()
|
|||||||
//! Frees items allocated in the constructor and shuts down FreeType
|
//! Frees items allocated in the constructor and shuts down FreeType
|
||||||
FontManager::~FontManager()
|
FontManager::~FontManager()
|
||||||
{
|
{
|
||||||
delete fDefaultPlainFont;
|
fDefaultPlainFont.Unset();
|
||||||
delete fDefaultBoldFont;
|
fDefaultBoldFont.Unset();
|
||||||
delete fDefaultFixedFont;
|
fDefaultFixedFont.Unset();
|
||||||
|
|
||||||
// free families before we're done with FreeType
|
// free families before we're done with FreeType
|
||||||
|
|
||||||
@@ -467,27 +467,27 @@ FontManager::_SetDefaultFonts()
|
|||||||
if (style == NULL)
|
if (style == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
fDefaultPlainFont = new (std::nothrow) ServerFont(*style,
|
fDefaultPlainFont.SetTo(new (std::nothrow) ServerFont(*style,
|
||||||
DEFAULT_PLAIN_FONT_SIZE);
|
DEFAULT_PLAIN_FONT_SIZE));
|
||||||
if (fDefaultPlainFont == NULL)
|
if (fDefaultPlainFont.Get() == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
// bold font
|
// bold font
|
||||||
style = _GetDefaultStyle(DEFAULT_BOLD_FONT_FAMILY, DEFAULT_BOLD_FONT_STYLE,
|
style = _GetDefaultStyle(DEFAULT_BOLD_FONT_FAMILY, DEFAULT_BOLD_FONT_STYLE,
|
||||||
FALLBACK_BOLD_FONT_FAMILY, DEFAULT_BOLD_FONT_STYLE, B_BOLD_FACE);
|
FALLBACK_BOLD_FONT_FAMILY, DEFAULT_BOLD_FONT_STYLE, B_BOLD_FACE);
|
||||||
|
|
||||||
fDefaultBoldFont = new (std::nothrow) ServerFont(*style,
|
fDefaultBoldFont.SetTo(new (std::nothrow) ServerFont(*style,
|
||||||
DEFAULT_BOLD_FONT_SIZE);
|
DEFAULT_BOLD_FONT_SIZE));
|
||||||
if (fDefaultBoldFont == NULL)
|
if (fDefaultBoldFont.Get() == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
// fixed font
|
// fixed font
|
||||||
style = _GetDefaultStyle(DEFAULT_FIXED_FONT_FAMILY, DEFAULT_FIXED_FONT_STYLE,
|
style = _GetDefaultStyle(DEFAULT_FIXED_FONT_FAMILY, DEFAULT_FIXED_FONT_STYLE,
|
||||||
FALLBACK_FIXED_FONT_FAMILY, DEFAULT_FIXED_FONT_STYLE, B_REGULAR_FACE);
|
FALLBACK_FIXED_FONT_FAMILY, DEFAULT_FIXED_FONT_STYLE, B_REGULAR_FACE);
|
||||||
|
|
||||||
fDefaultFixedFont = new (std::nothrow) ServerFont(*style,
|
fDefaultFixedFont.SetTo(new (std::nothrow) ServerFont(*style,
|
||||||
DEFAULT_FIXED_FONT_SIZE);
|
DEFAULT_FIXED_FONT_SIZE));
|
||||||
if (fDefaultFixedFont == NULL)
|
if (fDefaultFixedFont.Get() == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
fDefaultFixedFont->SetSpacing(B_FIXED_SPACING);
|
fDefaultFixedFont->SetSpacing(B_FIXED_SPACING);
|
||||||
@@ -1121,21 +1121,21 @@ FontManager::RemoveStyle(FontStyle* style)
|
|||||||
const ServerFont*
|
const ServerFont*
|
||||||
FontManager::DefaultPlainFont() const
|
FontManager::DefaultPlainFont() const
|
||||||
{
|
{
|
||||||
return fDefaultPlainFont;
|
return fDefaultPlainFont.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const ServerFont*
|
const ServerFont*
|
||||||
FontManager::DefaultBoldFont() const
|
FontManager::DefaultBoldFont() const
|
||||||
{
|
{
|
||||||
return fDefaultBoldFont;
|
return fDefaultBoldFont.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const ServerFont*
|
const ServerFont*
|
||||||
FontManager::DefaultFixedFont() const
|
FontManager::DefaultFixedFont() const
|
||||||
{
|
{
|
||||||
return fDefaultFixedFont;
|
return fDefaultFixedFont.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#define FONT_MANAGER_H
|
#define FONT_MANAGER_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
#include <HashMap.h>
|
#include <HashMap.h>
|
||||||
#include <Looper.h>
|
#include <Looper.h>
|
||||||
#include <ObjectList.h>
|
#include <ObjectList.h>
|
||||||
@@ -143,9 +144,12 @@ private:
|
|||||||
|
|
||||||
HashMap<FontKey, BReference<FontStyle> > fStyleHashTable;
|
HashMap<FontKey, BReference<FontStyle> > fStyleHashTable;
|
||||||
|
|
||||||
ServerFont* fDefaultPlainFont;
|
ObjectDeleter<ServerFont>
|
||||||
ServerFont* fDefaultBoldFont;
|
fDefaultPlainFont;
|
||||||
ServerFont* fDefaultFixedFont;
|
ObjectDeleter<ServerFont>
|
||||||
|
fDefaultBoldFont;
|
||||||
|
ObjectDeleter<ServerFont>
|
||||||
|
fDefaultFixedFont;
|
||||||
|
|
||||||
bool fScanned;
|
bool fScanned;
|
||||||
int32 fNextID;
|
int32 fNextID;
|
||||||
|
|||||||
@@ -637,7 +637,7 @@ Tab::Tab(SATGroup* group, Variable* variable, orientation_t orientation)
|
|||||||
fVariable(variable),
|
fVariable(variable),
|
||||||
fOrientation(orientation)
|
fOrientation(orientation)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -647,8 +647,6 @@ Tab::~Tab()
|
|||||||
fGroup->_RemoveVerticalTab(this);
|
fGroup->_RemoveVerticalTab(this);
|
||||||
else
|
else
|
||||||
fGroup->_RemoveHorizontalTab(this);
|
fGroup->_RemoveHorizontalTab(this);
|
||||||
|
|
||||||
delete fVariable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -806,7 +804,7 @@ SATGroup::~SATGroup()
|
|||||||
debugger("Deleting a SATGroup which is not empty");
|
debugger("Deleting a SATGroup which is not empty");
|
||||||
//while (fSATWindowList.CountItems() > 0)
|
//while (fSATWindowList.CountItems() > 0)
|
||||||
// RemoveWindow(fSATWindowList.ItemAt(0));
|
// RemoveWindow(fSATWindowList.ItemAt(0));
|
||||||
|
|
||||||
fLinearSpec->ReleaseReference();
|
fLinearSpec->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
#include "ObjectList.h"
|
#include "ObjectList.h"
|
||||||
#include "Referenceable.h"
|
#include "Referenceable.h"
|
||||||
|
|
||||||
@@ -107,7 +108,7 @@ public:
|
|||||||
float Position() const;
|
float Position() const;
|
||||||
void SetPosition(float position);
|
void SetPosition(float position);
|
||||||
orientation_t Orientation() const;
|
orientation_t Orientation() const;
|
||||||
Variable* Var() { return fVariable; }
|
Variable* Var() { return fVariable.Get(); }
|
||||||
|
|
||||||
//! Caller takes ownership of the constraint.
|
//! Caller takes ownership of the constraint.
|
||||||
Constraint* Connect(Variable* variable);
|
Constraint* Connect(Variable* variable);
|
||||||
@@ -126,7 +127,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
SATGroup* fGroup;
|
SATGroup* fGroup;
|
||||||
Variable* fVariable;
|
ObjectDeleter<Variable>
|
||||||
|
fVariable;
|
||||||
orientation_t fOrientation;
|
orientation_t fOrientation;
|
||||||
|
|
||||||
CrossingList fCrossingList;
|
CrossingList fCrossingList;
|
||||||
|
|||||||
Reference in New Issue
Block a user