Oups. Layer::MoveBy/ResizeBy() escaped me. :-) The actions they used to perform are now executed only by RootLayer's thread.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10972 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -40,7 +40,8 @@
|
||||
#include "RootLayer.h"
|
||||
#include "DisplayDriver.h"
|
||||
#include "LayerData.h"
|
||||
#include <stdio.h>
|
||||
#include "PortLink.h"
|
||||
#include "ServerProtocol.h"
|
||||
|
||||
//#define DEBUG_LAYER
|
||||
#ifdef DEBUG_LAYER
|
||||
@@ -1159,6 +1160,18 @@ void Layer::MoveBy(float x, float y)
|
||||
return;
|
||||
}
|
||||
|
||||
BPortLink msg(-1, -1);
|
||||
msg.StartMessage(AS_ROOTLAYER_LAYER_MOVE);
|
||||
msg.Attach<Layer*>(this);
|
||||
msg.Attach<float>(x);
|
||||
msg.Attach<float>(y);
|
||||
GetRootLayer()->EnqueueMessage(msg);
|
||||
|
||||
STRACE(("Layer(%s)::MoveBy() END\n", GetName()));
|
||||
}
|
||||
|
||||
void Layer::move_layer(float x, float y)
|
||||
{
|
||||
fFrameAction = B_LAYER_ACTION_MOVE;
|
||||
|
||||
BPoint pt(x,y);
|
||||
@@ -1171,8 +1184,6 @@ void Layer::MoveBy(float x, float y)
|
||||
EmptyGlobals();
|
||||
|
||||
fFrameAction = B_LAYER_ACTION_NONE;
|
||||
|
||||
STRACE(("Layer(%s)::MoveBy() END\n", GetName()));
|
||||
}
|
||||
|
||||
void Layer::EmptyGlobals()
|
||||
@@ -1265,6 +1276,18 @@ void Layer::ResizeBy(float x, float y)
|
||||
return;
|
||||
}
|
||||
|
||||
BPortLink msg(-1, -1);
|
||||
msg.StartMessage(AS_ROOTLAYER_LAYER_RESIZE);
|
||||
msg.Attach<Layer*>(this);
|
||||
msg.Attach<float>(x);
|
||||
msg.Attach<float>(y);
|
||||
GetRootLayer()->EnqueueMessage(msg);
|
||||
|
||||
STRACE(("Layer(%s)::ResizeBy() END\n", GetName()));
|
||||
}
|
||||
|
||||
void Layer::resize_layer(float x, float y)
|
||||
{
|
||||
fFrameAction = B_LAYER_ACTION_RESIZE;
|
||||
|
||||
BPoint pt(x,y);
|
||||
@@ -1280,8 +1303,6 @@ void Layer::ResizeBy(float x, float y)
|
||||
EmptyGlobals();
|
||||
|
||||
fFrameAction = B_LAYER_ACTION_NONE;
|
||||
|
||||
STRACE(("Layer(%s)::ResizeBy() END\n", GetName()));
|
||||
}
|
||||
|
||||
//! Prints information about the layer's current state
|
||||
|
||||
@@ -158,6 +158,9 @@ protected:
|
||||
friend class ServerWindow;
|
||||
friend class Workspace;
|
||||
|
||||
void move_layer(float x, float y);
|
||||
void resize_layer(float x, float y);
|
||||
|
||||
BRect fFrame;
|
||||
BPoint fBoundsLeftTop;
|
||||
Layer *fParent;
|
||||
|
||||
@@ -211,6 +211,26 @@ int32 RootLayer::WorkingThread(void *data)
|
||||
oneRootLayer->redraw_layer(layer, redrawRegion);
|
||||
break;
|
||||
}
|
||||
case AS_ROOTLAYER_LAYER_MOVE:
|
||||
{
|
||||
Layer *layer = NULL;
|
||||
float x, y;
|
||||
messageQueue.Read<Layer*>(&layer);
|
||||
messageQueue.Read<float>(&x);
|
||||
messageQueue.Read<float>(&y);
|
||||
layer->move_layer(x, y);
|
||||
break;
|
||||
}
|
||||
case AS_ROOTLAYER_LAYER_RESIZE:
|
||||
{
|
||||
Layer *layer = NULL;
|
||||
float x, y;
|
||||
messageQueue.Read<Layer*>(&layer);
|
||||
messageQueue.Read<float>(&x);
|
||||
messageQueue.Read<float>(&y);
|
||||
layer->resize_layer(x, y);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
STRACE(("RootLayer(%s)::WorkingThread received unexpected code %lx\n",oneRootLayer->GetName(), oneRootLayer->code));
|
||||
break;
|
||||
@@ -244,6 +264,12 @@ void RootLayer::invalidate_layer(Layer *layer, const BRegion ®ion)
|
||||
layer->FullInvalidate(region);
|
||||
}
|
||||
|
||||
status_t RootLayer::EnqueueMessage(BPortLink &message)
|
||||
{
|
||||
message.SetSendPort(fListenPort);
|
||||
message.Flush();
|
||||
}
|
||||
|
||||
void RootLayer::GoRedraw(const Layer *layer, const BRegion ®ion)
|
||||
{
|
||||
BPortLink msg(fListenPort, -1);
|
||||
|
||||
@@ -42,6 +42,7 @@ class Screen;
|
||||
class WinBorder;
|
||||
class Desktop;
|
||||
class DisplayDriver;
|
||||
class BPortLink;
|
||||
|
||||
/*!
|
||||
\class RootLayer RootLayer.h
|
||||
@@ -115,6 +116,7 @@ public:
|
||||
void Unlock() { fAllRegionsLock.Unlock(); }
|
||||
bool IsLocked() { return fAllRegionsLock.IsLocked(); }
|
||||
void RunThread();
|
||||
status_t EnqueueMessage(BPortLink &message);
|
||||
void GoInvalidate(const Layer *layer, const BRegion ®ion);
|
||||
void GoRedraw(const Layer *layer, const BRegion ®ion);
|
||||
|
||||
|
||||
@@ -411,7 +411,7 @@ void WinBorder::MoveBy(float x, float y)
|
||||
if(fDecorator)
|
||||
fDecorator->MoveBy(x,y);
|
||||
|
||||
Layer::MoveBy(x,y);
|
||||
move_layer(x,y);
|
||||
}
|
||||
|
||||
//! Resizes the winborder with redraw
|
||||
@@ -423,7 +423,7 @@ void WinBorder::ResizeBy(float x, float y)
|
||||
if(fDecorator)
|
||||
fDecorator->ResizeBy(x,y);
|
||||
|
||||
Layer::ResizeBy(x,y);
|
||||
resize_layer(x,y);
|
||||
}
|
||||
|
||||
//! Returns true if hidden
|
||||
|
||||
Reference in New Issue
Block a user