Kaydet (Commit) 6fffd098 authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Justin Luth

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: 's avatarJustin Luth <justin_luth@sil.org>
üst 391134e4
......@@ -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;
......
......@@ -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)
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment