xref: /haiku/src/add-ons/input_server/devices/mouse/MouseInputDevice.h (revision d3d8b26997fac34a84981e6d2b649521de2cc45a)
1 /*****************************************************************************/
2 // Mouse input server device addon
3 // Written by Stefano Ceccherini
4 //
5 // MouseInputDevice.h
6 //
7 // Copyright (c) 2004 Haiku Project
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining a
10 // copy of this software and associated documentation files (the "Software"),
11 // to deal in the Software without restriction, including without limitation
12 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 // and/or sell copies of the Software, and to permit persons to whom the
14 // Software is furnished to do so, subject to the following conditions:
15 //
16 // The above copyright notice and this permission notice shall be included
17 // in all copies or substantial portions of the Software.
18 //
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 // DEALINGS IN THE SOFTWARE.
26 /*****************************************************************************/
27 #ifndef __MOUSEINPUTDEVICE_H
28 #define __MOUSEINPUTDEVICE_H
29 
30 #include <InputServerDevice.h>
31 #include <InterfaceDefs.h>
32 #include <List.h>
33 #include <stdio.h>
34 
35 struct mouse_device;
36 class MouseInputDevice : public BInputServerDevice {
37 public:
38 	MouseInputDevice();
39 	~MouseInputDevice();
40 
41 	virtual status_t InitCheck();
42 
43 	virtual status_t Start(const char *name, void *cookie);
44 	virtual status_t Stop(const char *name, void *cookie);
45 
46 	virtual status_t Control(const char *name, void *cookie,
47 							 uint32 command, BMessage *message);
48 private:
49 	status_t HandleMonitor(BMessage *message);
50 	status_t InitFromSettings(void *cookie, uint32 opcode = 0);
51 	void RecursiveScan(const char *directory);
52 
53 	status_t AddDevice(const char *path);
54 	status_t RemoveDevice(const char *path);
55 
56 	int32 DeviceWatcher(mouse_device *device);
57 	static int32 ThreadFunction(void *arg);
58 
59 	BList fDevices;
60 #ifdef DEBUG
61 public:
62 	static FILE *sLogFile;
63 #endif
64 };
65 
66 extern "C" BInputServerDevice *instantiate_input_device();
67 
68 #endif
69 
70