summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-04-22 17:26:31 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-08-10 20:25:33 +0200
commit87917d2b05fd2fbc3bf15ab23fbfcc73f54153ed (patch)
tree77f039cf7c4005815f64d4e2d34a3ba5fb40bf46
parent9dd52c920703b41072d82e8a1ea5c45931684bf0 (diff)
undo blocking emitting focus events during grab_focus
revert... commit f97dbac73fe149e8fed0932890d0c1d6be4869a3 Author: Caolán McNamara <caolanm@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@redhat.com> (cherry picked from commit db1cf111666847ce5ce93d18ae5ae8c29a4c44d6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120079 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--dbaccess/source/ui/app/AppDetailView.cxx1
-rw-r--r--formula/source/ui/dlg/funcutl.cxx8
-rw-r--r--include/formula/funcutl.hxx5
-rw-r--r--include/vcl/customweld.hxx9
-rw-r--r--sc/source/ui/app/inputwin.cxx1
-rw-r--r--svx/source/dialog/weldeditview.cxx3
-rw-r--r--svx/source/inc/findtextfield.hxx2
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.cxx6
-rw-r--r--sw/source/ui/dbui/createaddresslistdialog.cxx1
-rw-r--r--sw/source/uibase/inc/conttree.hxx2
-rw-r--r--vcl/source/app/salvtables.cxx9
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx16
12 files changed, 18 insertions, 45 deletions
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 4e008181eae7..4ed4b407c480 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 b19b64bf980e..64f980732dfb 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 6307eee3edd7..fadce637d2c5 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -2104,6 +2104,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 56ce13f12c3a..48819345fa55 100644
--- a/svx/source/dialog/weldeditview.cxx
+++ b/svx/source/dialog/weldeditview.cxx
@@ -137,7 +137,10 @@ bool WeldEditView::MouseButtonDown(const MouseEvent& rMEvt)
CaptureMouse();
if (!HasFocus())
+ {
GrabFocus();
+ GetFocus();
+ }
return m_xEditView && m_xEditView->MouseButtonDown(rMEvt);
}
diff --git a/svx/source/inc/findtextfield.hxx b/svx/source/inc/findtextfield.hxx
index 3e5de483c91a..982b70f69b59 100644
--- a/svx/source/inc/findtextfield.hxx
+++ b/svx/source/inc/findtextfield.hxx
@@ -37,8 +37,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 a1860eea7126..76c7d3f294be 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 bf07a8de5232..24423b909ba9 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -249,7 +249,6 @@ public:
void grab_focus()
{
m_xTreeView->grab_focus();
- FocusHdl(*m_xTreeView);
}
OUString get_selected_text() const
@@ -345,7 +344,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 317770c367c3..b50ebb6a46b6 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -260,12 +260,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(); }
@@ -547,8 +542,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)
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index f8cc467b5e0e..5dd7dc92ffd8 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2505,9 +2505,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
@@ -8703,7 +8703,8 @@ public:
virtual void grab_focus() override
{
- disable_notify_events();
+ if (has_focus())
+ return;
gtk_widget_grab_focus(m_pWidget);
if (!gtk_container_get_focus_child(GTK_CONTAINER(m_pWidget)))
{
@@ -8711,7 +8712,6 @@ public:
gtk_container_set_focus_child(GTK_CONTAINER(m_pWidget), GTK_WIDGET(pItem));
}
gtk_widget_child_focus(gtk_container_get_focus_child(GTK_CONTAINER(m_pWidget)), GTK_DIR_TAB_FORWARD);
- enable_notify_events();
}
virtual ~GtkInstanceToolbar() override
@@ -9345,9 +9345,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
@@ -15643,12 +15643,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