[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 9 13:54:32 UTC 2021


 vcl/unx/gtk3/gtkinst.cxx |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit b1b6af02465b1a20ec4f28811bc5cc6bde8417be
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Jul 9 12:18:32 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Jul 9 15:53:54 2021 +0200

    gtk4: adjust restoring focus to GtkEntry part of GtkComboBox on menu popdown
    
    the order of changed and popdown is different that in the gtk3 variant
    so protect against something (font size picker) changing the focus already
    when the ComboBox reported a change before the popdown happened
    
    Change-Id: Ie93e92685c9155b2520841ca6a436e499666adf0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118679
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 741d7c29470a..cd3fd1b5bc84 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -17587,11 +17587,15 @@ private:
         {
             m_bPopupActive = bIsShown;
             ComboBox::signal_popup_toggled();
-            if (!m_bPopupActive && m_pEntry)
+            // restore focus to the GtkEntry when the popup is gone, which
+            // is what the vcl case does, to ease the transition a little,
+            // but don't do it if the focus was moved out of togglebutton
+            // by something else already (e.g. font combobox in toolbar
+            // on a "direct pick" from the menu which moves focus into
+            // the main document
+            if (!m_bPopupActive && m_pEntry && has_child_focus())
             {
                 disable_notify_events();
-                //restore focus to the GtkEntry when the popup is gone, which
-                //is what the vcl case does, to ease the transition a little
                 gtk_widget_grab_focus(m_pEntry);
                 enable_notify_events();
             }


More information about the Libreoffice-commits mailing list