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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Jan 27 20:07:40 UTC 2020


 vcl/unx/gtk3/gtk3gtkframe.cxx |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit b7411079bb833aa2857aa4b0de7cd4eeb6dc06fa
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jan 27 16:26:56 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jan 27 21:07:08 2020 +0100

    vcl: ignore floating window set-focus events
    
    because they generate unwanted lose focus events in their parent. We
    only want these set-focus events for native widgets hosted in the
    sidebar.
    
    This happens with the font widget in Writer, it displays a substituted
    font and ComboBox::Impl::ImplUpdateFloatSelection() can't find it as
    aSearchStr because it's substituted so there's no entry.
    
    Something like this should reproduce it:
    1. select fonts until the MRU list is full
    2. apply a substituted font
    3. click on font combo box and select any font that's not in MRU list
    4. click on font combo box, notice empty string
    
    This is called when losing focus:
    
    0  ComboBox::Impl::ImplUpdateFloatSelection() (this=0x6fcd9e0) at vcl/source/control/combobox.cxx:858
    1  ComboBox::SetText(rtl::OUString const&) (this=0x6ffa1c0, rStr="Calibri") at vcl/source/control/combobox.cxx:800
    2  (anonymous namespace)::SvxFontNameBox_Impl::EventNotify(NotifyEvent&) (this=0x6ffa1c0, rNEvt=...) at svx/source/tbxctrls/tbcontrl.cxx:1476
    3  vcl::Window::CompatNotify(NotifyEvent&) (this=0x6ffa1c0, rNEvt=...) at vcl/source/window/window.cxx:3874
    4  vcl::Window::EventNotify(NotifyEvent&) (this=0x7004f10, rNEvt=...) at vcl/source/window/event.cxx:207
    5  Control::EventNotify(NotifyEvent&) (this=0x7004f10, rNEvt=...) at vcl/source/control/ctrl.cxx:257
    6  vcl::Window::CompatNotify(NotifyEvent&) (this=0x7004f10, rNEvt=...) at vcl/source/window/window.cxx:3874
    7  vcl::Window::LoseFocus() (this=0x7004f10) at vcl/source/window/window.cxx:1822
    8  Edit::LoseFocus() (this=0x7004f10) at vcl/source/control/edit.cxx:1899
    9  vcl::Window::CompatLoseFocus() (this=0x7004f10) at vcl/source/window/window.cxx:3848
    10 vcl::Window::ImplGrabFocus(GetFocusFlags) (this=0x6ffb9d0, nFlags=GetFocusFlags::NONE) at vcl/source/window/mouse.cxx:350
    11 vcl::Window::GrabFocus() (this=0x6ffb9d0) at vcl/source/window/window.cxx:2979
    
    But then later the mouse-button-up event causes some MRU handling to
    get the currently selected entry, and if that is LISTBOX_ENTRY_NOTFOUND
    an empty string is added instead of what was selected, and then later we
    get asserts about out-of-bounds accesses because this sitation is
    unexpected.
    
    0  ImplListBoxWindow::ImplCallSelect() (this=0x7006750) at vcl/source/control/imp_listbox.cxx:701
    1  ImplListBoxWindow::Tracking(TrackingEvent const&) (this=0x7006750, rTEvt=...) at vcl/source/control/imp_listbox.cxx:1186
    2  vcl::Window::EndTracking(TrackingEventFlags) (this=0x7006750, nFlags=TrackingEventFlags::NONE) at vcl/source/window/window2.cxx:307
    3  ImplHandleMouseEvent(VclPtr<vcl::Window> const&, MouseNotifyEvent, bool, long, long, unsigned long, unsigned short, MouseEventModifiers) (xWindow=..., nSVEvent=MouseNotifyEvent::MOUSEBUTTONUP, bMouseLeave=false, nX=191, nY=292, nMsgTime=157599233, nCode=1, nMode=(MouseEventModifiers::SIMPLECLICK | MouseEventModifiers::SELECT)) at vcl/source/window/winproc.cxx:715
    4  ImplHandleSalMouseButtonUp(vcl::Window*, SalMouseEvent const*) (pWindow=0x6ffc300, pEvent=0x7ffea6457a70) at vcl/source/window/winproc.cxx:2072
    
    Change-Id: I2c23889ea1bbb9a20c948d31b04bf22b68a62248
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87539
    Tested-by: Michael Stahl <michael.stahl at cib.de>
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 8b1d165520dc..6096dbd09ba0 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -3053,6 +3053,9 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f
 
 void GtkSalFrame::signalSetFocus(GtkWindow*, GtkWidget* pWidget, gpointer frame)
 {
+    // do not propagate focus get/lose if floats are open
+    if (m_nFloats)
+        return;
     // change of focus between native widgets within the toplevel
     GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
     // tdf#129634 interpret losing focus as focus passing explicitly to another widget


More information about the Libreoffice-commits mailing list