virtualkeyboard: fix input_server event loop crash
This commit is contained in:
parent
a9fd76aefc
commit
2071724c6f
@ -1077,29 +1077,30 @@ KeyboardLayoutView::_EvaluateDropTarget(BPoint point)
|
||||
void
|
||||
KeyboardLayoutView::_SendKeyDown(const Key* key)
|
||||
{
|
||||
BMessage message(B_KEY_DOWN);
|
||||
message.AddInt64("when", system_time());
|
||||
message.AddData("states", B_UINT8_TYPE, &fKeyState,
|
||||
BMessage* message = new BMessage(B_KEY_DOWN);
|
||||
message->AddInt64("when", system_time());
|
||||
message->AddData("states", B_UINT8_TYPE, &fKeyState,
|
||||
sizeof(fKeyState));
|
||||
message.AddInt32("key", key->code);
|
||||
message.AddInt32("modifiers", fModifiers);
|
||||
message.AddPointer("keymap", fKeymap);
|
||||
message->AddInt32("key", key->code);
|
||||
message->AddInt32("modifiers", fModifiers);
|
||||
//message.AddPointer("keymap", fKeymap);
|
||||
|
||||
char* string;
|
||||
int32 numBytes;
|
||||
fKeymap->GetChars(key->code, fModifiers, fDeadKey, &string,
|
||||
&numBytes);
|
||||
if (string != NULL) {
|
||||
message.AddString("bytes", string);
|
||||
message->AddString("bytes", string);
|
||||
delete[] string;
|
||||
}
|
||||
|
||||
fKeymap->GetChars(key->code, 0, 0, &string, &numBytes);
|
||||
if (string != NULL) {
|
||||
message.AddInt32("raw_char", string[0]);
|
||||
message.AddInt8("byte", string[0]);
|
||||
message->AddInt32("raw_char", string[0]);
|
||||
message->AddInt8("byte", string[0]);
|
||||
delete[] string;
|
||||
}
|
||||
fDevice->EnqueueMessage(&message);
|
||||
|
||||
|
||||
if (fDevice->EnqueueMessage(message) == B_OK)
|
||||
delete message;
|
||||
}
|
||||
|
@ -14,8 +14,6 @@ instantiate_input_device()
|
||||
|
||||
|
||||
VirtualKeyboardInputDevice::VirtualKeyboardInputDevice()
|
||||
:
|
||||
BInputServerDevice()
|
||||
{
|
||||
fKeyboardWindow = new VirtualKeyboardWindow(this);
|
||||
}
|
||||
@ -55,3 +53,11 @@ VirtualKeyboardInputDevice::Stop(const char* name, void* cookie)
|
||||
}
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
VirtualKeyboardInputDevice::Control(const char* name, void* cookie,
|
||||
uint32 command, BMessage* message)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
@ -5,7 +5,9 @@
|
||||
#ifndef VKID_H
|
||||
#define VKID_H
|
||||
|
||||
|
||||
#include <InputServerDevice.h>
|
||||
#include <Message.h>
|
||||
|
||||
#include "VirtualKeyboardWindow.h"
|
||||
|
||||
@ -17,7 +19,8 @@ public:
|
||||
virtual status_t InitCheck();
|
||||
virtual status_t Start(const char* name, void* cookie);
|
||||
virtual status_t Stop(const char* name, void* cookie);
|
||||
|
||||
virtual status_t Control(const char* name, void* cookie,
|
||||
uint32 command, BMessage* message);
|
||||
private:
|
||||
VirtualKeyboardWindow* fKeyboardWindow;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user