Panda3D
ioKitInputDeviceManager.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file ioKitInputDeviceManager.h
10  * @author rdb
11  * @date 2018-02-04
12  */
13 
14 #ifndef IOKITINPUTDEVICEMANAGER_H
15 #define IOKITINPUTDEVICEMANAGER_H
16 
17 #include "inputDeviceManager.h"
18 
19 #if defined(__APPLE__) && !defined(CPPPARSER)
20 #include <IOKit/hid/IOHIDManager.h>
21 
22 class IOKitInputDevice;
23 
24 /**
25  * The macOS implementation of InputDeviceManager.
26  */
27 class EXPCL_PANDA_DEVICE IOKitInputDeviceManager final : public InputDeviceManager {
28 protected:
29  IOKitInputDeviceManager();
30  ~IOKitInputDeviceManager();
31 
32 protected:
33  IOHIDManagerRef _hid_manager;
34 
35  // The device removal callback method we need to use requires us to remember
36  // which IOKitInputDevice corresponds to which IOHIDDeviceRef. This is the
37  // same strategy used by winInputDevice and friends.
38  //
39  // We can make this a mapping to raw pointers since we know _devices will be
40  // holding a reference until remove_device is called.
42 
43  static void on_match_device(void *ctx, IOReturn result, void *sender, IOHIDDeviceRef device);
44  static void on_remove_device(void *ctx, IOReturn result, void *sender, IOHIDDeviceRef device);
45 
46  friend class InputDeviceManager;
47 };
48 
49 #endif
50 
51 #endif
This class keeps track of all the devices on a system, and sends out events when a device has been ho...
This is our own Panda specialization on the default STL map.
Definition: pmap.h:49
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.