1 /* 2 * Copyright 2008, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _INPUTSERVERDEVICE_H 6 #define _INPUTSERVERDEVICE_H 7 8 9 #include <Input.h> 10 #include <SupportDefs.h> 11 12 13 // Register your actual devices using this one - you can subclass 14 // this to suit your needs 15 struct input_device_ref { 16 char* name; 17 input_device_type type; // see Input.h 18 void* cookie; 19 }; 20 21 // BInputServerDevice::Control() codes 22 enum { 23 // B_KEYBOARD_DEVICE notifications 24 B_KEY_MAP_CHANGED = 1, 25 B_KEY_LOCKS_CHANGED, 26 B_KEY_REPEAT_DELAY_CHANGED, 27 B_KEY_REPEAT_RATE_CHANGED, 28 29 // B_POINTING_DEVICE notifications 30 B_MOUSE_TYPE_CHANGED, 31 B_MOUSE_MAP_CHANGED, 32 B_MOUSE_SPEED_CHANGED, 33 B_CLICK_SPEED_CHANGED, 34 B_MOUSE_ACCELERATION_CHANGED, 35 B_SET_TOUCHPAD_SETTINGS, 36 }; 37 38 namespace BPrivate { 39 class DeviceAddOn; 40 } 41 42 class BInputServerDevice { 43 public: 44 BInputServerDevice(); 45 virtual ~BInputServerDevice(); 46 47 virtual status_t InitCheck(); 48 virtual status_t SystemShuttingDown(); 49 50 virtual status_t Start(const char* device, void* cookie); 51 virtual status_t Stop(const char* device, void* cookie); 52 virtual status_t Control(const char* device, void* cookie, uint32 code, 53 BMessage* message); 54 55 status_t RegisterDevices(input_device_ref** devices); 56 status_t UnregisterDevices(input_device_ref** devices); 57 58 status_t EnqueueMessage(BMessage* message); 59 60 status_t StartMonitoringDevice(const char* device); 61 status_t StopMonitoringDevice(const char* device); 62 status_t AddDevices(const char* path); 63 64 private: 65 virtual void _ReservedInputServerDevice1(); 66 virtual void _ReservedInputServerDevice2(); 67 virtual void _ReservedInputServerDevice3(); 68 virtual void _ReservedInputServerDevice4(); 69 70 BPrivate::DeviceAddOn* fOwner; 71 uint32 _reserved[4]; 72 }; 73 74 #endif // _INPUTSERVERDEVICE_H 75