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
|
void
|
||||||
RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
|
RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
|
||||||
{
|
{
|
||||||
|
switch (code) {
|
||||||
switch(code)
|
|
||||||
{
|
|
||||||
case B_KEY_DOWN:
|
case B_KEY_DOWN:
|
||||||
{
|
{
|
||||||
// Attached Data:
|
// Attached Data:
|
||||||
@@ -1504,97 +1502,32 @@ RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
|
|||||||
msg.Read<int32>(&modifiers);
|
msg.Read<int32>(&modifiers);
|
||||||
msg.Read(utf, sizeof(utf));
|
msg.Read(utf, sizeof(utf));
|
||||||
msg.ReadString(&string);
|
msg.ReadString(&string);
|
||||||
msg.Read(keystates,sizeof(int8)*16);
|
msg.Read(keystates, sizeof(keystates));
|
||||||
|
|
||||||
STRACE(("Key Down: 0x%lx\n",scancode));
|
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
|
// Check for workspace change or safe video mode
|
||||||
if(scancode>0x01 && scancode<0x0e)
|
#if !TEST_MODE
|
||||||
{
|
if (scancode == 0x0d && (modifiers & (B_LEFT_COMMAND_KEY
|
||||||
if(scancode==0x0d)
|
| B_LEFT_CONTROL_KEY | B_LEFT_SHIFT_KEY)) != 0)
|
||||||
{
|
#else
|
||||||
if(modifiers & (B_LEFT_COMMAND_KEY |
|
if (scancode == 0x0d && (modifiers & (B_LEFT_CONTROL_KEY
|
||||||
B_LEFT_CONTROL_KEY | B_LEFT_SHIFT_KEY))
|
| B_LEFT_SHIFT_KEY | B_LEFT_OPTION_KEY)) != 0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// TODO: Set to Safe Mode in KeyboardEventHandler:B_KEY_DOWN. (DisplayDriver API change)
|
// TODO: Set to Safe Mode in KeyboardEventHandler:B_KEY_DOWN. (DisplayDriver API change)
|
||||||
STRACE(("Safe Video Mode invoked - code unimplemented\n"));
|
STRACE(("Safe Video Mode invoked - code unimplemented\n"));
|
||||||
if (string)
|
|
||||||
free(string);
|
free(string);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
#if !TEST_MODE
|
||||||
if (modifiers & B_CONTROL_KEY)
|
if (modifiers & B_CONTROL_KEY)
|
||||||
{
|
#else
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (modifiers & (B_LEFT_SHIFT_KEY | B_LEFT_CONTROL_KEY))
|
if (modifiers & (B_LEFT_SHIFT_KEY | B_LEFT_CONTROL_KEY))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
STRACE(("Set Workspace %ld\n",scancode-1));
|
STRACE(("Set Workspace %ld\n",scancode-1));
|
||||||
WinBorder* exFocus = FocusWinBorder();
|
WinBorder* exFocus = FocusWinBorder();
|
||||||
@@ -1602,11 +1535,8 @@ RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
|
|||||||
|
|
||||||
if (SetActiveWorkspace(scancode - 2))
|
if (SetActiveWorkspace(scancode - 2))
|
||||||
show_final_scene(exFocus, exActive);
|
show_final_scene(exFocus, exActive);
|
||||||
if (string)
|
|
||||||
free(string);
|
|
||||||
|
|
||||||
#ifdef APPSERVER_ROOTLAYER_SHOW_WORKSPACE_NUMBER
|
#ifdef APPSERVER_ROOTLAYER_SHOW_WORKSPACE_NUMBER
|
||||||
{
|
|
||||||
// to draw the current Workspace index on screen.
|
// to draw the current Workspace index on screen.
|
||||||
#ifndef NEW_CLIPPING
|
#ifndef NEW_CLIPPING
|
||||||
BRegion reg(fVisible);
|
BRegion reg(fVisible);
|
||||||
@@ -1614,15 +1544,18 @@ RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
|
|||||||
Draw(reg.Frame());
|
Draw(reg.Frame());
|
||||||
fDriver->ConstrainClippingRegion(NULL);
|
fDriver->ConstrainClippingRegion(NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
free(string);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Tab
|
// Tab key
|
||||||
|
#if !TEST_MODE
|
||||||
|
if (scancode == 0x26 && (modifiers & B_CONTROL_KEY))
|
||||||
|
#else
|
||||||
if (scancode == 0x26 && (modifiers & B_SHIFT_KEY))
|
if (scancode == 0x26 && (modifiers & B_SHIFT_KEY))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
STRACE(("Twitcher\n"));
|
STRACE(("Twitcher\n"));
|
||||||
//ServerApp *deskbar = app_server->FindApp("application/x-vnd.Be-TSKB");
|
//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);
|
show_final_scene(exFocus, exActive);
|
||||||
|
|
||||||
printf("Send Twitcher message key to Deskbar - unimplmemented\n");
|
printf("Send Twitcher message key to Deskbar - unimplmemented\n");
|
||||||
if (string)
|
|
||||||
free(string);
|
free(string);
|
||||||
break;
|
break;
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !TEST_MODE
|
||||||
|
// PrintScreen
|
||||||
|
if (scancode == 0xe)
|
||||||
|
#else
|
||||||
// Pause/Break
|
// Pause/Break
|
||||||
if (scancode == 0x7f)
|
if (scancode == 0x7f)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if(GetDisplayDriver())
|
if (GetDisplayDriver()) {
|
||||||
{
|
|
||||||
char filename[128];
|
char filename[128];
|
||||||
BEntry entry;
|
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);
|
entry.SetTo(filename);
|
||||||
|
} while(entry.Exists());
|
||||||
while(entry.Exists())
|
|
||||||
{
|
|
||||||
fScreenShotIndex++;
|
|
||||||
sprintf(filename,"/boot/home/screen%ld.png",fScreenShotIndex);
|
|
||||||
entry.SetTo(filename);
|
|
||||||
}
|
|
||||||
fScreenShotIndex++;
|
|
||||||
|
|
||||||
GetDisplayDriver()->DumpToFile(filename);
|
GetDisplayDriver()->DumpToFile(filename);
|
||||||
if (string)
|
|
||||||
free(string);
|
free(string);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // !TEST_MODE
|
|
||||||
|
|
||||||
// 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.
|
||||||
|
|
||||||
if(FocusWinBorder())
|
if (FocusWinBorder()) {
|
||||||
{
|
|
||||||
ServerWindow *win = FocusWinBorder()->Window();
|
ServerWindow *win = FocusWinBorder()->Window();
|
||||||
if(win)
|
if (win) {
|
||||||
{
|
|
||||||
BMessage keymsg(B_KEY_DOWN);
|
BMessage keymsg(B_KEY_DOWN);
|
||||||
keymsg.AddInt64("when", time);
|
keymsg.AddInt64("when", time);
|
||||||
keymsg.AddInt32("key", scancode);
|
keymsg.AddInt32("key", scancode);
|
||||||
@@ -1695,10 +1623,10 @@ RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string)
|
|
||||||
free(string);
|
free(string);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case B_KEY_UP:
|
case B_KEY_UP:
|
||||||
{
|
{
|
||||||
// Attached Data:
|
// Attached Data:
|
||||||
@@ -1723,7 +1651,7 @@ RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
|
|||||||
msg.Read<int32>(&modifiers);
|
msg.Read<int32>(&modifiers);
|
||||||
msg.Read(utf, sizeof(utf));
|
msg.Read(utf, sizeof(utf));
|
||||||
msg.ReadString(&string);
|
msg.ReadString(&string);
|
||||||
msg.Read(keystates,sizeof(int8)*16);
|
msg.Read(keystates, sizeof(keystates));
|
||||||
|
|
||||||
STRACE(("Key Up: 0x%lx\n", scancode));
|
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
|
// We got this far, so apparently it's safe to pass to the active
|
||||||
// window.
|
// window.
|
||||||
|
|
||||||
if(FocusWinBorder())
|
if (FocusWinBorder()) {
|
||||||
{
|
|
||||||
ServerWindow *win = FocusWinBorder()->Window();
|
ServerWindow *win = FocusWinBorder()->Window();
|
||||||
if(win)
|
if (win) {
|
||||||
{
|
|
||||||
BMessage keymsg(B_KEY_UP);
|
BMessage keymsg(B_KEY_UP);
|
||||||
keymsg.AddInt64("when", time);
|
keymsg.AddInt64("when", time);
|
||||||
keymsg.AddInt32("key", scancode);
|
keymsg.AddInt32("key", scancode);
|
||||||
@@ -1775,10 +1701,10 @@ RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string)
|
|
||||||
free(string);
|
free(string);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case B_UNMAPPED_KEY_DOWN:
|
case B_UNMAPPED_KEY_DOWN:
|
||||||
{
|
{
|
||||||
// Attached Data:
|
// Attached Data:
|
||||||
|
|||||||
Reference in New Issue
Block a user