diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-02-18 17:22:31 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-02-18 21:24:43 +0100 |
commit | 422a8c3218b484817a8723b57fe9845d6abb83f4 (patch) | |
tree | f437367d1ed111060558e05f289dc2889528408d /svtools/source | |
parent | c56e0c791a79dc414108e1b2fbf0f7eb38657f10 (diff) |
update DataBrowser has-focus when child widget loses focus
similar to tdf#135641 case, focus-out becomes an issue with
the bibliography editor if focus-in is seen on clicking in a cell,
then click in a GtkEntry and tab around in a circle. Without this
lose-focus support focus will be grabbed back to the cell of the
initial click on a circuit of the focus-cycle
Change-Id: I36288ed21dc4357c077f8dee55b55abf2457c2a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111157
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools/source')
-rw-r--r-- | svtools/source/brwbox/brwbox2.cxx | 4 | ||||
-rw-r--r-- | svtools/source/brwbox/ebbcontrols.cxx | 20 | ||||
-rw-r--r-- | svtools/source/brwbox/editbrowsebox.cxx | 11 |
3 files changed, 29 insertions, 6 deletions
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index 3ad89e4a4bbc..e52421f9cdcd 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -1690,6 +1690,10 @@ void BrowseBox::ChildFocusIn() { } +void BrowseBox::ChildFocusOut() +{ +} + void BrowseBox::Dispatch( sal_uInt16 nId ) { diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx index db614a86c31c..35fb994daaea 100644 --- a/svtools/source/brwbox/ebbcontrols.cxx +++ b/svtools/source/brwbox/ebbcontrols.cxx @@ -31,6 +31,7 @@ namespace svt m_xWidget->connect_changed(LINK(this, ComboBoxControl, SelectHdl)); m_xWidget->connect_key_press(LINK(this, ControlBase, KeyInputHdl)); m_xWidget->connect_focus_in(LINK(this, ControlBase, FocusInHdl)); + m_xWidget->connect_focus_out(LINK(this, ControlBase, FocusOutHdl)); } void ComboBoxControl::dispose() @@ -117,6 +118,7 @@ namespace svt m_xWidget->connect_changed(LINK(this, ListBoxControl, SelectHdl)); m_xWidget->connect_key_press(LINK(this, ControlBase, KeyInputHdl)); m_xWidget->connect_focus_in(LINK(this, ControlBase, FocusInHdl)); + m_xWidget->connect_focus_out(LINK(this, ControlBase, FocusOutHdl)); } void ListBoxControl::dispose() @@ -186,6 +188,7 @@ namespace svt InitControlBase(m_xBox.get()); m_xBox->connect_key_press(LINK(this, ControlBase, KeyInputHdl)); m_xBox->connect_focus_in(LINK(this, ControlBase, FocusInHdl)); + m_xBox->connect_focus_out(LINK(this, ControlBase, FocusOutHdl)); m_xBox->connect_toggled(LINK(this, CheckBoxControl, OnToggle)); } @@ -338,6 +341,7 @@ namespace svt m_pEntry->set_width_chars(1); // so a smaller than default width can be used m_pEntry->connect_key_press(LINK(this, ControlBase, KeyInputHdl)); m_pEntry->connect_focus_in(LINK(this, ControlBase, FocusInHdl)); + connect_focus_out(LINK(this, ControlBase, FocusOutHdl)); } bool ControlBase::ProcessKey(const KeyEvent& rKEvt) @@ -355,6 +359,11 @@ namespace svt return static_cast<BrowserDataWin*>(GetParent())->GetParent()->ChildFocusIn(); } + IMPL_LINK_NOARG(ControlBase, FocusOutHdl, weld::Widget&, void) + { + return static_cast<BrowserDataWin*>(GetParent())->GetParent()->ChildFocusOut(); + } + void EditControlBase::dispose() { m_pEntry = nullptr; @@ -392,6 +401,11 @@ namespace svt get_formatter().connect_changed(rLink); } + void FormattedControlBase::connect_focus_out(const Link<weld::Widget&, void>& rLink) + { + get_formatter().connect_focus_out(rLink); + } + weld::EntryFormatter& FormattedControlBase::get_formatter() { return *m_xEntryFormatter; @@ -530,6 +544,11 @@ namespace svt m_xEntryFormatter->connect_changed(rLink); } + void PatternControl::connect_focus_out(const Link<weld::Widget&, void>& rLink) + { + m_xEntryFormatter->connect_focus_out(rLink); + } + void PatternControl::dispose() { m_xEntryFormatter.reset(); @@ -618,6 +637,7 @@ namespace svt InitControlBase(m_xWidget.get()); m_xWidget->connect_key_press(LINK(this, ControlBase, KeyInputHdl)); m_xWidget->connect_focus_in(LINK(this, ControlBase, FocusInHdl)); + m_xWidget->connect_focus_out(LINK(this, ControlBase, FocusOutHdl)); // so any the natural size doesn't have an effect m_xWidget->set_size_request(1, 1); } diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index 71126b5a3f4b..236897d0d96e 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -160,7 +160,6 @@ namespace svt nEditCol = 0; } - VclPtr<BrowserHeader> EditBrowseBox::CreateHeaderBar(BrowseBox* pParent) { pHeader = imp_CreateHeaderBar(pParent); @@ -169,20 +168,17 @@ namespace svt return pHeader; } - VclPtr<BrowserHeader> EditBrowseBox::imp_CreateHeaderBar(BrowseBox* pParent) { return VclPtr<EditBrowserHeader>::Create(pParent); } - void EditBrowseBox::LoseFocus() { BrowseBox::LoseFocus(); DetermineFocus(); } - void EditBrowseBox::GetFocus() { BrowseBox::GetFocus(); @@ -195,14 +191,12 @@ namespace svt DetermineFocus(getRealGetFocusFlags(this)); } - bool EditBrowseBox::SeekRow(sal_Int32 nRow) { nPaintRow = nRow; return true; } - IMPL_LINK_NOARG(EditBrowseBox, StartEditHdl, void*, void) { nStartEvent = nullptr; @@ -418,6 +412,11 @@ namespace svt DetermineFocus(getRealGetFocusFlags(this)); } + void EditBrowseBox::ChildFocusOut() + { + DetermineFocus(); + } + void EditBrowseBox::MouseButtonDown(const BrowserMouseEvent& rEvt) { // absorb double clicks |