Handles mouse movements and clicks.
More...
#include <device/mouse.h>
|
| Mouse (unsigned max_x, unsigned max_y) |
| Constructor. More...
|
|
void | getPos (unsigned &x, unsigned &y) const |
| Retrieve the current mouse position. More...
|
|
bool | isPressed (MouseButton btn) const |
| Check if a given mouse button is pressed. More...
|
|
void | plugin () |
| Initialization of the mouse. More...
|
|
bool | prologue () override |
| Prologue of mouse interrupts. More...
|
|
void | epilogue () override |
| Epilogue of mouse interrupts. More...
|
|
| Gate () |
| Constructor.
|
|
virtual | ~Gate () |
| Destructor. More...
|
|
virtual bool | prologue ()=0 |
| Device-specific interrupt handling routine that is executed immediately after the interrupt occurs (asynchronously). More...
|
|
virtual void | epilogue () |
| Possibly delayed, synchronously executed Device-specific interrupt handling routine. More...
|
|
|
const unsigned | MAX_X |
| Maximum X position of the mouse.
|
|
const unsigned | MAX_Y |
| Maximum Y position of the mouse.
|
|
Handles mouse movements and clicks.
This class ensures correct initialization of the mouse and, above all, its interrupt handling.
◆ Mouse()
Mouse::Mouse |
( |
unsigned |
max_x, |
|
|
unsigned |
max_y |
|
) |
| |
|
inlineexplicit |
Constructor.
Defines a virtual window for the mouse.
- Parameters
-
max_x | Maximum X position (excluding) for the mouse |
max_y | Maximum Y position (excluding) for the mouse |
◆ getPos()
void Mouse::getPos |
( |
unsigned & |
x, |
|
|
unsigned & |
y |
|
) |
| const |
|
inline |
Retrieve the current mouse position.
- Parameters
-
x | Reference to variable for the X position (0 ≤ x < MAX_X) of the mouse |
y | Reference to variable for the Y position (0 ≤ y < MAX_Y) of the mouse |
◆ isPressed()
Check if a given mouse button is pressed.
- Parameters
-
btn | Button to check for press |
- Returns
true
if button is currently pressed
◆ plugin()
Initialization of the mouse.
Initialization of the mouse and activation of the specific interrupt handling: The object will register itself at the Plugbox and configure the IOAPIC to receive the corresponding interrupts.
- Note
- The mouse interrupts should be configured as level triggered.
◆ prologue()
Prologue of mouse interrupts.
This method directly handles interrupts caused by the mouse. The position of the mouse and the pressed buttons are calculated and stored in variables, which are used by the epilogue to draw the cursor on the screen.
- Optional:
- Implement method
Implements Gate.
◆ epilogue()
Epilogue of mouse interrupts.
The current position of the cursor is drawn on the screen using TextMode::showMouse(). Press and release events of the buttons are printed to the debug output.
Reimplemented from Gate.
The documentation for this class was generated from the following files: