virtualkeyboard: Add input_server device add-on code

This commit is contained in:
Freeman Lou 2014-01-02 14:46:40 +00:00 committed by François Revol
parent 857688724e
commit c099b74eac
2 changed files with 73 additions and 0 deletions

View File

@ -0,0 +1,43 @@
/*
* Copyright 2014 Freeman Lou <freemanlou2430@yahoo.com>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#include "VirtualKeyboardInputDevice.h"
extern "C" BInputServerDevice*
instantiate_input_device()
{
return new(std::nothrow) VirtualKeyboardInputDevice();
}
VirtualKeyboardInputDevice::VirtualKeyboardInputDevice()
:
BInputServerDevice()
{
fKeyboardWindow = new VirtualKeyboardWindow();
}
status_t
VirtualKeyboardInputDevice::SystemShuttingDown()
{
if (fKeyboardWindow)
fKeyboardWindow->PostMessage(SYSTEM_SHUTTING_DOWN);
return B_OK;
}
status_t
VirtualKeyboardInputDevice::InitCheck()
{
return BInputServerDevice::InitCheck();
}
status_t
VirtualKeyboardInputDevice::Start(const char* name, void* cookie)
{
fKeyboardWindow->Show();
}

View File

@ -0,0 +1,30 @@
/*
* Copyright 2014 Freeman Lou <freemanlou2430@yahoo.com>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#ifndef VKID_H
#define VKID_H
#include <InputServerDevice.h>
#include "VirtualKeyboardWindow.h"
class VirtualKeyboardInputDevice : public BInputServerDevice {
public:
VirtualKeyboardInputDevice();
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);
virtual status_t SystemShuttingDown();
private:
friend class VirtualKeyboardWindow;
VirtualKeyboardWindow* fKeyboardWindow;
};
extern "C" BInputServerDevice* instantiate_input_device();
#endif // VKID_H