summaryrefslogtreecommitdiff
path: root/Libraries/LibVT
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-05-09 17:04:12 +0200
committerAndreas Kling <kling@serenityos.org>2020-05-09 17:04:12 +0200
commit31ec4de0eef436ca7f65c96c83e9ed6f0d03d28c (patch)
tree503982485ac4effd462f9b0c5fa8944a0becd073 /Libraries/LibVT
parent7b34f5bb92a75a7f72b9cc0412d12b360cde1679 (diff)
downloadserenity-31ec4de0eef436ca7f65c96c83e9ed6f0d03d28c.zip
LibVT: Show the hover hand cursor when hovering over hyperlinks :^)
Diffstat (limited to 'Libraries/LibVT')
-rw-r--r--Libraries/LibVT/TerminalWidget.cpp14
-rw-r--r--Libraries/LibVT/TerminalWidget.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/Libraries/LibVT/TerminalWidget.cpp b/Libraries/LibVT/TerminalWidget.cpp
index d00caca5f5..3cd0957b4a 100644
--- a/Libraries/LibVT/TerminalWidget.cpp
+++ b/Libraries/LibVT/TerminalWidget.cpp
@@ -644,6 +644,10 @@ void TerminalWidget::mousemove_event(GUI::MouseEvent& event)
if (attribute.href_id != m_hovered_href_id) {
m_hovered_href_id = attribute.href_id;
m_hovered_href = attribute.href;
+ if (!m_hovered_href.is_empty())
+ window()->set_override_cursor(GUI::StandardCursor::Hand);
+ else
+ window()->set_override_cursor(GUI::StandardCursor::None);
update();
}
@@ -656,6 +660,16 @@ void TerminalWidget::mousemove_event(GUI::MouseEvent& event)
update();
}
+void TerminalWidget::leave_event(Core::Event&)
+{
+ window()->set_override_cursor(GUI::StandardCursor::None);
+ bool should_update = !m_hovered_href.is_empty();
+ m_hovered_href = {};
+ m_hovered_href_id = {};
+ if (should_update)
+ update();
+}
+
void TerminalWidget::mousewheel_event(GUI::MouseEvent& event)
{
if (!is_scrollable())
diff --git a/Libraries/LibVT/TerminalWidget.h b/Libraries/LibVT/TerminalWidget.h
index 36f5bdcf4b..4d5085f6da 100644
--- a/Libraries/LibVT/TerminalWidget.h
+++ b/Libraries/LibVT/TerminalWidget.h
@@ -101,6 +101,7 @@ private:
virtual void focusout_event(Core::Event&) override;
virtual void context_menu_event(GUI::ContextMenuEvent&) override;
virtual void drop_event(GUI::DropEvent&) override;
+ virtual void leave_event(Core::Event&) override;
virtual void did_change_font() override;
// ^TerminalClient