vcl/source/control/edit.cxx | 14 ++++---------- vcl/source/control/imp_listbox.cxx | 10 ++++------ vcl/source/control/spinfld.cxx | 4 +--- vcl/source/window/brdwin.cxx | 11 +---------- vcl/win/gdi/salnativewidgets-luna.cxx | 17 ++++++++++++++++- 5 files changed, 26 insertions(+), 30 deletions(-)
New commits: commit 8bc5c3bfdb5717f4bff0a513c5c2d17cd728771d Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Oct 7 16:13:17 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Oct 7 20:24:51 2022 +0200 Related: tdf#98067 use EP_EDITBORDER_NOSCROLL for Edits which gives a border which indicates if the Edit has focus or not. In High Contrast Black this is a bright yellow and I see it in notepad and visual studio, so lets do that too. MultilineEdit left alone for now Change-Id: I6785e3cdef7d563509a3a6ea8617ab5f89602a6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141085 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 29b25a7205ad..70c29cff95b1 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -1876,11 +1876,8 @@ void Edit::GetFocus() ImplShowCursor(); - // FIXME: this is currently only on macOS - // check for other platforms that need similar handling - if( ImplGetSVData()->maNWFData.mbNoFocusRects && - IsNativeWidgetEnabled() && - IsNativeControlSupported( ControlType::Editbox, ControlPart::Entire ) ) + if (IsNativeWidgetEnabled() && + IsNativeControlSupported( ControlType::Editbox, ControlPart::Entire )) { ImplInvalidateOutermostBorder( mbIsSubEdit ? GetParent() : this ); } @@ -1903,11 +1900,8 @@ void Edit::LoseFocus() { if ( !mpSubEdit ) { - // FIXME: this is currently only on macOS - // check for other platforms that need similar handling - if( ImplGetSVData()->maNWFData.mbNoFocusRects && - IsNativeWidgetEnabled() && - IsNativeControlSupported( ControlType::Editbox, ControlPart::Entire ) ) + if (IsNativeWidgetEnabled() && + IsNativeControlSupported(ControlType::Editbox, ControlPart::Entire)) { ImplInvalidateOutermostBorder( mbIsSubEdit ? GetParent() : this ); } diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index 033f477a9185..531244925062 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -2769,9 +2769,8 @@ void ImplWin::Resize() void ImplWin::GetFocus() { ShowFocus( maFocusRect ); - if( ImplGetSVData()->maNWFData.mbNoFocusRects && - IsNativeWidgetEnabled() && - IsNativeControlSupported( ControlType::Listbox, ControlPart::Entire ) ) + if (IsNativeWidgetEnabled() && + IsNativeControlSupported(ControlType::Listbox, ControlPart::Entire)) { vcl::Window* pWin = GetParent()->GetWindow( GetWindowType::Border ); if( ! pWin ) @@ -2786,9 +2785,8 @@ void ImplWin::GetFocus() void ImplWin::LoseFocus() { HideFocus(); - if( ImplGetSVData()->maNWFData.mbNoFocusRects && - IsNativeWidgetEnabled() && - IsNativeControlSupported( ControlType::Listbox, ControlPart::Entire ) ) + if (IsNativeWidgetEnabled() && + IsNativeControlSupported( ControlType::Listbox, ControlPart::Entire)) { vcl::Window* pWin = GetParent()->GetWindow( GetWindowType::Border ); if( ! pWin ) diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 51d66131160a..56d26d81c8f8 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -870,9 +870,7 @@ bool SpinField::PreNotify(NotifyEvent& rNEvt) tools::Rectangle* pLastRect = ImplFindPartRect( GetLastPointerPosPixel() ); if( pRect != pLastRect || (pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow()) ) { - // FIXME: this is currently only on macOS - // check for other platforms that need similar handling - if (ImplGetSVData()->maNWFData.mbNoFocusRects && IsNativeWidgetEnabled() && + if (IsNativeWidgetEnabled() && IsNativeControlSupported(ControlType::Editbox, ControlPart::Entire)) { ImplInvalidateOutermostBorder(this); diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index 6617de6414b3..3e8ff6f332d2 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -662,17 +662,8 @@ void ImplSmallBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, c if (!mpBorderWindow->IsEnabled()) nState &= ~ControlState::ENABLED; - if (mpBorderWindow->HasFocus()) + if (mpBorderWindow->HasFocus() || pCtrl->HasFocus() || pCtrl->HasChildPathFocus()) nState |= ControlState::FOCUSED; - else if(mbNWFBorder) - { - // FIXME: this is currently only on macOS, see if other platforms can profit - - // FIXME: for macOS focus rings all controls need to support GetNativeControlRegion - // for the dropdown style - if (pCtrl->HasFocus() || pCtrl->HasChildPathFocus()) - nState |= ControlState::FOCUSED; - } bool bMouseOver = false; vcl::Window *pCtrlChild = pCtrl->GetWindow(GetWindowType::FirstChild); diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx index 331e6c36ef5b..6b676162f7d0 100644 --- a/vcl/win/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/gdi/salnativewidgets-luna.cxx @@ -721,7 +721,22 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption); } - if( ( nType == ControlType::Editbox ) || ( nType == ControlType::MultilineEditbox ) ) + if (nType == ControlType::Editbox) + { + iPart = EP_EDITBORDER_NOSCROLL; + if( !(nState & ControlState::ENABLED) ) + iState = EPSN_DISABLED; + else if( nState & ControlState::FOCUSED ) + iState = EPSN_FOCUSED; + else if( nState & ControlState::ROLLOVER ) + iState = EPSN_HOT; + else + iState = EPSN_NORMAL; + + return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption); + } + + if (nType == ControlType::MultilineEditbox) { iPart = EP_EDITTEXT; if( !(nState & ControlState::ENABLED) )