HackStudio: Fix the wrong cursor being drawn

This commit is contained in:
Oriko 2020-03-13 15:33:49 +02:00 committed by Andreas Kling
parent 0e04e2cff0
commit 792a709765
Notes: sideshowbarker 2024-07-19 08:19:47 +09:00
2 changed files with 18 additions and 2 deletions

View File

@ -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<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;

View File

@ -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 };
};