1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:48:11 +00:00

WindowServer: Add support for per-window override cursors.

Use this to implement automatic switching to an I-beam cursor when hovering
over a GTextEditor. :^)
This commit is contained in:
Andreas Kling 2019-03-31 23:52:02 +02:00
parent 42c95959a8
commit dcf6726487
13 changed files with 110 additions and 0 deletions

View file

@ -19,3 +19,16 @@ Retained<WSCursor> WSCursor::create(Retained<GraphicsBitmap>&& bitmap, const Poi
{
return adopt(*new WSCursor(move(bitmap), hotspot));
}
RetainPtr<WSCursor> WSCursor::create(WSStandardCursor standard_cursor)
{
switch (standard_cursor) {
case WSStandardCursor::None:
return nullptr;
case WSStandardCursor::Arrow:
return create(*GraphicsBitmap::load_from_file("/res/cursors/arrow.png"));
case WSStandardCursor::IBeam:
return create(*GraphicsBitmap::load_from_file("/res/cursors/i-beam.png"));
}
ASSERT_NOT_REACHED();
}