[Libreoffice-commits] core.git: vcl/inc vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Sep 8 19:27:51 UTC 2020
vcl/inc/listbox.hxx | 2 +-
vcl/source/control/combobox.cxx | 2 +-
vcl/source/control/imp_listbox.cxx | 4 +++-
vcl/source/control/listbox.cxx | 2 +-
vcl/source/control/spinfld.cxx | 3 +++
5 files changed, 9 insertions(+), 4 deletions(-)
New commits:
commit d05c1459f5b8150654ca0b7098cc331ba6009e07
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Sep 8 15:21:10 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Sep 8 21:27:08 2020 +0200
tdf#136208 make combo/list/spin take focus on use of scroll wheel
So using the scrollwheel on those widgets when they do not have focus will
cause then to take focus. That will then cause the fontsize/fontname widgets to
reset back to the current document size/name if they are scrolled to a new
value, but their new value not explicitly applied to the current document,
when focus is restored to the document window.
Change-Id: I5d27e5e90c4d76d9cb3321878d82e22d40cacf81
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102261
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/inc/listbox.hxx b/vcl/inc/listbox.hxx
index 0485001216b0..4d714e418d81 100644
--- a/vcl/inc/listbox.hxx
+++ b/vcl/inc/listbox.hxx
@@ -427,7 +427,7 @@ public:
sal_Int32 GetCurrentPos() const { return maLBWindow->GetCurrentPos(); }
bool ProcessKeyInput( const KeyEvent& rKEvt ) { return maLBWindow->ProcessKeyInput( rKEvt ); }
- bool HandleWheelAsCursorTravel( const CommandEvent& rCEvt );
+ bool HandleWheelAsCursorTravel(const CommandEvent& rCEvt, Control& rControl);
/**
* Removes existing separators, and sets the position of the
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 00764d68bf12..b5b14d833d9d 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -784,7 +784,7 @@ bool ComboBox::EventNotify( NotifyEvent& rNEvt )
)
)
{
- bDone = m_pImpl->m_pImplLB->HandleWheelAsCursorTravel( *rNEvt.GetCommandEvent() );
+ bDone = m_pImpl->m_pImplLB->HandleWheelAsCursorTravel(*rNEvt.GetCommandEvent(), *this);
}
else
{
diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx
index e25a506c6a48..a11d0eb8ba7c 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -2402,7 +2402,7 @@ const Wallpaper& ImplListBox::GetDisplayBackground() const
return maLBWindow->GetDisplayBackground();
}
-bool ImplListBox::HandleWheelAsCursorTravel( const CommandEvent& rCEvt )
+bool ImplListBox::HandleWheelAsCursorTravel(const CommandEvent& rCEvt, Control& rControl)
{
bool bDone = false;
if ( rCEvt.GetCommand() == CommandEventId::Wheel )
@@ -2410,6 +2410,8 @@ bool ImplListBox::HandleWheelAsCursorTravel( const CommandEvent& rCEvt )
const CommandWheelData* pData = rCEvt.GetWheelData();
if( !pData->GetModifier() && ( pData->GetMode() == CommandWheelMode::SCROLL ) )
{
+ if (!rControl.HasChildPathFocus())
+ rControl.GrabFocus();
sal_uInt16 nKey = ( pData->GetDelta() < 0 ) ? KEY_DOWN : KEY_UP;
KeyEvent aKeyEvent( 0, vcl::KeyCode( nKey ) );
bDone = ProcessKeyInput( aKeyEvent );
diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx
index fbada6496e89..a82e4ce0fb11 100644
--- a/vcl/source/control/listbox.cxx
+++ b/vcl/source/control/listbox.cxx
@@ -883,7 +883,7 @@ bool ListBox::PreNotify( NotifyEvent& rNEvt )
)
)
{
- bDone = mpImplLB->HandleWheelAsCursorTravel( *rNEvt.GetCommandEvent() );
+ bDone = mpImplLB->HandleWheelAsCursorTravel(*rNEvt.GetCommandEvent(), *this);
}
else
{
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index d9298ae1598a..f63c037d6e9d 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -554,6 +554,9 @@ bool SpinField::EventNotify(NotifyEvent& rNEvt)
else
Up();
bDone = true;
+
+ if (!HasChildPathFocus())
+ GrabFocus();
}
}
else
More information about the Libreoffice-commits
mailing list