summaryrefslogtreecommitdiff
path: root/LibGUI/GTextEditor.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-31 23:52:02 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-03-31 23:52:02 +0200
commitdcf6726487d17f5fb36803e3b8d74ed75ee4fa53 (patch)
tree9d9c049244674d4b191b67ff238884b0c8442f92 /LibGUI/GTextEditor.cpp
parent42c95959a8ea883669491499d8d890881ff20031 (diff)
downloadserenity-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.cpp13
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);
+}