From 792a70976547387ff685220c5beb6d9e4e4f9b2f Mon Sep 17 00:00:00 2001 From: Oriko Date: Fri, 13 Mar 2020 15:33:49 +0200 Subject: [PATCH] HackStudio: Fix the wrong cursor being drawn --- DevTools/HackStudio/Editor.cpp | 17 +++++++++++++++-- DevTools/HackStudio/Editor.h | 3 +++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/DevTools/HackStudio/Editor.cpp b/DevTools/HackStudio/Editor.cpp index 1a4b530ebef..b95d0e5a1f9 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()); - - window()->set_override_cursor(m_hovering_link && m_holding_ctrl ? GUI::StandardCursor::Hand : GUI::StandardCursor::IBeam); } + + if (m_hovering_editor) + window()->set_override_cursor(m_hovering_link && m_holding_ctrl ? GUI::StandardCursor::Hand : GUI::StandardCursor::IBeam); } static HashMap& 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& include_paths() { static HashMap paths; diff --git a/DevTools/HackStudio/Editor.h b/DevTools/HackStudio/Editor.h index b3c159f4003..d188e3655c4 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 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 }; };