summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-10-07 16:40:23 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-10-07 20:25:21 +0200
commit4cb11d8a6682fecd661b926a417ae7f26f76e7db (patch)
tree06d27209082762b1ccca95d79f8f9984ee31ec55
parent8bc5c3bfdb5717f4bff0a513c5c2d17cd728771d (diff)
Related: tdf#98067 do RollOver for Edit as well as SpinButton
Change-Id: I058cc965a9b0d85e5491191e2ac712c01f700043 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141086 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/vcl/toolkit/edit.hxx1
-rw-r--r--vcl/source/control/edit.cxx22
-rw-r--r--vcl/source/control/spinfld.cxx8
-rw-r--r--vcl/source/window/brdwin.cxx17
4 files changed, 35 insertions, 13 deletions
diff --git a/include/vcl/toolkit/edit.hxx b/include/vcl/toolkit/edit.hxx
index 6cba936040eb..2291ce2d7558 100644
--- a/include/vcl/toolkit/edit.hxx
+++ b/include/vcl/toolkit/edit.hxx
@@ -161,6 +161,7 @@ public:
virtual void Command( const CommandEvent& rCEvt ) override;
virtual void StateChanged( StateChangedType nType ) override;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual bool PreNotify(NotifyEvent& rNEvt) override;
virtual void Modify();
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 70c29cff95b1..1554f846ba95 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1913,6 +1913,28 @@ void Edit::LoseFocus()
Control::LoseFocus();
}
+bool Edit::PreNotify(NotifyEvent& rNEvt)
+{
+ if (rNEvt.GetType() == NotifyEventType::MOUSEMOVE)
+ {
+ const MouseEvent* pMouseEvt = rNEvt.GetMouseEvent();
+ if (pMouseEvt && !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged())
+ {
+ // trigger redraw if mouse over state has changed
+ if (pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow())
+ {
+ if (IsNativeWidgetEnabled() &&
+ IsNativeControlSupported(ControlType::Editbox, ControlPart::Entire))
+ {
+ ImplInvalidateOutermostBorder(this);
+ }
+ }
+ }
+ }
+
+ return Control::PreNotify(rNEvt);
+}
+
void Edit::Command( const CommandEvent& rCEvt )
{
if ( rCEvt.GetCommand() == CommandEventId::ContextMenu )
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 56d26d81c8f8..973825a3a977 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -870,12 +870,8 @@ bool SpinField::PreNotify(NotifyEvent& rNEvt)
tools::Rectangle* pLastRect = ImplFindPartRect( GetLastPointerPosPixel() );
if( pRect != pLastRect || (pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow()) )
{
- if (IsNativeWidgetEnabled() &&
- IsNativeControlSupported(ControlType::Editbox, ControlPart::Entire))
- {
- ImplInvalidateOutermostBorder(this);
- }
- else
+ if (!IsNativeWidgetEnabled() ||
+ !IsNativeControlSupported(ControlType::Editbox, ControlPart::Entire))
{
// paint directly
vcl::Region aRgn( GetOutDev()->GetActiveClipRegion() );
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index 3e8ff6f332d2..0d4bdbbf5515 100644
--- a/vcl/source/window/brdwin.cxx
+++ b/vcl/source/window/brdwin.cxx
@@ -665,14 +665,17 @@ void ImplSmallBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, c
if (mpBorderWindow->HasFocus() || pCtrl->HasFocus() || pCtrl->HasChildPathFocus())
nState |= ControlState::FOCUSED;
- bool bMouseOver = false;
- vcl::Window *pCtrlChild = pCtrl->GetWindow(GetWindowType::FirstChild);
- while(pCtrlChild)
+ bool bMouseOver = pCtrl->IsMouseOver();
+ if (!bMouseOver)
{
- bMouseOver = pCtrlChild->IsMouseOver();
- if (bMouseOver)
- break;
- pCtrlChild = pCtrlChild->GetWindow(GetWindowType::Next);
+ vcl::Window *pCtrlChild = pCtrl->GetWindow(GetWindowType::FirstChild);
+ while(pCtrlChild)
+ {
+ bMouseOver = pCtrlChild->IsMouseOver();
+ if (bMouseOver)
+ break;
+ pCtrlChild = pCtrlChild->GetWindow(GetWindowType::Next);
+ }
}
if (bMouseOver)