* Rewrote InputServerDevice.h header.
* Renamed _BDeviceAddOn_ to DeviceAddOn, and put it into the BPrivate namespace. * Moved the DeviceManager functionality into the AddOnManager - this also solves a locking issue, as BInputServerDevice::Control() was called in the context of the DeviceManager before. * The AddOnManager now uses the BPathMonitor to monitor the devices that BInputServerDevices ask for - this greatly simplifies the code. * Got rid of TList.h, and use ObjectList.h instead. * Added PathList class that has a list of paths with reference count, used by DeviceAddOn and the AddOnManager. * DeviceAddOn got an actual implementation that lives in InputServerDevice.cpp. * Added an experimental BInputServerDevice::AddDevices() that could be used instead of recursing over devices manually. It replaces the functionality that was found in the DeviceManager before (this was done implicitely for all monitored devices). * Greatly cleaned up and simplified the AddOnManager. * Also fixed lots of potential errors/leaks when things go wrong. * Removed the extra locker in AddOnManager - its BLooper lock is now used instead. * Replaced PRINT()/PRINTERR() macros in the AddOnManager with TRACE(), and ERROR(), both now use debug_printf(). * Hopefully this fixes the problem that I don't have keyboard under VirtualBox from time to time. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28241 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,46 +1,42 @@
|
||||
/******************************************************************************
|
||||
/
|
||||
/ File: InputServerDevice.h
|
||||
/
|
||||
/ Description: Add-on class for input_server devices.
|
||||
/
|
||||
/ Copyright 1998, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright 2008 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _INPUTSERVERDEVICE_H
|
||||
#define _INPUTSERVERDEVICE_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
|
||||
#include <Input.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
// Register your actual devices using this one - you can subclass
|
||||
// this to suit your needs
|
||||
struct input_device_ref {
|
||||
char *name;
|
||||
input_device_type type;
|
||||
void *cookie;
|
||||
char* name;
|
||||
input_device_type type; // see Input.h
|
||||
void* cookie;
|
||||
};
|
||||
|
||||
|
||||
// BInputServerDevice::Control() codes
|
||||
enum {
|
||||
// B_KEYBOARD_DEVICE notifications
|
||||
B_KEY_MAP_CHANGED = 1,
|
||||
B_KEY_MAP_CHANGED = 1,
|
||||
B_KEY_LOCKS_CHANGED,
|
||||
B_KEY_REPEAT_DELAY_CHANGED,
|
||||
B_KEY_REPEAT_DELAY_CHANGED,
|
||||
B_KEY_REPEAT_RATE_CHANGED,
|
||||
|
||||
// B_POINTING_DEVICE notifications
|
||||
B_MOUSE_TYPE_CHANGED,
|
||||
B_MOUSE_TYPE_CHANGED,
|
||||
B_MOUSE_MAP_CHANGED,
|
||||
B_MOUSE_SPEED_CHANGED,
|
||||
B_CLICK_SPEED_CHANGED,
|
||||
B_MOUSE_ACCELERATION_CHANGED
|
||||
B_MOUSE_ACCELERATION_CHANGED,
|
||||
};
|
||||
|
||||
|
||||
class _BDeviceAddOn_;
|
||||
|
||||
namespace BPrivate {
|
||||
class DeviceAddOn;
|
||||
}
|
||||
|
||||
class BInputServerDevice {
|
||||
public:
|
||||
@@ -50,30 +46,28 @@ public:
|
||||
virtual status_t InitCheck();
|
||||
virtual status_t SystemShuttingDown();
|
||||
|
||||
virtual status_t Start(const char *device, void *cookie);
|
||||
virtual status_t Stop(const char *device, void *cookie);
|
||||
virtual status_t Control(const char *device,
|
||||
void *cookie,
|
||||
uint32 code,
|
||||
BMessage *message);
|
||||
virtual status_t Start(const char* device, void* cookie);
|
||||
virtual status_t Stop(const char* device, void* cookie);
|
||||
virtual status_t Control(const char* device, void* cookie, uint32 code,
|
||||
BMessage* message);
|
||||
|
||||
status_t RegisterDevices(input_device_ref **devices);
|
||||
status_t UnregisterDevices(input_device_ref **devices);
|
||||
status_t RegisterDevices(input_device_ref** devices);
|
||||
status_t UnregisterDevices(input_device_ref** devices);
|
||||
|
||||
status_t EnqueueMessage(BMessage *message);
|
||||
status_t EnqueueMessage(BMessage* message);
|
||||
|
||||
status_t StartMonitoringDevice(const char *device);
|
||||
status_t StopMonitoringDevice(const char *device);
|
||||
status_t StartMonitoringDevice(const char* device);
|
||||
status_t StopMonitoringDevice(const char* device);
|
||||
status_t AddDevices(const char* path);
|
||||
|
||||
private:
|
||||
_BDeviceAddOn_* fOwner;
|
||||
|
||||
virtual void _ReservedInputServerDevice1();
|
||||
virtual void _ReservedInputServerDevice2();
|
||||
virtual void _ReservedInputServerDevice3();
|
||||
virtual void _ReservedInputServerDevice4();
|
||||
|
||||
BPrivate::DeviceAddOn* fOwner;
|
||||
uint32 _reserved[4];
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#endif // _INPUTSERVERDEVICE_H
|
||||
|
||||
Reference in New Issue
Block a user