From 9b7dfb10641ba7978ffcbd1db0507163411ae027 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 9 Jun 2016 16:52:21 +0100 Subject: EndSaveFocus does nothing on the !bRestore case Change-Id: I8e199535803faf364469f9b9df46f339febe25c6 --- vcl/source/window/floatwin.cxx | 2 -- vcl/source/window/menubarwindow.cxx | 7 +++---- vcl/source/window/menufloatingwindow.cxx | 1 - vcl/source/window/window2.cxx | 12 +++--------- 4 files changed, 6 insertions(+), 16 deletions(-) (limited to 'vcl') diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 82283c94337e..20b1579b0ad3 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -803,8 +803,6 @@ void FloatingWindow::ImplEndPopupMode( FloatWinPopupEndFlags nFlags, const VclPt else { mbPopupModeTearOff = true; - if ( xFocusId != nullptr ) - Window::EndSaveFocus( xFocusId, false ); } mbPopupModeCanceled = bool(nFlags & FloatWinPopupEndFlags::Cancel); diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index 7b6c3d08de70..28a554ff8650 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -466,8 +466,6 @@ void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, bool bSelectEntry, bool b { if( !ImplGetSVData()->maWinData.mbNoSaveFocus ) { - // we didn't clean up last time - Window::EndSaveFocus( xSaveFocusId, false ); // clean up xSaveFocusId = nullptr; if( !bNoSaveFocus ) xSaveFocusId = Window::SaveFocus(); // only save focus when initially activated @@ -499,9 +497,10 @@ void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, bool bSelectEntry, bool b { VclPtr xTempFocusId = xSaveFocusId; xSaveFocusId = nullptr; - Window::EndSaveFocus( xTempFocusId, bAllowRestoreFocus ); + if (bAllowRestoreFocus) + Window::EndSaveFocus(xTempFocusId); // #105406# restore focus to document if we could not save focus before - if( bDefaultToDocument && xTempFocusId == nullptr && bAllowRestoreFocus ) + if (bDefaultToDocument && xTempFocusId == nullptr && bAllowRestoreFocus) GrabFocusToDocument(); } } diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index 16f7cc9e77f1..02b9d2f8d40b 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -401,7 +401,6 @@ void MenuFloatingWindow::StopExecute( VclPtr xFocusId ) // (could have been restored in Select) if ( xSaveFocusId != nullptr ) { - Window::EndSaveFocus( xFocusId, false ); xFocusId = xSaveFocusId; if ( xFocusId != nullptr ) { diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 2878e0ab09bc..17b48cbaba2c 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -421,17 +421,11 @@ VclPtr Window::SaveFocus() return nullptr; } -void Window::EndSaveFocus( const VclPtr& xFocusWin, bool bRestore ) +void Window::EndSaveFocus(const VclPtr& xFocusWin) { - if ( xFocusWin == nullptr ) - return; - else + if (xFocusWin && !xFocusWin->IsDisposed()) { - if ( !xFocusWin->IsDisposed() ) - { - if ( bRestore ) - xFocusWin->GrabFocus(); - } + xFocusWin->GrabFocus(); } } -- cgit