summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2018-05-22 19:32:25 +0300
committerJustin Luth <justin_luth@sil.org>2018-07-02 09:53:24 +0200
commit6fffd09833a5bd602b0117f48656afd07fd40f41 (patch)
tree1c6c80bab8af8e2f172c7fb4e72e4438de310ac3
parent391134e4cc0cf444ac50c6df02073de57ad9c466 (diff)
tdf#109190 sd: only MakeVisible on mouseclick-up
Since MakeVisible is called on both mousebuttom-down and mousebuttom-up, this also eliminates useless double-processing. In the problematic use case, the user pressed Ctrl-A to select a tall table. When clicking to de-select the cells, the contents moved around in unexpected ways because the rectangle is at the end of the selection during down-click, not at the cursor location. The re-arrangment of the screen invalidates the mouse-up, so the intended cursor position shifted. In the bug's calendar example, position the screen so that items 20-31 are hidden, select the whole month, and then click on 5. Before, it would move the screen down to show 31, and the cursor would be placed at the screen position where 5 had originally been. Solved by only repositioning on mouse-click up. However, mouseButtonDown must still be honoured while selecting, otherwise you can't select off-screen content with the mouse. Change-Id: I41c90a7b113dc59a3c8c385139a5bb41993646fa Reviewed-on: https://gerrit.libreoffice.org/56262 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
-rw-r--r--sd/source/ui/inc/DrawViewShell.hxx4
-rw-r--r--sd/source/ui/view/drviews4.cxx7
-rw-r--r--sd/source/ui/view/drviewsh.cxx2
3 files changed, 12 insertions, 1 deletions
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index 37afa1bcb039..b8f1dab8f038 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -114,6 +114,8 @@ public:
virtual void MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin) override;
virtual void MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin) override;
virtual void Command(const CommandEvent& rCEvt, ::sd::Window* pWin) override;
+ bool IsMouseButtonDown() { return mbMouseButtonDown; }
+ bool IsMouseSelecting() { return mbMouseSelecting; }
virtual void Resize() override;
@@ -443,6 +445,8 @@ private:
css::uno::Reference< css::lang::XEventListener > mxScannerListener;
rtl::Reference<TransferableClipboardListener> mxClipEvtLstnr;
bool mbPastePossible;
+ bool mbMouseButtonDown;
+ bool mbMouseSelecting;
virtual void Notify (SfxBroadcaster& rBC, const SfxHint& rHint) override;
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index 9356034fa8b1..41f387897f56 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -269,6 +269,7 @@ void DrawViewShell::FreshNavigatrTree()
void DrawViewShell::MouseButtonDown(const MouseEvent& rMEvt,
::sd::Window* pWin)
{
+ mbMouseButtonDown = true;
// We have to check if a context menu is shown and we have an UI
// active inplace client. In that case we have to ignore the mouse
// button down event. Otherwise we would crash (context menu has been
@@ -300,6 +301,9 @@ void DrawViewShell::MouseButtonDown(const MouseEvent& rMEvt,
void DrawViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)
{
+ if ( IsMouseButtonDown() )
+ mbMouseSelecting = true;
+
if ( !IsInputLocked() )
{
if ( mpDrawView->IsAction() )
@@ -409,6 +413,8 @@ void DrawViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)
void DrawViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin)
{
+ mbMouseButtonDown = false;
+
if ( !IsInputLocked() )
{
bool bIsSetPageOrg = mpDrawView->IsSetPageOrg();
@@ -446,6 +452,7 @@ void DrawViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin)
//else the corresponding entry is set false .
FreshNavigatrTree();
}
+ mbMouseSelecting = false;
}
void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin)
diff --git a/sd/source/ui/view/drviewsh.cxx b/sd/source/ui/view/drviewsh.cxx
index 54915188b498..bbdcc47c66da 100644
--- a/sd/source/ui/view/drviewsh.cxx
+++ b/sd/source/ui/view/drviewsh.cxx
@@ -58,7 +58,7 @@ void DrawViewShell::GotoBookmark(const OUString& rBookmark)
void DrawViewShell::MakeVisible(const ::tools::Rectangle& rRect, vcl::Window& rWin)
{
- if ( SlideShow::IsRunning( GetViewShellBase() ) )
+ if ( (IsMouseButtonDown() && !IsMouseSelecting()) || SlideShow::IsRunning( GetViewShellBase() ) )
return;
// tdf#98646 check if Rectangle which contains the bounds of the region to