|
The Pedigree Project
0.1
|
#include <InputManager.h>
Collaboration diagram for InputManager:Classes | |
| struct | CallbackItem |
| struct | InputNotification |
Public Types | |
| typedef int | CallbackType |
| typedef void(* | callback_t) (InputNotification &) |
| Callback function type. | |
Public Member Functions | |
| InputManager () | |
| Default constructor. | |
| virtual | ~InputManager () |
| Default destructor. | |
| void | initialise () |
| Begins the worker thread. | |
| void | shutdown () |
| Shuts down the worker thread, clears queues, and removes callbacks. | |
| void | keyPressed (uint64_t key) |
| Called whenever a key is pressed and needs to be added to the queue. | |
| void | rawKeyUpdate (uint8_t scancode, bool bKeyUp) |
| void | machineKeyUpdate (uint8_t scancode, bool bKeyUp) |
| Called whenever a machine-specific key scancode comes in. | |
| void | mouseUpdate (ssize_t relX, ssize_t relY, ssize_t relZ, uint32_t buttonBitmap) |
| Called whenever mouse input comes in. | |
| void | joystickUpdate (ssize_t relX, ssize_t relY, ssize_t relZ, uint32_t buttonBitmap) |
| Called whenever joystick input comes in. | |
| void | installCallback (CallbackType filter, callback_t callback, void *meta=0, Thread *pThread=0, uintptr_t param=0) |
| Installs a callback. | |
| void | removeCallback (callback_t callback, void *meta=0, Thread *pThread=0) |
| Removes a callback. | |
| bool | removeCallbackByThread (Thread *pThread) |
| void | mainThread () |
| Main worker thread. More... | |
| bool | isActive () const |
| Returns whether the instance is creating notifications. | |
Static Public Member Functions | |
| static InputManager & | instance () |
| Singleton design. | |
| static int | trampoline (void *ptr) |
| Thread trampoline. | |
Static Public Attributes | |
| static const int | Key = 1 |
| static const int | Mouse = 2 |
| static const int | Joystick = 4 |
| static const int | RawKey = 8 |
| static const int | MachineKey = 16 |
| static const int | Unknown = 255 |
Private Member Functions | |
| void | putNotification (InputNotification *note) |
Private Attributes | |
| List< InputNotification * > | m_InputQueue |
| Input queue (for distribution to applications) | |
| Spinlock | m_QueueLock |
| List< CallbackItem * > | m_Callbacks |
| Callback list. | |
| Semaphore | m_InputQueueSize |
| Key press queue Semaphore. | |
| Thread * | m_pThread |
| Thread object for our worker thread. | |
| bool | m_bActive |
| Are we active? | |
Static Private Attributes | |
| static InputManager | m_Instance |
| Static instance. | |
Global manager for all input from HID devices.
Definition at line 35 of file InputManager.h.
| void InputManager::mainThread | ( | ) |
Main worker thread.
Definition at line 301 of file InputManager.cc.
References Spinlock::acquire(), Semaphore::acquire(), Scheduler::instance(), isActive(), m_Callbacks, m_InputQueue, m_InputQueueSize, m_QueueLock, NOTICE, Spinlock::release(), Thread::sendEvent(), WARNING, and Scheduler::yield().
Referenced by trampoline().
Here is the caller graph for this function:
|
private |
Puts a notification into the queue (doer for all main functions)
note if THREADS is not defined Definition at line 172 of file InputManager.cc.
References m_Callbacks, m_InputQueue, m_InputQueueSize, m_QueueLock, Semaphore::release(), and WARNING.
Referenced by joystickUpdate(), keyPressed(), machineKeyUpdate(), mouseUpdate(), and rawKeyUpdate().
Here is the caller graph for this function:| void InputManager::rawKeyUpdate | ( | uint8_t | scancode, |
| bool | bKeyUp | ||
| ) |
Called whenever a raw key signal comes in
| scancode | a HID scancode |
Definition at line 119 of file InputManager.cc.
References putNotification().
Referenced by HidInputManager::keyDown(), and HidInputManager::keyUp().
Here is the caller graph for this function:| bool InputManager::removeCallbackByThread | ( | Thread * | pThread | ) |
Removes a callback by searching for a Thread pointer. This can be used to avoid useless and broken links to a Thread in the callback list if the Thread doesn't clean up properly.
Definition at line 270 of file InputManager.cc.
References m_Callbacks, and m_QueueLock.
|
static |
The type for a given callback (enum values can't be used for bitwise operations, so we define these as constants).
Definition at line 40 of file InputManager.h.
Referenced by StreamingScreenLogger::callback(), DevFs::initialise(), keyPressed(), and TextIO::translate().
|
private |
Spinlock for work on queues.
Definition at line 196 of file InputManager.h.
Referenced by installCallback(), mainThread(), putNotification(), removeCallback(), and removeCallbackByThread().
1.8.11