Removed global gDesktop variable - there is now an sDesktop variable in AppServer.cpp, but
that will go away, too. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14590 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
3ab795e374
commit
959a5a68bc
@ -64,7 +64,7 @@
|
||||
|
||||
|
||||
// Globals
|
||||
Desktop *gDesktop;
|
||||
static Desktop *sDesktop;
|
||||
|
||||
port_id gAppServerPort;
|
||||
|
||||
@ -163,9 +163,9 @@ AppServer::AppServer()
|
||||
gBitmapManager = new BitmapManager();
|
||||
|
||||
// Set up the Desktop
|
||||
gDesktop = new Desktop();
|
||||
gDesktop->Init();
|
||||
gDesktop->Run();
|
||||
sDesktop = new Desktop();
|
||||
sDesktop->Init();
|
||||
sDesktop->Run();
|
||||
|
||||
#if 0
|
||||
LaunchCursorThread();
|
||||
@ -275,7 +275,7 @@ AppServer::CursorThread(void* data)
|
||||
p.y = *server->fCursorAddr & 0x7fff;
|
||||
p.x = *server->fCursorAddr >> 15 & 0x7fff;
|
||||
|
||||
gDesktop->GetHWInterface()->MoveCursorTo(p.x, p.y);
|
||||
sDesktop->GetHWInterface()->MoveCursorTo(p.x, p.y);
|
||||
STRACE(("CursorThread : %f, %f\n", p.x, p.y));
|
||||
}
|
||||
|
||||
@ -318,7 +318,7 @@ AppServer::_DispatchMessage(int32 code, BPrivate::LinkReceiver& msg)
|
||||
|
||||
BPrivate::LinkSender reply(replyPort);
|
||||
reply.StartMessage(B_OK);
|
||||
reply.Attach<port_id>(gDesktop->MessagePort());
|
||||
reply.Attach<port_id>(sDesktop->MessagePort());
|
||||
reply.Flush();
|
||||
break;
|
||||
}
|
||||
@ -350,13 +350,13 @@ AppServer::_DispatchMessage(int32 code, BPrivate::LinkReceiver& msg)
|
||||
#if TEST_MODE
|
||||
case B_QUIT_REQUESTED:
|
||||
{
|
||||
thread_id thread = gDesktop->Thread();
|
||||
thread_id thread = sDesktop->Thread();
|
||||
|
||||
// We've been asked to quit, so (for now) broadcast to all
|
||||
// test apps to quit. This situation will occur only when the server
|
||||
// is compiled as a regular Be application.
|
||||
|
||||
gDesktop->PostMessage(B_QUIT_REQUESTED);
|
||||
sDesktop->PostMessage(B_QUIT_REQUESTED);
|
||||
fQuitting = true;
|
||||
|
||||
// we just wait for the desktop to kill itself
|
||||
@ -374,7 +374,7 @@ AppServer::_DispatchMessage(int32 code, BPrivate::LinkReceiver& msg)
|
||||
|
||||
case AS_SET_SYSCURSOR_DEFAULTS:
|
||||
{
|
||||
gDesktop->GetCursorManager().SetDefaults();
|
||||
sDesktop->GetCursorManager().SetDefaults();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -399,30 +399,30 @@ AppServer::_DispatchMessage(int32 code, BPrivate::LinkReceiver& msg)
|
||||
// activate one of the app's windows.
|
||||
if (error == B_OK) {
|
||||
error = B_BAD_TEAM_ID;
|
||||
if (gDesktop->Lock()) {
|
||||
if (sDesktop->Lock()) {
|
||||
// search for an unhidden window to give focus to
|
||||
int32 windowCount = gDesktop->WindowList().CountItems();
|
||||
int32 windowCount = sDesktop->WindowList().CountItems();
|
||||
Layer *layer;
|
||||
for (int32 i = 0; i < windowCount; ++i)
|
||||
// is this layer in fact a WinBorder?
|
||||
if ((layer = static_cast<Layer*>(gDesktop->WindowList().ItemAtFast(i)))) {
|
||||
if ((layer = static_cast<Layer*>(sDesktop->WindowList().ItemAtFast(i)))) {
|
||||
WinBorder *winBorder = dynamic_cast<WinBorder*>(layer);
|
||||
// if winBorder is valid and not hidden, then we've found our target
|
||||
if (winBorder && !winBorder->IsHidden()
|
||||
&& winBorder->App()->ClientTeam() == team) {
|
||||
if (gDesktop->ActiveRootLayer()
|
||||
&& gDesktop->ActiveRootLayer()->Lock()) {
|
||||
gDesktop->ActiveRootLayer()->SetActive(winBorder);
|
||||
gDesktop->ActiveRootLayer()->Unlock();
|
||||
if (sDesktop->ActiveRootLayer()
|
||||
&& sDesktop->ActiveRootLayer()->Lock()) {
|
||||
sDesktop->ActiveRootLayer()->SetActive(winBorder);
|
||||
sDesktop->ActiveRootLayer()->Unlock();
|
||||
|
||||
if (gDesktop->ActiveRootLayer()->Active() == winBorder)
|
||||
if (sDesktop->ActiveRootLayer()->Active() == winBorder)
|
||||
error = B_OK;
|
||||
else
|
||||
error = B_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
gDesktop->Unlock();
|
||||
sDesktop->Unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,6 +116,4 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
||||
CursorManager fCursorManager;
|
||||
};
|
||||
|
||||
extern Desktop *gDesktop;
|
||||
|
||||
#endif // _DESKTOP_H_
|
||||
|
@ -964,10 +964,10 @@ RootLayer::_ProcessMouseMovedEvent(BMessage *msg)
|
||||
// change focus in FFM mode
|
||||
WinBorder* winBorderTarget = dynamic_cast<WinBorder*>(target);
|
||||
if (winBorderTarget) {
|
||||
DesktopSettings ds(gDesktop);
|
||||
DesktopSettings desktopSettings(fDesktop);
|
||||
// TODO: Focus should be a RootLayer option/feature, NOT a Workspace one!!!
|
||||
WinBorder* exFocus = Focus();
|
||||
if (ds.MouseMode() != B_NORMAL_MOUSE && exFocus != winBorderTarget) {
|
||||
if (desktopSettings.MouseMode() != B_NORMAL_MOUSE && exFocus != winBorderTarget) {
|
||||
ActiveWorkspace()->AttemptToSetFocus(winBorderTarget);
|
||||
// Workspace::SetFocus() *attempts* to set a new focus WinBorder, it may not succeed
|
||||
if (exFocus != Focus()) {
|
||||
@ -1544,10 +1544,9 @@ RootLayer::change_winBorder_feel(WinBorder *winBorder, int32 newFeel)
|
||||
}
|
||||
}
|
||||
|
||||
gDesktop->SetWinBorderFeel(winBorder, newFeel);
|
||||
fDesktop->SetWinBorderFeel(winBorder, newFeel);
|
||||
|
||||
if (isVisible)
|
||||
{
|
||||
if (isVisible) {
|
||||
// just show, don't invalidate
|
||||
winBorder->Show(false);
|
||||
// all workspaces must be up-to-date with this change of feel.
|
||||
@ -1696,4 +1695,4 @@ RootLayer::ConvertToMessage(void* raw, int32 code)
|
||||
}
|
||||
|
||||
return bmsg;
|
||||
}
|
||||
}
|
||||
|
@ -67,14 +67,15 @@ class UtilityBitmap;
|
||||
class RootLayer : public Layer {
|
||||
public:
|
||||
RootLayer(const char *name, int32 workspaceCount,
|
||||
Desktop *desktop, DisplayDriver *driver);
|
||||
Desktop *desktop, DisplayDriver *driver);
|
||||
virtual ~RootLayer(void);
|
||||
|
||||
|
||||
Desktop* GetDesktop() const { return fDesktop; }
|
||||
|
||||
virtual void MoveBy(float x, float y);
|
||||
virtual void ResizeBy(float x, float y);
|
||||
virtual void ScrollBy(float x, float y)
|
||||
{ // not allowed
|
||||
}
|
||||
{ /* not allowed */ }
|
||||
|
||||
// For the active workspaces
|
||||
virtual Layer* FirstChild() const;
|
||||
@ -85,8 +86,7 @@ public:
|
||||
void HideWinBorder(WinBorder* winBorder);
|
||||
void ShowWinBorder(WinBorder* winBorder);
|
||||
void SetWinBorderWorskpaces(WinBorder *winBorder,
|
||||
uint32 oldIndex,
|
||||
uint32 newIndex);
|
||||
uint32 oldIndex, uint32 newIndex);
|
||||
|
||||
void RevealNewWMState(Workspace::State &oldWMState);
|
||||
// TODO: we need to replace Winborder* with Layer*
|
||||
@ -117,7 +117,8 @@ public:
|
||||
void SetDragMessage(BMessage *msg);
|
||||
BMessage* DragMessage(void) const;
|
||||
|
||||
bool AddToInputNotificationLists(Layer *lay, uint32 mask, uint32 options);
|
||||
bool AddToInputNotificationLists(Layer *lay, uint32 mask,
|
||||
uint32 options);
|
||||
bool SetNotifyLayer(Layer *lay, uint32 mask, uint32 options);
|
||||
void ClearNotifyLayer();
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
* Stefano Ceccherini (burton666@libero.it)
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
* Jérôme Duval, jerome.duval@free.fr
|
||||
* Jérôme Duval, jerome.duval@free.fr
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -70,6 +70,8 @@ class ServerApp : public MessageLooper {
|
||||
|
||||
AreaPool *AppAreaPool() { return &fSharedMem; }
|
||||
|
||||
Desktop* GetDesktop() const { return fDesktop; }
|
||||
|
||||
// ToDo: public?
|
||||
SubWindowList fAppSubWindowList;
|
||||
|
||||
|
@ -132,6 +132,7 @@ ServerWindow::ServerWindow(const char *title, ServerApp *app,
|
||||
port_id clientPort, port_id looperPort, int32 handlerID)
|
||||
: MessageLooper(title && *title ? title : "Unnamed Window"),
|
||||
fTitle(title),
|
||||
fDesktop(app->GetDesktop()),
|
||||
fServerApp(app),
|
||||
fWinBorder(NULL),
|
||||
fClientTeam(app->ClientTeam()),
|
||||
@ -155,7 +156,7 @@ ServerWindow::~ServerWindow()
|
||||
STRACE(("*ServerWindow(%s@%p):~ServerWindow()\n", fTitle, this));
|
||||
|
||||
if (!fWinBorder->IsOffscreenWindow())
|
||||
gDesktop->RemoveWinBorder(fWinBorder);
|
||||
fDesktop->RemoveWinBorder(fWinBorder);
|
||||
|
||||
delete fWinBorder;
|
||||
|
||||
@ -191,7 +192,7 @@ ServerWindow::Init(BRect frame, uint32 look, uint32 feel, uint32 flags, uint32 w
|
||||
return B_NO_MEMORY;
|
||||
|
||||
if (!fWinBorder->IsOffscreenWindow())
|
||||
gDesktop->AddWinBorder(fWinBorder);
|
||||
fDesktop->AddWinBorder(fWinBorder);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
@ -487,7 +488,7 @@ ServerWindow::CreateLayerTree(BPrivate::LinkReceiver &link, Layer **_parent)
|
||||
flags, fWinBorder->GetDisplayDriver());
|
||||
} else {
|
||||
newLayer = new Layer(frame, name, token, resizeMask,
|
||||
flags, gDesktop->GetDisplayDriver());
|
||||
flags, fDesktop->GetDisplayDriver());
|
||||
}
|
||||
|
||||
free(name);
|
||||
@ -1273,13 +1274,13 @@ myRootLayer->Unlock();
|
||||
STRACE(("ServerWindow %s: Message Send_Behind unimplemented\n", Title()));
|
||||
int32 token;
|
||||
team_id teamID;
|
||||
WinBorder *behindOf;
|
||||
status_t status = B_NAME_NOT_FOUND;
|
||||
|
||||
link.Read<int32>(&token);
|
||||
link.Read<team_id>(&teamID);
|
||||
|
||||
if ((behindOf = gDesktop->FindWinBorderByClientToken(token, teamID))) {
|
||||
WinBorder *behindOf;
|
||||
if ((behindOf = fDesktop->FindWinBorderByClientToken(token, teamID)) != NULL) {
|
||||
fWinBorder->GetRootLayer()->Lock();
|
||||
// TODO: move to back ATM. Fix this later!
|
||||
fWinBorder->GetRootLayer()->SetActive(fWinBorder, false);
|
||||
@ -1337,13 +1338,13 @@ myRootLayer->Unlock();
|
||||
link.Read<int32>(&mainToken);
|
||||
link.Read(&teamID, sizeof(team_id));
|
||||
|
||||
windowBorder = gDesktop->FindWinBorderByClientToken(mainToken, teamID);
|
||||
windowBorder = fDesktop->FindWinBorderByClientToken(mainToken, teamID);
|
||||
if (windowBorder) {
|
||||
fLink.StartMessage(SERVER_TRUE);
|
||||
fLink.Flush();
|
||||
|
||||
fWinBorder->GetRootLayer()->Lock();
|
||||
gDesktop->AddWinBorderToSubset(fWinBorder, windowBorder);
|
||||
fDesktop->AddWinBorderToSubset(fWinBorder, windowBorder);
|
||||
fWinBorder->GetRootLayer()->Unlock();
|
||||
} else {
|
||||
fLink.StartMessage(SERVER_FALSE);
|
||||
@ -1361,13 +1362,13 @@ myRootLayer->Unlock();
|
||||
link.Read<int32>(&mainToken);
|
||||
link.Read(&teamID, sizeof(team_id));
|
||||
|
||||
windowBorder = gDesktop->FindWinBorderByClientToken(mainToken, teamID);
|
||||
windowBorder = fDesktop->FindWinBorderByClientToken(mainToken, teamID);
|
||||
if (windowBorder) {
|
||||
fLink.StartMessage(SERVER_TRUE);
|
||||
fLink.Flush();
|
||||
|
||||
fWinBorder->GetRootLayer()->Lock();
|
||||
gDesktop->RemoveWinBorderFromSubset(fWinBorder, windowBorder);
|
||||
fDesktop->RemoveWinBorderFromSubset(fWinBorder, windowBorder);
|
||||
fWinBorder->GetRootLayer()->Unlock();
|
||||
} else {
|
||||
fLink.StartMessage(SERVER_FALSE);
|
||||
@ -1641,8 +1642,8 @@ myRootLayer->Unlock();
|
||||
// 1) BPoint mouse location
|
||||
// 2) int32 button state
|
||||
|
||||
fLink.Attach<BPoint>(gDesktop->GetHWInterface()->GetCursorPosition());
|
||||
fLink.Attach<int32>(gDesktop->ActiveRootLayer()->Buttons());
|
||||
fLink.Attach<BPoint>(fDesktop->GetHWInterface()->GetCursorPosition());
|
||||
fLink.Attach<int32>(fDesktop->ActiveRootLayer()->Buttons());
|
||||
|
||||
fLink.Flush();
|
||||
break;
|
||||
@ -2384,7 +2385,7 @@ ServerWindow::MakeWinBorder(BRect frame, const char* name,
|
||||
{
|
||||
// The non-offscreen ServerWindow uses the DisplayDriver instance from the desktop.
|
||||
return new(nothrow) WinBorder(frame, name, look, feel, flags,
|
||||
workspace, this, gDesktop->GetDisplayDriver());
|
||||
workspace, this, fDesktop->GetDisplayDriver());
|
||||
}
|
||||
|
||||
|
||||
@ -2418,7 +2419,7 @@ ServerWindow::_HandleDirectConnection(direct_buffer_state state)
|
||||
|
||||
if ((state & B_DIRECT_MODE_MASK) != B_DIRECT_STOP) {
|
||||
// TODO: Locking ?
|
||||
RenderingBuffer *buffer = gDesktop->GetHWInterface()->FrontBuffer();
|
||||
RenderingBuffer *buffer = fDesktop->GetHWInterface()->FrontBuffer();
|
||||
fDirectWindowData->direct_info->bits = buffer->Bits();
|
||||
fDirectWindowData->direct_info->pci_bits = NULL; // TODO
|
||||
fDirectWindowData->direct_info->bytes_per_row = buffer->BytesPerRow();
|
||||
|
@ -32,6 +32,7 @@ class BMessenger;
|
||||
class BPoint;
|
||||
class BMessage;
|
||||
|
||||
class Desktop;
|
||||
class ServerApp;
|
||||
class Decorator;
|
||||
class WinBorder;
|
||||
@ -129,6 +130,7 @@ private:
|
||||
private:
|
||||
const char* fTitle;
|
||||
|
||||
Desktop* fDesktop;
|
||||
ServerApp* fServerApp;
|
||||
WinBorder* fWinBorder;
|
||||
|
||||
|
@ -125,7 +125,7 @@ WinBorder::WinBorder(const BRect &frame,
|
||||
uint16 width, height;
|
||||
uint32 colorSpace;
|
||||
float frequency;
|
||||
gDesktop->ActiveScreen()->GetMode(width, height, colorSpace, frequency);
|
||||
GetRootLayer()->GetDesktop()->ScreenAt(0)->GetMode(width, height, colorSpace, frequency);
|
||||
_ResizeBy(width - frame.Width(), height - frame.Height());
|
||||
} else
|
||||
_ResizeBy(0, 0);
|
||||
@ -428,10 +428,10 @@ WinBorder::SetSizeLimits(float minWidth, float maxWidth,
|
||||
ResizeBy(xDiff, yDiff);
|
||||
}
|
||||
|
||||
// GetSizeLimits
|
||||
|
||||
void
|
||||
WinBorder::GetSizeLimits(float* minWidth, float* maxWidth,
|
||||
float* minHeight, float* maxHeight) const
|
||||
float* minHeight, float* maxHeight) const
|
||||
{
|
||||
*minWidth = fMinWidth;
|
||||
*maxWidth = fMaxWidth;
|
||||
@ -439,10 +439,11 @@ WinBorder::GetSizeLimits(float* minWidth, float* maxWidth,
|
||||
*maxHeight = fMaxHeight;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WinBorder::MouseDown(const BMessage *msg)
|
||||
{
|
||||
DesktopSettings desktopSettings(gDesktop);
|
||||
DesktopSettings desktopSettings(GetRootLayer()->GetDesktop());
|
||||
BPoint where(0,0);
|
||||
|
||||
msg->FindPoint("where", &where);
|
||||
|
@ -178,7 +178,7 @@ WorkspacesLayer::_DrawWorkspace(int32 index)
|
||||
uint16 width, height;
|
||||
uint32 colorSpace;
|
||||
float frequency;
|
||||
gDesktop->ScreenAt(0)->GetMode(width, height, colorSpace, frequency);
|
||||
GetRootLayer()->GetDesktop()->ScreenAt(0)->GetMode(width, height, colorSpace, frequency);
|
||||
BRect screenFrame(0, 0, width - 1, height - 1);
|
||||
|
||||
BRegion workspaceRegion(rect);
|
||||
|
@ -71,7 +71,7 @@ class FontLocker {
|
||||
};
|
||||
|
||||
|
||||
// pragma mark -
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
// constructor
|
||||
|
Loading…
Reference in New Issue
Block a user