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:
{
#if DISPLAYDRIVER != HWDRIVER
// Attached Data:
// none
// We've been asked to quit, so (for now) broadcast to all
// test apps to quit. This situation will occur only when the server
// is compiled as a regular Be application.
if(DISPLAYDRIVER== HWDRIVER)
break;
Broadcast(AS_QUIT_APP);
@ -678,6 +677,7 @@ void AppServer::DispatchMessage(int32 code, BPortLink &msg)
exit_thread(0);
// we are now clear to exit
#endif
break;
}
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)
{
case 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.
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;
}
bool initDrivers = true;
while (initDrivers) {
driver = new AccelerantDriver();
AddDriver(driver);
initDrivers = false;
}
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;
return;
}
InitMode();
SetActiveRootLayerByIndex(0);
}
void Desktop::AddDriver(DisplayDriver *driver)
void
Desktop::AddDriver(DisplayDriver *driver)
{
if (driver->Initialize()) {
// 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));
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>0x01 && scancode<0x0e)
if(scancode==0x0d)
{
if(scancode==0x0d)
if(modifiers & (B_LEFT_COMMAND_KEY |
B_LEFT_CONTROL_KEY | B_LEFT_SHIFT_KEY))
{
if(modifiers & (B_LEFT_COMMAND_KEY |
B_LEFT_CONTROL_KEY | B_LEFT_SHIFT_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;
}
// 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_CONTROL_KEY)
{
STRACE(("Set Workspace %ld\n",scancode-1));
if(modifiers & B_CONTROL_KEY)
{
STRACE(("Set Workspace %ld\n",scancode-1));
//TODO: SetWorkspace in KeyboardEventHandler
//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;
}
}
//TODO: SetWorkspace in KeyboardEventHandler
//SetWorkspace(scancode-2);
if (string)
free(string);
break;
}
}
else
// Tab key
if(scancode==0x26 && (modifiers & B_CONTROL_KEY))
{
// F12
if(scancode>0x1 && scancode<0xe)
//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())
{
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++;
GetDisplayDriver()->DumpToFile(filename);
if (string)
free(string);
break;
sprintf(filename,"/boot/home/screen%ld.png",fScreenShotIndex);
}
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
// window.
@ -1479,31 +1476,28 @@ void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg)
STRACE(("Key Up: 0x%lx\n",scancode));
if(DISPLAYDRIVER==HWDRIVER)
#if DISPLAYDRIVER == HWDRIVER
// Tab key
if(scancode==0x26 && (modifiers & B_CONTROL_KEY))
{
// 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");
break;
//}
}
//ServerApp *deskbar=app_server->FindApp("application/x-vnd.Be-TSKB");
//if(deskbar)
//{
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)
//{
printf("Send Twitcher message key to Deskbar - unimplmemented\n");
break;
//}
}
//ServerApp *deskbar=app_server->FindApp("application/x-vnd.Be-TSKB");
//if(deskbar)
//{
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
// window.

View File

@ -380,11 +380,10 @@ int32 ServerApp::MonitorApp(void *data)
// If we are using the real, accelerated version of the
// DisplayDriver, we do NOT want the user to be able shut down
// the server. The results would NOT be pretty
if(DISPLAYDRIVER!=HWDRIVER)
{
BMessage pleaseQuit(B_QUIT_REQUESTED);
app->SendMessageToClient(&pleaseQuit);
}
#if DISPLAYDRIVER != HWDRIVER
BMessage pleaseQuit(B_QUIT_REQUESTED);
app->SendMessageToClient(&pleaseQuit);
#endif
break;
}