ViewDriver functions won't do anything if not initialized
Style tweaks to a number of files to better match OT guidelines Added MsgCodeToBString to Utils.cpp Removed a crash on new_decorator git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6157 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -58,9 +58,10 @@
|
|||||||
#else
|
#else
|
||||||
# define STRACE(x) ;
|
# define STRACE(x) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Globals
|
// Globals
|
||||||
|
|
||||||
Desktop* desktop;
|
Desktop *desktop;
|
||||||
|
|
||||||
//! Used to access the app_server from new_decorator
|
//! Used to access the app_server from new_decorator
|
||||||
AppServer *app_server=NULL;
|
AppServer *app_server=NULL;
|
||||||
@@ -83,14 +84,17 @@ AppServer::AppServer(void) : BApplication (SERVER_SIGNATURE)
|
|||||||
AppServer::AppServer(void)
|
AppServer::AppServer(void)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
_mouseport = create_port(200,SERVER_INPUT_PORT);
|
fMousePort= create_port(200,SERVER_INPUT_PORT);
|
||||||
_messageport = create_port(200,SERVER_PORT_NAME);
|
_fMessagePort= create_port(200,SERVER_PORT_NAME);
|
||||||
|
|
||||||
_applist = new BList(0);
|
fAppList= new BList(0);
|
||||||
_quitting_server= false;
|
fQuittingServer= false;
|
||||||
_exit_poller = false;
|
fExitPoller= false;
|
||||||
_ssindex = 1;
|
fScreenShotIndex= 1;
|
||||||
make_decorator = NULL;
|
make_decorator= NULL;
|
||||||
|
|
||||||
|
// We need this in order for new_decorator to be able to instantiate new decorators
|
||||||
|
app_server=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;
|
||||||
@@ -125,36 +129,36 @@ AppServer::AppServer(void)
|
|||||||
InitDecorators();
|
InitDecorators();
|
||||||
|
|
||||||
// Set up the Desktop
|
// Set up the Desktop
|
||||||
desktop = new Desktop();
|
desktop= new Desktop();
|
||||||
desktop->Init();
|
desktop->Init();
|
||||||
|
|
||||||
// Create the cursor manager. Object declared in CursorManager.cpp
|
// Create the cursor manager. Object declared in CursorManager.cpp
|
||||||
cursormanager = new CursorManager();
|
cursormanager= new CursorManager();
|
||||||
cursormanager->SetCursor(B_CURSOR_DEFAULT);
|
cursormanager->SetCursor(B_CURSOR_DEFAULT);
|
||||||
|
|
||||||
// Create the bitmap allocator. Object declared in BitmapManager.cpp
|
// Create the bitmap allocator. Object declared in BitmapManager.cpp
|
||||||
bitmapmanager = new BitmapManager();
|
bitmapmanager= new BitmapManager();
|
||||||
|
|
||||||
// This is necessary to mediate access between the Poller and app_server threads
|
// This is necessary to mediate access between the Poller and app_server threads
|
||||||
_active_lock = create_sem(1,"app_server_active_sem");
|
fActiveAppLock= create_sem(1,"app_server_active_sem");
|
||||||
|
|
||||||
// This locker is for app_server and Picasso to vy for control of the ServerApp list
|
// This locker is for app_server and Picasso to vy for control of the ServerApp list
|
||||||
_applist_lock = create_sem(1,"app_server_applist_sem");
|
fAppListLock= create_sem(1,"app_server_applist_sem");
|
||||||
|
|
||||||
// This locker is to mediate access to the make_decorator pointer
|
// This locker is to mediate access to the make_decorator pointer
|
||||||
_decor_lock = create_sem(1,"app_server_decor_sem");
|
fDecoratorLock= create_sem(1,"app_server_decor_sem");
|
||||||
|
|
||||||
// Spawn our input-polling thread
|
// Spawn our input-polling thread
|
||||||
_poller_id = spawn_thread(PollerThread, "Poller", B_NORMAL_PRIORITY, this);
|
fPollerThreadID= spawn_thread(PollerThread, "Poller", B_NORMAL_PRIORITY, this);
|
||||||
if (_poller_id >= 0)
|
if (fPollerThreadID >= 0)
|
||||||
resume_thread(_poller_id);
|
resume_thread(fPollerThreadID);
|
||||||
|
|
||||||
// Spawn our thread-monitoring thread
|
// Spawn our thread-monitoring thread
|
||||||
_picasso_id = spawn_thread(PicassoThread,"Picasso", B_NORMAL_PRIORITY, this);
|
fPicassoThreadID= spawn_thread(PicassoThread,"Picasso", B_NORMAL_PRIORITY, this);
|
||||||
if (_picasso_id >= 0)
|
if (fPicassoThreadID >= 0)
|
||||||
resume_thread(_picasso_id);
|
resume_thread(fPicassoThreadID);
|
||||||
|
|
||||||
decorator_name = "Default";
|
fDecoratorName="Default";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -168,15 +172,15 @@ AppServer::~AppServer(void)
|
|||||||
|
|
||||||
ServerApp *tempapp;
|
ServerApp *tempapp;
|
||||||
int32 i;
|
int32 i;
|
||||||
acquire_sem(_applist_lock);
|
acquire_sem(fAppListLock);
|
||||||
for(i=0;i<_applist->CountItems();i++)
|
for(i=0;i<fAppList->CountItems();i++)
|
||||||
{
|
{
|
||||||
tempapp=(ServerApp *)_applist->ItemAt(i);
|
tempapp=(ServerApp *)fAppList->ItemAt(i);
|
||||||
if(tempapp!=NULL)
|
if(tempapp!=NULL)
|
||||||
delete tempapp;
|
delete tempapp;
|
||||||
}
|
}
|
||||||
delete _applist;
|
delete fAppList;
|
||||||
release_sem(_applist_lock);
|
release_sem(fAppListLock);
|
||||||
|
|
||||||
delete bitmapmanager;
|
delete bitmapmanager;
|
||||||
delete cursormanager;
|
delete cursormanager;
|
||||||
@@ -186,8 +190,8 @@ AppServer::~AppServer(void)
|
|||||||
// 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
|
||||||
// error and fail if the threads have already exited.
|
// error and fail if the threads have already exited.
|
||||||
kill_thread(_poller_id);
|
kill_thread(fPollerThreadID);
|
||||||
kill_thread(_picasso_id);
|
kill_thread(fPicassoThreadID);
|
||||||
|
|
||||||
delete fontserver;
|
delete fontserver;
|
||||||
|
|
||||||
@@ -202,8 +206,8 @@ AppServer::~AppServer(void)
|
|||||||
int32 AppServer::PollerThread(void *data)
|
int32 AppServer::PollerThread(void *data)
|
||||||
{
|
{
|
||||||
// This thread handles nothing but input messages for mouse and keyboard
|
// This thread handles nothing but input messages for mouse and keyboard
|
||||||
AppServer *appserver = (AppServer*)data;
|
AppServer *appserver=(AppServer*)data;
|
||||||
PortQueue mousequeue(appserver->_mouseport);
|
PortQueue mousequeue(appserver->fMousePort);
|
||||||
PortMessage *msg;
|
PortMessage *msg;
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
@@ -213,7 +217,7 @@ int32 AppServer::PollerThread(void *data)
|
|||||||
else
|
else
|
||||||
mousequeue.GetMessagesFromPort(false);
|
mousequeue.GetMessagesFromPort(false);
|
||||||
|
|
||||||
msg = mousequeue.GetMessageFromQueue();
|
msg= mousequeue.GetMessageFromQueue();
|
||||||
if(!msg)
|
if(!msg)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -244,7 +248,7 @@ int32 AppServer::PollerThread(void *data)
|
|||||||
|
|
||||||
delete msg;
|
delete msg;
|
||||||
|
|
||||||
if(appserver->_exit_poller)
|
if(appserver->fExitPoller)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -258,14 +262,14 @@ int32 AppServer::PollerThread(void *data)
|
|||||||
int32 AppServer::PicassoThread(void *data)
|
int32 AppServer::PicassoThread(void *data)
|
||||||
{
|
{
|
||||||
int32 i;
|
int32 i;
|
||||||
AppServer *appserver = (AppServer*)data;
|
AppServer *appserver=(AppServer*)data;
|
||||||
ServerApp *app;
|
ServerApp *app;
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
acquire_sem(appserver->_applist_lock);
|
acquire_sem(appserver->fAppListLock);
|
||||||
for(i = 0; i < appserver->_applist->CountItems(); i++)
|
for(i= 0; i < appserver->fAppList->CountItems(); i++)
|
||||||
{
|
{
|
||||||
app = (ServerApp*)appserver->_applist->ItemAt(i);
|
app=(ServerApp*)appserver->fAppList->ItemAt(i);
|
||||||
if(!app)
|
if(!app)
|
||||||
{
|
{
|
||||||
printf("PANIC: NULL app in app list\n");
|
printf("PANIC: NULL app in app list\n");
|
||||||
@@ -273,11 +277,11 @@ int32 AppServer::PicassoThread(void *data)
|
|||||||
}
|
}
|
||||||
app->PingTarget();
|
app->PingTarget();
|
||||||
}
|
}
|
||||||
release_sem(appserver->_applist_lock);
|
release_sem(appserver->fAppListLock);
|
||||||
|
|
||||||
// if poller thread has to exit, so do we - I just was too lazy
|
// if poller thread has to exit, so do we - I just was too lazy
|
||||||
// to rename the variable name. ;)
|
// to rename the variable name. ;)
|
||||||
if(appserver->_exit_poller)
|
if(appserver->fExitPoller)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// we do this every other second so as not to suck *too* many CPU cycles
|
// we do this every other second so as not to suck *too* many CPU cycles
|
||||||
@@ -300,13 +304,13 @@ thread_id AppServer::Run(void)
|
|||||||
//! Main message-monitoring loop for the regular message port - no input messages!
|
//! Main message-monitoring loop for the regular message port - no input messages!
|
||||||
void AppServer::MainLoop(void)
|
void AppServer::MainLoop(void)
|
||||||
{
|
{
|
||||||
PortMessage pmsg;
|
PortMessage pmsg;
|
||||||
|
|
||||||
for(;;)
|
while(1)
|
||||||
{
|
{
|
||||||
if(pmsg.ReadFromPort(_messageport) == B_OK)
|
if(pmsg.ReadFromPort(_fMessagePort)== B_OK)
|
||||||
{
|
{
|
||||||
if(pmsg.Protocol() == B_QUIT_REQUESTED)
|
if(pmsg.Protocol()== B_QUIT_REQUESTED)
|
||||||
pmsg.SetCode(B_QUIT_REQUESTED);
|
pmsg.SetCode(B_QUIT_REQUESTED);
|
||||||
|
|
||||||
switch(pmsg.Code())
|
switch(pmsg.Code())
|
||||||
@@ -336,7 +340,7 @@ void AppServer::MainLoop(void)
|
|||||||
|
|
||||||
if(pmsg.Code()==AS_DELETE_APP || (pmsg.Protocol()==B_QUIT_REQUESTED && DISPLAYDRIVER!=HWDRIVER))
|
if(pmsg.Code()==AS_DELETE_APP || (pmsg.Protocol()==B_QUIT_REQUESTED && DISPLAYDRIVER!=HWDRIVER))
|
||||||
{
|
{
|
||||||
if(_quitting_server == true && _applist->CountItems() == 0)
|
if(fQuittingServer== true && fAppList->CountItems()== 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -361,15 +365,15 @@ bool AppServer::LoadDecorator(const char *path)
|
|||||||
// internal one
|
// internal one
|
||||||
if(!path)
|
if(!path)
|
||||||
{
|
{
|
||||||
make_decorator = NULL;
|
make_decorator= NULL;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
create_decorator *pcreatefunc = NULL;
|
create_decorator *pcreatefunc= NULL;
|
||||||
status_t stat;
|
status_t stat;
|
||||||
image_id addon;
|
image_id addon;
|
||||||
|
|
||||||
addon = load_add_on(path);
|
addon= load_add_on(path);
|
||||||
if(addon < 0)
|
if(addon < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -379,19 +383,19 @@ bool AppServer::LoadDecorator(const char *path)
|
|||||||
// go here.
|
// go here.
|
||||||
|
|
||||||
// Get the instantiation function
|
// Get the instantiation function
|
||||||
stat = get_image_symbol(addon, "instantiate_decorator", B_SYMBOL_TYPE_TEXT, (void**)&pcreatefunc);
|
stat= get_image_symbol(addon, "instantiate_decorator", B_SYMBOL_TYPE_TEXT, (void**)&pcreatefunc);
|
||||||
if(stat != B_OK){
|
if(stat != B_OK){
|
||||||
unload_add_on(addon);
|
unload_add_on(addon);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BPath temppath(path);
|
BPath temppath(path);
|
||||||
decorator_name = temppath.Leaf();
|
fDecoratorName= temppath.Leaf();
|
||||||
|
|
||||||
acquire_sem(_decor_lock);
|
acquire_sem(fDecoratorLock);
|
||||||
make_decorator = pcreatefunc;
|
make_decorator=pcreatefunc;
|
||||||
_decorator_id = addon;
|
fDecoratorID=addon;
|
||||||
release_sem(_decor_lock);
|
release_sem(fDecoratorLock);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -467,26 +471,26 @@ void AppServer::DispatchMessage(PortMessage *msg)
|
|||||||
msg->Read<int32>(&reply_port);
|
msg->Read<int32>(&reply_port);
|
||||||
|
|
||||||
// Create the ServerApp subthread for this app
|
// Create the ServerApp subthread for this app
|
||||||
acquire_sem(_applist_lock);
|
acquire_sem(fAppListLock);
|
||||||
|
|
||||||
port_id r = create_port(DEFAULT_MONITOR_PORT_SIZE, app_signature);
|
port_id r= create_port(DEFAULT_MONITOR_PORT_SIZE, app_signature);
|
||||||
if(r == B_NO_MORE_PORTS || r == B_BAD_VALUE)
|
if(r== B_NO_MORE_PORTS || r== B_BAD_VALUE)
|
||||||
{
|
{
|
||||||
release_sem(_applist_lock);
|
release_sem(fAppListLock);
|
||||||
printf("No more ports left. Time to crash. Have a nice day! :)\n");
|
printf("No more ports left. Time to crash. Have a nice day! :)\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ServerApp *newapp;
|
ServerApp *newapp;
|
||||||
newapp = new ServerApp(app_port, r, clientLooperPort, clientTeamID, htoken, app_signature);
|
newapp= new ServerApp(app_port, r, clientLooperPort, clientTeamID, htoken, app_signature);
|
||||||
|
|
||||||
// add the new ServerApp to the known list of ServerApps
|
// add the new ServerApp to the known list of ServerApps
|
||||||
_applist->AddItem(newapp);
|
fAppList->AddItem(newapp);
|
||||||
|
|
||||||
release_sem(_applist_lock);
|
release_sem(fAppListLock);
|
||||||
|
|
||||||
PortLink replylink(reply_port);
|
PortLink replylink(reply_port);
|
||||||
replylink.SetOpCode(AS_SET_SERVER_PORT);
|
replylink.SetOpCode(AS_SET_SERVER_PORT);
|
||||||
replylink.Attach<int32>(newapp->_receiver);
|
replylink.Attach<int32>(newapp->fMessagePort);
|
||||||
replylink.Flush();
|
replylink.Flush();
|
||||||
|
|
||||||
// This is necessary because PortLink::ReadString allocates memory
|
// This is necessary because PortLink::ReadString allocates memory
|
||||||
@@ -503,33 +507,33 @@ void AppServer::DispatchMessage(PortMessage *msg)
|
|||||||
// 1) thread_id - thread ID of the ServerApp to be deleted
|
// 1) thread_id - thread ID of the ServerApp to be deleted
|
||||||
|
|
||||||
int32 i,
|
int32 i,
|
||||||
appnum = _applist->CountItems();
|
appnum= fAppList->CountItems();
|
||||||
ServerApp *srvapp;
|
ServerApp *srvapp;
|
||||||
|
|
||||||
thread_id srvapp_id;
|
thread_id srvapp_id;
|
||||||
msg->Read<thread_id>(&srvapp_id);
|
msg->Read<thread_id>(&srvapp_id);
|
||||||
|
|
||||||
acquire_sem(_applist_lock);
|
acquire_sem(fAppListLock);
|
||||||
|
|
||||||
// Run through the list of apps and nuke the proper one
|
// Run through the list of apps and nuke the proper one
|
||||||
for(i = 0; i < appnum; i++)
|
for(i= 0; i < appnum; i++)
|
||||||
{
|
{
|
||||||
srvapp = (ServerApp *)_applist->ItemAt(i);
|
srvapp=(ServerApp *)fAppList->ItemAt(i);
|
||||||
|
|
||||||
if(srvapp != NULL && srvapp->_monitor_thread == srvapp_id)
|
if(srvapp != NULL && srvapp->fMonitorThreadID== srvapp_id)
|
||||||
{
|
{
|
||||||
srvapp = (ServerApp *)_applist->RemoveItem(i);
|
srvapp=(ServerApp *)fAppList->RemoveItem(i);
|
||||||
if(srvapp){
|
if(srvapp){
|
||||||
status_t temp;
|
status_t temp;
|
||||||
wait_for_thread(srvapp_id, &temp);
|
wait_for_thread(srvapp_id, &temp);
|
||||||
delete srvapp;
|
delete srvapp;
|
||||||
srvapp = NULL;
|
srvapp= NULL;
|
||||||
}
|
}
|
||||||
break; // jump out of our for() loop
|
break; // jump out of our for() loop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
release_sem(_applist_lock);
|
release_sem(fAppListLock);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_UPDATED_CLIENT_FONTLIST:
|
case AS_UPDATED_CLIENT_FONTLIST:
|
||||||
@@ -615,7 +619,7 @@ void AppServer::DispatchMessage(PortMessage *msg)
|
|||||||
msg->Read<port_id>(&replyport);
|
msg->Read<port_id>(&replyport);
|
||||||
PortLink replylink(replyport);
|
PortLink replylink(replyport);
|
||||||
replylink.SetOpCode(AS_GET_DECORATOR);
|
replylink.SetOpCode(AS_GET_DECORATOR);
|
||||||
replylink.AttachString(decorator_name.String());
|
replylink.AttachString(fDecoratorName.String());
|
||||||
replylink.Flush();
|
replylink.Flush();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -666,9 +670,9 @@ void AppServer::DispatchMessage(PortMessage *msg)
|
|||||||
|
|
||||||
PortLink replylink(replyport);
|
PortLink replylink(replyport);
|
||||||
replylink.SetOpCode(AS_GET_SCREEN_MODE);
|
replylink.SetOpCode(AS_GET_SCREEN_MODE);
|
||||||
replylink.Attach<int16>(_driver->GetWidth());
|
replylink.Attach<int16>(fDriver->GetWidth());
|
||||||
replylink.Attach<int16>(_driver->GetHeight());
|
replylink.Attach<int16>(fDriver->GetHeight());
|
||||||
replylink.Attach<int16>(_driver->GetDepth());
|
replylink.Attach<int16>(fDriver->GetDepth());
|
||||||
replylink.Flush();
|
replylink.Flush();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -680,35 +684,59 @@ void AppServer::DispatchMessage(PortMessage *msg)
|
|||||||
// We've been asked to quit, so (for now) broadcast to all
|
// We've been asked to quit, so (for now) broadcast to all
|
||||||
// test apps to quit. This situation will occur only when the server
|
// test apps to quit. This situation will occur only when the server
|
||||||
// is compiled as a regular Be application.
|
// is compiled as a regular Be application.
|
||||||
if(DISPLAYDRIVER == HWDRIVER)
|
if(DISPLAYDRIVER== HWDRIVER)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
Broadcast(AS_QUIT_APP);
|
Broadcast(AS_QUIT_APP);
|
||||||
|
|
||||||
// we have to wait until *all* threads have finished!
|
// we have to wait until *all* threads have finished!
|
||||||
ServerApp *app = NULL;
|
ServerApp *app= NULL;
|
||||||
status_t rv;
|
acquire_sem(fAppListLock);
|
||||||
acquire_sem(_applist_lock);
|
thread_info tinfo;
|
||||||
for(int32 i = 0; i < _applist->CountItems(); i++)
|
|
||||||
{
|
|
||||||
app = (ServerApp*)_applist->ItemAt(i);
|
|
||||||
if(!app)
|
|
||||||
{ printf("PANIC in AppServer::Broadcast()\n"); continue; }
|
|
||||||
|
|
||||||
wait_for_thread(app->_monitor_thread, &rv);
|
for(int32 i= 0; i < fAppList->CountItems(); i++)
|
||||||
|
{
|
||||||
|
app=(ServerApp*)fAppList->ItemAt(i);
|
||||||
|
if(!app)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Instead of calling wait_for_thread, we will wait a bit, check for the
|
||||||
|
// thread_id. We will only wait so long, because then the app is probably crashed
|
||||||
|
// or hung. Seeing that being the case, we'll kill its BApp team and fake the
|
||||||
|
// quit message
|
||||||
|
if(get_thread_info(app->fMonitorThreadID, &tinfo)==B_OK)
|
||||||
|
{
|
||||||
|
bool killteam=true;
|
||||||
|
|
||||||
|
for(int32 j=0; j<5; j++)
|
||||||
|
{
|
||||||
|
snooze(1000); // wait half a second for it to quit
|
||||||
|
if(get_thread_info(app->fMonitorThreadID, &tinfo)!=B_OK)
|
||||||
|
{
|
||||||
|
killteam=false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(killteam)
|
||||||
|
{
|
||||||
|
kill_team(app->ClientTeamID());
|
||||||
|
app->PostMessage(B_QUIT_REQUESTED);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
release_sem(_applist_lock);
|
release_sem(fAppListLock);
|
||||||
|
|
||||||
// When we delete the last ServerApp, we can exit the server
|
// When we delete the last ServerApp, we can exit the server
|
||||||
_quitting_server = true;
|
fQuittingServer=true;
|
||||||
_exit_poller = true;
|
fExitPoller=true;
|
||||||
|
|
||||||
// also wait for picasso thread
|
// also wait for picasso thread
|
||||||
kill_thread(_picasso_id);
|
kill_thread(fPicassoThreadID);
|
||||||
|
|
||||||
// poller thread is stuck reading messages from its input port
|
// poller thread is stuck reading messages from its input port
|
||||||
// so, there is no cleaner way to make it quit, other than killing it!
|
// so, there is no cleaner way to make it quit, other than killing it!
|
||||||
kill_thread(_poller_id);
|
kill_thread(fPollerThreadID);
|
||||||
|
|
||||||
// we are now clear to exit
|
// we are now clear to exit
|
||||||
break;
|
break;
|
||||||
@@ -732,17 +760,17 @@ void AppServer::DispatchMessage(PortMessage *msg)
|
|||||||
*/
|
*/
|
||||||
void AppServer::Broadcast(int32 code)
|
void AppServer::Broadcast(int32 code)
|
||||||
{
|
{
|
||||||
ServerApp *app = NULL;
|
ServerApp *app= NULL;
|
||||||
|
|
||||||
acquire_sem(_applist_lock);
|
acquire_sem(fAppListLock);
|
||||||
for(int32 i = 0; i < _applist->CountItems(); i++)
|
for(int32 i= 0; i < fAppList->CountItems(); i++)
|
||||||
{
|
{
|
||||||
app = (ServerApp*)_applist->ItemAt(i);
|
app=(ServerApp*)fAppList->ItemAt(i);
|
||||||
if(!app)
|
if(!app)
|
||||||
{ printf("PANIC in AppServer::Broadcast()\n"); continue; }
|
{ printf("PANIC in AppServer::Broadcast()\n"); continue; }
|
||||||
app->PostMessage(code, sizeof(int32), (int8*)&code);
|
app->PostMessage(code, sizeof(int32), (int8*)&code);
|
||||||
}
|
}
|
||||||
release_sem(_applist_lock);
|
release_sem(fAppListLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -783,7 +811,7 @@ void AppServer::HandleKeyMessage(int32 code, int8 *buffer)
|
|||||||
int32 modifiers=*((int32*)index); index+=sizeof(int32) + (sizeof(int8) * 3);
|
int32 modifiers=*((int32*)index); index+=sizeof(int32) + (sizeof(int8) * 3);
|
||||||
int8 stringlength=*index; index+=stringlength;
|
int8 stringlength=*index; index+=stringlength;
|
||||||
STRACE(("Key Down: 0x%lx\n",scancode));
|
STRACE(("Key Down: 0x%lx\n",scancode));
|
||||||
if(DISPLAYDRIVER == HWDRIVER)
|
if(DISPLAYDRIVER==HWDRIVER)
|
||||||
{
|
{
|
||||||
// Check for workspace change or safe video mode
|
// Check for workspace change or safe video mode
|
||||||
if(scancode>0x01 && scancode<0x0e)
|
if(scancode>0x01 && scancode<0x0e)
|
||||||
@@ -803,7 +831,8 @@ void AppServer::HandleKeyMessage(int32 code, int8 *buffer)
|
|||||||
if(modifiers & B_CONTROL_KEY)
|
if(modifiers & B_CONTROL_KEY)
|
||||||
{
|
{
|
||||||
STRACE(("Set Workspace %ld\n",scancode-1));
|
STRACE(("Set Workspace %ld\n",scancode-1));
|
||||||
//TODO: change SetWorkspace(scancode-2);
|
//TODO: change
|
||||||
|
//SetWorkspace(scancode-2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -821,21 +850,21 @@ void AppServer::HandleKeyMessage(int32 code, int8 *buffer)
|
|||||||
// PrintScreen
|
// PrintScreen
|
||||||
if(scancode==0xe)
|
if(scancode==0xe)
|
||||||
{
|
{
|
||||||
if(_driver)
|
if(fDriver)
|
||||||
{
|
{
|
||||||
char filename[128];
|
char filename[128];
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
|
|
||||||
sprintf(filename,"/boot/home/screen%ld.png",_ssindex);
|
sprintf(filename,"/boot/home/screen%ld.png",fScreenShotIndex);
|
||||||
entry.SetTo(filename);
|
entry.SetTo(filename);
|
||||||
|
|
||||||
while(entry.Exists())
|
while(entry.Exists())
|
||||||
{
|
{
|
||||||
_ssindex++;
|
fScreenShotIndex++;
|
||||||
sprintf(filename,"/boot/home/screen%ld.png",_ssindex);
|
sprintf(filename,"/boot/home/screen%ld.png",fScreenShotIndex);
|
||||||
}
|
}
|
||||||
_ssindex++;
|
fScreenShotIndex++;
|
||||||
_driver->DumpToFile(filename);
|
fDriver->DumpToFile(filename);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -857,7 +886,8 @@ void AppServer::HandleKeyMessage(int32 code, int8 *buffer)
|
|||||||
if(modifiers & (B_LEFT_SHIFT_KEY | B_LEFT_CONTROL_KEY))
|
if(modifiers & (B_LEFT_SHIFT_KEY | B_LEFT_CONTROL_KEY))
|
||||||
{
|
{
|
||||||
STRACE(("Set Workspace %ld\n",scancode-1));
|
STRACE(("Set Workspace %ld\n",scancode-1));
|
||||||
//TODO: resolve SetWorkspace(scancode-2);
|
//TODO: resolve
|
||||||
|
//SetWorkspace(scancode-2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -877,22 +907,22 @@ void AppServer::HandleKeyMessage(int32 code, int8 *buffer)
|
|||||||
// Pause/Break
|
// Pause/Break
|
||||||
if(scancode==0x7f)
|
if(scancode==0x7f)
|
||||||
{
|
{
|
||||||
if(_driver)
|
if(fDriver)
|
||||||
{
|
{
|
||||||
char filename[128];
|
char filename[128];
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
|
|
||||||
sprintf(filename,"/boot/home/screen%ld.png",_ssindex);
|
sprintf(filename,"/boot/home/screen%ld.png",fScreenShotIndex);
|
||||||
entry.SetTo(filename);
|
entry.SetTo(filename);
|
||||||
|
|
||||||
while(entry.Exists())
|
while(entry.Exists())
|
||||||
{
|
{
|
||||||
_ssindex++;
|
fScreenShotIndex++;
|
||||||
sprintf(filename,"/boot/home/screen%ld.png",_ssindex);
|
sprintf(filename,"/boot/home/screen%ld.png",fScreenShotIndex);
|
||||||
}
|
}
|
||||||
_ssindex++;
|
fScreenShotIndex++;
|
||||||
|
|
||||||
_driver->DumpToFile(filename);
|
fDriver->DumpToFile(filename);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1026,19 +1056,19 @@ ServerApp *AppServer::FindApp(const char *sig)
|
|||||||
|
|
||||||
ServerApp *foundapp=NULL;
|
ServerApp *foundapp=NULL;
|
||||||
|
|
||||||
acquire_sem(_applist_lock);
|
acquire_sem(fAppListLock);
|
||||||
|
|
||||||
for(int32 i=0; i<_applist->CountItems();i++)
|
for(int32 i=0; i<fAppList->CountItems();i++)
|
||||||
{
|
{
|
||||||
foundapp=(ServerApp*)_applist->ItemAt(i);
|
foundapp=(ServerApp*)fAppList->ItemAt(i);
|
||||||
if(foundapp && foundapp->_signature==sig)
|
if(foundapp && foundapp->fSignature==sig)
|
||||||
{
|
{
|
||||||
release_sem(_applist_lock);
|
release_sem(fAppListLock);
|
||||||
return foundapp;
|
return foundapp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
release_sem(_applist_lock);
|
release_sem(fAppListLock);
|
||||||
|
|
||||||
// couldn't find a match
|
// couldn't find a match
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1059,13 +1089,13 @@ Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel
|
|||||||
int32 wflags, DisplayDriver *ddriver)
|
int32 wflags, DisplayDriver *ddriver)
|
||||||
{
|
{
|
||||||
Decorator *dec=NULL;
|
Decorator *dec=NULL;
|
||||||
// Temporary solution!
|
|
||||||
dec=new DefaultDecorator(rect,wlook,wfeel,wflags);
|
dec=new DefaultDecorator(rect,wlook,wfeel,wflags);
|
||||||
/* if(!app_server->make_decorator)
|
if(!app_server->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=app_server->make_decorator(rect,wlook,wfeel,wflags);
|
||||||
*/
|
|
||||||
gui_colorset.Lock();
|
gui_colorset.Lock();
|
||||||
dec->SetDriver(ddriver);
|
dec->SetDriver(ddriver);
|
||||||
dec->SetColors(gui_colorset);
|
dec->SetColors(gui_colorset);
|
||||||
@@ -1088,11 +1118,6 @@ int main( int argc, char** argv )
|
|||||||
if(find_port(SERVER_PORT_NAME)!=B_NAME_NOT_FOUND)
|
if(find_port(SERVER_PORT_NAME)!=B_NAME_NOT_FOUND)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// why on the heap?
|
|
||||||
/* app_server=new AppServer();
|
|
||||||
app_server->Run();
|
|
||||||
delete app_server;
|
|
||||||
*/
|
|
||||||
AppServer app_server;
|
AppServer app_server;
|
||||||
app_server.Run();
|
app_server.Run();
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -60,27 +60,27 @@ private:
|
|||||||
// global function pointer
|
// global function pointer
|
||||||
create_decorator *make_decorator;
|
create_decorator *make_decorator;
|
||||||
|
|
||||||
port_id _messageport,
|
port_id _fMessagePort,
|
||||||
_mouseport;
|
fMousePort;
|
||||||
|
|
||||||
image_id _decorator_id;
|
image_id fDecoratorID;
|
||||||
|
|
||||||
BString decorator_name;
|
BString fDecoratorName;
|
||||||
|
|
||||||
bool _quitting_server,
|
bool fQuittingServer,
|
||||||
_exit_poller;
|
fExitPoller;
|
||||||
|
|
||||||
BList *_applist;
|
BList *fAppList;
|
||||||
thread_id _poller_id,
|
thread_id fPollerThreadID,
|
||||||
_picasso_id;
|
fPicassoThreadID;
|
||||||
|
|
||||||
sem_id _active_lock,
|
sem_id fActiveAppLock,
|
||||||
_applist_lock,
|
fAppListLock,
|
||||||
_decor_lock;
|
fDecoratorLock;
|
||||||
|
|
||||||
DisplayDriver *_driver;
|
DisplayDriver *fDriver;
|
||||||
|
|
||||||
int32 _ssindex;
|
int32 fScreenShotIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel,
|
Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel,
|
||||||
|
|||||||
@@ -308,18 +308,15 @@ int32 Decorator::_ClipTitle(float width)
|
|||||||
{
|
{
|
||||||
int32 strlength=_title_string->CountChars();
|
int32 strlength=_title_string->CountChars();
|
||||||
float pixwidth=_driver->StringWidth(_title_string->String(),strlength,&_layerdata);
|
float pixwidth=_driver->StringWidth(_title_string->String(),strlength,&_layerdata);
|
||||||
// printf("Initial width = %f\n", width );
|
|
||||||
// printf("DEC: strlen = %ld\t pixwidth = %f\n", strlength, pixwidth);
|
|
||||||
while(strlength>=0)
|
while(strlength>=0)
|
||||||
{
|
{
|
||||||
if(pixwidth<width)
|
if(pixwidth<width)
|
||||||
break;
|
return strlength;
|
||||||
|
|
||||||
strlength--;
|
strlength--;
|
||||||
pixwidth=_driver->StringWidth(_title_string->String(),strlength,&_layerdata);
|
pixwidth=_driver->StringWidth(_title_string->String(),strlength,&_layerdata);
|
||||||
// printf("DEC: strlen = %ld\t pixwidth = %f\n", strlength, pixwidth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return strlength;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ void Layer::MouseTransit(uint32 transit)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(_serverwin)
|
if(_serverwin)
|
||||||
_serverwin->GetApp()->SetAppCursor();
|
_serverwin->App()->SetAppCursor();
|
||||||
else
|
else
|
||||||
cursormanager->SetCursor(B_CURSOR_DEFAULT);
|
cursormanager->SetCursor(B_CURSOR_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,78 +70,80 @@
|
|||||||
\brief Constructor
|
\brief Constructor
|
||||||
\param sendport port ID for the BApplication which will receive the ServerApp's messages
|
\param sendport port ID for the BApplication which will receive the ServerApp's messages
|
||||||
\param rcvport port by which the ServerApp will receive messages from its BApplication.
|
\param rcvport port by which the ServerApp will receive messages from its BApplication.
|
||||||
\param _signature NULL-terminated string which contains the BApplication's
|
\param fSignature NULL-terminated string which contains the BApplication's
|
||||||
MIME _signature.
|
MIME fSignature.
|
||||||
*/
|
*/
|
||||||
ServerApp::ServerApp(port_id sendport, port_id rcvport, port_id clientLooperPort,
|
ServerApp::ServerApp(port_id sendport, port_id rcvport, port_id clientLooperPort,
|
||||||
team_id clientTeamID, int32 handlerID, char *signature)
|
team_id clientTeamID, int32 handlerID, char *signature)
|
||||||
{
|
{
|
||||||
// it will be of *very* musch use in correct window order
|
// it will be of *very* musch use in correct window order
|
||||||
fClientTeamID = clientTeamID;
|
fClientTeamID = clientTeamID;
|
||||||
// what to send a message to the client? Write a BMessage to this port.
|
|
||||||
|
// what to send a message to the client? Write a BMessage to this port.
|
||||||
fClientLooperPort = clientLooperPort;
|
fClientLooperPort = clientLooperPort;
|
||||||
|
|
||||||
// need to copy the _signature because the message buffer
|
// need to copy the fSignature because the message buffer
|
||||||
// owns the copy which we are passed as a parameter.
|
// owns the copy which we are passed as a parameter.
|
||||||
_signature=(signature)?signature:"application/x-vnd.NULL-application-signature";
|
fSignature=(signature)?signature:"application/x-vnd.NULL-application-signature";
|
||||||
|
|
||||||
// token ID of the BApplication's BHandler object. Used for BMessage target specification
|
// token ID of the BApplication's BHandler object. Used for BMessage target specification
|
||||||
_handlertoken=handlerID;
|
fHandlerToken=handlerID;
|
||||||
|
|
||||||
// _sender is the our BApplication's event port
|
// fClientAppPort is the our BApplication's event port
|
||||||
_sender=sendport;
|
fClientAppPort=sendport;
|
||||||
_applink=new PortLink(_sender);
|
fAppLink=new PortLink(fClientAppPort);
|
||||||
_applink->SetPort(_sender);
|
|
||||||
|
|
||||||
// Gotta get the team ID so we can ping the application
|
// fMessagePort is the port we receive messages from our BApplication
|
||||||
_target_id = clientTeamID;
|
fMessagePort=rcvport;
|
||||||
|
|
||||||
// _receiver is the port we receive messages from our BApplication
|
fSWindowList=new BList(0);
|
||||||
_receiver=rcvport;
|
fBitmapList=new BList(0);
|
||||||
|
fPictureList=new BList(0);
|
||||||
_winlist=new BList(0);
|
fIsActive=false;
|
||||||
_bmplist=new BList(0);
|
|
||||||
_piclist=new BList(0);
|
|
||||||
_isactive=false;
|
|
||||||
|
|
||||||
ServerCursor *defaultc=cursormanager->GetCursor(B_CURSOR_DEFAULT);
|
ServerCursor *defaultc=cursormanager->GetCursor(B_CURSOR_DEFAULT);
|
||||||
|
|
||||||
_appcursor=(defaultc)?new ServerCursor(defaultc):NULL;
|
fAppCursor=(defaultc)?new ServerCursor(defaultc):NULL;
|
||||||
_lock=create_sem(1,"ServerApp sem");
|
fLockSem=create_sem(1,"ServerApp sem");
|
||||||
|
|
||||||
// Does this even belong here any more? --DW
|
// Does this even belong here any more? --DW
|
||||||
// _driver=desktop->GetDisplayDriver();
|
// _driver=desktop->GetDisplayDriver();
|
||||||
|
|
||||||
_cursorhidden=false;
|
fCursorHidden=false;
|
||||||
|
|
||||||
Run();
|
Run();
|
||||||
|
|
||||||
STRACE(("ServerApp %s:\n",_signature.String()));
|
STRACE(("ServerApp %s:\n",fSignature.String()));
|
||||||
STRACE(("\tBApp port: %ld\n",_sender));
|
STRACE(("\tBApp port: %ld\n",fClientAppPort));
|
||||||
STRACE(("\tReceiver port: %ld\n",_receiver));
|
STRACE(("\tReceiver port: %ld\n",fMessagePort));
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Does all necessary teardown for application
|
//! Does all necessary teardown for application
|
||||||
ServerApp::~ServerApp(void)
|
ServerApp::~ServerApp(void)
|
||||||
{
|
{
|
||||||
STRACE(("*ServerApp %s:~ServerApp()\n",_signature.String()));
|
STRACE(("*ServerApp %s:~ServerApp()\n",fSignature.String()));
|
||||||
int32 i;
|
int32 i;
|
||||||
|
|
||||||
|
WindowBroadcast(AS_QUIT_APP);
|
||||||
|
|
||||||
// wait for our ServerWindow threads
|
// wait for our ServerWindow threads
|
||||||
bool ready = true;
|
bool ready=true;
|
||||||
desktop->fLayerLock.Lock();
|
desktop->fLayerLock.Lock();
|
||||||
do{
|
do{
|
||||||
ready = true;
|
ready = true;
|
||||||
|
|
||||||
int32 count = desktop->fWinBorderList.CountItems();
|
int32 count = desktop->fWinBorderList.CountItems();
|
||||||
for( int32 i = 0; i < count; i++){
|
for( int32 i = 0; i < count; i++)
|
||||||
ServerWindow *sw = ((WinBorder*)desktop->fWinBorderList.ItemAt(i))->Window();
|
{
|
||||||
if (ClientTeamID() == sw->ClientTeamID()){
|
ServerWindow *sw = ((WinBorder*)desktop->fWinBorderList.ItemAt(i))->Window();
|
||||||
|
if (ClientTeamID() == sw->ClientTeamID())
|
||||||
|
{
|
||||||
thread_id tid = sw->ThreadID();
|
thread_id tid = sw->ThreadID();
|
||||||
status_t temp;
|
status_t temp;
|
||||||
|
|
||||||
desktop->fLayerLock.Unlock();
|
desktop->fLayerLock.Unlock();
|
||||||
printf("waiting for thread %s\n", sw->Title());
|
|
||||||
|
printf("waiting for thread %s\n", sw->Title());
|
||||||
wait_for_thread(tid, &temp);
|
wait_for_thread(tid, &temp);
|
||||||
|
|
||||||
desktop->fLayerLock.Lock();
|
desktop->fLayerLock.Lock();
|
||||||
@@ -150,54 +152,56 @@ printf("waiting for thread %s\n", sw->Title());
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}while(!ready);
|
} while(!ready);
|
||||||
desktop->fLayerLock.Unlock();
|
desktop->fLayerLock.Unlock();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ServerWindow *tempwin;
|
ServerWindow *tempwin;
|
||||||
for(i=0;i<_winlist->CountItems();i++)
|
for(i=0;i<fSWindowList->CountItems();i++)
|
||||||
{
|
{
|
||||||
tempwin=(ServerWindow*)_winlist->ItemAt(i);
|
tempwin=(ServerWindow*)fSWindowList->ItemAt(i);
|
||||||
if(tempwin)
|
if(tempwin)
|
||||||
delete tempwin;
|
delete tempwin;
|
||||||
}
|
}
|
||||||
_winlist->MakeEmpty();
|
fSWindowList->MakeEmpty();
|
||||||
delete _winlist;
|
delete fSWindowList;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ServerBitmap *tempbmp;
|
ServerBitmap *tempbmp;
|
||||||
for(i=0;i<_bmplist->CountItems();i++)
|
for(i=0;i<fBitmapList->CountItems();i++)
|
||||||
{
|
{
|
||||||
tempbmp=(ServerBitmap*)_bmplist->ItemAt(i);
|
tempbmp=(ServerBitmap*)fBitmapList->ItemAt(i);
|
||||||
if(tempbmp)
|
if(tempbmp)
|
||||||
delete tempbmp;
|
delete tempbmp;
|
||||||
}
|
}
|
||||||
_bmplist->MakeEmpty();
|
fBitmapList->MakeEmpty();
|
||||||
delete _bmplist;
|
delete fBitmapList;
|
||||||
|
|
||||||
ServerPicture *temppic;
|
ServerPicture *temppic;
|
||||||
for(i=0;i<_piclist->CountItems();i++)
|
for(i=0;i<fPictureList->CountItems();i++)
|
||||||
{
|
{
|
||||||
temppic=(ServerPicture*)_piclist->ItemAt(i);
|
temppic=(ServerPicture*)fPictureList->ItemAt(i);
|
||||||
if(temppic)
|
if(temppic)
|
||||||
delete temppic;
|
delete temppic;
|
||||||
}
|
}
|
||||||
_piclist->MakeEmpty();
|
fPictureList->MakeEmpty();
|
||||||
delete _piclist;
|
delete fPictureList;
|
||||||
|
|
||||||
delete _applink;
|
delete fAppLink;
|
||||||
_applink=NULL;
|
fAppLink=NULL;
|
||||||
if(_appcursor)
|
if(fAppCursor)
|
||||||
delete _appcursor;
|
delete fAppCursor;
|
||||||
|
|
||||||
|
|
||||||
cursormanager->RemoveAppCursors(_signature.String());
|
cursormanager->RemoveAppCursors(fSignature.String());
|
||||||
delete_sem(_lock);
|
delete_sem(fLockSem);
|
||||||
|
|
||||||
STRACE(("#ServerApp %s:~ServerApp()\n",_signature.String()));
|
STRACE(("#ServerApp %s:~ServerApp()\n",fSignature.String()));
|
||||||
|
|
||||||
// Kill the monitor thread if it exists
|
// Kill the monitor thread if it exists
|
||||||
thread_info info;
|
thread_info info;
|
||||||
if(get_thread_info(_monitor_thread,&info)==B_OK)
|
if(get_thread_info(fMonitorThreadID,&info)==B_OK)
|
||||||
kill_thread(_monitor_thread);
|
kill_thread(fMonitorThreadID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,11 +213,11 @@ bool ServerApp::Run(void)
|
|||||||
{
|
{
|
||||||
// Unlike a BApplication, a ServerApp is *supposed* to return immediately
|
// Unlike a BApplication, a ServerApp is *supposed* to return immediately
|
||||||
// when its Run() function is called.
|
// when its Run() function is called.
|
||||||
_monitor_thread=spawn_thread(MonitorApp,_signature.String(),B_NORMAL_PRIORITY,this);
|
fMonitorThreadID=spawn_thread(MonitorApp,fSignature.String(),B_NORMAL_PRIORITY,this);
|
||||||
if(_monitor_thread==B_NO_MORE_THREADS || _monitor_thread==B_NO_MEMORY)
|
if(fMonitorThreadID==B_NO_MORE_THREADS || fMonitorThreadID==B_NO_MEMORY)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
resume_thread(_monitor_thread);
|
resume_thread(fMonitorThreadID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,18 +237,18 @@ bool ServerApp::Run(void)
|
|||||||
bool ServerApp::PingTarget(void)
|
bool ServerApp::PingTarget(void)
|
||||||
{
|
{
|
||||||
team_info tinfo;
|
team_info tinfo;
|
||||||
if(get_team_info(_target_id,&tinfo)==B_BAD_TEAM_ID)
|
if(get_team_info(fClientTeamID,&tinfo)==B_BAD_TEAM_ID)
|
||||||
{
|
{
|
||||||
port_id serverport=find_port(SERVER_PORT_NAME);
|
port_id serverport=find_port(SERVER_PORT_NAME);
|
||||||
if(serverport==B_NAME_NOT_FOUND)
|
if(serverport==B_NAME_NOT_FOUND)
|
||||||
{
|
{
|
||||||
printf("PANIC: ServerApp %s could not find the app_server port in PingTarget()!\n",_signature.String());
|
printf("PANIC: ServerApp %s could not find the app_server port in PingTarget()!\n",fSignature.String());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_applink->SetPort(serverport);
|
fAppLink->SetPort(serverport);
|
||||||
_applink->SetOpCode(AS_DELETE_APP);
|
fAppLink->SetOpCode(AS_DELETE_APP);
|
||||||
_applink->Attach(&_monitor_thread,sizeof(thread_id));
|
fAppLink->Attach(&fMonitorThreadID,sizeof(thread_id));
|
||||||
_applink->Flush();
|
fAppLink->Flush();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -256,20 +260,41 @@ bool ServerApp::PingTarget(void)
|
|||||||
*/
|
*/
|
||||||
void ServerApp::PostMessage(int32 code, size_t size, int8 *buffer)
|
void ServerApp::PostMessage(int32 code, size_t size, int8 *buffer)
|
||||||
{
|
{
|
||||||
write_port(_receiver,code, buffer, size);
|
write_port(fMessagePort,code, buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerApp::SendMessageToClient(const BMessage* msg) const{
|
/*!
|
||||||
ssize_t size;
|
\brief Send a simple message to all of the ServerApp's ServerWindows
|
||||||
char *buffer;
|
\param msg The message code to broadcast
|
||||||
|
*/
|
||||||
size = msg->FlattenedSize();
|
void ServerApp::WindowBroadcast(int32 code)
|
||||||
buffer = new char[size];
|
{
|
||||||
if (msg->Flatten(buffer, size) == B_OK){
|
desktop->fLayerLock.Lock();
|
||||||
write_port(fClientLooperPort, msg->what, buffer, size);
|
int32 count=desktop->fWinBorderList.CountItems();
|
||||||
|
for(int32 i=0; i<count; i++)
|
||||||
|
{
|
||||||
|
ServerWindow *sw = ((WinBorder*)desktop->fWinBorderList.ItemAt(i))->Window();
|
||||||
|
sw->PostMessage(code);
|
||||||
}
|
}
|
||||||
|
desktop->fLayerLock.Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Send a message to the ServerApp's BApplication
|
||||||
|
\param msg The message to send
|
||||||
|
*/
|
||||||
|
void ServerApp::SendMessageToClient(const BMessage *msg) const
|
||||||
|
{
|
||||||
|
ssize_t size;
|
||||||
|
char *buffer;
|
||||||
|
|
||||||
|
size=msg->FlattenedSize();
|
||||||
|
buffer=new char[size];
|
||||||
|
|
||||||
|
if (msg->Flatten(buffer, size) == B_OK)
|
||||||
|
write_port(fClientLooperPort, msg->what, buffer, size);
|
||||||
else
|
else
|
||||||
printf("PANIC: ServerApp: '%s': can't flatten message in 'SendMessageToClient()'\n", _signature.String());
|
printf("PANIC: ServerApp: '%s': can't flatten message in 'SendMessageToClient()'\n", fSignature.String());
|
||||||
|
|
||||||
delete buffer;
|
delete buffer;
|
||||||
}
|
}
|
||||||
@@ -283,15 +308,15 @@ void ServerApp::SendMessageToClient(const BMessage* msg) const{
|
|||||||
*/
|
*/
|
||||||
void ServerApp::Activate(bool value)
|
void ServerApp::Activate(bool value)
|
||||||
{
|
{
|
||||||
_isactive=value;
|
fIsActive=value;
|
||||||
SetAppCursor();
|
SetAppCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Sets the cursor to the application cursor, if any.
|
//! Sets the cursor to the application cursor, if any.
|
||||||
void ServerApp::SetAppCursor(void)
|
void ServerApp::SetAppCursor(void)
|
||||||
{
|
{
|
||||||
if(_appcursor)
|
if(fAppCursor)
|
||||||
cursormanager->SetCursor(_appcursor->ID());
|
cursormanager->SetCursor(fAppCursor->ID());
|
||||||
else
|
else
|
||||||
cursormanager->SetCursor(B_CURSOR_DEFAULT);
|
cursormanager->SetCursor(B_CURSOR_DEFAULT);
|
||||||
}
|
}
|
||||||
@@ -301,23 +326,23 @@ void ServerApp::SetAppCursor(void)
|
|||||||
\param data Pointer to the thread's ServerApp object
|
\param data Pointer to the thread's ServerApp object
|
||||||
\return Throwaway value - always 0
|
\return Throwaway value - always 0
|
||||||
*/
|
*/
|
||||||
int32 ServerApp::MonitorApp(void *data)
|
int32 ServerApp::MonitorApp(void *data)
|
||||||
{
|
{
|
||||||
// Message-dispatching loop for the ServerApp
|
// Message-dispatching loop for the ServerApp
|
||||||
|
|
||||||
ServerApp *app = (ServerApp *)data;
|
ServerApp *app = (ServerApp *)data;
|
||||||
PortQueue msgqueue(app->_receiver);
|
PortQueue msgqueue(app->fMessagePort);
|
||||||
PortMessage *msg;
|
PortMessage *msg;
|
||||||
bool quiting = false;
|
bool quitting = false;
|
||||||
|
|
||||||
for( ; !quiting; )
|
for( ; !quitting; )
|
||||||
{
|
{
|
||||||
if(!msgqueue.MessagesWaiting())
|
if(!msgqueue.MessagesWaiting())
|
||||||
msgqueue.GetMessagesFromPort(true);
|
msgqueue.GetMessagesFromPort(true);
|
||||||
else
|
else
|
||||||
msgqueue.GetMessagesFromPort(false);
|
msgqueue.GetMessagesFromPort(false);
|
||||||
|
|
||||||
msg = msgqueue.GetMessageFromQueue();
|
msg = msgqueue.GetMessageFromQueue();
|
||||||
if(!msg)
|
if(!msg)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -325,52 +350,53 @@ void ServerApp::SetAppCursor(void)
|
|||||||
{
|
{
|
||||||
case AS_QUIT_APP:
|
case AS_QUIT_APP:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s:Server shutdown notification received\n",app->_signature.String()));
|
// This message is received only when the app_server is asked to shut down in
|
||||||
/*
|
// test/debug mode. Of course, if we are testing while using AccelerantDriver, we do
|
||||||
|
// NOT want to shut down client applications. The server can be quit o in this fashion
|
||||||
|
// through the driver's interface, such as closing the ViewDriver's window.
|
||||||
|
|
||||||
|
STRACE(("ServerApp %s:Server shutdown notification received\n",app->fSignature.String()));
|
||||||
|
|
||||||
// If we are using the real, accelerated version of the
|
// If we are using the real, accelerated version of the
|
||||||
// DisplayDriver, we do NOT want the user to be able shut down
|
// DisplayDriver, we do NOT want the user to be able shut down
|
||||||
// the server. The results would NOT be pretty
|
// the server. The results would NOT be pretty
|
||||||
if(DISPLAYDRIVER!=HWDRIVER)
|
if(DISPLAYDRIVER!=HWDRIVER)
|
||||||
{
|
{
|
||||||
// This message is received from the app_server thread
|
BMessage pleaseQuit(B_QUIT_REQUESTED);
|
||||||
// because the server was asked to quit. Thus, we
|
|
||||||
// ask all apps to quit. This is NOT the same as system
|
|
||||||
// shutdown and will happen only in testing
|
|
||||||
|
|
||||||
BMessage pleaseQuit(_QUIT_);
|
|
||||||
app->SendMessageToClient(&pleaseQuit);
|
app->SendMessageToClient(&pleaseQuit);
|
||||||
}
|
}
|
||||||
* Adi: I do not agree here! I think this is a reminiscence(?) since the "old" days...
|
|
||||||
*/
|
|
||||||
BMessage pleaseQuit(_QUIT_);
|
|
||||||
app->SendMessageToClient(&pleaseQuit);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Fix
|
||||||
|
// Using this case is a hack. The ServerApp is receiving a message with a '0' code after
|
||||||
|
// it sends the quit message on server shutdown and I can't find what's sending it. This
|
||||||
|
// must be found and fixed!
|
||||||
|
case 0:
|
||||||
case B_QUIT_REQUESTED:
|
case B_QUIT_REQUESTED:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: B_QUIT_REQUESTED\n",app->_signature.String()));
|
STRACE(("ServerApp %s: B_QUIT_REQUESTED\n",app->fSignature.String()));
|
||||||
// Our BApplication sent us this message when it quit.
|
// Our BApplication sent us this message when it quit.
|
||||||
// We need to ask the app_server to delete our monitor
|
// We need to ask the app_server to delete our monitor
|
||||||
// ADI: No! This is a bad solution. A thead should continue its
|
// ADI: No! This is a bad solution. A thead should continue its
|
||||||
// execution until its exit point, and this can *very* easily be done
|
// execution until its exit point, and this can *very* easily be done
|
||||||
quiting = true;
|
quitting=true;
|
||||||
// see... no need to ask the main thread to kill us.
|
// see... no need to ask the main thread to kill us.
|
||||||
// still... it will delete this ServerApp object.
|
// still... it will delete this ServerApp object.
|
||||||
port_id serverport = find_port(SERVER_PORT_NAME);
|
port_id serverport = find_port(SERVER_PORT_NAME);
|
||||||
if(serverport == B_NAME_NOT_FOUND){
|
if(serverport == B_NAME_NOT_FOUND){
|
||||||
printf("PANIC: ServerApp %s could not find the app_server port!\n",app->_signature.String());
|
printf("PANIC: ServerApp %s could not find the app_server port!\n",app->fSignature.String());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
app->_applink->SetPort(serverport);
|
app->fAppLink->SetPort(serverport);
|
||||||
app->_applink->SetOpCode(AS_DELETE_APP);
|
app->fAppLink->SetOpCode(AS_DELETE_APP);
|
||||||
app->_applink->Attach(&app->_monitor_thread, sizeof(thread_id));
|
app->fAppLink->Attach(&app->fMonitorThreadID, sizeof(thread_id));
|
||||||
app->_applink->Flush();
|
app->fAppLink->Flush();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Got a Message to dispatch\n",app->_signature.String()));
|
STRACE(("ServerApp %s: Got a Message to dispatch\n",app->fSignature.String()));
|
||||||
app->_DispatchMessage(msg);
|
app->_DispatchMessage(msg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -378,7 +404,8 @@ void ServerApp::SetAppCursor(void)
|
|||||||
|
|
||||||
delete msg;
|
delete msg;
|
||||||
} // end for
|
} // end for
|
||||||
// clean exit.
|
|
||||||
|
// clean exit.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,7 +425,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
{
|
{
|
||||||
case AS_UPDATED_CLIENT_FONTLIST:
|
case AS_UPDATED_CLIENT_FONTLIST:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Acknowledged update of client-side font list\n",_signature.String()));
|
STRACE(("ServerApp %s: Acknowledged update of client-side font list\n",fSignature.String()));
|
||||||
|
|
||||||
// received when the client-side global font list has been
|
// received when the client-side global font list has been
|
||||||
// refreshed
|
// refreshed
|
||||||
@@ -409,47 +436,47 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
}
|
}
|
||||||
case AS_UPDATE_COLORS:
|
case AS_UPDATE_COLORS:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Received global UI color update notification\n",_signature.String()));
|
/* STRACE(("ServerApp %s: Received global UI color update notification\n",fSignature.String()));
|
||||||
ServerWindow *win;
|
ServerWindow *win;
|
||||||
BMessage msg(_COLORS_UPDATED);
|
BMessage msg(_COLORS_UPDATED);
|
||||||
|
|
||||||
for(int32 i=0; i<_winlist->CountItems(); i++)
|
for(int32 i=0; i<fSWindowList->CountItems(); i++)
|
||||||
{
|
{
|
||||||
win=(ServerWindow*)_winlist->ItemAt(i);
|
win=(ServerWindow*)fSWindowList->ItemAt(i);
|
||||||
win->Lock();
|
win->Lock();
|
||||||
win->_winborder->UpdateColors();
|
win->fWinBorder->UpdateColors();
|
||||||
win->SendMessageToClient(&msg);
|
win->SendMessageToClient(&msg);
|
||||||
win->Unlock();
|
win->Unlock();
|
||||||
}
|
}
|
||||||
break;
|
*/ break;
|
||||||
}
|
}
|
||||||
case AS_UPDATE_FONTS:
|
case AS_UPDATE_FONTS:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Received global font update notification\n",_signature.String()));
|
/* STRACE(("ServerApp %s: Received global font update notification\n",fSignature.String()));
|
||||||
ServerWindow *win;
|
ServerWindow *win;
|
||||||
BMessage msg(_FONTS_UPDATED);
|
BMessage msg(_FONTS_UPDATED);
|
||||||
|
|
||||||
for(int32 i=0; i<_winlist->CountItems(); i++)
|
for(int32 i=0; i<fSWindowList->CountItems(); i++)
|
||||||
{
|
{
|
||||||
win=(ServerWindow*)_winlist->ItemAt(i);
|
win=(ServerWindow*)fSWindowList->ItemAt(i);
|
||||||
win->Lock();
|
win->Lock();
|
||||||
win->_winborder->UpdateFont();
|
win->fWinBorder->UpdateFont();
|
||||||
win->SendMessageToClient(&msg);
|
win->SendMessageToClient(&msg);
|
||||||
win->Unlock();
|
win->Unlock();
|
||||||
}
|
}
|
||||||
break;
|
*/ break;
|
||||||
}
|
}
|
||||||
case AS_UPDATE_DECORATOR:
|
case AS_UPDATE_DECORATOR:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Received decorator update notification\n",_signature.String()));
|
STRACE(("ServerApp %s: Received decorator update notification\n",fSignature.String()));
|
||||||
|
|
||||||
ServerWindow *win;
|
ServerWindow *win;
|
||||||
|
|
||||||
for(int32 i=0; i<_winlist->CountItems(); i++)
|
for(int32 i=0; i<fSWindowList->CountItems(); i++)
|
||||||
{
|
{
|
||||||
win=(ServerWindow*)_winlist->ItemAt(i);
|
win=(ServerWindow*)fSWindowList->ItemAt(i);
|
||||||
win->Lock();
|
win->Lock();
|
||||||
win->_winborder->UpdateDecorator();
|
win->fWinBorder->UpdateDecorator();
|
||||||
win->Unlock();
|
win->Unlock();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -490,7 +517,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
msg->ReadString(&title);
|
msg->ReadString(&title);
|
||||||
msg->Read<port_id>(&replyport);
|
msg->Read<port_id>(&replyport);
|
||||||
|
|
||||||
STRACE(("ServerApp %s: Got 'New Window' message, trying to do smething...\n",_signature.String()));
|
STRACE(("ServerApp %s: Got 'New Window' message, trying to do smething...\n",fSignature.String()));
|
||||||
|
|
||||||
// ServerWindow constructor will reply with port_id of a newly created port
|
// ServerWindow constructor will reply with port_id of a newly created port
|
||||||
new ServerWindow(frame, title, look, feel, flags, this,
|
new ServerWindow(frame, title, look, feel, flags, this,
|
||||||
@@ -499,7 +526,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
// We don't have to do anything here...
|
// We don't have to do anything here...
|
||||||
|
|
||||||
STRACE(("\nServerApp %s: New Window %s (%.1f,%.1f,%.1f,%.1f)\n",
|
STRACE(("\nServerApp %s: New Window %s (%.1f,%.1f,%.1f,%.1f)\n",
|
||||||
_signature.String(),title,frame.left,frame.top,frame.right,frame.bottom));
|
fSignature.String(),title,frame.left,frame.top,frame.right,frame.bottom));
|
||||||
|
|
||||||
delete title;
|
delete title;
|
||||||
|
|
||||||
@@ -507,7 +534,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
}
|
}
|
||||||
case AS_CREATE_BITMAP:
|
case AS_CREATE_BITMAP:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Received BBitmap creation request\n",_signature.String()));
|
STRACE(("ServerApp %s: Received BBitmap creation request\n",fSignature.String()));
|
||||||
// Allocate a bitmap for an application
|
// Allocate a bitmap for an application
|
||||||
|
|
||||||
// Attached Data:
|
// Attached Data:
|
||||||
@@ -541,7 +568,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
ServerBitmap *sbmp=bitmapmanager->CreateBitmap(r,cs,f,bpr,s);
|
ServerBitmap *sbmp=bitmapmanager->CreateBitmap(r,cs,f,bpr,s);
|
||||||
|
|
||||||
STRACE(("ServerApp %s: Create Bitmap (%.1f,%.1f,%.1f,%.1f)\n",
|
STRACE(("ServerApp %s: Create Bitmap (%.1f,%.1f,%.1f,%.1f)\n",
|
||||||
_signature.String(),r.left,r.top,r.right,r.bottom));
|
fSignature.String(),r.left,r.top,r.right,r.bottom));
|
||||||
|
|
||||||
if(sbmp)
|
if(sbmp)
|
||||||
{
|
{
|
||||||
@@ -563,7 +590,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
}
|
}
|
||||||
case AS_DELETE_BITMAP:
|
case AS_DELETE_BITMAP:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: received BBitmap delete request\n",_signature.String()));
|
STRACE(("ServerApp %s: received BBitmap delete request\n",fSignature.String()));
|
||||||
// Delete a bitmap's allocated memory
|
// Delete a bitmap's allocated memory
|
||||||
|
|
||||||
// Attached Data:
|
// Attached Data:
|
||||||
@@ -581,9 +608,9 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
ServerBitmap *sbmp=_FindBitmap(bmp_id);
|
ServerBitmap *sbmp=_FindBitmap(bmp_id);
|
||||||
if(sbmp)
|
if(sbmp)
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Deleting Bitmap %ld\n",_signature.String(),bmp_id));
|
STRACE(("ServerApp %s: Deleting Bitmap %ld\n",fSignature.String(),bmp_id));
|
||||||
|
|
||||||
_bmplist->RemoveItem(sbmp);
|
fBitmapList->RemoveItem(sbmp);
|
||||||
bitmapmanager->DeleteBitmap(sbmp);
|
bitmapmanager->DeleteBitmap(sbmp);
|
||||||
write_port(replyport,SERVER_TRUE,NULL,0);
|
write_port(replyport,SERVER_TRUE,NULL,0);
|
||||||
}
|
}
|
||||||
@@ -595,34 +622,34 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
case AS_CREATE_PICTURE:
|
case AS_CREATE_PICTURE:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
STRACE(("ServerApp %s: Create Picture unimplemented\n",_signature.String()));
|
STRACE(("ServerApp %s: Create Picture unimplemented\n",fSignature.String()));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_DELETE_PICTURE:
|
case AS_DELETE_PICTURE:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
STRACE(("ServerApp %s: Delete Picture unimplemented\n",_signature.String()));
|
STRACE(("ServerApp %s: Delete Picture unimplemented\n",fSignature.String()));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_CLONE_PICTURE:
|
case AS_CLONE_PICTURE:
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
STRACE(("ServerApp %s: Clone Picture unimplemented\n",_signature.String()));
|
STRACE(("ServerApp %s: Clone Picture unimplemented\n",fSignature.String()));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_DOWNLOAD_PICTURE:
|
case AS_DOWNLOAD_PICTURE:
|
||||||
{
|
{
|
||||||
// TODO; Implement
|
// TODO; Implement
|
||||||
STRACE(("ServerApp %s: Download Picture unimplemented\n",_signature.String()));
|
STRACE(("ServerApp %s: Download Picture unimplemented\n",fSignature.String()));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_SET_SCREEN_MODE:
|
case AS_SET_SCREEN_MODE:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Set Screen Mode\n",_signature.String()));
|
STRACE(("ServerApp %s: Set Screen Mode\n",fSignature.String()));
|
||||||
|
|
||||||
// Attached data
|
// Attached data
|
||||||
// 1) int32 workspace #
|
// 1) int32 workspace #
|
||||||
@@ -642,7 +669,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
}
|
}
|
||||||
case AS_ACTIVATE_WORKSPACE:
|
case AS_ACTIVATE_WORKSPACE:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Activate Workspace\n",_signature.String()));
|
STRACE(("ServerApp %s: Activate Workspace\n",fSignature.String()));
|
||||||
// Attached data
|
// Attached data
|
||||||
// 1) int32 workspace index
|
// 1) int32 workspace index
|
||||||
|
|
||||||
@@ -659,39 +686,39 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
// call the CursorManager's version to allow for future expansion
|
// call the CursorManager's version to allow for future expansion
|
||||||
case AS_SHOW_CURSOR:
|
case AS_SHOW_CURSOR:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Show Cursor\n",_signature.String()));
|
STRACE(("ServerApp %s: Show Cursor\n",fSignature.String()));
|
||||||
cursormanager->ShowCursor();
|
cursormanager->ShowCursor();
|
||||||
_cursorhidden=false;
|
fCursorHidden=false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_HIDE_CURSOR:
|
case AS_HIDE_CURSOR:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Hide Cursor\n",_signature.String()));
|
STRACE(("ServerApp %s: Hide Cursor\n",fSignature.String()));
|
||||||
cursormanager->HideCursor();
|
cursormanager->HideCursor();
|
||||||
_cursorhidden=true;
|
fCursorHidden=true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_OBSCURE_CURSOR:
|
case AS_OBSCURE_CURSOR:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Obscure Cursor\n",_signature.String()));
|
STRACE(("ServerApp %s: Obscure Cursor\n",fSignature.String()));
|
||||||
cursormanager->ObscureCursor();
|
cursormanager->ObscureCursor();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_QUERY_CURSOR_HIDDEN:
|
case AS_QUERY_CURSOR_HIDDEN:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Received IsCursorHidden request\n",_signature.String()));
|
STRACE(("ServerApp %s: Received IsCursorHidden request\n",fSignature.String()));
|
||||||
// Attached data
|
// Attached data
|
||||||
// 1) int32 port to reply to
|
// 1) int32 port to reply to
|
||||||
int32 replyport;
|
int32 replyport;
|
||||||
msg->Read<int32>(&replyport);
|
msg->Read<int32>(&replyport);
|
||||||
|
|
||||||
write_port(replyport,(_cursorhidden)?SERVER_TRUE:SERVER_FALSE,NULL,0);
|
write_port(replyport,(fCursorHidden)?SERVER_TRUE:SERVER_FALSE,NULL,0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_SET_CURSOR_DATA:
|
case AS_SET_CURSOR_DATA:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: SetCursor via cursor data\n",_signature.String()));
|
STRACE(("ServerApp %s: SetCursor via cursor data\n",fSignature.String()));
|
||||||
// Attached data: 68 bytes of _appcursor data
|
// Attached data: 68 bytes of fAppCursor data
|
||||||
|
|
||||||
int8 cdata[68];
|
int8 cdata[68];
|
||||||
msg->Read(cdata,68);
|
msg->Read(cdata,68);
|
||||||
@@ -700,18 +727,18 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
// cursors, we will delete them if there is an existing one. It would
|
// cursors, we will delete them if there is an existing one. It would
|
||||||
// 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(_appcursor)
|
if(fAppCursor)
|
||||||
cursormanager->DeleteCursor(_appcursor->ID());
|
cursormanager->DeleteCursor(fAppCursor->ID());
|
||||||
|
|
||||||
_appcursor=new ServerCursor(cdata);
|
fAppCursor=new ServerCursor(cdata);
|
||||||
_appcursor->SetAppSignature(_signature.String());
|
fAppCursor->SetAppSignature(fSignature.String());
|
||||||
cursormanager->AddCursor(_appcursor);
|
cursormanager->AddCursor(fAppCursor);
|
||||||
cursormanager->SetCursor(_appcursor->ID());
|
cursormanager->SetCursor(fAppCursor->ID());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_SET_CURSOR_BCURSOR:
|
case AS_SET_CURSOR_BCURSOR:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: SetCursor via BCursor\n",_signature.String()));
|
STRACE(("ServerApp %s: SetCursor via BCursor\n",fSignature.String()));
|
||||||
// Attached data:
|
// Attached data:
|
||||||
// 1) bool flag to send a reply
|
// 1) bool flag to send a reply
|
||||||
// 2) int32 token ID of the cursor to set
|
// 2) int32 token ID of the cursor to set
|
||||||
@@ -738,9 +765,9 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
}
|
}
|
||||||
case AS_CREATE_BCURSOR:
|
case AS_CREATE_BCURSOR:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Create BCursor\n",_signature.String()));
|
STRACE(("ServerApp %s: Create BCursor\n",fSignature.String()));
|
||||||
// Attached data:
|
// Attached data:
|
||||||
// 1) 68 bytes of _appcursor data
|
// 1) 68 bytes of fAppCursor data
|
||||||
// 2) port_id reply port
|
// 2) port_id reply port
|
||||||
|
|
||||||
port_id replyport;
|
port_id replyport;
|
||||||
@@ -749,33 +776,33 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
msg->Read(cdata,68);
|
msg->Read(cdata,68);
|
||||||
msg->Read<int32>(&replyport);
|
msg->Read<int32>(&replyport);
|
||||||
|
|
||||||
_appcursor=new ServerCursor(cdata);
|
fAppCursor=new ServerCursor(cdata);
|
||||||
_appcursor->SetAppSignature(_signature.String());
|
fAppCursor->SetAppSignature(fSignature.String());
|
||||||
cursormanager->AddCursor(_appcursor);
|
cursormanager->AddCursor(fAppCursor);
|
||||||
|
|
||||||
// Synchronous message - BApplication is waiting on the cursor's ID
|
// Synchronous message - BApplication is waiting on the cursor's ID
|
||||||
PortLink link(replyport);
|
PortLink link(replyport);
|
||||||
link.Attach<int32>(_appcursor->ID());
|
link.Attach<int32>(fAppCursor->ID());
|
||||||
link.Flush();
|
link.Flush();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_DELETE_BCURSOR:
|
case AS_DELETE_BCURSOR:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Delete BCursor\n",_signature.String()));
|
STRACE(("ServerApp %s: Delete BCursor\n",fSignature.String()));
|
||||||
// Attached data:
|
// Attached data:
|
||||||
// 1) int32 token ID of the cursor to delete
|
// 1) int32 token ID of the cursor to delete
|
||||||
int32 ctoken;
|
int32 ctoken;
|
||||||
msg->Read<int32>(&ctoken);
|
msg->Read<int32>(&ctoken);
|
||||||
|
|
||||||
if(_appcursor && _appcursor->ID()==ctoken)
|
if(fAppCursor && fAppCursor->ID()==ctoken)
|
||||||
_appcursor=NULL;
|
fAppCursor=NULL;
|
||||||
|
|
||||||
cursormanager->DeleteCursor(ctoken);
|
cursormanager->DeleteCursor(ctoken);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_GET_SCROLLBAR_INFO:
|
case AS_GET_SCROLLBAR_INFO:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Get ScrollBar info\n",_signature.String()));
|
STRACE(("ServerApp %s: Get ScrollBar info\n",fSignature.String()));
|
||||||
// Attached data:
|
// Attached data:
|
||||||
// 1) port_id reply port - synchronous message
|
// 1) port_id reply port - synchronous message
|
||||||
|
|
||||||
@@ -792,7 +819,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
}
|
}
|
||||||
case AS_SET_SCROLLBAR_INFO:
|
case AS_SET_SCROLLBAR_INFO:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Set ScrollBar info\n",_signature.String()));
|
STRACE(("ServerApp %s: Set ScrollBar info\n",fSignature.String()));
|
||||||
// Attached Data:
|
// Attached Data:
|
||||||
// 1) scroll_bar_info scroll bar info structure
|
// 1) scroll_bar_info scroll bar info structure
|
||||||
scroll_bar_info sbi;
|
scroll_bar_info sbi;
|
||||||
@@ -803,7 +830,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
}
|
}
|
||||||
case AS_FOCUS_FOLLOWS_MOUSE:
|
case AS_FOCUS_FOLLOWS_MOUSE:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: query Focus Follow Mouse in use\n",_signature.String()));
|
STRACE(("ServerApp %s: query Focus Follow Mouse in use\n",fSignature.String()));
|
||||||
// Attached data:
|
// Attached data:
|
||||||
// 1) port_id reply port - synchronous message
|
// 1) port_id reply port - synchronous message
|
||||||
|
|
||||||
@@ -818,7 +845,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
}
|
}
|
||||||
case AS_SET_FOCUS_FOLLOWS_MOUSE:
|
case AS_SET_FOCUS_FOLLOWS_MOUSE:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Set Focus Follows Mouse in use\n",_signature.String()));
|
STRACE(("ServerApp %s: Set Focus Follows Mouse in use\n",fSignature.String()));
|
||||||
// Attached Data:
|
// Attached Data:
|
||||||
// 1) scroll_bar_info scroll bar info structure
|
// 1) scroll_bar_info scroll bar info structure
|
||||||
scroll_bar_info sbi;
|
scroll_bar_info sbi;
|
||||||
@@ -829,7 +856,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
}
|
}
|
||||||
case AS_SET_MOUSE_MODE:
|
case AS_SET_MOUSE_MODE:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Set Focus Follows Mouse mode\n",_signature.String()));
|
STRACE(("ServerApp %s: Set Focus Follows Mouse mode\n",fSignature.String()));
|
||||||
// Attached Data:
|
// Attached Data:
|
||||||
// 1) enum mode_mouse FFM mouse mode
|
// 1) enum mode_mouse FFM mouse mode
|
||||||
mode_mouse mmode;
|
mode_mouse mmode;
|
||||||
@@ -840,7 +867,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
}
|
}
|
||||||
case AS_GET_MOUSE_MODE:
|
case AS_GET_MOUSE_MODE:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Get Focus Follows Mouse mode\n",_signature.String()));
|
STRACE(("ServerApp %s: Get Focus Follows Mouse mode\n",fSignature.String()));
|
||||||
// Attached data:
|
// Attached data:
|
||||||
// 1) port_id reply port - synchronous message
|
// 1) port_id reply port - synchronous message
|
||||||
|
|
||||||
@@ -857,7 +884,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
}
|
}
|
||||||
case AS_GET_UI_COLOR:
|
case AS_GET_UI_COLOR:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Get UI color\n",_signature.String()));
|
STRACE(("ServerApp %s: Get UI color\n",fSignature.String()));
|
||||||
|
|
||||||
RGBColor color;
|
RGBColor color;
|
||||||
int32 whichcolor;
|
int32 whichcolor;
|
||||||
@@ -878,7 +905,8 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s received unhandled message code offset %s\n",_signature.String(),MsgCodeToString(msg->Code())));
|
STRACE(("ServerApp %s received unhandled message code offset %s\n",fSignature.String(),
|
||||||
|
MsgCodeToBString(msg->Code()).String()));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -893,15 +921,16 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
|
|||||||
ServerBitmap *ServerApp::_FindBitmap(int32 token)
|
ServerBitmap *ServerApp::_FindBitmap(int32 token)
|
||||||
{
|
{
|
||||||
ServerBitmap *temp;
|
ServerBitmap *temp;
|
||||||
for(int32 i=0; i<_bmplist->CountItems();i++)
|
for(int32 i=0; i<fBitmapList->CountItems();i++)
|
||||||
{
|
{
|
||||||
temp=(ServerBitmap*)_bmplist->ItemAt(i);
|
temp=(ServerBitmap*)fBitmapList->ItemAt(i);
|
||||||
if(temp && temp->Token()==token)
|
if(temp && temp->Token()==token)
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
team_id ServerApp::ClientTeamID(){
|
team_id ServerApp::ClientTeamID()
|
||||||
|
{
|
||||||
return fClientTeamID;
|
return fClientTeamID;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
//
|
//
|
||||||
// File Name: ServerApp.h
|
// File Name: ServerApp.h
|
||||||
// Author: DarkWyrm <[email protected]>
|
// Author: DarkWyrm <[email protected]>
|
||||||
|
// Adi Oanca <[email protected]>
|
||||||
// Description: Server-side BApplication counterpart
|
// Description: Server-side BApplication counterpart
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -46,60 +47,60 @@ class ServerCursor;
|
|||||||
class ServerApp
|
class ServerApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ServerApp(port_id sendport, port_id rcvport, port_id clientLooperPort,
|
ServerApp(port_id sendport, port_id rcvport, port_id clientLooperPort,
|
||||||
team_id clientTeamID, int32 handlerID, char *signature);
|
team_id clientTeamID, int32 handlerID, char *signature);
|
||||||
virtual ~ServerApp(void);
|
virtual ~ServerApp(void);
|
||||||
|
|
||||||
bool Run(void);
|
bool Run(void);
|
||||||
static int32 MonitorApp(void *data);
|
static int32 MonitorApp(void *data);
|
||||||
void Lock(void);
|
void Lock(void);
|
||||||
void Unlock(void);
|
void Unlock(void);
|
||||||
bool IsLocked(void);
|
bool IsLocked(void);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Determines whether the application is the active one
|
\brief Determines whether the application is the active one
|
||||||
\return true if active, false if not.
|
\return true if active, false if not.
|
||||||
*/
|
*/
|
||||||
bool IsActive(void) const { return _isactive; }
|
bool IsActive(void) const { return fIsActive; }
|
||||||
|
|
||||||
void Activate(bool value);
|
void Activate(bool value);
|
||||||
bool PingTarget(void);
|
bool PingTarget(void);
|
||||||
|
|
||||||
void PostMessage(int32 code, size_t size=0,
|
void PostMessage(int32 code, size_t size=0,int8 *buffer=NULL);
|
||||||
int8 *buffer=NULL);
|
void WindowBroadcast(int32 code);
|
||||||
void SendMessageToClient( const BMessage* msg ) const;
|
|
||||||
|
|
||||||
void SetAppCursor(void);
|
void SendMessageToClient( const BMessage* msg ) const;
|
||||||
|
void SetAppCursor(void);
|
||||||
|
|
||||||
team_id ClientTeamID();
|
team_id ClientTeamID();
|
||||||
|
|
||||||
|
FMWList fAppFMWList;
|
||||||
|
|
||||||
FMWList fAppFMWList;
|
|
||||||
protected:
|
protected:
|
||||||
friend class AppServer;
|
friend class AppServer;
|
||||||
friend class ServerWindow;
|
friend class ServerWindow;
|
||||||
|
|
||||||
void _DispatchMessage(PortMessage *msg);
|
void _DispatchMessage(PortMessage *msg);
|
||||||
ServerBitmap* _FindBitmap(int32 token);
|
ServerBitmap *_FindBitmap(int32 token);
|
||||||
|
|
||||||
port_id _sender,
|
port_id fClientAppPort,
|
||||||
_receiver,
|
fMessagePort,
|
||||||
fClientLooperPort;
|
fClientLooperPort;
|
||||||
|
|
||||||
BString _signature;
|
BString fSignature;
|
||||||
thread_id _monitor_thread;
|
thread_id fMonitorThreadID;
|
||||||
|
|
||||||
team_id fClientTeamID;
|
team_id fClientTeamID;
|
||||||
|
|
||||||
team_id _target_id;
|
PortLink *fAppLink;
|
||||||
PortLink* _applink;
|
BList *fSWindowList,
|
||||||
BList *_winlist,
|
*fBitmapList,
|
||||||
*_bmplist,
|
*fPictureList;
|
||||||
*_piclist;
|
ServerCursor *fAppCursor;
|
||||||
ServerCursor* _appcursor;
|
sem_id fLockSem;
|
||||||
sem_id _lock;
|
bool fCursorHidden;
|
||||||
bool _cursorhidden;
|
bool fIsActive;
|
||||||
bool _isactive;
|
int32 fHandlerToken;
|
||||||
int32 _handlertoken;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -65,114 +65,104 @@ class Layer;
|
|||||||
class ServerWindow
|
class ServerWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ServerWindow(BRect rect, const char *string,
|
ServerWindow(BRect rect, const char *string, uint32 wlook, uint32 wfeel, uint32 wflags,
|
||||||
uint32 wlook, uint32 wfeel, uint32 wflags,
|
ServerApp *winapp, port_id winport, port_id looperPort, port_id replyport,
|
||||||
ServerApp *winapp, port_id winport,
|
uint32 index, int32 handlerID);
|
||||||
port_id looperPort, port_id replyport, uint32 index,
|
~ServerWindow(void);
|
||||||
int32 handlerID);
|
|
||||||
~ServerWindow(void);
|
|
||||||
|
|
||||||
void ReplaceDecorator(void);
|
void ReplaceDecorator(void);
|
||||||
void Quit(void);
|
void Quit(void);
|
||||||
const char* GetTitle(void);
|
void Show(void);
|
||||||
ServerApp* GetApp(void);
|
void Hide(void);
|
||||||
void Show(void);
|
bool IsHidden(void);
|
||||||
void Hide(void);
|
void Minimize(bool status);
|
||||||
bool IsHidden(void);
|
void Zoom(void);
|
||||||
void Minimize(bool status);
|
void SetFocus(bool value);
|
||||||
void Zoom(void);
|
bool HasFocus(void);
|
||||||
void SetFocus(bool value);
|
void RequestDraw(BRect rect);
|
||||||
bool HasFocus(void);
|
void RequestDraw(void);
|
||||||
void RequestDraw(BRect rect);
|
|
||||||
void RequestDraw(void);
|
|
||||||
|
|
||||||
void WorkspaceActivated(int32 workspace, bool active);
|
void WorkspaceActivated(int32 workspace, bool active);
|
||||||
void WorkspacesChanged(int32 oldone,int32 newone);
|
void WorkspacesChanged(int32 oldone,int32 newone);
|
||||||
void WindowActivated(bool active);
|
void WindowActivated(bool active);
|
||||||
void ScreenModeChanged(const BRect frame, const color_space cspace);
|
void ScreenModeChanged(const BRect frame, const color_space cspace);
|
||||||
|
|
||||||
void SetFrame(const BRect &rect);
|
void SetFrame(const BRect &rect);
|
||||||
BRect Frame(void);
|
BRect Frame(void);
|
||||||
|
|
||||||
status_t Lock(void);
|
status_t Lock(void);
|
||||||
void Unlock(void);
|
void Unlock(void);
|
||||||
bool IsLocked(void);
|
bool IsLocked(void);
|
||||||
thread_id ThreadID() const { return _monitorthread;}
|
thread_id ThreadID(void) const { return fMonitorThreadID;}
|
||||||
|
|
||||||
void DispatchMessage(int32 code);
|
void DispatchMessage(int32 code);
|
||||||
void DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer);
|
void DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer);
|
||||||
static int32 MonitorWin(void *data);
|
static int32 MonitorWin(void *data);
|
||||||
static void HandleMouseEvent(PortMessage *msg);
|
static void HandleMouseEvent(PortMessage *msg);
|
||||||
static void HandleKeyEvent(int32 code, int8 *buffer);
|
static void HandleKeyEvent(int32 code, int8 *buffer);
|
||||||
|
void PostMessage(int32 code, size_t size=0, int8 *buffer=NULL);
|
||||||
|
|
||||||
//! Returns the index of the workspaces to which it belongs
|
//! Returns the index of the workspaces to which it belongs
|
||||||
int32 GetWorkspaceIndex(void) { return fWorkspaces; }
|
int32 GetWorkspaceIndex(void) { return fWorkspaces; }
|
||||||
Workspace* GetWorkspace(void);
|
Workspace *GetWorkspace(void);
|
||||||
void SetWorkspace(Workspace *wkspc);
|
void SetWorkspace(Workspace *wkspc);
|
||||||
|
|
||||||
//! Returns the window's title
|
//! Returns the window's title
|
||||||
const char* Title(void) { return _title->String(); }
|
const char *Title(void) { return fTitle.String(); }
|
||||||
|
|
||||||
Layer* FindLayer(const Layer* start, int32 token) const;
|
Layer* FindLayer(const Layer* start, int32 token) const;
|
||||||
void SendMessageToClient( const BMessage* msg ) const;
|
void SendMessageToClient( const BMessage* msg ) const;
|
||||||
|
|
||||||
int32 Look() const { return _look; }
|
int32 Look(void) const { return fLook; }
|
||||||
int32 Feel() const { return _feel; }
|
int32 Feel(void) const { return fFeel; }
|
||||||
uint32 Flags() const { return _flags; }
|
uint32 Flags(void) const { return fFlags; }
|
||||||
team_id ClientTeamID() const { return fClientTeamID; }
|
team_id ClientTeamID(void) const { return fClientTeamID; }
|
||||||
ServerApp* App() const { return _app; }
|
ServerApp *App(void) const { return fServerApp; }
|
||||||
uint32 Workspaces() const { return fWorkspaces; }
|
uint32 Workspaces(void) const { return fWorkspaces; }
|
||||||
WinBorder* GetWinBorder() const { return _winborder; }
|
WinBorder *GetWinBorder(void) const { return fWinBorder; }
|
||||||
|
|
||||||
// server "private" - try not to use
|
// server "private" - try not to use
|
||||||
void QuietlySetWorkspaces(uint32 wks)
|
void QuietlySetWorkspaces(uint32 wks) { fWorkspaces = wks; }
|
||||||
{ fWorkspaces = wks; }
|
void QuietlySetFeel(int32 feel) { fFeel = feel; }
|
||||||
void QuietlySetFeel(int32 feel)
|
int32 ClientToken(void) const { return fHandlerToken; }
|
||||||
{ _feel = feel; }
|
|
||||||
int32 ClientToken() const { return _handlertoken; }
|
|
||||||
|
|
||||||
FMWList fWinFMWList;
|
FMWList fWinFMWList;
|
||||||
protected:
|
protected:
|
||||||
friend class ServerApp;
|
friend class ServerApp;
|
||||||
friend class WinBorder;
|
friend class WinBorder;
|
||||||
friend class Screen;
|
friend class Screen;
|
||||||
friend class Layer;
|
friend class Layer;
|
||||||
|
|
||||||
BString *_title;
|
BString fTitle;
|
||||||
int32 _look,
|
int32 fLook,
|
||||||
_feel,
|
fFeel,
|
||||||
_flags;
|
fFlags;
|
||||||
uint32 fWorkspaces;
|
uint32 fWorkspaces;
|
||||||
Workspace *_workspace;
|
Workspace *fWorkspace;
|
||||||
bool _active;
|
bool fIsActive;
|
||||||
|
|
||||||
ServerApp *_app;
|
ServerApp *fServerApp;
|
||||||
WinBorder *_winborder;
|
WinBorder *fWinBorder;
|
||||||
|
|
||||||
team_id fClientTeamID;
|
team_id fClientTeamID;
|
||||||
thread_id _monitorthread;
|
thread_id fMonitorThreadID;
|
||||||
port_id _receiver; // Messages from window
|
|
||||||
port_id _sender; // Messages to window
|
|
||||||
PortLink *_winlink;
|
|
||||||
|
|
||||||
BLocker _locker;
|
port_id fMessagePort;
|
||||||
BRect _frame;
|
port_id fClientWinPort;
|
||||||
uint32 _token;
|
port_id fClientLooperPort;
|
||||||
int32 _handlertoken;
|
|
||||||
|
|
||||||
BSession *ses;
|
PortLink *fWinLink;
|
||||||
port_id winLooperPort;
|
|
||||||
Layer *top_layer;
|
BLocker fLocker;
|
||||||
Layer *cl; // short for currentLayer. We'll use it a lot, that's why it's short :-)
|
BRect fFrame;
|
||||||
|
uint32 fToken;
|
||||||
|
int32 fHandlerToken;
|
||||||
|
|
||||||
|
BSession *fSession;
|
||||||
|
Layer *fTopLayer;
|
||||||
|
Layer *cl; // short for currentLayer. We'll use it a lot, that's why it's short :-)
|
||||||
};
|
};
|
||||||
|
|
||||||
void ActivateWindow(ServerWindow *oldwin,ServerWindow *newwin);
|
void ActivateWindow(ServerWindow *oldwin,ServerWindow *newwin);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/*
|
|
||||||
@log
|
|
||||||
* added Layer as a friend.
|
|
||||||
* added a new member: port_id winLooperPort; We'll use it to send flattened BMessages(like _UPDATE_ / B_VIEW_RESIZED(MOVED)) to our BWindow counterpart.
|
|
||||||
* SendMessageToClient( BMessage ) sends that message BWindow's looper port.
|
|
||||||
*/
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
#include <String.h>
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Send a BMessage to a Looper target
|
\brief Send a BMessage to a Looper target
|
||||||
@@ -92,9 +93,23 @@ const char *MsgCodeToString(int32 code)
|
|||||||
// Used to translate BMessage message codes back to a character
|
// Used to translate BMessage message codes back to a character
|
||||||
// format
|
// format
|
||||||
char string [10];
|
char string [10];
|
||||||
sprintf(string,"'%c%c%c%c'",(char)((code & 0xFF000000) >> 24),
|
sprintf(string,"'%x%x%x%x'",(char)((code & 0xFF000000) >> 24),
|
||||||
(char)((code & 0x00FF0000) >> 16),
|
(char)((code & 0x00FF0000) >> 16),
|
||||||
(char)((code & 0x0000FF00) >> 8),
|
(char)((code & 0x0000FF00) >> 8),
|
||||||
(char)((code & 0x000000FF)) );
|
(char)((code & 0x000000FF)) );
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BString MsgCodeToBString(int32 code)
|
||||||
|
{
|
||||||
|
// Used to translate BMessage message codes back to a character
|
||||||
|
// format
|
||||||
|
char string [10];
|
||||||
|
sprintf(string,"'%x%x%x%x'",(char)((code & 0xFF000000) >> 24),
|
||||||
|
(char)((code & 0x00FF0000) >> 16),
|
||||||
|
(char)((code & 0x0000FF00) >> 8),
|
||||||
|
(char)((code & 0x000000FF)) );
|
||||||
|
|
||||||
|
BString bstring(string);
|
||||||
|
return bstring;
|
||||||
|
}
|
||||||
|
|||||||
@@ -32,5 +32,6 @@
|
|||||||
|
|
||||||
void SendMessage(port_id port, BMessage *message, int32 target=-1);
|
void SendMessage(port_id port, BMessage *message, int32 target=-1);
|
||||||
const char *MsgCodeToString(int32 code);
|
const char *MsgCodeToString(int32 code);
|
||||||
|
BString MsgCodeToBString(int32 code);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -106,8 +106,10 @@ VDView::VDView(BRect bounds)
|
|||||||
VDView::~VDView(void)
|
VDView::~VDView(void)
|
||||||
{
|
{
|
||||||
delete serverlink;
|
delete serverlink;
|
||||||
delete viewbmp;
|
|
||||||
delete cursor;
|
delete cursor;
|
||||||
|
|
||||||
|
viewbmp->Lock();
|
||||||
|
delete viewbmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VDView::AttachedToWindow(void)
|
void VDView::AttachedToWindow(void)
|
||||||
@@ -581,6 +583,9 @@ void ViewDriver::Shutdown(void)
|
|||||||
|
|
||||||
void ViewDriver::SetMode(const display_mode &mode)
|
void ViewDriver::SetMode(const display_mode &mode)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
|
|
||||||
BBitmap *tempbmp=new BBitmap(BRect(0,0,mode.virtual_width-1,mode.virtual_height-1),
|
BBitmap *tempbmp=new BBitmap(BRect(0,0,mode.virtual_width-1,mode.virtual_height-1),
|
||||||
@@ -620,6 +625,9 @@ void ViewDriver::SetMode(const display_mode &mode)
|
|||||||
|
|
||||||
void ViewDriver::SetMode(int32 space)
|
void ViewDriver::SetMode(int32 space)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
int16 w=640,h=480;
|
int16 w=640,h=480;
|
||||||
color_space s=B_CMAP8;
|
color_space s=B_CMAP8;
|
||||||
@@ -696,6 +704,9 @@ void ViewDriver::SetMode(int32 space)
|
|||||||
|
|
||||||
void ViewDriver::CopyBits(BRect src, BRect dest)
|
void ViewDriver::CopyBits(BRect src, BRect dest)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
drawview->CopyBits(src,dest);
|
drawview->CopyBits(src,dest);
|
||||||
@@ -708,6 +719,9 @@ void ViewDriver::CopyBits(BRect src, BRect dest)
|
|||||||
|
|
||||||
void ViewDriver::CopyRegion(BRegion *src, const BPoint &lefttop)
|
void ViewDriver::CopyRegion(BRegion *src, const BPoint &lefttop)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
STRACE(("ViewDriver:: CopyRegion not completely tested\n"));
|
STRACE(("ViewDriver:: CopyRegion not completely tested\n"));
|
||||||
|
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
@@ -801,11 +815,17 @@ printf("Overlap\n");
|
|||||||
|
|
||||||
void ViewDriver::DrawBitmap(ServerBitmap *bitmap, BRect src, BRect dest)
|
void ViewDriver::DrawBitmap(ServerBitmap *bitmap, BRect src, BRect dest)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
STRACE(("ViewDriver:: DrawBitmap unimplemented()\n"));
|
STRACE(("ViewDriver:: DrawBitmap unimplemented()\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewDriver::DrawChar(char c, BPoint pt, LayerData *d)
|
void ViewDriver::DrawChar(char c, BPoint pt, LayerData *d)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
char str[2];
|
char str[2];
|
||||||
str[0]=c;
|
str[0]=c;
|
||||||
str[1]='\0';
|
str[1]='\0';
|
||||||
@@ -814,6 +834,9 @@ void ViewDriver::DrawChar(char c, BPoint pt, LayerData *d)
|
|||||||
|
|
||||||
void ViewDriver::DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *delta=NULL)
|
void ViewDriver::DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *delta=NULL)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
STRACE(("ViewDriver:: DrawString(\"%s\",%ld,BPoint(%f,%f))\n",string,length,pt.x,pt.y));
|
STRACE(("ViewDriver:: DrawString(\"%s\",%ld,BPoint(%f,%f))\n",string,length,pt.x,pt.y));
|
||||||
if(!d)
|
if(!d)
|
||||||
return;
|
return;
|
||||||
@@ -846,6 +869,9 @@ STRACE(("ViewDriver:: DrawString(\"%s\",%ld,BPoint(%f,%f))\n",string,length,pt.x
|
|||||||
|
|
||||||
bool ViewDriver::DumpToFile(const char *path)
|
bool ViewDriver::DumpToFile(const char *path)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Dump to PNG
|
// Dump to PNG
|
||||||
Lock();
|
Lock();
|
||||||
SaveToPNG(path,framebuffer->Bounds(),framebuffer->ColorSpace(),
|
SaveToPNG(path,framebuffer->Bounds(),framebuffer->ColorSpace(),
|
||||||
@@ -860,6 +886,9 @@ bool ViewDriver::DumpToFile(const char *path)
|
|||||||
|
|
||||||
void ViewDriver::FillArc(const BRect r, float angle, float span, RGBColor& color)
|
void ViewDriver::FillArc(const BRect r, float angle, float span, RGBColor& color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -878,6 +907,9 @@ void ViewDriver::FillArc(const BRect r, float angle, float span, RGBColor& color
|
|||||||
|
|
||||||
void ViewDriver::FillArc(const BRect r, float angle, float span, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
void ViewDriver::FillArc(const BRect r, float angle, float span, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -896,6 +928,9 @@ void ViewDriver::FillArc(const BRect r, float angle, float span, const Pattern&
|
|||||||
|
|
||||||
void ViewDriver::FillBezier(BPoint *pts, RGBColor& color)
|
void ViewDriver::FillBezier(BPoint *pts, RGBColor& color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!pts)
|
if(!pts)
|
||||||
return;
|
return;
|
||||||
Lock();
|
Lock();
|
||||||
@@ -917,6 +952,9 @@ void ViewDriver::FillBezier(BPoint *pts, RGBColor& color)
|
|||||||
|
|
||||||
void ViewDriver::FillBezier(BPoint *pts, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
void ViewDriver::FillBezier(BPoint *pts, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!pts)
|
if(!pts)
|
||||||
return;
|
return;
|
||||||
Lock();
|
Lock();
|
||||||
@@ -938,6 +976,9 @@ void ViewDriver::FillBezier(BPoint *pts, const Pattern& pat, RGBColor& high_colo
|
|||||||
|
|
||||||
void ViewDriver::FillEllipse(BRect r, RGBColor& color)
|
void ViewDriver::FillEllipse(BRect r, RGBColor& color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -954,6 +995,9 @@ void ViewDriver::FillEllipse(BRect r, RGBColor& color)
|
|||||||
|
|
||||||
void ViewDriver::FillEllipse(BRect r, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
void ViewDriver::FillEllipse(BRect r, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -970,6 +1014,9 @@ void ViewDriver::FillEllipse(BRect r, const Pattern& pat, RGBColor& high_color,
|
|||||||
|
|
||||||
void ViewDriver::FillPolygon(BPoint *ptlist, int32 numpts, RGBColor& color)
|
void ViewDriver::FillPolygon(BPoint *ptlist, int32 numpts, RGBColor& color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -986,6 +1033,9 @@ void ViewDriver::FillPolygon(BPoint *ptlist, int32 numpts, RGBColor& color)
|
|||||||
|
|
||||||
void ViewDriver::FillPolygon(BPoint *ptlist, int32 numpts, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
void ViewDriver::FillPolygon(BPoint *ptlist, int32 numpts, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1002,6 +1052,9 @@ void ViewDriver::FillPolygon(BPoint *ptlist, int32 numpts, const Pattern& pat, R
|
|||||||
|
|
||||||
void ViewDriver::FillRect(const BRect r, RGBColor& color)
|
void ViewDriver::FillRect(const BRect r, RGBColor& color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1025,6 +1078,9 @@ void ViewDriver::FillRect(const BRect r, RGBColor& color)
|
|||||||
*/
|
*/
|
||||||
void ViewDriver::FillRect(const BRect r, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
void ViewDriver::FillRect(const BRect r, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1041,6 +1097,9 @@ void ViewDriver::FillRect(const BRect r, const Pattern& pat, RGBColor& high_colo
|
|||||||
|
|
||||||
void ViewDriver::FillRoundRect(BRect r, float xrad, float yrad, RGBColor& color)
|
void ViewDriver::FillRoundRect(BRect r, float xrad, float yrad, RGBColor& color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1057,6 +1116,9 @@ void ViewDriver::FillRoundRect(BRect r, float xrad, float yrad, RGBColor& color)
|
|||||||
|
|
||||||
void ViewDriver::FillRoundRect(BRect r, float xrad, float yrad, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
void ViewDriver::FillRoundRect(BRect r, float xrad, float yrad, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1073,6 +1135,9 @@ void ViewDriver::FillRoundRect(BRect r, float xrad, float yrad, const Pattern& p
|
|||||||
|
|
||||||
void ViewDriver::FillTriangle(BPoint *pts, RGBColor& color)
|
void ViewDriver::FillTriangle(BPoint *pts, RGBColor& color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1102,6 +1167,9 @@ void ViewDriver::FillTriangle(BPoint *pts, RGBColor& color)
|
|||||||
|
|
||||||
void ViewDriver::FillTriangle(BPoint *pts, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
void ViewDriver::FillTriangle(BPoint *pts, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1131,6 +1199,9 @@ void ViewDriver::FillTriangle(BPoint *pts, const Pattern& pat, RGBColor& high_co
|
|||||||
|
|
||||||
void ViewDriver::StrokeArc(BRect r, float angle, float span, float pensize, RGBColor& color)
|
void ViewDriver::StrokeArc(BRect r, float angle, float span, float pensize, RGBColor& color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1148,6 +1219,9 @@ void ViewDriver::StrokeArc(BRect r, float angle, float span, float pensize, RGBC
|
|||||||
|
|
||||||
void ViewDriver::StrokeArc(BRect r, float angle, float span, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
void ViewDriver::StrokeArc(BRect r, float angle, float span, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1165,6 +1239,9 @@ void ViewDriver::StrokeArc(BRect r, float angle, float span, float pensize, cons
|
|||||||
|
|
||||||
void ViewDriver::StrokeBezier(BPoint *pts, float pensize, RGBColor& color)
|
void ViewDriver::StrokeBezier(BPoint *pts, float pensize, RGBColor& color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1182,6 +1259,9 @@ void ViewDriver::StrokeBezier(BPoint *pts, float pensize, RGBColor& color)
|
|||||||
|
|
||||||
void ViewDriver::StrokeBezier(BPoint *pts, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
void ViewDriver::StrokeBezier(BPoint *pts, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1199,6 +1279,9 @@ void ViewDriver::StrokeBezier(BPoint *pts, float pensize, const Pattern& pat, RG
|
|||||||
|
|
||||||
void ViewDriver::StrokeEllipse(BRect r, float pensize, RGBColor& color)
|
void ViewDriver::StrokeEllipse(BRect r, float pensize, RGBColor& color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1216,6 +1299,9 @@ void ViewDriver::StrokeEllipse(BRect r, float pensize, RGBColor& color)
|
|||||||
|
|
||||||
void ViewDriver::StrokeEllipse(BRect r, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
void ViewDriver::StrokeEllipse(BRect r, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1233,6 +1319,9 @@ void ViewDriver::StrokeEllipse(BRect r, float pensize, const Pattern& pat, RGBCo
|
|||||||
|
|
||||||
void ViewDriver::StrokeLine(BPoint start, BPoint end, float pensize, RGBColor& color)
|
void ViewDriver::StrokeLine(BPoint start, BPoint end, float pensize, RGBColor& color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1250,6 +1339,9 @@ void ViewDriver::StrokeLine(BPoint start, BPoint end, float pensize, RGBColor& c
|
|||||||
|
|
||||||
void ViewDriver::StrokeLine(BPoint start, BPoint end, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
void ViewDriver::StrokeLine(BPoint start, BPoint end, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1267,6 +1359,9 @@ void ViewDriver::StrokeLine(BPoint start, BPoint end, float pensize, const Patte
|
|||||||
|
|
||||||
void ViewDriver::StrokePoint(BPoint& pt, RGBColor& color)
|
void ViewDriver::StrokePoint(BPoint& pt, RGBColor& color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
@@ -1309,11 +1404,17 @@ void ViewDriver::StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, RGBC
|
|||||||
|
|
||||||
void ViewDriver::StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color, bool is_closed)
|
void ViewDriver::StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color, bool is_closed)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
StrokePolygon(ptlist,numpts,pensize,high_color,is_closed);
|
StrokePolygon(ptlist,numpts,pensize,high_color,is_closed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewDriver::StrokeRect(BRect r, float pensize, RGBColor& color)
|
void ViewDriver::StrokeRect(BRect r, float pensize, RGBColor& color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1331,6 +1432,9 @@ void ViewDriver::StrokeRect(BRect r, float pensize, RGBColor& color)
|
|||||||
|
|
||||||
void ViewDriver::StrokeRect(BRect r, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
void ViewDriver::StrokeRect(BRect r, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1348,6 +1452,9 @@ void ViewDriver::StrokeRect(BRect r, float pensize, const Pattern& pat, RGBColor
|
|||||||
|
|
||||||
void ViewDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, RGBColor& color)
|
void ViewDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, RGBColor& color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1365,6 +1472,9 @@ void ViewDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize,
|
|||||||
|
|
||||||
void ViewDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
void ViewDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
@@ -1389,6 +1499,9 @@ void ViewDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize,
|
|||||||
*/
|
*/
|
||||||
void ViewDriver::StrokeLineArray(BPoint *pts, int32 numlines, float pensize, RGBColor *colors)
|
void ViewDriver::StrokeLineArray(BPoint *pts, int32 numlines, float pensize, RGBColor *colors)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
if( !numlines || !pts || !colors)
|
if( !numlines || !pts || !colors)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1426,6 +1539,9 @@ void ViewDriver::StrokeLineArray(BPoint *pts, int32 numlines, float pensize, RGB
|
|||||||
|
|
||||||
void ViewDriver::HideCursor(void)
|
void ViewDriver::HideCursor(void)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
Lock();
|
Lock();
|
||||||
|
|
||||||
@@ -1438,6 +1554,9 @@ void ViewDriver::HideCursor(void)
|
|||||||
|
|
||||||
void ViewDriver::InvertRect(BRect r)
|
void ViewDriver::InvertRect(BRect r)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
drawview->InvertRect(r);
|
drawview->InvertRect(r);
|
||||||
@@ -1449,6 +1568,9 @@ void ViewDriver::InvertRect(BRect r)
|
|||||||
|
|
||||||
bool ViewDriver::IsCursorHidden(void)
|
bool ViewDriver::IsCursorHidden(void)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return false;
|
||||||
|
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
bool value=(hide_cursor>0)?true:false;
|
bool value=(hide_cursor>0)?true:false;
|
||||||
screenwin->Unlock();
|
screenwin->Unlock();
|
||||||
@@ -1457,6 +1579,9 @@ bool ViewDriver::IsCursorHidden(void)
|
|||||||
|
|
||||||
void ViewDriver::ObscureCursor(void)
|
void ViewDriver::ObscureCursor(void)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
screenwin->PostMessage(VDWIN_OBSCURECURSOR);
|
screenwin->PostMessage(VDWIN_OBSCURECURSOR);
|
||||||
screenwin->Unlock();
|
screenwin->Unlock();
|
||||||
@@ -1464,6 +1589,9 @@ void ViewDriver::ObscureCursor(void)
|
|||||||
|
|
||||||
void ViewDriver::MoveCursorTo(float x, float y)
|
void ViewDriver::MoveCursorTo(float x, float y)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
BMessage *msg=new BMessage(VDWIN_MOVECURSOR);
|
BMessage *msg=new BMessage(VDWIN_MOVECURSOR);
|
||||||
msg->AddFloat("x",x);
|
msg->AddFloat("x",x);
|
||||||
@@ -1474,6 +1602,9 @@ void ViewDriver::MoveCursorTo(float x, float y)
|
|||||||
|
|
||||||
void ViewDriver::SetCursor(ServerCursor *cursor)
|
void ViewDriver::SetCursor(ServerCursor *cursor)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
if(cursor!=NULL)
|
if(cursor!=NULL)
|
||||||
{
|
{
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
@@ -1499,6 +1630,9 @@ void ViewDriver::SetCursor(ServerCursor *cursor)
|
|||||||
|
|
||||||
void ViewDriver::ShowCursor(void)
|
void ViewDriver::ShowCursor(void)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
if(hide_cursor>0)
|
if(hide_cursor>0)
|
||||||
{
|
{
|
||||||
@@ -1511,6 +1645,9 @@ void ViewDriver::ShowCursor(void)
|
|||||||
|
|
||||||
void ViewDriver::SetLayerData(LayerData *d, bool set_font_data)
|
void ViewDriver::SetLayerData(LayerData *d, bool set_font_data)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!d)
|
if(!d)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1552,7 +1689,7 @@ void ViewDriver::SetLayerData(LayerData *d, bool set_font_data)
|
|||||||
|
|
||||||
float ViewDriver::StringWidth(const char *string, int32 length, LayerData *d)
|
float ViewDriver::StringWidth(const char *string, int32 length, LayerData *d)
|
||||||
{
|
{
|
||||||
if(!string || !d )
|
if(!string || !d || !is_initialized)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
|
|
||||||
@@ -1616,7 +1753,7 @@ float ViewDriver::StringWidth(const char *string, int32 length, LayerData *d)
|
|||||||
|
|
||||||
float ViewDriver::StringHeight(const char *string, int32 length, LayerData *d)
|
float ViewDriver::StringHeight(const char *string, int32 length, LayerData *d)
|
||||||
{
|
{
|
||||||
if(!string || !d )
|
if(!string || !d || !is_initialized)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
|
|
||||||
@@ -1666,6 +1803,9 @@ float ViewDriver::StringHeight(const char *string, int32 length, LayerData *d)
|
|||||||
/*
|
/*
|
||||||
void ViewDriver::DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *edelta)
|
void ViewDriver::DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *edelta)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!string || !d )
|
if(!string || !d )
|
||||||
return;
|
return;
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
@@ -1810,6 +1950,9 @@ void ViewDriver::DrawString(const char *string, int32 length, BPoint pt, LayerDa
|
|||||||
*/
|
*/
|
||||||
void ViewDriver::BlitMono2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d)
|
void ViewDriver::BlitMono2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
rgb_color color=d->highcolor.GetColor32();
|
rgb_color color=d->highcolor.GetColor32();
|
||||||
|
|
||||||
// pointers to the top left corner of the area to be copied in each bitmap
|
// pointers to the top left corner of the area to be copied in each bitmap
|
||||||
@@ -1895,6 +2038,9 @@ void ViewDriver::BlitMono2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d)
|
|||||||
|
|
||||||
void ViewDriver::BlitGray2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d)
|
void ViewDriver::BlitGray2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
// pointers to the top left corner of the area to be copied in each bitmap
|
// pointers to the top left corner of the area to be copied in each bitmap
|
||||||
uint8 *srcbuffer=NULL, *destbuffer=NULL;
|
uint8 *srcbuffer=NULL, *destbuffer=NULL;
|
||||||
|
|
||||||
@@ -2010,8 +2156,9 @@ void ViewDriver::BlitGray2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d)
|
|||||||
rgb_color ViewDriver::GetBlitColor(rgb_color src, rgb_color dest, LayerData *d, bool use_high)
|
rgb_color ViewDriver::GetBlitColor(rgb_color src, rgb_color dest, LayerData *d, bool use_high)
|
||||||
{
|
{
|
||||||
rgb_color returncolor={0,0,0,0};
|
rgb_color returncolor={0,0,0,0};
|
||||||
|
|
||||||
int16 value;
|
int16 value;
|
||||||
if(!d)
|
if(!d || !is_initialized)
|
||||||
return returncolor;
|
return returncolor;
|
||||||
|
|
||||||
switch(d->draw_mode)
|
switch(d->draw_mode)
|
||||||
@@ -2111,6 +2258,9 @@ rgb_color ViewDriver::GetBlitColor(rgb_color src, rgb_color dest, LayerData *d,
|
|||||||
|
|
||||||
status_t ViewDriver::SetDPMSMode(const uint32 &state)
|
status_t ViewDriver::SetDPMSMode(const uint32 &state)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
// TODO: Implement software DPMS
|
// TODO: Implement software DPMS
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
@@ -2129,7 +2279,7 @@ uint32 ViewDriver::DPMSCapabilities(void) const
|
|||||||
|
|
||||||
status_t ViewDriver::GetDeviceInfo(accelerant_device_info *info)
|
status_t ViewDriver::GetDeviceInfo(accelerant_device_info *info)
|
||||||
{
|
{
|
||||||
if(!info)
|
if(!info || !is_initialized)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
// We really don't have to provide anything here because this is strictly
|
// We really don't have to provide anything here because this is strictly
|
||||||
@@ -2147,7 +2297,7 @@ status_t ViewDriver::GetDeviceInfo(accelerant_device_info *info)
|
|||||||
|
|
||||||
status_t ViewDriver::GetModeList(display_mode **modes, uint32 *count)
|
status_t ViewDriver::GetModeList(display_mode **modes, uint32 *count)
|
||||||
{
|
{
|
||||||
if(!count)
|
if(!count || !is_initialized)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
@@ -2214,16 +2364,25 @@ status_t ViewDriver::GetModeList(display_mode **modes, uint32 *count)
|
|||||||
|
|
||||||
status_t ViewDriver::GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high)
|
status_t ViewDriver::GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t ViewDriver::GetTimingConstraints(display_timing_constraints *dtc)
|
status_t ViewDriver::GetTimingConstraints(display_timing_constraints *dtc)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t ViewDriver::ProposeMode(display_mode *candidate, const display_mode *low, const display_mode *high)
|
status_t ViewDriver::ProposeMode(display_mode *candidate, const display_mode *low, const display_mode *high)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
// TODO: Unhack
|
// TODO: Unhack
|
||||||
|
|
||||||
// We should be able to get away with this because we're not dealing with any
|
// We should be able to get away with this because we're not dealing with any
|
||||||
@@ -2234,6 +2393,9 @@ status_t ViewDriver::ProposeMode(display_mode *candidate, const display_mode *lo
|
|||||||
|
|
||||||
status_t ViewDriver::WaitForRetrace(bigtime_t timeout=B_INFINITE_TIMEOUT)
|
status_t ViewDriver::WaitForRetrace(bigtime_t timeout=B_INFINITE_TIMEOUT)
|
||||||
{
|
{
|
||||||
|
if(!is_initialized)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
// Locking shouldn't be necessary here - R5 should handle this for us. :)
|
// Locking shouldn't be necessary here - R5 should handle this for us. :)
|
||||||
BScreen screen;
|
BScreen screen;
|
||||||
return screen.WaitForRetrace(timeout);
|
return screen.WaitForRetrace(timeout);
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i
|
|||||||
_decorator = NULL;
|
_decorator = NULL;
|
||||||
|
|
||||||
if (feel == B_NO_BORDER_WINDOW_LOOK){
|
if (feel == B_NO_BORDER_WINDOW_LOOK){
|
||||||
_full = _win->top_layer->_full;
|
_full = _win->fTopLayer->_full;
|
||||||
fDecFull = NULL;
|
fDecFull = NULL;
|
||||||
fDecFullVisible = NULL;
|
fDecFullVisible = NULL;
|
||||||
fDecVisible = NULL;
|
fDecVisible = NULL;
|
||||||
@@ -109,8 +109,8 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i
|
|||||||
|
|
||||||
_decorator->GetFootprint( fDecFull );
|
_decorator->GetFootprint( fDecFull );
|
||||||
|
|
||||||
// our full region is the union between decorator's region and top_layer's region
|
// our full region is the union between decorator's region and fTopLayer's region
|
||||||
_full = _win->top_layer->_full;
|
_full = _win->fTopLayer->_full;
|
||||||
_full.Include( fDecFull );
|
_full.Include( fDecFull );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@ void WinBorder::MouseDown(int8 *buffer)
|
|||||||
BRect helpRect(pt.x, pt.y, pt.x+1, pt.y+1);
|
BRect helpRect(pt.x, pt.y, pt.x+1, pt.y+1);
|
||||||
msg.what = B_MOUSE_DOWN;
|
msg.what = B_MOUSE_DOWN;
|
||||||
msg.AddInt64("when", real_time_clock_usecs());
|
msg.AddInt64("when", real_time_clock_usecs());
|
||||||
msg.AddPoint("where", (_win->top_layer->LayerAt(pt)->ConvertFromTop(helpRect)).LeftTop() );
|
msg.AddPoint("where", (_win->fTopLayer->LayerAt(pt)->ConvertFromTop(helpRect)).LeftTop() );
|
||||||
msg.AddInt32("modifiers", modifiers);
|
msg.AddInt32("modifiers", modifiers);
|
||||||
msg.AddInt32("buttons", buttons);
|
msg.AddInt32("buttons", buttons);
|
||||||
msg.AddInt32("clicks", 1);
|
msg.AddInt32("clicks", 1);
|
||||||
@@ -246,7 +246,7 @@ void WinBorder::MouseMoved(int8 *buffer)
|
|||||||
BRect helpRect(pt.x, pt.y, pt.x+1, pt.y+1);
|
BRect helpRect(pt.x, pt.y, pt.x+1, pt.y+1);
|
||||||
msg.what = B_MOUSE_MOVED;
|
msg.what = B_MOUSE_MOVED;
|
||||||
msg.AddInt64("when", real_time_clock_usecs());
|
msg.AddInt64("when", real_time_clock_usecs());
|
||||||
msg.AddPoint("where", (_win->top_layer->ConvertFromTop(helpRect)).LeftTop() );
|
msg.AddPoint("where", (_win->fTopLayer->ConvertFromTop(helpRect)).LeftTop() );
|
||||||
msg.AddInt32("buttons", buttons);
|
msg.AddInt32("buttons", buttons);
|
||||||
|
|
||||||
_win->SendMessageToClient( &msg );
|
_win->SendMessageToClient( &msg );
|
||||||
@@ -311,7 +311,7 @@ STRACE_MOUSE(("WinBorder %s: MouseUp() \n",GetName()));
|
|||||||
BRect helpRect(pt.x, pt.y, pt.x+1, pt.y+1);
|
BRect helpRect(pt.x, pt.y, pt.x+1, pt.y+1);
|
||||||
msg.what = B_MOUSE_UP;
|
msg.what = B_MOUSE_UP;
|
||||||
msg.AddInt64("when", real_time_clock_usecs());
|
msg.AddInt64("when", real_time_clock_usecs());
|
||||||
msg.AddPoint("where", (_win->top_layer->LayerAt(pt)->ConvertFromTop(helpRect)).LeftTop() );
|
msg.AddPoint("where", (_win->fTopLayer->LayerAt(pt)->ConvertFromTop(helpRect)).LeftTop() );
|
||||||
msg.AddInt32("modifiers", modifiers);
|
msg.AddInt32("modifiers", modifiers);
|
||||||
|
|
||||||
_win->SendMessageToClient( &msg );
|
_win->SendMessageToClient( &msg );
|
||||||
@@ -373,25 +373,25 @@ void WinBorder::RebuildRegions( const BRect& r ){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// rebuild top_layer:
|
// rebuild top_layer:
|
||||||
if ( _win->top_layer->_full.Intersects( r ) ){
|
if ( _win->fTopLayer->_full.Intersects( r ) ){
|
||||||
// build top_layer's visible region by intersecting its _full with winborder's _visible region.
|
// build top_layer's visible region by intersecting its _full with winborder's _visible region.
|
||||||
_win->top_layer->_visible = _win->top_layer->_full;
|
_win->fTopLayer->_visible = _win->fTopLayer->_full;
|
||||||
_win->top_layer->_visible.IntersectWith( &(_visible) );
|
_win->fTopLayer->_visible.IntersectWith( &(_visible) );
|
||||||
|
|
||||||
// then exclude it from winborder's _visible...
|
// then exclude it from winborder's _visible...
|
||||||
_visible.Exclude( &(_win->top_layer->_visible) );
|
_visible.Exclude( &(_win->fTopLayer->_visible) );
|
||||||
|
|
||||||
_win->top_layer->_fullVisible = _win->top_layer->_visible;
|
_win->fTopLayer->_fullVisible = _win->fTopLayer->_visible;
|
||||||
|
|
||||||
// Rebuild regions for children...
|
// Rebuild regions for children...
|
||||||
for(Layer *lay = _win->top_layer->_bottomchild; lay != NULL; lay = lay->_uppersibling){
|
for(Layer *lay = _win->fTopLayer->_bottomchild; lay != NULL; lay = lay->_uppersibling){
|
||||||
if ( !(lay->_hidden) ){
|
if ( !(lay->_hidden) ){
|
||||||
lay->RebuildRegions( r );
|
lay->RebuildRegions( r );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
_visible.Exclude( &(_win->top_layer->_fullVisible) );
|
_visible.Exclude( &(_win->fTopLayer->_fullVisible) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// rebuild decorator.
|
// rebuild decorator.
|
||||||
@@ -431,9 +431,9 @@ printf("#WinBorder(%s)::Draw() ENDED\n", GetName());
|
|||||||
|
|
||||||
// draw the top_layer
|
// draw the top_layer
|
||||||
reg.Set( r );
|
reg.Set( r );
|
||||||
reg.IntersectWith( &(_win->top_layer->_visible) );
|
reg.IntersectWith( &(_win->fTopLayer->_visible) );
|
||||||
if (reg.CountRects() > 0){
|
if (reg.CountRects() > 0){
|
||||||
_win->top_layer->RequestClientUpdate( reg.Frame() );
|
_win->fTopLayer->RequestClientUpdate( reg.Frame() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,8 +445,8 @@ void WinBorder::MoveBy(float x, float y)
|
|||||||
_frame.OffsetBy(x, y);
|
_frame.OffsetBy(x, y);
|
||||||
_full.OffsetBy(x, y);
|
_full.OffsetBy(x, y);
|
||||||
|
|
||||||
_win->top_layer->_frame.OffsetBy(x, y);
|
_win->fTopLayer->_frame.OffsetBy(x, y);
|
||||||
_win->top_layer->MoveRegionsBy(x, y);
|
_win->fTopLayer->MoveRegionsBy(x, y);
|
||||||
|
|
||||||
if (_decorator){
|
if (_decorator){
|
||||||
// allow decorator to make its internal calculations.
|
// allow decorator to make its internal calculations.
|
||||||
@@ -526,9 +526,9 @@ void WinBorder::ResizeBy(float x, float y)
|
|||||||
_frame.right = _frame.right + x;
|
_frame.right = _frame.right + x;
|
||||||
_frame.bottom = _frame.bottom + y;
|
_frame.bottom = _frame.bottom + y;
|
||||||
|
|
||||||
_win->top_layer->ResizeRegionsBy(x, y);
|
_win->fTopLayer->ResizeRegionsBy(x, y);
|
||||||
|
|
||||||
_full = _win->top_layer->_full;
|
_full = _win->fTopLayer->_full;
|
||||||
|
|
||||||
if (_decorator){
|
if (_decorator){
|
||||||
// allow decorator to make its internal calculations.
|
// allow decorator to make its internal calculations.
|
||||||
|
|||||||
Reference in New Issue
Block a user