1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 23:27:42 +00:00

Hook up the PS2MouseDevice to the AbstractScreen+WindowManager.

Render the mouse cursor by xor'ing the pixels. I don't know anything about
hardware cursors yet and this way we don't need to recompose the window
hierarchy every time you move the mouse. :^)
This commit is contained in:
Andreas Kling 2019-01-11 03:52:09 +01:00
parent 31667b47a5
commit e5e295052f
10 changed files with 117 additions and 5 deletions

View file

@ -1,10 +1,13 @@
#include "PS2MouseDevice.h"
#include "IO.h"
static PS2MouseDevice* s_the;
PS2MouseDevice::PS2MouseDevice()
: IRQHandler(12)
, CharacterDevice(10, 1)
{
s_the = this;
initialize();
}
@ -12,6 +15,11 @@ PS2MouseDevice::~PS2MouseDevice()
{
}
PS2MouseDevice& PS2MouseDevice::the()
{
return *s_the;
}
void PS2MouseDevice::handle_irq()
{
byte data = IO::in8(0x60);
@ -32,6 +40,8 @@ void PS2MouseDevice::handle_irq()
(m_data[0] & 1) ? "Left" : "",
(m_data[0] & 2) ? "Right" : ""
);
if (m_client)
m_client->did_receive_mouse_data(m_data[1], -m_data[2], m_data[0] & 1, m_data[0] & 2);
break;
}
}
@ -120,3 +130,7 @@ ssize_t PS2MouseDevice::write(const byte *buffer, size_t buffer_size)
ASSERT_NOT_REACHED();
return 0;
}
MouseClient::~MouseClient()
{
}