Made app_server a static, renamed desktop to gDesktop as it's a global, RootLayer now uses its own fDesktop internal member instead of the global one. Fixed a typo in some commented code (thanks Axel)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12864 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2005-05-28 13:43:13 +00:00
parent 7f2831b56b
commit 6390df8e27
6 changed files with 78 additions and 80 deletions
+12 -14
View File
@@ -70,14 +70,12 @@
#endif #endif
// Globals // Globals
Desktop *gDesktop;
Desktop *desktop;
port_id gAppServerPort; port_id gAppServerPort;
// TODO: Global ? Is it really needed ?
//! Used to access the app_server from new_decorator //! Used to access the app_server from new_decorator
AppServer *app_server=NULL; static AppServer *sAppServer = NULL;
//! Default background color for workspaces //! Default background color for workspaces
//RGBColor workspace_default_color(51,102,160); //RGBColor workspace_default_color(51,102,160);
@@ -117,7 +115,7 @@ AppServer::AppServer(void) :
make_decorator = NULL; make_decorator = NULL;
// We need this in order for new_decorator to be able to instantiate new decorators // We need this in order for new_decorator to be able to instantiate new decorators
app_server = this; sAppServer = this;
// Create the font server and scan the proper directories. // Create the font server and scan the proper directories.
fontserver = new FontServer; fontserver = new FontServer;
@@ -181,8 +179,8 @@ AppServer::AppServer(void) :
InitDecorators(); InitDecorators();
// Set up the Desktop // Set up the Desktop
desktop = new Desktop(); gDesktop = new Desktop();
desktop->Init(); gDesktop->Init();
// Create the bitmap allocator. Object declared in BitmapManager.cpp // Create the bitmap allocator. Object declared in BitmapManager.cpp
bitmapmanager = new BitmapManager(); bitmapmanager = new BitmapManager();
@@ -232,7 +230,7 @@ AppServer::~AppServer(void)
delete bitmapmanager; delete bitmapmanager;
delete desktop; delete gDesktop;
// If these threads are still running, kill them - after this, if exit_poller // If these threads are still running, kill them - after this, if exit_poller
// is deleted, who knows what will happen... These things will just return an // is deleted, who knows what will happen... These things will just return an
@@ -367,7 +365,7 @@ AppServer::CursorThread(void* data)
p.y = *app->fCursorAddr & 0x7fff; p.y = *app->fCursorAddr & 0x7fff;
p.x = *app->fCursorAddr >> 15 & 0x7fff; p.x = *app->fCursorAddr >> 15 & 0x7fff;
desktop->GetDisplayDriver()->MoveCursorTo(p.x, p.y); gDesktop->GetDisplayDriver()->MoveCursorTo(p.x, p.y);
STRACE(("CursorThread : %f, %f\n", p.x, p.y)); STRACE(("CursorThread : %f, %f\n", p.x, p.y));
} }
@@ -799,7 +797,7 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
release_sem(fAppListLock); release_sem(fAppListLock);
delete desktop; delete gDesktop;
delete fAppList; delete fAppList;
delete bitmapmanager; delete bitmapmanager;
delete fontserver; delete fontserver;
@@ -816,7 +814,7 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
// although this isn't pretty, ATM we only have RootLayer. // although this isn't pretty, ATM we only have RootLayer.
// this messages should be handled somewhere into a RootLayer // this messages should be handled somewhere into a RootLayer
// specific area - this set is intended for a RootLayer. // specific area - this set is intended for a RootLayer.
desktop->ActiveRootLayer()->GetCursorManager().SetDefaults(); gDesktop->ActiveRootLayer()->GetCursorManager().SetDefaults();
break; break;
} }
default: default:
@@ -902,10 +900,10 @@ new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel,
{ {
Decorator *dec=NULL; Decorator *dec=NULL;
if(!app_server->make_decorator) if (!sAppServer->make_decorator)
dec=new DefaultDecorator(rect,wlook,wfeel,wflags); dec = new DefaultDecorator(rect, wlook, wfeel, wflags);
else else
dec=app_server->make_decorator(rect,wlook,wfeel,wflags); dec = sAppServer->make_decorator(rect, wlook, wfeel, wflags);
gui_colorset.Lock(); gui_colorset.Lock();
dec->SetDriver(ddriver); dec->SetDriver(ddriver);
+1 -1
View File
@@ -119,6 +119,6 @@ private:
bool fFFMouseMode; bool fFFMouseMode;
}; };
extern Desktop *desktop; extern Desktop *gDesktop;
#endif // _DESKTOP_H_ #endif // _DESKTOP_H_
+6 -6
View File
@@ -269,7 +269,7 @@ int32 RootLayer::WorkingThread(void *data)
WinBorder *toWinBorder = NULL; WinBorder *toWinBorder = NULL;
messageQueue.Read<WinBorder*>(&winBorder); messageQueue.Read<WinBorder*>(&winBorder);
messageQueue.Read<WinBorder*>(&toWinBorder); messageQueue.Read<WinBorder*>(&toWinBorder);
desktop->AddWinBorderToSubset(winBorder, toWinBorder); oneRootLayer->fDesktop->AddWinBorderToSubset(winBorder, toWinBorder);
break; break;
} }
case AS_ROOTLAYER_REMOVE_FROM_SUBSET: case AS_ROOTLAYER_REMOVE_FROM_SUBSET:
@@ -278,7 +278,7 @@ int32 RootLayer::WorkingThread(void *data)
WinBorder *fromWinBorder = NULL; WinBorder *fromWinBorder = NULL;
messageQueue.Read<WinBorder*>(&winBorder); messageQueue.Read<WinBorder*>(&winBorder);
messageQueue.Read<WinBorder*>(&fromWinBorder); messageQueue.Read<WinBorder*>(&fromWinBorder);
desktop->RemoveWinBorderFromSubset(winBorder, fromWinBorder); oneRootLayer->fDesktop->RemoveWinBorderFromSubset(winBorder, fromWinBorder);
break; break;
} }
case AS_ROOTLAYER_WINBORDER_SET_WORKSPACES: case AS_ROOTLAYER_WINBORDER_SET_WORKSPACES:
@@ -558,9 +558,9 @@ bool RootLayer::SetActiveWorkspace(int32 index)
fWorkspace[index] = new Workspace(index, 0xFF00FF00, kDefaultWorkspaceColor); fWorkspace[index] = new Workspace(index, 0xFF00FF00, kDefaultWorkspaceColor);
// we need to lock the window list here so no other window can be created // we need to lock the window list here so no other window can be created
desktop->Lock(); fDesktop->Lock();
const BList& windowList = desktop->WindowList(); const BList& windowList = fDesktop->WindowList();
int32 ptrCount = windowList.CountItems(); int32 ptrCount = windowList.CountItems();
WinBorder **ptrWin = (WinBorder**)windowList.Items(); WinBorder **ptrWin = (WinBorder**)windowList.Items();
@@ -575,7 +575,7 @@ bool RootLayer::SetActiveWorkspace(int32 index)
} }
} }
desktop->Unlock(); fDesktop->Unlock();
} }
rgb_color bg = fWorkspace[index]->BGColor().GetColor32(); rgb_color bg = fWorkspace[index]->BGColor().GetColor32();
if ((bg.red + bg.green + bg.blue) / 3 > 128) if ((bg.red + bg.green + bg.blue) / 3 > 128)
@@ -1891,7 +1891,7 @@ void RootLayer::change_winBorder_feel(WinBorder *winBorder, int32 newFeel)
winBorder->Hide(false); winBorder->Hide(false);
} }
desktop->SetWinBorderFeel(winBorder, newFeel); gDesktop->SetWinBorderFeel(winBorder, newFeel);
if (isVisible) if (isVisible)
{ {
+27 -27
View File
@@ -114,7 +114,7 @@ ServerApp::ServerApp(port_id sendport, port_id rcvport, port_id clientLooperPort
// there should be a way that this ServerApp be attached to a particular // there should be a way that this ServerApp be attached to a particular
// RootLayer to know which RootLayer's cursor to modify. // RootLayer to know which RootLayer's cursor to modify.
ServerCursor *defaultCursor = ServerCursor *defaultCursor =
desktop->ActiveRootLayer()->GetCursorManager().GetCursor(B_CURSOR_DEFAULT); gDesktop->ActiveRootLayer()->GetCursorManager().GetCursor(B_CURSOR_DEFAULT);
if (defaultCursor) { if (defaultCursor) {
fAppCursor = new ServerCursor(defaultCursor); fAppCursor = new ServerCursor(defaultCursor);
@@ -159,7 +159,7 @@ ServerApp::~ServerApp(void)
// although this isn't pretty, ATM we have only one RootLayer. // although this isn't pretty, ATM we have only one RootLayer.
// there should be a way that this ServerApp be attached to a particular // there should be a way that this ServerApp be attached to a particular
// RootLayer to know which RootLayer's cursor to modify. // RootLayer to know which RootLayer's cursor to modify.
desktop->ActiveRootLayer()->GetCursorManager().RemoveAppCursors(fClientTeamID); gDesktop->ActiveRootLayer()->GetCursorManager().RemoveAppCursors(fClientTeamID);
delete_sem(fLockSem); delete_sem(fLockSem);
STRACE(("#ServerApp %s:~ServerApp()\n",fSignature.String())); STRACE(("#ServerApp %s:~ServerApp()\n",fSignature.String()));
@@ -275,7 +275,7 @@ ServerApp::SetAppCursor(void)
// there should be a way that this ServerApp be attached to a particular // there should be a way that this ServerApp be attached to a particular
// RootLayer to know which RootLayer's cursor to modify. // RootLayer to know which RootLayer's cursor to modify.
if (fAppCursor) if (fAppCursor)
desktop->ActiveRootLayer()->GetDisplayDriver()->SetCursor(fAppCursor); gDesktop->ActiveRootLayer()->GetDisplayDriver()->SetCursor(fAppCursor);
} }
/*! /*!
@@ -428,7 +428,7 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
for(int32 i=0; i<fSWindowList->CountItems(); i++) for(int32 i=0; i<fSWindowList->CountItems(); i++)
{ {
win=(ServerWindow*)fSWindowList->ItemAt(i); win=(ServerWindow*)fSWindowList->ItemAt(i);
win->GetWinBorder->UpdateColors(); win->GetWinBorder()->UpdateColors();
win->SendMessageToClient(AS_UPDATE_COLORS, msg); win->SendMessageToClient(AS_UPDATE_COLORS, msg);
} }
*/ break; */ break;
@@ -445,7 +445,7 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
for(int32 i=0; i<fSWindowList->CountItems(); i++) for(int32 i=0; i<fSWindowList->CountItems(); i++)
{ {
win=(ServerWindow*)fSWindowList->ItemAt(i); win=(ServerWindow*)fSWindowList->ItemAt(i);
win->GetWinBorder->UpdateFont(); win->GetWinBorder()->UpdateFont();
win->SendMessageToClient(AS_UPDATE_FONTS, msg); win->SendMessageToClient(AS_UPDATE_FONTS, msg);
} }
*/ break; */ break;
@@ -703,7 +703,7 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
msg.Read<uint32>(&mode); msg.Read<uint32>(&mode);
msg.Read<bool>(&stick); msg.Read<bool>(&stick);
RootLayer *root=desktop->ActiveRootLayer(); RootLayer *root=gDesktop->ActiveRootLayer();
Workspace *workspace=root->WorkspaceAt(index); Workspace *workspace=root->WorkspaceAt(index);
if (!workspace) { if (!workspace) {
@@ -737,7 +737,7 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
// although this isn't pretty, ATM we have only one RootLayer. // although this isn't pretty, ATM we have only one RootLayer.
// there should be a way that this ServerApp be attached to a particular // there should be a way that this ServerApp be attached to a particular
// RootLayer to know which RootLayer's cursor to modify. // RootLayer to know which RootLayer's cursor to modify.
desktop->ActiveRootLayer()->GetDisplayDriver()->ShowCursor(); gDesktop->ActiveRootLayer()->GetDisplayDriver()->ShowCursor();
fCursorHidden = false; fCursorHidden = false;
break; break;
} }
@@ -747,7 +747,7 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
// although this isn't pretty, ATM we have only one RootLayer. // although this isn't pretty, ATM we have only one RootLayer.
// there should be a way that this ServerApp be attached to a particular // there should be a way that this ServerApp be attached to a particular
// RootLayer to know which RootLayer's cursor to modify. // RootLayer to know which RootLayer's cursor to modify.
desktop->ActiveRootLayer()->GetDisplayDriver()->HideCursor(); gDesktop->ActiveRootLayer()->GetDisplayDriver()->HideCursor();
fCursorHidden = true; fCursorHidden = true;
break; break;
} }
@@ -757,7 +757,7 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
// although this isn't pretty, ATM we have only one RootLayer. // although this isn't pretty, ATM we have only one RootLayer.
// there should be a way that this ServerApp be attached to a particular // there should be a way that this ServerApp be attached to a particular
// RootLayer to know which RootLayer's cursor to modify. // RootLayer to know which RootLayer's cursor to modify.
desktop->ActiveRootLayer()->GetDisplayDriver()->ObscureCursor(); gDesktop->ActiveRootLayer()->GetDisplayDriver()->ObscureCursor();
break; break;
} }
case AS_QUERY_CURSOR_HIDDEN: case AS_QUERY_CURSOR_HIDDEN:
@@ -786,16 +786,16 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
// otherwise be easy to crash the server by calling SetCursor a // otherwise be easy to crash the server by calling SetCursor a
// sufficient number of times // sufficient number of times
if(fAppCursor) if(fAppCursor)
desktop->ActiveRootLayer()->GetCursorManager().DeleteCursor(fAppCursor->ID()); gDesktop->ActiveRootLayer()->GetCursorManager().DeleteCursor(fAppCursor->ID());
fAppCursor = new ServerCursor(cdata); fAppCursor = new ServerCursor(cdata);
fAppCursor->SetOwningTeam(fClientTeamID); fAppCursor->SetOwningTeam(fClientTeamID);
fAppCursor->SetAppSignature(fSignature.String()); fAppCursor->SetAppSignature(fSignature.String());
desktop->ActiveRootLayer()->GetCursorManager().AddCursor(fAppCursor); gDesktop->ActiveRootLayer()->GetCursorManager().AddCursor(fAppCursor);
// although this isn't pretty, ATM we have only one RootLayer. // although this isn't pretty, ATM we have only one RootLayer.
// there should be a way that this ServerApp be attached to a particular // there should be a way that this ServerApp be attached to a particular
// RootLayer to know which RootLayer's cursor to modify. // RootLayer to know which RootLayer's cursor to modify.
desktop->ActiveRootLayer()->GetDisplayDriver()->SetCursor(fAppCursor); gDesktop->ActiveRootLayer()->GetDisplayDriver()->SetCursor(fAppCursor);
break; break;
} }
case AS_SET_CURSOR_BCURSOR: case AS_SET_CURSOR_BCURSOR:
@@ -818,8 +818,8 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
// there should be a way that this ServerApp be attached to a particular // there should be a way that this ServerApp be attached to a particular
// RootLayer to know which RootLayer's cursor to modify. // RootLayer to know which RootLayer's cursor to modify.
ServerCursor *cursor; ServerCursor *cursor;
if ((cursor = desktop->ActiveRootLayer()->GetCursorManager().FindCursor(ctoken))) if ((cursor = gDesktop->ActiveRootLayer()->GetCursorManager().FindCursor(ctoken)))
desktop->ActiveRootLayer()->GetDisplayDriver()->SetCursor(cursor); gDesktop->ActiveRootLayer()->GetDisplayDriver()->SetCursor(cursor);
if(sync) if(sync)
{ {
@@ -850,7 +850,7 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
// although this isn't pretty, ATM we have only one RootLayer. // although this isn't pretty, ATM we have only one RootLayer.
// there should be a way that this ServerApp be attached to a particular // there should be a way that this ServerApp be attached to a particular
// RootLayer to know which RootLayer's cursor to modify. // RootLayer to know which RootLayer's cursor to modify.
desktop->ActiveRootLayer()->GetCursorManager().AddCursor(fAppCursor); gDesktop->ActiveRootLayer()->GetCursorManager().AddCursor(fAppCursor);
// Synchronous message - BApplication is waiting on the cursor's ID // Synchronous message - BApplication is waiting on the cursor's ID
replylink.SetSendPort(replyport); replylink.SetSendPort(replyport);
@@ -873,7 +873,7 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
// although this isn't pretty, ATM we have only one RootLayer. // although this isn't pretty, ATM we have only one RootLayer.
// there should be a way that this ServerApp be attached to a particular // there should be a way that this ServerApp be attached to a particular
// RootLayer to know which RootLayer's cursor to modify. // RootLayer to know which RootLayer's cursor to modify.
desktop->ActiveRootLayer()->GetCursorManager().DeleteCursor(ctoken); gDesktop->ActiveRootLayer()->GetCursorManager().DeleteCursor(ctoken);
break; break;
} }
case AS_GET_SCROLLBAR_INFO: case AS_GET_SCROLLBAR_INFO:
@@ -882,7 +882,7 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
// Attached data: // Attached data:
// 1) port_id reply port - synchronous message // 1) port_id reply port - synchronous message
scroll_bar_info sbi=desktop->ScrollBarInfo(); scroll_bar_info sbi=gDesktop->ScrollBarInfo();
port_id replyport; port_id replyport;
msg.Read<int32>(&replyport); msg.Read<int32>(&replyport);
@@ -901,7 +901,7 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
scroll_bar_info sbi; scroll_bar_info sbi;
msg.Read<scroll_bar_info>(&sbi); msg.Read<scroll_bar_info>(&sbi);
desktop->SetScrollBarInfo(sbi); gDesktop->SetScrollBarInfo(sbi);
break; break;
} }
case AS_FOCUS_FOLLOWS_MOUSE: case AS_FOCUS_FOLLOWS_MOUSE:
@@ -915,7 +915,7 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
replylink.SetSendPort(replyport); replylink.SetSendPort(replyport);
replylink.StartMessage(SERVER_TRUE); replylink.StartMessage(SERVER_TRUE);
replylink.Attach<bool>(desktop->FFMouseInUse()); replylink.Attach<bool>(gDesktop->FFMouseInUse());
replylink.Flush(); replylink.Flush();
break; break;
} }
@@ -927,7 +927,7 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
scroll_bar_info sbi; scroll_bar_info sbi;
msg.Read<scroll_bar_info>(&sbi); msg.Read<scroll_bar_info>(&sbi);
desktop->SetScrollBarInfo(sbi);*/ gDesktop->SetScrollBarInfo(sbi);*/
break; break;
} }
case AS_SET_MOUSE_MODE: case AS_SET_MOUSE_MODE:
@@ -938,7 +938,7 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
mode_mouse mmode; mode_mouse mmode;
msg.Read<mode_mouse>(&mmode); msg.Read<mode_mouse>(&mmode);
desktop->SetFFMouseMode(mmode); gDesktop->SetFFMouseMode(mmode);
break; break;
} }
case AS_GET_MOUSE_MODE: case AS_GET_MOUSE_MODE:
@@ -947,7 +947,7 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
// Attached data: // Attached data:
// 1) port_id reply port - synchronous message // 1) port_id reply port - synchronous message
mode_mouse mmode=desktop->FFMouseMode(); mode_mouse mmode=gDesktop->FFMouseMode();
port_id replyport = -1; port_id replyport = -1;
msg.Read<int32>(&replyport); msg.Read<int32>(&replyport);
@@ -1209,7 +1209,7 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
font.SetSize(size); font.SetSize(size);
font.SetSpacing(spacing); font.SetSpacing(spacing);
width = desktop->GetDisplayDriver()->StringWidth(string, length, font); width = gDesktop->GetDisplayDriver()->StringWidth(string, length, font);
// NOTE: The line below will return the exact same thing. However, // NOTE: The line below will return the exact same thing. However,
// the line above uses the AGG rendering backend, for which glyph caching // the line above uses the AGG rendering backend, for which glyph caching
// actually works. It is about 20 times faster! // actually works. It is about 20 times faster!
@@ -1890,7 +1890,7 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
// We have the screen_id and the workspace number, with these // We have the screen_id and the workspace number, with these
// we need to find the corresponding "driver", and call getmode on it // we need to find the corresponding "driver", and call getmode on it
display_mode mode; display_mode mode;
desktop->GetDisplayDriver()->GetMode(mode); gDesktop->GetDisplayDriver()->GetMode(mode);
// actually this isn't still enough as different workspaces can // actually this isn't still enough as different workspaces can
// have different display_modes // have different display_modes
@@ -1929,10 +1929,10 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
// TODO: Adi doesn't like this: see if // TODO: Adi doesn't like this: see if
// messaging is better. // messaging is better.
desktop->ActiveRootLayer()->Lock(); gDesktop->ActiveRootLayer()->Lock();
// TODO: This should return something // TODO: This should return something
desktop->GetDisplayDriver()->SetMode(mode); gDesktop->GetDisplayDriver()->SetMode(mode);
desktop->ActiveRootLayer()->Unlock(); gDesktop->ActiveRootLayer()->Unlock();
int32 replyport; int32 replyport;
msg.Read<int32>(&replyport); msg.Read<int32>(&replyport);
+30 -30
View File
@@ -162,7 +162,7 @@ ServerWindow::Init(BRect frame, uint32 wlook,
snprintf(name, sizeof(name), "%ld: %s", fClientTeamID, fName); snprintf(name, sizeof(name), "%ld: %s", fClientTeamID, fName);
fWinBorder = new WinBorder(frame, name, wlook, wfeel, wflags, fWinBorder = new WinBorder(frame, name, wlook, wfeel, wflags,
wwksindex, this, desktop->GetDisplayDriver()); wwksindex, this, gDesktop->GetDisplayDriver());
// Spawn our message-monitoring thread // Spawn our message-monitoring thread
fMonitorThreadID = spawn_thread(MonitorWin, fName, B_NORMAL_PRIORITY, this); fMonitorThreadID = spawn_thread(MonitorWin, fName, B_NORMAL_PRIORITY, this);
@@ -378,7 +378,7 @@ ServerWindow::CreateLayerTree(Layer *localRoot, LinkMsgReader &link)
STRACE(("ServerWindow(%s)::CreateLayerTree()-> layer %s, token %ld\n", fName,name,token)); STRACE(("ServerWindow(%s)::CreateLayerTree()-> layer %s, token %ld\n", fName,name,token));
Layer *newLayer = new Layer(frame, name, token, resizeMask, Layer *newLayer = new Layer(frame, name, token, resizeMask,
flags, desktop->GetDisplayDriver()); flags, gDesktop->GetDisplayDriver());
free(name); free(name);
@@ -1179,7 +1179,7 @@ ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
link.Read<int32>(&mainToken); link.Read<int32>(&mainToken);
link.Read(&teamID, sizeof(team_id)); link.Read(&teamID, sizeof(team_id));
wb = desktop->FindWinBorderByServerWindowTokenAndTeamID(mainToken, teamID); wb = gDesktop->FindWinBorderByServerWindowTokenAndTeamID(mainToken, teamID);
if(wb) if(wb)
{ {
fMsgSender->StartMessage(SERVER_TRUE); fMsgSender->StartMessage(SERVER_TRUE);
@@ -1208,7 +1208,7 @@ ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
link.Read<int32>(&mainToken); link.Read<int32>(&mainToken);
link.Read(&teamID, sizeof(team_id)); link.Read(&teamID, sizeof(team_id));
wb = desktop->FindWinBorderByServerWindowTokenAndTeamID(mainToken, teamID); wb = gDesktop->FindWinBorderByServerWindowTokenAndTeamID(mainToken, teamID);
if(wb) if(wb)
{ {
fMsgSender->StartMessage(SERVER_TRUE); fMsgSender->StartMessage(SERVER_TRUE);
@@ -1488,8 +1488,8 @@ ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
// 1) BPoint mouse location // 1) BPoint mouse location
// 2) int32 button state // 2) int32 button state
fMsgSender->Attach<BPoint>(desktop->GetDisplayDriver()->GetCursorPosition()); fMsgSender->Attach<BPoint>(gDesktop->GetDisplayDriver()->GetCursorPosition());
fMsgSender->Attach<int32>(desktop->ActiveRootLayer()->Buttons()); fMsgSender->Attach<int32>(gDesktop->ActiveRootLayer()->Buttons());
fMsgSender->Flush(); fMsgSender->Flush();
break; break;
@@ -1510,10 +1510,10 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
if (fWinBorder->fInUpdate) if (fWinBorder->fInUpdate)
rreg.IntersectWith(&fWinBorder->yUpdateReg); rreg.IntersectWith(&fWinBorder->yUpdateReg);
desktop->GetDisplayDriver()->ConstrainClippingRegion(&rreg); gDesktop->GetDisplayDriver()->ConstrainClippingRegion(&rreg);
// rgb_color rrr = fCurrentLayer->fLayerData->viewcolor.GetColor32(); // rgb_color rrr = fCurrentLayer->fLayerData->viewcolor.GetColor32();
// RGBColor c(rand()%255,rand()%255,rand()%255); // RGBColor c(rand()%255,rand()%255,rand()%255);
// desktop->GetDisplayDriver()->FillRect(BRect(0,0,639,479), c); // gDesktop->GetDisplayDriver()->FillRect(BRect(0,0,639,479), c);
switch (code) { switch (code) {
case AS_STROKE_LINE: case AS_STROKE_LINE:
@@ -1530,7 +1530,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
if (fCurrentLayer && fCurrentLayer->fLayerData) { if (fCurrentLayer && fCurrentLayer->fLayerData) {
BPoint p1(x1,y1); BPoint p1(x1,y1);
BPoint p2(x2,y2); BPoint p2(x2,y2);
desktop->GetDisplayDriver()->StrokeLine(fCurrentLayer->ConvertToTop(p1), gDesktop->GetDisplayDriver()->StrokeLine(fCurrentLayer->ConvertToTop(p1),
fCurrentLayer->ConvertToTop(p2), fCurrentLayer->ConvertToTop(p2),
fCurrentLayer->fLayerData); fCurrentLayer->fLayerData);
@@ -1552,7 +1552,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
link.Read<BRect>(&rect); link.Read<BRect>(&rect);
if (fCurrentLayer && fCurrentLayer->fLayerData) if (fCurrentLayer && fCurrentLayer->fLayerData)
desktop->GetDisplayDriver()->InvertRect(fCurrentLayer->ConvertToTop(rect)); gDesktop->GetDisplayDriver()->InvertRect(fCurrentLayer->ConvertToTop(rect));
break; break;
} }
case AS_STROKE_RECT: case AS_STROKE_RECT:
@@ -1567,7 +1567,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
BRect rect(left,top,right,bottom); BRect rect(left,top,right,bottom);
if (fCurrentLayer && fCurrentLayer->fLayerData) if (fCurrentLayer && fCurrentLayer->fLayerData)
desktop->GetDisplayDriver()->StrokeRect(fCurrentLayer->ConvertToTop(rect),fCurrentLayer->fLayerData); gDesktop->GetDisplayDriver()->StrokeRect(fCurrentLayer->ConvertToTop(rect),fCurrentLayer->fLayerData);
break; break;
} }
case AS_FILL_RECT: case AS_FILL_RECT:
@@ -1577,7 +1577,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
BRect rect; BRect rect;
link.Read<BRect>(&rect); link.Read<BRect>(&rect);
if (fCurrentLayer && fCurrentLayer->fLayerData) if (fCurrentLayer && fCurrentLayer->fLayerData)
desktop->GetDisplayDriver()->FillRect(fCurrentLayer->ConvertToTop(rect),fCurrentLayer->fLayerData); gDesktop->GetDisplayDriver()->FillRect(fCurrentLayer->ConvertToTop(rect),fCurrentLayer->fLayerData);
break; break;
} }
case AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT: case AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT:
@@ -1677,7 +1677,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
link.Read<float>(&angle); link.Read<float>(&angle);
link.Read<float>(&span); link.Read<float>(&span);
if (fCurrentLayer && fCurrentLayer->fLayerData) if (fCurrentLayer && fCurrentLayer->fLayerData)
desktop->GetDisplayDriver()->StrokeArc(fCurrentLayer->ConvertToTop(r),angle,span,fCurrentLayer->fLayerData); gDesktop->GetDisplayDriver()->StrokeArc(fCurrentLayer->ConvertToTop(r),angle,span,fCurrentLayer->fLayerData);
break; break;
} }
case AS_FILL_ARC: case AS_FILL_ARC:
@@ -1691,7 +1691,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
link.Read<float>(&angle); link.Read<float>(&angle);
link.Read<float>(&span); link.Read<float>(&span);
if (fCurrentLayer && fCurrentLayer->fLayerData) if (fCurrentLayer && fCurrentLayer->fLayerData)
desktop->GetDisplayDriver()->FillArc(fCurrentLayer->ConvertToTop(r),angle,span,fCurrentLayer->fLayerData); gDesktop->GetDisplayDriver()->FillArc(fCurrentLayer->ConvertToTop(r),angle,span,fCurrentLayer->fLayerData);
break; break;
} }
case AS_STROKE_BEZIER: case AS_STROKE_BEZIER:
@@ -1710,7 +1710,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
for (i=0; i<4; i++) for (i=0; i<4; i++)
pts[i]=fCurrentLayer->ConvertToTop(pts[i]); pts[i]=fCurrentLayer->ConvertToTop(pts[i]);
desktop->GetDisplayDriver()->StrokeBezier(pts,fCurrentLayer->fLayerData); gDesktop->GetDisplayDriver()->StrokeBezier(pts,fCurrentLayer->fLayerData);
} }
delete [] pts; delete [] pts;
break; break;
@@ -1731,7 +1731,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
for (i=0; i<4; i++) for (i=0; i<4; i++)
pts[i]=fCurrentLayer->ConvertToTop(pts[i]); pts[i]=fCurrentLayer->ConvertToTop(pts[i]);
desktop->GetDisplayDriver()->FillBezier(pts,fCurrentLayer->fLayerData); gDesktop->GetDisplayDriver()->FillBezier(pts,fCurrentLayer->fLayerData);
} }
delete [] pts; delete [] pts;
break; break;
@@ -1743,7 +1743,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
BRect rect; BRect rect;
link.Read<BRect>(&rect); link.Read<BRect>(&rect);
if (fCurrentLayer && fCurrentLayer->fLayerData) if (fCurrentLayer && fCurrentLayer->fLayerData)
desktop->GetDisplayDriver()->StrokeEllipse(fCurrentLayer->ConvertToTop(rect),fCurrentLayer->fLayerData); gDesktop->GetDisplayDriver()->StrokeEllipse(fCurrentLayer->ConvertToTop(rect),fCurrentLayer->fLayerData);
break; break;
} }
case AS_FILL_ELLIPSE: case AS_FILL_ELLIPSE:
@@ -1753,7 +1753,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
BRect rect; BRect rect;
link.Read<BRect>(&rect); link.Read<BRect>(&rect);
if (fCurrentLayer && fCurrentLayer->fLayerData) if (fCurrentLayer && fCurrentLayer->fLayerData)
desktop->GetDisplayDriver()->FillEllipse(fCurrentLayer->ConvertToTop(rect),fCurrentLayer->fLayerData); gDesktop->GetDisplayDriver()->FillEllipse(fCurrentLayer->ConvertToTop(rect),fCurrentLayer->fLayerData);
break; break;
} }
case AS_STROKE_ROUNDRECT: case AS_STROKE_ROUNDRECT:
@@ -1767,7 +1767,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
link.Read<float>(&yrad); link.Read<float>(&yrad);
if (fCurrentLayer && fCurrentLayer->fLayerData) if (fCurrentLayer && fCurrentLayer->fLayerData)
desktop->GetDisplayDriver()->StrokeRoundRect(fCurrentLayer->ConvertToTop(rect),xrad,yrad,fCurrentLayer->fLayerData); gDesktop->GetDisplayDriver()->StrokeRoundRect(fCurrentLayer->ConvertToTop(rect),xrad,yrad,fCurrentLayer->fLayerData);
break; break;
} }
case AS_FILL_ROUNDRECT: case AS_FILL_ROUNDRECT:
@@ -1781,7 +1781,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
link.Read<float>(&yrad); link.Read<float>(&yrad);
if (fCurrentLayer && fCurrentLayer->fLayerData) if (fCurrentLayer && fCurrentLayer->fLayerData)
desktop->GetDisplayDriver()->FillRoundRect(fCurrentLayer->ConvertToTop(rect),xrad,yrad,fCurrentLayer->fLayerData); gDesktop->GetDisplayDriver()->FillRoundRect(fCurrentLayer->ConvertToTop(rect),xrad,yrad,fCurrentLayer->fLayerData);
break; break;
} }
case AS_STROKE_TRIANGLE: case AS_STROKE_TRIANGLE:
@@ -1801,7 +1801,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
for(int i=0;i<3;i++) for(int i=0;i<3;i++)
pts[i]=fCurrentLayer->ConvertToTop(pts[i]); pts[i]=fCurrentLayer->ConvertToTop(pts[i]);
desktop->GetDisplayDriver()->StrokeTriangle(pts,fCurrentLayer->ConvertToTop(rect),fCurrentLayer->fLayerData); gDesktop->GetDisplayDriver()->StrokeTriangle(pts,fCurrentLayer->ConvertToTop(rect),fCurrentLayer->fLayerData);
} }
break; break;
} }
@@ -1822,7 +1822,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
for(int i=0;i<3;i++) for(int i=0;i<3;i++)
pts[i]=fCurrentLayer->ConvertToTop(pts[i]); pts[i]=fCurrentLayer->ConvertToTop(pts[i]);
desktop->GetDisplayDriver()->FillTriangle(pts,fCurrentLayer->ConvertToTop(rect),fCurrentLayer->fLayerData); gDesktop->GetDisplayDriver()->FillTriangle(pts,fCurrentLayer->ConvertToTop(rect),fCurrentLayer->fLayerData);
} }
break; break;
} }
@@ -1847,7 +1847,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
for(int32 i=0; i<pointcount; i++) for(int32 i=0; i<pointcount; i++)
pointlist[i]=fCurrentLayer->ConvertToTop(pointlist[i]); pointlist[i]=fCurrentLayer->ConvertToTop(pointlist[i]);
desktop->GetDisplayDriver()->StrokePolygon(pointlist,pointcount,polyframe, gDesktop->GetDisplayDriver()->StrokePolygon(pointlist,pointcount,polyframe,
fCurrentLayer->fLayerData,isclosed); fCurrentLayer->fLayerData,isclosed);
delete [] pointlist; delete [] pointlist;
@@ -1872,7 +1872,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
for(int32 i=0; i<pointcount; i++) for(int32 i=0; i<pointcount; i++)
pointlist[i]=fCurrentLayer->ConvertToTop(pointlist[i]); pointlist[i]=fCurrentLayer->ConvertToTop(pointlist[i]);
desktop->GetDisplayDriver()->FillPolygon(pointlist,pointcount,polyframe,fCurrentLayer->fLayerData); gDesktop->GetDisplayDriver()->FillPolygon(pointlist,pointcount,polyframe,fCurrentLayer->fLayerData);
delete [] pointlist; delete [] pointlist;
@@ -1901,7 +1901,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
for(int32 i=0; i<ptcount; i++) for(int32 i=0; i<ptcount; i++)
ptlist[i]=fCurrentLayer->ConvertToTop(ptlist[i]); ptlist[i]=fCurrentLayer->ConvertToTop(ptlist[i]);
desktop->GetDisplayDriver()->StrokeShape(shaperect, opcount, oplist, ptcount, ptlist, fCurrentLayer->fLayerData); gDesktop->GetDisplayDriver()->StrokeShape(shaperect, opcount, oplist, ptcount, ptlist, fCurrentLayer->fLayerData);
delete oplist; delete oplist;
delete ptlist; delete ptlist;
@@ -1930,7 +1930,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
for(int32 i=0; i<ptcount; i++) for(int32 i=0; i<ptcount; i++)
ptlist[i]=fCurrentLayer->ConvertToTop(ptlist[i]); ptlist[i]=fCurrentLayer->ConvertToTop(ptlist[i]);
desktop->GetDisplayDriver()->FillShape(shaperect, opcount, oplist, ptcount, ptlist, fCurrentLayer->fLayerData); gDesktop->GetDisplayDriver()->FillShape(shaperect, opcount, oplist, ptcount, ptlist, fCurrentLayer->fLayerData);
delete oplist; delete oplist;
delete ptlist; delete ptlist;
@@ -1954,7 +1954,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
// in repeatedly calling FillRect(), this is definitely in need of optimization. At // in repeatedly calling FillRect(), this is definitely in need of optimization. At
// least it works for now. :) // least it works for now. :)
for(int32 i=0; i<rectcount; i++) for(int32 i=0; i<rectcount; i++)
desktop->GetDisplayDriver()->FillRect(fCurrentLayer->ConvertToTop(rectlist[i]),fCurrentLayer->fLayerData); gDesktop->GetDisplayDriver()->FillRect(fCurrentLayer->ConvertToTop(rectlist[i]),fCurrentLayer->fLayerData);
delete [] rectlist; delete [] rectlist;
@@ -1991,7 +1991,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
index->pt1=fCurrentLayer->ConvertToTop(index->pt1); index->pt1=fCurrentLayer->ConvertToTop(index->pt1);
index->pt2=fCurrentLayer->ConvertToTop(index->pt2); index->pt2=fCurrentLayer->ConvertToTop(index->pt2);
} }
desktop->GetDisplayDriver()->StrokeLineArray(linecount,linedata,fCurrentLayer->fLayerData); gDesktop->GetDisplayDriver()->StrokeLineArray(linecount,linedata,fCurrentLayer->fLayerData);
} }
break; break;
} }
@@ -2009,7 +2009,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
link.ReadString(&string); link.ReadString(&string);
if (fCurrentLayer && fCurrentLayer->fLayerData) if (fCurrentLayer && fCurrentLayer->fLayerData)
desktop->GetDisplayDriver()->DrawString(string, length, gDesktop->GetDisplayDriver()->DrawString(string, length,
fCurrentLayer->ConvertToTop(location), fCurrentLayer->ConvertToTop(location),
fCurrentLayer->fLayerData); fCurrentLayer->fLayerData);
@@ -2023,7 +2023,7 @@ ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
} }
} }
desktop->GetDisplayDriver()->ConstrainClippingRegion(NULL); gDesktop->GetDisplayDriver()->ConstrainClippingRegion(NULL);
fWinBorder->GetRootLayer()->Unlock(); fWinBorder->GetRootLayer()->Unlock();
} }
+2 -2
View File
@@ -118,7 +118,7 @@ cnt = 0; // for debugging
RebuildFullRegion(); RebuildFullRegion();
desktop->AddWinBorder(this); gDesktop->AddWinBorder(this);
STRACE(("WinBorder %s:\n",GetName())); STRACE(("WinBorder %s:\n",GetName()));
STRACE(("\tFrame: (%.1f,%.1f,%.1f,%.1f)\n",r.left,r.top,r.right,r.bottom)); STRACE(("\tFrame: (%.1f,%.1f,%.1f,%.1f)\n",r.left,r.top,r.right,r.bottom));
@@ -129,7 +129,7 @@ WinBorder::~WinBorder(void)
{ {
STRACE(("WinBorder(%s)::~WinBorder()\n",GetName())); STRACE(("WinBorder(%s)::~WinBorder()\n",GetName()));
desktop->RemoveWinBorder(this); gDesktop->RemoveWinBorder(this);
if (fTopLayer){ if (fTopLayer){
delete fTopLayer; delete fTopLayer;