diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-09-04 13:39:27 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-09-04 19:44:49 +0200 |
commit | 42d197ef301db68e56f7e45b6e36ace5fae04b4d (patch) | |
tree | 624dc9ea18f43361848e03e4cf664a0d219ad6bc /sd/source | |
parent | d0d6e43f9f9894f65a18f22a28ed0d8c0dbd2b61 (diff) |
tdf#150773: Avoid bringing loading files to front several times
The change attempts to establish this logic:
1. Honor the ForceFocusAndToFront setting uniformly: previously, it
was ignored when reusing existing windows (opening in Start Center,
in place of an empty document, or trying to open an already opened
document);
2. When ForceFocusAndToFront is set, try to activate the window as
early as possible (before loading begind), as a feedback to user,
and also to avoid situations when activation would be impossible
later (e.g., there is a timespan on Windows, during which entitled
applications can bring themselves to foreground; a lengthy loading
process can exceed that time);
3. If activated once, do not activate second time after loading ends,
to avoid nagging users who deliberately switched to other tasks.
Explicit calls to impl_makeFrameWindowVisible were removed from
impl_searchAlreadyLoaded and impl_isFrameAlreadyUsedForLoading,
because those functions are called from impl_loadContent, which makes
sure that they are followed by a call to impl_makeFrameWindowVisible
(either in impl_setResult -> impl_reactForLoadingState, or directly).
A fix to tdf#83773 was adjusted; I checked that the bug doesn't
reappear after that.
Change-Id: I4bdcf978d43016d1e8979adf2fdf108a37f6ba2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139362
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/inc/DrawViewShell.hxx | 5 | ||||
-rw-r--r-- | sd/source/ui/view/drviews1.cxx | 19 |
2 files changed, 18 insertions, 6 deletions
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index c56a0f33e604..e75570a79638 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -414,6 +414,11 @@ protected: void GetMenuStateSel(SfxItemSet& rSet); private: + /** Prevents grabbing focus while loading - see tdf#83773 that intruduced + the grabbing, and tdf#150773 that needs grabbing disabled on loading + */ + bool mbFirstTimeActivation = true; + /** This flag controls whether the layer mode is active, i.e. the layer dialog is visible. */ diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index 9f372f67e320..64440617e611 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -79,13 +79,20 @@ void DrawViewShell::Activate(bool bIsMDIActivate) { ViewShell::Activate(bIsMDIActivate); - // When the mode is switched to normal the main view shell grabs focus. - // This is done for getting cut/copy/paste commands on slides in the left - // pane (slide sorter view shell) to work properly. - SfxShell* pTopViewShell = this->GetViewShellBase().GetViewShellManager()->GetTopViewShell(); - if (pTopViewShell && pTopViewShell == this) + // tdf#150773: do not grab focus on loading + if (mbFirstTimeActivation) + mbFirstTimeActivation = false; + else { - this->GetActiveWindow()->GrabFocus(); + + // When the mode is switched to normal the main view shell grabs focus. + // This is done for getting cut/copy/paste commands on slides in the left + // pane (slide sorter view shell) to work properly. + SfxShell* pTopViewShell = GetViewShellBase().GetViewShellManager()->GetTopViewShell(); + if (pTopViewShell == this) + { + GetActiveWindow()->GrabFocus(); + } } } |