diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-07-09 12:18:32 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-07-09 15:53:54 +0200 |
commit | b1b6af02465b1a20ec4f28811bc5cc6bde8417be (patch) | |
tree | 40b48eca176032fc7cffc5d7e69fd46b3f9cf7d1 | |
parent | f020784e14a55c82418e4f231855040177ac9f82 (diff) |
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@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 10 |
1 files changed, 7 insertions, 3 deletions
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(); } |