include/vcl/toolkit/edit.hxx | 1 + sw/source/ui/table/autoformatpreview.cxx | 9 ++++----- vcl/source/control/edit.cxx | 22 ++++++++++++++++++++++ vcl/source/control/spinfld.cxx | 8 ++------ vcl/source/window/brdwin.cxx | 17 ++++++++++------- 5 files changed, 39 insertions(+), 18 deletions(-)
New commits: commit e73f779f46cb709c2c7de7f0b6d217195ccb5a4f Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Oct 7 17:31:40 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Oct 7 20:25:41 2022 +0200 set the background before setting the DrawMode so we get the document color set even in HighContrast mode Change-Id: I40a009cb473cc7e033f2be77488c081067fef69d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141088 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/ui/table/autoformatpreview.cxx b/sw/source/ui/table/autoformatpreview.cxx index 2a2318252c9f..e04fffefcae4 100644 --- a/sw/source/ui/table/autoformatpreview.cxx +++ b/sw/source/ui/table/autoformatpreview.cxx @@ -432,6 +432,10 @@ void AutoFormatPreview::Paint(vcl::RenderContext& rRenderContext, const tools::R { rRenderContext.Push(vcl::PushFlags::ALL); + const Color& rWinColor = SW_MOD()->GetColorConfig().GetColorValue(::svtools::DOCCOLOR).nColor; + rRenderContext.SetBackground(Wallpaper(rWinColor)); + rRenderContext.Erase(); + DrawModeFlags nOldDrawMode = rRenderContext.GetDrawMode(); if (rRenderContext.GetSettings().GetStyleSettings().GetHighContrastMode()) rRenderContext.SetDrawMode(DrawModeFlags::SettingsLine | DrawModeFlags::SettingsFill @@ -441,12 +445,7 @@ void AutoFormatPreview::Paint(vcl::RenderContext& rRenderContext, const tools::R vcl::Font aFont(rRenderContext.GetFont()); aFont.SetTransparent(true); - rRenderContext.SetFont(aFont); - rRenderContext.SetLineColor(); - const Color& rWinColor = SW_MOD()->GetColorConfig().GetColorValue(::svtools::DOCCOLOR).nColor; - rRenderContext.SetBackground(Wallpaper(rWinColor)); - rRenderContext.SetFillColor(rWinColor); // Draw the Frame Color oldColor = rRenderContext.GetLineColor(); commit 4cb11d8a6682fecd661b926a417ae7f26f76e7db Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Oct 7 16:40:23 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Oct 7 20:25:21 2022 +0200 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 <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> 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)