xref: /haiku/src/add-ons/input_server/devices/mouse/MouseInputDevice.h (revision 4f00613311d0bd6b70fa82ce19931c41f071ea4e)
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 class MouseInputDevice : public BInputServerDevice {
36 public:
37 	MouseInputDevice();
38 	~MouseInputDevice();
39 
40 	virtual status_t InitCheck();
41 
42 	virtual status_t Start(const char *name, void *cookie);
43 	virtual status_t Stop(const char *name, void *cookie);
44 
45 	virtual status_t Control(const char *name, void *cookie,
46 							 uint32 command, BMessage *message);
47 private:
48 	status_t HandleMonitor(BMessage *message);
49 	status_t InitFromSettings(void *cookie, uint32 opcode = 0);
50 	void RecursiveScan(const char *directory);
51 
52 	status_t AddDevice(const char *path);
53 	status_t RemoveDevice(const char *path);
54 
55 	static int32 DeviceWatcher(void *arg);
56 
57 	BList fDevices;
58 #ifdef DEBUG
59 public:
60 	static FILE *sLogFile;
61 #endif
62 };
63 
64 extern "C" BInputServerDevice *instantiate_input_device();
65 
66 #endif
67 
68