diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-04-22 17:26:31 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-04-23 11:58:00 +0200 |
commit | db1cf111666847ce5ce93d18ae5ae8c29a4c44d6 (patch) | |
tree | 56af2730e4ecb6c907c796dc196e767904150449 /vcl | |
parent | 983c1146ac80c038feae653e8e3752a72171d6cb (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>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/salvtables.cxx | 11 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 18 |
2 files changed, 9 insertions, 20 deletions
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 |