[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Mar 5 01:06:19 PST 2015
sw/source/core/view/viewsh.cxx | 16 +++++++++++-----
sw/source/uibase/docvw/edtwin.cxx | 6 ------
sw/source/uibase/uno/unotxdoc.cxx | 5 +++++
3 files changed, 16 insertions(+), 11 deletions(-)
New commits:
commit 297ec052aadb7dea7e4ee22c8d16da904329cb6e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Mar 5 09:54:27 2015 +0100
sw: when tiled rendering, disable map mode of SwEditWin early
The problem was that the earlier "SwEditWin: disable map mode in
LogicMouseButtonUp/Down" commit disabled map mode only during the
handling of the mouse event, so in case a method invoked by the idle
timer used our logic coordinates later, it still performed the pixel ->
logic conversion, leading to jumping cursor after a mouse click.
Fix this by disabling map mode early, even outside the mouse handlers.
Change-Id: Ib9f194f5555536a9af21a2d66bd7345addee72c3
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 0af292a..8cd439a 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1141,11 +1141,17 @@ void SwViewShell::VisPortChgd( const SwRect &rRect)
}
}
- Point aPt( VisArea().Pos() );
- aPt.X() = -aPt.X(); aPt.Y() = -aPt.Y();
- MapMode aMapMode( GetWin()->GetMapMode() );
- aMapMode.SetOrigin( aPt );
- GetWin()->SetMapMode( aMapMode );
+ // When tiled rendering, the map mode of the window is disabled, avoid
+ // enabling it here.
+ if (!isTiledRendering())
+ {
+ Point aPt( VisArea().Pos() );
+ aPt.X() = -aPt.X(); aPt.Y() = -aPt.Y();
+ MapMode aMapMode( GetWin()->GetMapMode() );
+ aMapMode.SetOrigin( aPt );
+ GetWin()->SetMapMode( aMapMode );
+ }
+
if ( HasDrawView() )
{
Imp()->GetDrawView()->VisAreaChanged( GetWin() );
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 106c23a..6d409e6 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -6246,15 +6246,12 @@ void SwEditWin::LogicMouseButtonDown(const MouseEvent& rMouseEvent)
// When we're not doing tiled rendering, then positions must be passed as pixels.
assert(m_rView.GetWrtShell().isTiledRendering());
- bool bMap = IsMapModeEnabled();
- EnableMapMode(false);
Point aPoint = GetPointerPosPixel();
SetLastMousePos(rMouseEvent.GetPosPixel());
MouseButtonDown(rMouseEvent);
SetPointerPosPixel(aPoint);
- EnableMapMode(bMap);
}
void SwEditWin::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
@@ -6262,15 +6259,12 @@ void SwEditWin::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
// When we're not doing tiled rendering, then positions must be passed as pixels.
assert(m_rView.GetWrtShell().isTiledRendering());
- bool bMap = IsMapModeEnabled();
- EnableMapMode(false);
Point aPoint = GetPointerPosPixel();
SetLastMousePos(rMouseEvent.GetPosPixel());
MouseButtonUp(rMouseEvent);
SetPointerPosPixel(aPoint);
- EnableMapMode(bMap);
}
void SwEditWin::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark)
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 0f0cbeb..b96f82f 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3166,6 +3166,11 @@ void SwXTextDocument::initializeForTiledRendering()
if (!pView)
return;
pView->SetViewLayout(nColumns, bBookMode, true);
+
+ // Disable map mode, so that it's possible to send mouse event coordinates
+ // directly in twips.
+ SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin();
+ rEditWin.EnableMapMode(false);
}
void SwXTextDocument::registerCallback(LibreOfficeKitCallback pCallback, void* pData)
More information about the Libreoffice-commits
mailing list