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
Notes: sideshowbarker 2024-07-19 14:51:44 +09:00
13 changed files with 110 additions and 0 deletions

View file

@ -3,6 +3,7 @@
#include <LibGUI/GFontDatabase.h>
#include <LibGUI/GClipboard.h>
#include <LibGUI/GPainter.h>
#include <LibGUI/GWindow.h>
#include <Kernel/KeyCode.h>
#include <AK/StringBuilder.h>
#include <unistd.h>
@ -801,3 +802,15 @@ void GTextEditor::paste()
printf("Paste: \"%s\"\n", paste_text.characters());
insert_at_cursor_or_replace_selection(paste_text);
}
void GTextEditor::enter_event(GEvent&)
{
ASSERT(window());
window()->set_override_cursor(GStandardCursor::IBeam);
}
void GTextEditor::leave_event(GEvent&)
{
ASSERT(window());
window()->set_override_cursor(GStandardCursor::None);
}