Przeglądaj źródła

LibVT: Show an I-beam cursor over TerminalWidget

..and implement this using the new widget override cursor mechanism.
Andreas Kling 4 lat temu
rodzic
commit
f475fa3f54
1 zmienionych plików z 4 dodań i 3 usunięć
  1. 4 3
      Libraries/LibVT/TerminalWidget.cpp

+ 4 - 3
Libraries/LibVT/TerminalWidget.cpp

@@ -94,6 +94,8 @@ TerminalWidget::TerminalWidget(int ptm_fd, bool automatic_size_policy, RefPtr<Co
     , m_automatic_size_policy(automatic_size_policy)
     , m_automatic_size_policy(automatic_size_policy)
     , m_config(move(config))
     , m_config(move(config))
 {
 {
+    set_override_cursor(Gfx::StandardCursor::IBeam);
+
     set_accepts_emoji_input(true);
     set_accepts_emoji_input(true);
     set_pty_master_fd(ptm_fd);
     set_pty_master_fd(ptm_fd);
     m_cursor_blink_timer = add<Core::Timer>();
     m_cursor_blink_timer = add<Core::Timer>();
@@ -629,9 +631,9 @@ void TerminalWidget::mousemove_event(GUI::MouseEvent& event)
             m_hovered_href = {};
             m_hovered_href = {};
         }
         }
         if (!m_hovered_href.is_empty())
         if (!m_hovered_href.is_empty())
-            window()->set_cursor(Gfx::StandardCursor::Hand);
+            set_override_cursor(Gfx::StandardCursor::Hand);
         else
         else
-            window()->set_cursor(Gfx::StandardCursor::None);
+            set_override_cursor(Gfx::StandardCursor::IBeam);
         update();
         update();
     }
     }
 
 
@@ -667,7 +669,6 @@ void TerminalWidget::mousemove_event(GUI::MouseEvent& event)
 
 
 void TerminalWidget::leave_event(Core::Event&)
 void TerminalWidget::leave_event(Core::Event&)
 {
 {
-    window()->set_cursor(Gfx::StandardCursor::None);
     bool should_update = !m_hovered_href.is_empty();
     bool should_update = !m_hovered_href.is_empty();
     m_hovered_href = {};
     m_hovered_href = {};
     m_hovered_href_id = {};
     m_hovered_href_id = {};