summaryrefslogtreecommitdiff
path: root/DevTools
diff options
context:
space:
mode:
authorOriko <oriko1010@protonmail.com>2020-03-13 15:33:49 +0200
committerAndreas Kling <kling@serenityos.org>2020-03-13 20:19:01 +0100
commit792a70976547387ff685220c5beb6d9e4e4f9b2f (patch)
tree612a51096a5db18e28739c926761c397aa0d501c /DevTools
parent0e04e2cff05a7c4fc3664c634e527313e656d15d (diff)
downloadserenity-792a70976547387ff685220c5beb6d9e4e4f9b2f.zip
HackStudio: Fix the wrong cursor being drawn
Diffstat (limited to 'DevTools')
-rw-r--r--DevTools/HackStudio/Editor.cpp15
-rw-r--r--DevTools/HackStudio/Editor.h3
2 files changed, 17 insertions, 1 deletions
diff --git a/DevTools/HackStudio/Editor.cpp b/DevTools/HackStudio/Editor.cpp
index 1a4b530ebe..b95d0e5a1f 100644
--- a/DevTools/HackStudio/Editor.cpp
+++ b/DevTools/HackStudio/Editor.cpp
@@ -93,9 +93,10 @@ void Editor::paint_event(GUI::PaintEvent& event)
if (horizontal_scrollbar().is_visible())
rect.set_height(rect.height() - horizontal_scrollbar().height());
painter.draw_rect(rect, palette().selection());
+ }
+ if (m_hovering_editor)
window()->set_override_cursor(m_hovering_link && m_holding_ctrl ? GUI::StandardCursor::Hand : GUI::StandardCursor::IBeam);
- }
}
static HashMap<String, String>& man_paths()
@@ -283,6 +284,18 @@ void Editor::keyup_event(GUI::KeyEvent& event)
GUI::TextEditor::keyup_event(event);
}
+void Editor::enter_event(Core::Event& event)
+{
+ m_hovering_editor = true;
+ GUI::TextEditor::enter_event(event);
+}
+
+void Editor::leave_event(Core::Event& event)
+{
+ m_hovering_editor = false;
+ GUI::TextEditor::leave_event(event);
+}
+
static HashMap<String, String>& include_paths()
{
static HashMap<String, String> paths;
diff --git a/DevTools/HackStudio/Editor.h b/DevTools/HackStudio/Editor.h
index b3c159f400..d188e3655c 100644
--- a/DevTools/HackStudio/Editor.h
+++ b/DevTools/HackStudio/Editor.h
@@ -50,6 +50,8 @@ private:
virtual void mousedown_event(GUI::MouseEvent&) override;
virtual void keydown_event(GUI::KeyEvent&) override;
virtual void keyup_event(GUI::KeyEvent&) override;
+ virtual void enter_event(Core::Event&) override;
+ virtual void leave_event(Core::Event&) override;
void show_documentation_tooltip_if_available(const String&, const Gfx::Point& screen_location);
void navigate_to_include_if_available(String);
@@ -60,6 +62,7 @@ private:
RefPtr<Web::HtmlView> m_documentation_html_view;
String m_last_parsed_token;
GUI::TextPosition m_previous_text_position { 0, 0 };
+ bool m_hovering_editor { false };
bool m_hovering_link { false };
bool m_holding_ctrl { false };
};