diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-03-31 23:52:02 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-03-31 23:52:02 +0200 |
commit | dcf6726487d17f5fb36803e3b8d74ed75ee4fa53 (patch) | |
tree | 9d9c049244674d4b191b67ff238884b0c8442f92 /LibGUI/GTextEditor.cpp | |
parent | 42c95959a8ea883669491499d8d890881ff20031 (diff) | |
download | serenity-dcf6726487d17f5fb36803e3b8d74ed75ee4fa53.zip |
WindowServer: Add support for per-window override cursors.
Use this to implement automatic switching to an I-beam cursor when hovering
over a GTextEditor. :^)
Diffstat (limited to 'LibGUI/GTextEditor.cpp')
-rw-r--r-- | LibGUI/GTextEditor.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/LibGUI/GTextEditor.cpp b/LibGUI/GTextEditor.cpp index c9ca1b4a6e..f409f06a54 100644 --- a/LibGUI/GTextEditor.cpp +++ b/LibGUI/GTextEditor.cpp @@ -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); +} |