When sending native keydown/keyup events the delivery of the string was broken.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12009 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2005-03-25 21:51:02 +00:00
parent 96b832ac57
commit b1530ab8e8
2 changed files with 27 additions and 19 deletions

View File

@ -1246,6 +1246,7 @@ void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg)
int8 keystates[16];
int32 raw_char;
int32 repeatcount;
int8 strlength;
*((int32*)utf)=0;
@ -1255,9 +1256,12 @@ void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg)
msg.Read<int32>(&repeatcount);
msg.Read<int32>(&modifiers);
msg.Read(utf, sizeof(utf));
msg.Read<int8>(&strlength);
msg.ReadString(&string);
msg.Read(keystates,sizeof(int8)*16);
STRACE(("Key Down: 0x%lx\n",scancode));
if(DISPLAYDRIVER==HWDRIVER)
{
// Check for workspace change or safe video mode
@ -1275,19 +1279,19 @@ void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg)
break;
}
}
}
if(modifiers & B_CONTROL_KEY)
{
STRACE(("Set Workspace %ld\n",scancode-1));
//TODO: SetWorkspace in KeyboardEventHandler
//SetWorkspace(scancode-2);
if (string)
free(string);
break;
}
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))
{
@ -1405,7 +1409,7 @@ void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg)
{
BMessage keymsg(B_KEY_DOWN);
keymsg.AddInt64("when",time);
// keymsg.AddInt32("modifiers",modifiers);
keymsg.AddInt32("modifiers",modifiers);
keymsg.AddInt32("key",scancode);
if(repeatcount>1)
keymsg.AddInt32("be:key_repeat",repeatcount);
@ -1416,7 +1420,7 @@ void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg)
keymsg.AddInt8("byte",utf[i]);
}
keymsg.AddString("bytes",string);
// keymsg.AddInt32("raw_char",raw_char);
keymsg.AddInt32("raw_char",raw_char);
win->SendMessageToClient(&keymsg, B_NULL_TOKEN, true);
}
@ -1445,6 +1449,7 @@ void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg)
char *string = NULL;
int8 keystates[16];
int32 raw_char;
int8 strlength;
*((int32*)utf)=0;
@ -1453,6 +1458,7 @@ void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg)
msg.Read<int32>(&raw_char);
msg.Read<int32>(&modifiers);
msg.Read(utf, sizeof(utf));
msg.Read<int8>(&strlength);
msg.ReadString(&string);
msg.Read(keystates,sizeof(int8)*16);

View File

@ -1285,8 +1285,9 @@ InputServer::DispatchEvent(BMessage *message)
appsvrlink->Attach(repeatcount);
appsvrlink->Attach(modifiers);
appsvrlink->Attach(utf8data,sizeof(int8)*3);
appsvrlink->Attach(string.Length()+1);
appsvrlink->Attach(string.String());
int8 strlength = string.Length()+1;
appsvrlink->Attach(strlength);
appsvrlink->AttachString(string.String());
appsvrlink->Attach(keyarray,sizeof(int8)*16);
appsvrlink->Flush();
break;
@ -1314,8 +1315,9 @@ InputServer::DispatchEvent(BMessage *message)
appsvrlink->Attach(asciicode);
appsvrlink->Attach(modifiers);
appsvrlink->Attach(utf8data,sizeof(int8)*3);
appsvrlink->Attach(string.Length()+1);
appsvrlink->Attach(string.String());
int8 strlength = string.Length() + 1;
appsvrlink->Attach(strlength);
appsvrlink->AttachString(string.String());
appsvrlink->Attach(keyarray,sizeof(int8)*16);
appsvrlink->Flush();
break;