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