[vte] widget: Listen for toplevel focus change



commit 5d732ad6f6f377e31260ae18dbc24d44f3a587e8
Author: Christian Persch <chpe src gnome org>
Date:   Wed Aug 3 22:58:02 2022 +0200

    widget: Listen for toplevel focus change
    
    Update the cursor state when the toplevel focus changes.
    
    Fixes: https://gitlab.gnome.org/GNOME/vte/-/issues/2555

 src/vte.cc         | 9 ---------
 src/vteinternal.hh | 1 -
 src/widget.cc      | 5 ++++-
 3 files changed, 4 insertions(+), 11 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index e09ff384..601b89ad 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -7009,15 +7009,6 @@ Terminal::widget_focus_out()
        check_cursor_blink();
 }
 
-void
-Terminal::widget_root_focused_changed(bool focused) noexcept
-{
-        if (!widget_realized())
-                return;
-
-        maybe_feed_focus_event(focused);
-}
-
 void
 Terminal::widget_mouse_enter(vte::platform::MouseEvent const& event)
 {
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 05e21d97..88464760 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -954,7 +954,6 @@ public:
                                   Alignment yalign,
                                   bool xfill,
                                   bool yfill) noexcept;
-        void widget_root_focused_changed(bool focused) noexcept;
 #endif /* VTE_GTK */
 
         void set_blink_settings(bool blink,
diff --git a/src/widget.cc b/src/widget.cc
index 1d28d905..4cf69c79 100644
--- a/src/widget.cc
+++ b/src/widget.cc
@@ -1718,7 +1718,10 @@ Widget::root_surface_state_notify()
         m_root_surface_state = new_state;
 
         if (changed_mask & GDK_TOPLEVEL_STATE_FOCUSED) {
-                terminal()->widget_root_focused_changed(root_focused());
+                if (root_focused())
+                        terminal()->widget_focus_in();
+                else
+                        terminal()->widget_focus_out();
         }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]