From 205313ed3727b8e6966e3be47940ef14a59afc89 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 10 Mar 2021 13:06:54 +0200 Subject: Don't unselect an existing selection on (long) press on iOS and Android A (long) press, also known as a long tap, in Collabora Online (as used to bring up a context menu), shows up in core as a click of the right mouse button. We don't want that to cause an existing selection to be unselected. This fixes https://github.com/CollaboraOnline/online/issues/1323 Why this problem happened only in presentation documents I have no idea. Change-Id: Iebbf71e75dcea7c39a92fd8d5dd07c368d92f163 Signed-off-by: Tor Lillqvist Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112261 Tested-by: Jenkins CollaboraOffice --- vcl/source/window/seleng.cxx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx index 41d0d5f89ec9..c8ee805b7354 100644 --- a/vcl/source/window/seleng.cxx +++ b/vcl/source/window/seleng.cxx @@ -256,6 +256,12 @@ bool SelectionEngine::SelMouseButtonUp( const MouseEvent& rMEvt ) if (!rMEvt.IsRight()) ReleaseMouse(); +#if defined IOS || defined ANDROID + const bool bDoMessWithSelection = !rMEvt.IsRight(); +#else + constexpr bool bDoMessWithSelection = true; +#endif + if( (nFlags & SelectionEngineFlags::WAIT_UPEVT) && !(nFlags & SelectionEngineFlags::CMDEVT) && eSelMode != SelectionMode::Single) { @@ -271,13 +277,16 @@ bool SelectionEngine::SelMouseButtonUp( const MouseEvent& rMEvt ) } pFunctionSet->DeselectAtPoint( aLastMove.GetPosPixel() ); nFlags &= ~SelectionEngineFlags::HAS_ANCH; // uncheck anchor - pFunctionSet->SetCursorAtPoint( aLastMove.GetPosPixel(), true ); + if (bDoMessWithSelection) + pFunctionSet->SetCursorAtPoint( aLastMove.GetPosPixel(), true ); } else { - pFunctionSet->DeselectAll(); + if (bDoMessWithSelection) + pFunctionSet->DeselectAll(); nFlags &= ~SelectionEngineFlags::HAS_ANCH; // uncheck anchor - pFunctionSet->SetCursorAtPoint( aLastMove.GetPosPixel() ); + if (bDoMessWithSelection) + pFunctionSet->SetCursorAtPoint( aLastMove.GetPosPixel() ); } } -- cgit