Panda3D
winInputDeviceManager.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 winInputDeviceManager.h
10  * @author rdb
11  * @date 2018-01-21
12  */
13 
14 #ifndef WININPUTDEVICEMANAGER_H
15 #define WININPUTDEVICEMANAGER_H
16 
17 #include "inputDeviceManager.h"
18 
19 #if defined(_WIN32) && !defined(CPPPARSER)
20 
21 #include "xInputDevice.h"
22 
23 #include <CfgMgr32.h>
24 #include <devpkey.h>
25 
26 class WinRawInputDevice;
27 
28 /**
29  * This is the Windows implementation of InputDeviceManager, managing both
30  * XInput controllers and raw input devices.
31  */
32 class EXPCL_PANDA_DEVICE WinInputDeviceManager final : public InputDeviceManager {
33 private:
34  WinInputDeviceManager();
35  ~WinInputDeviceManager();
36 
37 public:
38  void device_destroyed(WinRawInputDevice *device);
39 
40  void on_input(HRAWINPUT handle);
41  void on_input_device_arrival(HANDLE handle);
42  void on_input_device_removal(HANDLE handle);
43 
44 private:
45  // There are always exactly four of these in existence.
46  XInputDevice _xinput_device0;
47  XInputDevice _xinput_device1;
48  XInputDevice _xinput_device2;
49  XInputDevice _xinput_device3;
50 
51  HWND _message_hwnd;
53  pmap<std::string, WinRawInputDevice *> _raw_devices_by_path;
54 
55  static LRESULT WINAPI window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
56 
57  typedef CONFIGRET (*pCM_Get_DevNode_Property)(DEVINST, const DEVPROPKEY *, DEVPROPTYPE *, PBYTE, PULONG, ULONG);
58  pCM_Get_DevNode_Property _CM_Get_DevNode_PropertyW;
59 
60  friend class InputDeviceManager;
61 };
62 
63 #endif
64 #endif
This is our own Panda specialization on the default STL map.
Definition: pmap.h:49
This class keeps track of all the devices on a system, and sends out events when a device has been ho...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.