The TEST_MODE and non-TEST_MODE code is now the same, only the modifiers/keys
are different. Therefore, workspace changes should work on real hardware as well now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13387 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+38
-112
@@ -1474,9 +1474,7 @@ fprintf(stderr, "mouse position changed in B_MOUSE_UP (%.1f, %.1f) from last B_M
|
||||
void
|
||||
RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
|
||||
{
|
||||
|
||||
switch(code)
|
||||
{
|
||||
switch (code) {
|
||||
case B_KEY_DOWN:
|
||||
{
|
||||
// Attached Data:
|
||||
@@ -1504,97 +1502,32 @@ RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
|
||||
msg.Read<int32>(&modifiers);
|
||||
msg.Read(utf, sizeof(utf));
|
||||
msg.ReadString(&string);
|
||||
msg.Read(keystates,sizeof(int8)*16);
|
||||
msg.Read(keystates, sizeof(keystates));
|
||||
|
||||
STRACE(("Key Down: 0x%lx\n",scancode));
|
||||
|
||||
#if !TEST_MODE
|
||||
// F1-F12
|
||||
if (scancode > 0x01 && scancode < 0x0e) {
|
||||
// Check for workspace change or safe video mode
|
||||
if(scancode>0x01 && scancode<0x0e)
|
||||
{
|
||||
if(scancode==0x0d)
|
||||
{
|
||||
if(modifiers & (B_LEFT_COMMAND_KEY |
|
||||
B_LEFT_CONTROL_KEY | B_LEFT_SHIFT_KEY))
|
||||
#if !TEST_MODE
|
||||
if (scancode == 0x0d && (modifiers & (B_LEFT_COMMAND_KEY
|
||||
| B_LEFT_CONTROL_KEY | B_LEFT_SHIFT_KEY)) != 0)
|
||||
#else
|
||||
if (scancode == 0x0d && (modifiers & (B_LEFT_CONTROL_KEY
|
||||
| B_LEFT_SHIFT_KEY | B_LEFT_OPTION_KEY)) != 0)
|
||||
#endif
|
||||
{
|
||||
// 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 !TEST_MODE
|
||||
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)
|
||||
//{
|
||||
WinBorder *exActive = ActiveWinBorder();
|
||||
WinBorder *exFocus = FocusWinBorder();
|
||||
if (ActiveWorkspace()->MoveToBack(exActive))
|
||||
show_final_scene(exFocus, exActive);
|
||||
|
||||
//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);
|
||||
entry.SetTo(filename);
|
||||
}
|
||||
fScreenShotIndex++;
|
||||
GetDisplayDriver()->DumpToFile(filename);
|
||||
if (string)
|
||||
free(string);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else // TEST_MODE
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (modifiers & (B_LEFT_SHIFT_KEY | B_LEFT_CONTROL_KEY))
|
||||
#endif
|
||||
{
|
||||
STRACE(("Set Workspace %ld\n",scancode-1));
|
||||
WinBorder* exFocus = FocusWinBorder();
|
||||
@@ -1602,11 +1535,8 @@ RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
|
||||
|
||||
if (SetActiveWorkspace(scancode - 2))
|
||||
show_final_scene(exFocus, exActive);
|
||||
if (string)
|
||||
free(string);
|
||||
|
||||
#ifdef APPSERVER_ROOTLAYER_SHOW_WORKSPACE_NUMBER
|
||||
{
|
||||
// to draw the current Workspace index on screen.
|
||||
#ifndef NEW_CLIPPING
|
||||
BRegion reg(fVisible);
|
||||
@@ -1614,15 +1544,18 @@ RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
|
||||
Draw(reg.Frame());
|
||||
fDriver->ConstrainClippingRegion(NULL);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
free(string);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Tab
|
||||
// Tab key
|
||||
#if !TEST_MODE
|
||||
if (scancode == 0x26 && (modifiers & B_CONTROL_KEY))
|
||||
#else
|
||||
if (scancode == 0x26 && (modifiers & B_SHIFT_KEY))
|
||||
#endif
|
||||
{
|
||||
STRACE(("Twitcher\n"));
|
||||
//ServerApp *deskbar = app_server->FindApp("application/x-vnd.Be-TSKB");
|
||||
@@ -1634,47 +1567,42 @@ RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
|
||||
show_final_scene(exFocus, exActive);
|
||||
|
||||
printf("Send Twitcher message key to Deskbar - unimplmemented\n");
|
||||
if (string)
|
||||
free(string);
|
||||
break;
|
||||
//}
|
||||
}
|
||||
|
||||
#if !TEST_MODE
|
||||
// PrintScreen
|
||||
if (scancode == 0xe)
|
||||
#else
|
||||
// Pause/Break
|
||||
if (scancode == 0x7f)
|
||||
#endif
|
||||
{
|
||||
if(GetDisplayDriver())
|
||||
{
|
||||
if (GetDisplayDriver()) {
|
||||
char filename[128];
|
||||
BEntry entry;
|
||||
|
||||
sprintf(filename,"/boot/home/screen%ld.png",fScreenShotIndex);
|
||||
int32 index = 1;
|
||||
do {
|
||||
sprintf(filename, "/boot/home/screen%ld.png", index);
|
||||
entry.SetTo(filename);
|
||||
|
||||
while(entry.Exists())
|
||||
{
|
||||
fScreenShotIndex++;
|
||||
sprintf(filename,"/boot/home/screen%ld.png",fScreenShotIndex);
|
||||
entry.SetTo(filename);
|
||||
}
|
||||
fScreenShotIndex++;
|
||||
} while(entry.Exists());
|
||||
|
||||
GetDisplayDriver()->DumpToFile(filename);
|
||||
if (string)
|
||||
|
||||
free(string);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif // !TEST_MODE
|
||||
|
||||
// We got this far, so apparently it's safe to pass to the active
|
||||
// window.
|
||||
|
||||
if(FocusWinBorder())
|
||||
{
|
||||
if (FocusWinBorder()) {
|
||||
ServerWindow *win = FocusWinBorder()->Window();
|
||||
if(win)
|
||||
{
|
||||
if (win) {
|
||||
BMessage keymsg(B_KEY_DOWN);
|
||||
keymsg.AddInt64("when", time);
|
||||
keymsg.AddInt32("key", scancode);
|
||||
@@ -1695,10 +1623,10 @@ RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
|
||||
}
|
||||
}
|
||||
|
||||
if (string)
|
||||
free(string);
|
||||
break;
|
||||
}
|
||||
|
||||
case B_KEY_UP:
|
||||
{
|
||||
// Attached Data:
|
||||
@@ -1723,7 +1651,7 @@ RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
|
||||
msg.Read<int32>(&modifiers);
|
||||
msg.Read(utf, sizeof(utf));
|
||||
msg.ReadString(&string);
|
||||
msg.Read(keystates,sizeof(int8)*16);
|
||||
msg.Read(keystates, sizeof(keystates));
|
||||
|
||||
STRACE(("Key Up: 0x%lx\n", scancode));
|
||||
|
||||
@@ -1753,11 +1681,9 @@ RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
|
||||
// We got this far, so apparently it's safe to pass to the active
|
||||
// window.
|
||||
|
||||
if(FocusWinBorder())
|
||||
{
|
||||
if (FocusWinBorder()) {
|
||||
ServerWindow *win = FocusWinBorder()->Window();
|
||||
if(win)
|
||||
{
|
||||
if (win) {
|
||||
BMessage keymsg(B_KEY_UP);
|
||||
keymsg.AddInt64("when", time);
|
||||
keymsg.AddInt32("key", scancode);
|
||||
@@ -1775,10 +1701,10 @@ RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
|
||||
}
|
||||
}
|
||||
|
||||
if (string)
|
||||
free(string);
|
||||
break;
|
||||
}
|
||||
|
||||
case B_UNMAPPED_KEY_DOWN:
|
||||
{
|
||||
// Attached Data:
|
||||
|
||||
Reference in New Issue
Block a user