Made DISPLAYDRIVER a true compile time option.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12119 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-03-29 15:39:08 +00:00
parent 7ffc4e7782
commit b2b5acff33
4 changed files with 188 additions and 204 deletions

View File

@ -618,14 +618,13 @@ void AppServer::DispatchMessage(int32 code, BPortLink &msg)
} }
case B_QUIT_REQUESTED: case B_QUIT_REQUESTED:
{ {
#if DISPLAYDRIVER != HWDRIVER
// Attached Data: // Attached Data:
// none // none
// 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)
break;
Broadcast(AS_QUIT_APP); Broadcast(AS_QUIT_APP);
@ -678,6 +677,7 @@ void AppServer::DispatchMessage(int32 code, BPortLink &msg)
exit_thread(0); exit_thread(0);
// we are now clear to exit // we are now clear to exit
#endif
break; break;
} }
case AS_SET_SYSCURSOR_DEFAULTS: case AS_SET_SYSCURSOR_DEFAULTS:

View File

@ -75,62 +75,53 @@ Desktop::~Desktop(void)
} }
void Desktop::Init(void)
void
Desktop::Init(void)
{ {
DisplayDriver *driver=NULL; DisplayDriver *driver = NULL;
#if DISPLAYDRIVER == HWDRIVER
// If we're using the AccelerantDriver for rendering, eventually we will loop through
// drivers until one can't initialize in order to support multiple monitors. For now,
// we'll just load one and be done with it.
switch(DISPLAYDRIVER) bool initDrivers = true;
{ while (initDrivers) {
case HWDRIVER: driver = new AccelerantDriver();
{ AddDriver(driver);
// If we're using the AccelerantDriver for rendering, eventually we will loop through initDrivers = false;
// drivers until one can't initialize in order to support multiple monitors. For now,
// we'll just load one and be done with it.
bool initDrivers = true;
while(initDrivers)
{
driver = new AccelerantDriver();
AddDriver(driver);
initDrivers = false;
}
break;
}
case DIRECTDRIVER:
{
// It would be nice to have this for the default testing driver. Someday....
driver = new DirectDriver();
AddDriver(driver);
break;
}
case PAINTERDRIVER:
{
// It would be nice to have this for the default testing driver. Someday....
driver = new DisplayDriverPainter();
AddDriver(driver);
break;
}
default:
{
// It would be nice to not ever need this again....
driver = new ViewDriver();
AddDriver(driver);
break;
}
} }
if(fScreenList.CountItems()<1) #elif DISPLAYDRIVER == DIRECTDRIVER
{ // It would be nice to have this for the default testing driver. Someday....
driver = new DirectDriver();
AddDriver(driver);
#elif DISPLAYDRIVER == PAINTERDRIVER
// It would be nice to have this for the default testing driver. Someday....
driver = new DisplayDriverPainter();
AddDriver(driver);
#else
// It would be nice to not ever need this again....
driver = new ViewDriver();
AddDriver(driver);
#endif
if (fScreenList.CountItems() < 1) {
delete this; delete this;
return; return;
} }
InitMode(); InitMode();
SetActiveRootLayerByIndex(0); SetActiveRootLayerByIndex(0);
} }
void Desktop::AddDriver(DisplayDriver *driver)
void
Desktop::AddDriver(DisplayDriver *driver)
{ {
if (driver->Initialize()) { if (driver->Initialize()) {
// TODO: be careful of screen initialization - monitor may not support 640x480 // TODO: be careful of screen initialization - monitor may not support 640x480

View File

@ -1271,151 +1271,148 @@ void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg)
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
if(scancode>0x01 && scancode<0x0e)
{ {
// Check for workspace change or safe video mode if(scancode==0x0d)
if(scancode>0x01 && scancode<0x0e)
{ {
if(scancode==0x0d) if(modifiers & (B_LEFT_COMMAND_KEY |
B_LEFT_CONTROL_KEY | B_LEFT_SHIFT_KEY))
{ {
if(modifiers & (B_LEFT_COMMAND_KEY | // TODO: Set to Safe Mode in KeyboardEventHandler:B_KEY_DOWN. (DisplayDriver API change)
B_LEFT_CONTROL_KEY | B_LEFT_SHIFT_KEY)) STRACE(("Safe Video Mode invoked - code unimplemented\n"));
{ if (string)
// TODO: Set to Safe Mode in KeyboardEventHandler:B_KEY_DOWN. (DisplayDriver API change) free(string);
STRACE(("Safe Video Mode invoked - code unimplemented\n")); break;
if (string)
free(string);
break;
}
} }
}
if(modifiers & B_CONTROL_KEY)
{
STRACE(("Set Workspace %ld\n",scancode-1));
if(modifiers & B_CONTROL_KEY) //TODO: SetWorkspace in KeyboardEventHandler
{ //SetWorkspace(scancode-2);
STRACE(("Set Workspace %ld\n",scancode-1)); if (string)
free(string);
//TODO: SetWorkspace in KeyboardEventHandler break;
//SetWorkspace(scancode-2); }
if (string)
free(string);
break;
}
}
// Tab key
if(scancode==0x26 && (modifiers & B_CONTROL_KEY))
{
//ServerApp *deskbar=app_server->FindApp("application/x-vnd.Be-TSKB");
//if(deskbar)
//{
printf("Send Twitcher message key to Deskbar - unimplmemented\n");
if (string)
free(string);
break;
//}
}
// PrintScreen
if(scancode==0xe)
{
if(GetDisplayDriver())
{
char filename[128];
BEntry entry;
sprintf(filename,"/boot/home/screen%ld.png",fScreenShotIndex);
entry.SetTo(filename);
while(entry.Exists())
{
fScreenShotIndex++;
sprintf(filename,"/boot/home/screen%ld.png",fScreenShotIndex);
}
fScreenShotIndex++;
GetDisplayDriver()->DumpToFile(filename);
if (string)
free(string);
break;
}
}
} }
else
// Tab key
if(scancode==0x26 && (modifiers & B_CONTROL_KEY))
{ {
// F12 //ServerApp *deskbar=app_server->FindApp("application/x-vnd.Be-TSKB");
if(scancode>0x1 && scancode<0xe) //if(deskbar)
//{
printf("Send Twitcher message key to Deskbar - unimplmemented\n");
if (string)
free(string);
break;
//}
}
// PrintScreen
if(scancode==0xe)
{
if(GetDisplayDriver())
{ {
if(scancode==0xd) char filename[128];
BEntry entry;
sprintf(filename,"/boot/home/screen%ld.png",fScreenShotIndex);
entry.SetTo(filename);
while(entry.Exists())
{ {
if(modifiers & (B_LEFT_CONTROL_KEY | B_LEFT_SHIFT_KEY | B_LEFT_OPTION_KEY))
{
// TODO: Set to Safe Mode in KeyboardEventHandler:B_KEY_DOWN. (DisplayDriver API change)
STRACE(("Safe Video Mode invoked - code unimplemented\n"));
if (string)
free(string);
break;
}
}
if(modifiers & (B_LEFT_SHIFT_KEY | B_LEFT_CONTROL_KEY))
{
STRACE(("Set Workspace %ld\n",scancode-1));
//TODO: SetWorkspace in KeyboardEventHandler
if (scancode - 1 > 0 && scancode -1 <= fWsCount
&& scancode - 2 != fActiveWksIndex)
{
WinBorder *exFocus = FocusWinBorder();
SetActiveWorkspace(scancode-2);
get_workspace_windows();
invalidate_layer(this, fFull);
draw_window_tab(exFocus, FocusWinBorder());
}
if (string)
free(string);
break;
}
}
//Tab
if(scancode==0x26 && (modifiers & B_SHIFT_KEY))
{
STRACE(("Twitcher\n"));
//ServerApp *deskbar=app_server->FindApp("application/x-vnd.Be-TSKB");
//if(deskbar)
//{
printf("Send Twitcher message key to Deskbar - unimplmemented\n");
if (string)
free(string);
break;
//}
}
// Pause/Break
if(scancode==0x7f)
{
if(GetDisplayDriver())
{
char filename[128];
BEntry entry;
sprintf(filename,"/boot/home/screen%ld.png",fScreenShotIndex);
entry.SetTo(filename);
while(entry.Exists())
{
fScreenShotIndex++;
sprintf(filename,"/boot/home/screen%ld.png",fScreenShotIndex);
}
fScreenShotIndex++; fScreenShotIndex++;
sprintf(filename,"/boot/home/screen%ld.png",fScreenShotIndex);
GetDisplayDriver()->DumpToFile(filename);
if (string)
free(string);
break;
} }
fScreenShotIndex++;
GetDisplayDriver()->DumpToFile(filename);
if (string)
free(string);
break;
} }
} }
#else // DISPLAYDRIVER != HWDRIVER
// F12
if(scancode>0x1 && scancode<0xe)
{
if(scancode==0xd)
{
if(modifiers & (B_LEFT_CONTROL_KEY | B_LEFT_SHIFT_KEY | B_LEFT_OPTION_KEY))
{
// TODO: Set to Safe Mode in KeyboardEventHandler:B_KEY_DOWN. (DisplayDriver API change)
STRACE(("Safe Video Mode invoked - code unimplemented\n"));
if (string)
free(string);
break;
}
}
if(modifiers & (B_LEFT_SHIFT_KEY | B_LEFT_CONTROL_KEY))
{
STRACE(("Set Workspace %ld\n",scancode-1));
//TODO: SetWorkspace in KeyboardEventHandler
if (scancode - 1 > 0 && scancode -1 <= fWsCount
&& scancode - 2 != fActiveWksIndex)
{
WinBorder *exFocus = FocusWinBorder();
SetActiveWorkspace(scancode-2);
get_workspace_windows();
invalidate_layer(this, fFull);
draw_window_tab(exFocus, FocusWinBorder());
}
if (string)
free(string);
break;
}
}
//Tab
if(scancode==0x26 && (modifiers & B_SHIFT_KEY))
{
STRACE(("Twitcher\n"));
//ServerApp *deskbar=app_server->FindApp("application/x-vnd.Be-TSKB");
//if(deskbar)
//{
printf("Send Twitcher message key to Deskbar - unimplmemented\n");
if (string)
free(string);
break;
//}
}
// Pause/Break
if(scancode==0x7f)
{
if(GetDisplayDriver())
{
char filename[128];
BEntry entry;
sprintf(filename,"/boot/home/screen%ld.png",fScreenShotIndex);
entry.SetTo(filename);
while(entry.Exists())
{
fScreenShotIndex++;
sprintf(filename,"/boot/home/screen%ld.png",fScreenShotIndex);
}
fScreenShotIndex++;
GetDisplayDriver()->DumpToFile(filename);
if (string)
free(string);
break;
}
}
#endif // DISPLAYDRIVER != HWDRIVER
// We got this far, so apparently it's safe to pass to the active // We got this far, so apparently it's safe to pass to the active
// window. // window.
@ -1479,31 +1476,28 @@ void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg)
STRACE(("Key Up: 0x%lx\n",scancode)); STRACE(("Key Up: 0x%lx\n",scancode));
if(DISPLAYDRIVER==HWDRIVER) #if DISPLAYDRIVER == HWDRIVER
// Tab key
if(scancode==0x26 && (modifiers & B_CONTROL_KEY))
{ {
// Tab key //ServerApp *deskbar=app_server->FindApp("application/x-vnd.Be-TSKB");
if(scancode==0x26 && (modifiers & B_CONTROL_KEY)) //if(deskbar)
{ //{
//ServerApp *deskbar=app_server->FindApp("application/x-vnd.Be-TSKB"); printf("Send Twitcher message key to Deskbar - unimplmemented\n");
//if(deskbar) break;
//{ //}
printf("Send Twitcher message key to Deskbar - unimplmemented\n");
break;
//}
}
} }
else #else // DISPLAYDRIVER != HWDRIVER
if(scancode==0x26 && (modifiers & B_LEFT_SHIFT_KEY))
{ {
if(scancode==0x26 && (modifiers & B_LEFT_SHIFT_KEY)) //ServerApp *deskbar=app_server->FindApp("application/x-vnd.Be-TSKB");
{ //if(deskbar)
//ServerApp *deskbar=app_server->FindApp("application/x-vnd.Be-TSKB"); //{
//if(deskbar) printf("Send Twitcher message key to Deskbar - unimplmemented\n");
//{ break;
printf("Send Twitcher message key to Deskbar - unimplmemented\n"); //}
break;
//}
}
} }
#endif
// We got this far, so apparently it's safe to pass to the active // We got this far, so apparently it's safe to pass to the active
// window. // window.

View File

@ -380,11 +380,10 @@ int32 ServerApp::MonitorApp(void *data)
// 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
{ BMessage pleaseQuit(B_QUIT_REQUESTED);
BMessage pleaseQuit(B_QUIT_REQUESTED); app->SendMessageToClient(&pleaseQuit);
app->SendMessageToClient(&pleaseQuit); #endif
}
break; break;
} }