[Libreoffice-commits] core.git: dbaccess/source formula/source include/formula include/vcl sc/source svx/source sw/source vcl/source vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Apr 23 09:58:42 UTC 2021
dbaccess/source/ui/app/AppDetailView.cxx | 1 -
formula/source/ui/dlg/funcutl.cxx | 8 --------
include/formula/funcutl.hxx | 5 ++++-
include/vcl/customweld.hxx | 9 +--------
sc/source/ui/app/inputwin.cxx | 1 +
svx/source/dialog/weldeditview.cxx | 3 +++
svx/source/inc/findtextfield.hxx | 2 --
svx/source/tbxctrls/tbunosearchcontrollers.cxx | 6 ------
sw/source/ui/dbui/createaddresslistdialog.cxx | 1 -
sw/source/uibase/inc/conttree.hxx | 2 --
vcl/source/app/salvtables.cxx | 11 +----------
vcl/unx/gtk3/gtk3gtkinst.cxx | 18 ++++++++----------
12 files changed, 18 insertions(+), 49 deletions(-)
New commits:
commit db1cf111666847ce5ce93d18ae5ae8c29a4c44d6
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Apr 22 17:26:31 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Apr 23 11:58:00 2021 +0200
undo blocking emitting focus events during grab_focus
revert...
commit f97dbac73fe149e8fed0932890d0c1d6be4869a3
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 26 21:00:02 2019 +0100
infinite focus changing in toc biblio page
which blocked calling focus-changed callbacks when grab_focus is called
explicitly analogous to how we block value-changed callbacks setting
values through code but don't block them when the value is changed by
user interaction.
In retrospect that was a poor choice, so revert that and subsequent
workarounds in favour of just not calling gtk_grab_focus if the widget
already has focus.
checked:
a) tdf#138427 focus set to wrong input box
b) tdf#138078 only call GetFocus if we gained focus from an unfocused state
c) tdf#137993 ensure the toplevel vcl::Window is activated
d) tdf#136941 call focus in handler explicitly
Change-Id: I411480e2d627aa9995fb41b0aa17e9fb6d34d73f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114524
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx
index eba80dbfb4ec..6c56c6052282 100644
--- a/dbaccess/source/ui/app/AppDetailView.cxx
+++ b/dbaccess/source/ui/app/AppDetailView.cxx
@@ -84,7 +84,6 @@ void OTasksWindow::GrabFocus()
if (!m_xTreeView)
return;
m_xTreeView->grab_focus();
- FocusInHdl(*m_xTreeView);
}
bool OTasksWindow::HasChildPathFocus() const
diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx
index 361ec4c9ebaa..58c2492c5505 100644
--- a/formula/source/ui/dlg/funcutl.cxx
+++ b/formula/source/ui/dlg/funcutl.cxx
@@ -357,14 +357,6 @@ bool RefEdit::KeyInput(const KeyEvent& rKEvt)
return false;
}
-void RefEdit::GrabFocus()
-{
- bool bHadFocus = xEntry->has_focus();
- xEntry->grab_focus();
- if (!bHadFocus && xEntry->has_focus())
- GetFocus();
-}
-
void RefEdit::GetFocus()
{
maGetFocusHdl.Call(*this);
diff --git a/include/formula/funcutl.hxx b/include/formula/funcutl.hxx
index e94f29115068..f8375d4ef362 100644
--- a/include/formula/funcutl.hxx
+++ b/include/formula/funcutl.hxx
@@ -93,7 +93,10 @@ public:
Modify(*xEntry);
}
- void GrabFocus();
+ void GrabFocus()
+ {
+ xEntry->grab_focus();
+ }
void SelectAll()
{
diff --git a/include/vcl/customweld.hxx b/include/vcl/customweld.hxx
index 0bbfd46f4f94..8350c065a704 100644
--- a/include/vcl/customweld.hxx
+++ b/include/vcl/customweld.hxx
@@ -63,14 +63,7 @@ public:
}
virtual void Show() { m_pDrawingArea->show(); }
virtual void Hide() { m_pDrawingArea->hide(); }
- void GrabFocus()
- {
- bool bHadFocus = m_pDrawingArea->has_focus();
- m_pDrawingArea->grab_focus();
- // tdf#138078 only call GetFocus if we gained focus from an unfocused state
- if (!bHadFocus && m_pDrawingArea->has_focus())
- GetFocus();
- }
+ void GrabFocus() { m_pDrawingArea->grab_focus(); }
bool HasFocus() const { return m_pDrawingArea->has_focus(); }
bool IsVisible() const { return m_pDrawingArea->get_visible(); }
bool IsReallyVisible() const { return m_pDrawingArea->is_visible(); }
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 67c12839a4ac..8e0fdc7ce584 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -2127,6 +2127,7 @@ void ScTextWnd::StyleUpdated()
void ScTextWnd::TextGrabFocus()
{
GrabFocus();
+ GetFocus();
}
// Position window
diff --git a/svx/source/dialog/weldeditview.cxx b/svx/source/dialog/weldeditview.cxx
index 75b1707591e1..5c6c81c9aa60 100644
--- a/svx/source/dialog/weldeditview.cxx
+++ b/svx/source/dialog/weldeditview.cxx
@@ -192,7 +192,10 @@ bool WeldEditView::MouseButtonDown(const MouseEvent& rMEvt)
CaptureMouse();
if (!HasFocus())
+ {
GrabFocus();
+ GetFocus();
+ }
EditView* pEditView = GetEditView();
return pEditView && pEditView->MouseButtonDown(rMEvt);
diff --git a/svx/source/inc/findtextfield.hxx b/svx/source/inc/findtextfield.hxx
index 7ff507f8aac4..bce8b5589e16 100644
--- a/svx/source/inc/findtextfield.hxx
+++ b/svx/source/inc/findtextfield.hxx
@@ -39,8 +39,6 @@ public:
virtual ~FindTextFieldControl() override;
- virtual void GetFocus() override;
-
void Remember_Impl(const OUString& rStr);
void SetTextToSelected_Impl();
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index 3e38304727c7..c75c3edb03ef 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -405,12 +405,6 @@ void FindTextFieldControl::set_entry_message_type(weld::EntryMessageType eType)
m_xWidget->set_entry_message_type(eType);
}
-void FindTextFieldControl::GetFocus()
-{
- InterimItemWindow::GetFocus();
- FocusIn();
-}
-
namespace {
class SearchToolbarControllersManager
diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx
index e910fc476a61..969bff35d7ad 100644
--- a/sw/source/ui/dbui/createaddresslistdialog.cxx
+++ b/sw/source/ui/dbui/createaddresslistdialog.cxx
@@ -206,7 +206,6 @@ void SwAddressControl_Impl::SetCursorTo(std::size_t nElement)
{
weld::Entry* pEdit = m_aLines[nElement]->m_xEntry.get();
pEdit->grab_focus();
- GotFocusHdl_Impl(*pEdit);
}
}
diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx
index 496a7f602858..f572bc76a983 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -252,7 +252,6 @@ public:
void grab_focus()
{
m_xTreeView->grab_focus();
- FocusInHdl(*m_xTreeView);
}
void set_selection_mode(SelectionMode eMode)
@@ -338,7 +337,6 @@ public:
void grab_focus()
{
m_xTreeView->grab_focus();
- FocusInHdl(*m_xTreeView);
}
void set_selection_mode(SelectionMode eMode)
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index e381aeb2e64d..eb45ba39adbd 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -270,12 +270,7 @@ void SalInstanceWidget::set_can_focus(bool bCanFocus)
m_xWidget->SetStyle(nStyle);
}
-void SalInstanceWidget::grab_focus()
-{
- disable_notify_events();
- m_xWidget->GrabFocus();
- enable_notify_events();
-}
+void SalInstanceWidget::grab_focus() { m_xWidget->GrabFocus(); }
bool SalInstanceWidget::has_focus() const { return m_xWidget->HasFocus(); }
@@ -577,8 +572,6 @@ SystemWindow* SalInstanceWidget::getSystemWindow() { return m_xWidget->GetSystem
void SalInstanceWidget::HandleEventListener(VclWindowEvent& rEvent)
{
- if (notify_events_disabled())
- return;
if (rEvent.GetId() == VclEventId::WindowGetFocus)
m_aFocusInHdl.Call(*this);
else if (rEvent.GetId() == VclEventId::WindowLoseFocus)
@@ -1206,11 +1199,9 @@ void SalInstanceContainer::move(weld::Widget* pWidget, weld::Container* pNewPare
void SalInstanceContainer::child_grab_focus()
{
- disable_notify_events();
m_xContainer->GrabFocus();
if (vcl::Window* pFirstChild = m_xContainer->ImplGetDlgWindow(0, GetDlgWindowType::First))
pFirstChild->ImplControlFocus();
- enable_notify_events();
}
void SalInstanceContainer::recursively_unset_default_buttons()
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index f97ba43c1579..9d510da1838c 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2584,9 +2584,9 @@ public:
virtual void grab_focus() override
{
- disable_notify_events();
+ if (has_focus())
+ return;
gtk_widget_grab_focus(m_pWidget);
- enable_notify_events();
}
virtual bool has_focus() const override
@@ -3833,7 +3833,6 @@ public:
virtual void child_grab_focus() override
{
- disable_notify_events();
gtk_widget_grab_focus(m_pWidget);
bool bHasFocusChild = gtk_container_get_focus_child(m_pContainer);
if (!bHasFocusChild)
@@ -3849,7 +3848,6 @@ public:
}
if (bHasFocusChild)
gtk_widget_child_focus(gtk_container_get_focus_child(GTK_CONTAINER(m_pWidget)), GTK_DIR_TAB_FORWARD);
- enable_notify_events();
}
virtual void move(weld::Widget* pWidget, weld::Container* pNewParent) override
@@ -8968,7 +8966,8 @@ public:
virtual void grab_focus() override
{
- disable_notify_events();
+ if (has_focus())
+ return;
gtk_widget_grab_focus(m_pWidget);
bool bHasFocusChild = gtk_container_get_focus_child(GTK_CONTAINER(m_pWidget));
if (!bHasFocusChild)
@@ -8981,7 +8980,6 @@ public:
}
if (bHasFocusChild)
gtk_widget_child_focus(gtk_container_get_focus_child(GTK_CONTAINER(m_pWidget)), GTK_DIR_TAB_FORWARD);
- enable_notify_events();
}
virtual ~GtkInstanceToolbar() override
@@ -9617,9 +9615,9 @@ public:
virtual void grab_focus() override
{
- disable_notify_events();
+ if (has_focus())
+ return;
gtk_entry_grab_focus_without_selecting(m_pEntry);
- enable_notify_events();
}
virtual void set_alignment(TxtAlign eXAlign) override
@@ -15958,12 +15956,12 @@ public:
virtual void grab_focus() override
{
- disable_notify_events();
+ if (has_focus())
+ return;
if (m_pEntry)
gtk_widget_grab_focus(m_pEntry);
else
gtk_widget_grab_focus(m_pToggleButton);
- enable_notify_events();
}
virtual bool has_focus() const override
More information about the Libreoffice-commits
mailing list