include/vcl/window.hxx                   |    4 ----
 vcl/source/window/dndeventdispatcher.cxx |   10 +++++-----
 vcl/source/window/dockmgr.cxx            |   10 +++++-----
 vcl/source/window/dockwin.cxx            |   10 +++++-----
 vcl/source/window/mouse.cxx              |   12 ++++++------
 vcl/source/window/scrwnd.cxx             |    2 +-
 vcl/source/window/window2.cxx            |   14 ++------------
 vcl/source/window/winproc.cxx            |   14 +++++++-------
 8 files changed, 31 insertions(+), 45 deletions(-)

New commits:
commit 8fc4c3504947d0e5c34978cb8ae9bdd2a2196fd1
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Jul 18 16:28:17 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Jul 18 19:10:29 2023 +0200

    remove ImplFrameToOutput and ImplOutputToFrame
    
    in favour of ScreenToOutputPixel and OutputToScreenPixel, since their
    implementation is exactly the same
    
    Change-Id: Iede024bfc5654e3f671984620f8e88d2414003f5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154591
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index ba380cb8817d..c6ba57ef7e35 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -527,8 +527,6 @@ public:
 
     SAL_DLLPRIVATE WindowImpl*          ImplGetWindowImpl() const { return 
mpWindowImpl.get(); }
 
-    SAL_DLLPRIVATE Point                ImplFrameToOutput( const Point& rPos );
-
     SAL_DLLPRIVATE void                 ImplGrabFocus( GetFocusFlags nFlags );
     SAL_DLLPRIVATE void                 ImplGrabFocusToDocument( GetFocusFlags 
nFlags );
     SAL_DLLPRIVATE void                 ImplInvertFocus( const 
tools::Rectangle& rRect );
@@ -571,8 +569,6 @@ protected:
 
     SAL_DLLPRIVATE void                 ImplInit( vcl::Window* pParent, 
WinBits nStyle, SystemParentData* pSystemParentData );
 
-    SAL_DLLPRIVATE Point                ImplOutputToFrame( const Point& rPos );
-
     SAL_DLLPRIVATE void                 ImplInvalidateParentFrameRegion( const 
vcl::Region& rRegion );
     SAL_DLLPRIVATE void                 ImplValidateFrameRegion( const 
vcl::Region* rRegion, ValidateFlags nFlags );
     SAL_DLLPRIVATE void                 ImplValidate();
diff --git a/vcl/source/window/dndeventdispatcher.cxx 
b/vcl/source/window/dndeventdispatcher.cxx
index b8190a118fd5..a5a89928e616 100644
--- a/vcl/source/window/dndeventdispatcher.cxx
+++ b/vcl/source/window/dndeventdispatcher.cxx
@@ -263,7 +263,7 @@ sal_Int32 DNDEventDispatcher::fireDragEnterEvent( 
vcl::Window *pWindow,
         if( xDropTarget.is() )
         {
             // retrieve relative mouse position
-            Point relLoc = pWindow->ImplFrameToOutput( rLocation );
+            Point relLoc = pWindow->ScreenToOutputPixel( rLocation );
             aSolarGuard.clear();
 
             n = static_cast < DNDListenerContainer * > ( xDropTarget.get() 
)->fireDragEnterEvent(
@@ -291,7 +291,7 @@ sal_Int32 DNDEventDispatcher::fireDragOverEvent( 
vcl::Window *pWindow,
         if( xDropTarget.is() )
         {
             // retrieve relative mouse position
-            Point relLoc = pWindow->ImplFrameToOutput( rLocation );
+            Point relLoc = pWindow->ScreenToOutputPixel( rLocation );
             aSolarGuard.clear();
 
             n = static_cast < DNDListenerContainer * > ( xDropTarget.get() 
)->fireDragOverEvent(
@@ -339,7 +339,7 @@ sal_Int32 DNDEventDispatcher::fireDropActionChangedEvent( 
vcl::Window *pWindow,
         if( xDropTarget.is() )
         {
             // retrieve relative mouse position
-            Point relLoc = pWindow->ImplFrameToOutput( rLocation );
+            Point relLoc = pWindow->ScreenToOutputPixel( rLocation );
             aGuard.clear();
 
             n = static_cast < DNDListenerContainer * > ( xDropTarget.get() 
)->fireDropActionChangedEvent(
@@ -370,7 +370,7 @@ sal_Int32 DNDEventDispatcher::fireDropEvent( vcl::Window 
*pWindow,
         if( xDropTarget.is() )
         {
             // retrieve relative mouse position
-            Point relLoc = pWindow->ImplFrameToOutput( rLocation );
+            Point relLoc = pWindow->ScreenToOutputPixel( rLocation );
             aGuard.clear();
 
             n = static_cast < DNDListenerContainer * > ( xDropTarget.get() 
)->fireDropEvent(
@@ -398,7 +398,7 @@ sal_Int32 DNDEventDispatcher::fireDragGestureEvent( 
vcl::Window *pWindow,
         if( xDragGestureRecognizer.is() )
         {
             // retrieve relative mouse position
-            Point relLoc = pWindow->ImplFrameToOutput( rOrigin );
+            Point relLoc = pWindow->ScreenToOutputPixel( rOrigin );
             aGuard.clear();
 
             n = static_cast < DNDListenerContainer * > ( 
xDragGestureRecognizer.get() )->fireDragGestureEvent(
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index d64f7cd8f208..5112c322abda 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -527,7 +527,7 @@ void ImplDockingWindowWrapper::ImplStartDocking( const 
Point& rPos )
     if ( !mpFloatWin )
         pWin.disposeAndClear();
 
-    Point   aPos    = GetWindow()->ImplOutputToFrame( Point() );
+    Point   aPos    = GetWindow()->OutputToScreenPixel( Point() );
     Size    aSize   = GetWindow()->GetOutputSizePixel();
     mnTrackX        = aPos.X();
     mnTrackY        = aPos.Y();
@@ -582,7 +582,7 @@ void ImplDockingWindowWrapper::Tracking( const 
TrackingEvent& rTEvt )
     else if ( !rTEvt.GetMouseEvent().IsSynthetic() || 
rTEvt.GetMouseEvent().IsModifierChanged() )
     {
         Point   aMousePos = rTEvt.GetMouseEvent().GetPosPixel();
-        Point   aFrameMousePos = GetWindow()->ImplOutputToFrame( aMousePos );
+        Point   aFrameMousePos = GetWindow()->OutputToScreenPixel( aMousePos );
         Size    aFrameSize = 
GetWindow()->ImplGetFrameWindow()->GetOutputSizePixel();
         if ( aFrameMousePos.X() < 0 )
             aFrameMousePos.setX( 0 );
@@ -592,10 +592,10 @@ void ImplDockingWindowWrapper::Tracking( const 
TrackingEvent& rTEvt )
             aFrameMousePos.setX( aFrameSize.Width()-1 );
         if ( aFrameMousePos.Y() > aFrameSize.Height()-1 )
             aFrameMousePos.setY( aFrameSize.Height()-1 );
-        aMousePos = GetWindow()->ImplFrameToOutput( aFrameMousePos );
+        aMousePos = GetWindow()->ScreenToOutputPixel( aFrameMousePos );
         aMousePos.AdjustX( -(maMouseOff.X()) );
         aMousePos.AdjustY( -(maMouseOff.Y()) );
-        Point aPos = GetWindow()->ImplOutputToFrame( aMousePos );
+        Point aPos = GetWindow()->OutputToScreenPixel( aMousePos );
         tools::Rectangle aTrackRect( aPos, Size( mnTrackWidth, mnTrackHeight ) 
);
         tools::Rectangle aCompRect = aTrackRect;
         aPos.AdjustX(maMouseOff.X() );
@@ -631,7 +631,7 @@ void ImplDockingWindowWrapper::Tracking( const 
TrackingEvent& rTEvt )
         else
             nTrackStyle = ShowTrackFlags::Big;
         tools::Rectangle aShowTrackRect = aTrackRect;
-        aShowTrackRect.SetPos( GetWindow()->ImplFrameToOutput( 
aShowTrackRect.TopLeft() ) );
+        aShowTrackRect.SetPos( GetWindow()->ScreenToOutputPixel( 
aShowTrackRect.TopLeft() ) );
 
         GetWindow()->ShowTracking( aShowTrackRect, nTrackStyle );
 
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index b0d65fbd47d6..029438ba6ccc 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -247,7 +247,7 @@ void DockingWindow::ImplStartDocking( const Point& rPos )
     if ( !mpFloatWin )
         pWin.disposeAndClear();
 
-    Point   aPos    = ImplOutputToFrame( Point() );
+    Point   aPos    = OutputToScreenPixel( Point() );
     Size    aSize   = Window::GetOutputSizePixel();
     mnTrackX        = aPos.X();
     mnTrackY        = aPos.Y();
@@ -445,7 +445,7 @@ void DockingWindow::Tracking( const TrackingEvent& rTEvt )
     else if ( !rTEvt.GetMouseEvent().IsSynthetic() || 
rTEvt.GetMouseEvent().IsModifierChanged() )
     {
         Point   aMousePos = rTEvt.GetMouseEvent().GetPosPixel();
-        Point   aFrameMousePos = ImplOutputToFrame( aMousePos );
+        Point   aFrameMousePos = OutputToScreenPixel( aMousePos );
         Size    aFrameSize = mpWindowImpl->mpFrameWindow->GetOutputSizePixel();
         if ( aFrameMousePos.X() < 0 )
             aFrameMousePos.setX( 0 );
@@ -455,10 +455,10 @@ void DockingWindow::Tracking( const TrackingEvent& rTEvt )
             aFrameMousePos.setX( aFrameSize.Width()-1 );
         if ( aFrameMousePos.Y() > aFrameSize.Height()-1 )
             aFrameMousePos.setY( aFrameSize.Height()-1 );
-        aMousePos = ImplFrameToOutput( aFrameMousePos );
+        aMousePos = ScreenToOutputPixel( aFrameMousePos );
         aMousePos.AdjustX( -(maMouseOff.X()) );
         aMousePos.AdjustY( -(maMouseOff.Y()) );
-        Point aFramePos = ImplOutputToFrame( aMousePos );
+        Point aFramePos = OutputToScreenPixel( aMousePos );
         tools::Rectangle aTrackRect( aFramePos, Size( mnTrackWidth, 
mnTrackHeight ) );
         tools::Rectangle aCompRect = aTrackRect;
         aFramePos.AdjustX(maMouseOff.X() );
@@ -507,7 +507,7 @@ void DockingWindow::Tracking( const TrackingEvent& rTEvt )
             else
                 nTrackStyle = ShowTrackFlags::Object;
             tools::Rectangle aShowTrackRect = aTrackRect;
-            aShowTrackRect.SetPos( ImplFrameToOutput( aShowTrackRect.TopLeft() 
) );
+            aShowTrackRect.SetPos( ScreenToOutputPixel( 
aShowTrackRect.TopLeft() ) );
             ShowTracking( aShowTrackRect, nTrackStyle );
 
             // recalculate mouse offset, as the rectangle was changed
diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx
index 943543ce0d16..263c4e56fbc9 100644
--- a/vcl/source/window/mouse.cxx
+++ b/vcl/source/window/mouse.cxx
@@ -510,7 +510,7 @@ void Window::EnableChildPointerOverwrite( bool bOverwrite )
 
 void Window::SetPointerPosPixel( const Point& rPos )
 {
-    Point aPos = ImplOutputToFrame( rPos );
+    Point aPos = OutputToScreenPixel( rPos );
     const OutputDevice *pOutDev = GetOutDev();
     if( pOutDev->HasMirroredGraphics() )
     {
@@ -531,8 +531,8 @@ void Window::SetPointerPosPixel( const Point& rPos )
 void Window::SetLastMousePos(const Point& rPos)
 {
     // Do this conversion, so when GetPointerPosPixel() calls
-    // ImplFrameToOutput(), we get back the original position.
-    Point aPos = ImplOutputToFrame(rPos);
+    // ScreenToOutputPixel(), we get back the original position.
+    Point aPos = OutputToScreenPixel(rPos);
     mpWindowImpl->mpFrameData->mnLastMouseX = aPos.X();
     mpWindowImpl->mpFrameData->mnLastMouseY = aPos.Y();
 }
@@ -546,7 +546,7 @@ Point Window::GetPointerPosPixel()
         const OutputDevice *pOutDev = GetOutDev();
         pOutDev->ReMirror( aPos );
     }
-    return ImplFrameToOutput( aPos );
+    return ScreenToOutputPixel( aPos );
 }
 
 Point Window::GetLastPointerPosPixel()
@@ -558,7 +558,7 @@ Point Window::GetLastPointerPosPixel()
         const OutputDevice *pOutDev = GetOutDev();
         pOutDev->ReMirror( aPos );
     }
-    return ImplFrameToOutput( aPos );
+    return ScreenToOutputPixel( aPos );
 }
 
 void Window::ShowPointer( bool bVisible )
@@ -587,7 +587,7 @@ Window::PointerState Window::GetPointerState()
             const OutputDevice *pOutDev = GetOutDev();
             pOutDev->ReMirror( aSalPointerState.maPos );
         }
-        aState.maPos = ImplFrameToOutput( aSalPointerState.maPos );
+        aState.maPos = ScreenToOutputPixel( aSalPointerState.maPos );
         aState.mnState = aSalPointerState.mnState;
     }
     return aState;
diff --git a/vcl/source/window/scrwnd.cxx b/vcl/source/window/scrwnd.cxx
index 934dceaff7e3..9efc020a6aaa 100644
--- a/vcl/source/window/scrwnd.cxx
+++ b/vcl/source/window/scrwnd.cxx
@@ -354,7 +354,7 @@ IMPL_LINK_NOARG(ImplWheelWindow, ImplScrollHdl, Timer *, 
void)
     {
         vcl::Window*             pWindow = GetParent();
         const Point         aMousePos( pWindow->OutputToScreenPixel( 
pWindow->GetPointerPosPixel() ) );
-        Point               aCmdMousePos( pWindow->ImplFrameToOutput( 
aMousePos ) );
+        Point               aCmdMousePos( pWindow->ScreenToOutputPixel( 
aMousePos ) );
         CommandScrollData   aScrollData( mnActDeltaX, mnActDeltaY );
         CommandEvent        aCEvt( aCmdMousePos, CommandEventId::AutoScroll, 
true, &aScrollData );
         NotifyEvent         aNCmdEvt( NotifyEventType::COMMAND, pWindow, 
&aCEvt );
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 46d8bd7f8881..5e9ffd2ef529 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -235,7 +235,7 @@ IMPL_LINK( Window, ImplTrackTimerHdl, Timer*, pTimer, void )
         const OutputDevice *pOutDev = GetOutDev();
         pOutDev->ReMirror( aMousePos );
     }
-    MouseEvent      aMEvt( ImplFrameToOutput( aMousePos ),
+    MouseEvent      aMEvt( ScreenToOutputPixel( aMousePos ),
                            mpWindowImpl->mpFrameData->mnClickCount, 
MouseEventModifiers::NONE,
                            mpWindowImpl->mpFrameData->mnMouseCode,
                            mpWindowImpl->mpFrameData->mnMouseCode );
@@ -321,7 +321,7 @@ void Window::EndTracking( TrackingEventFlags nFlags )
             pOutDev->ReMirror( aMousePos );
         }
 
-        MouseEvent      aMEvt( ImplFrameToOutput( aMousePos ),
+        MouseEvent      aMEvt( ScreenToOutputPixel( aMousePos ),
                                mpWindowImpl->mpFrameData->mnClickCount, 
MouseEventModifiers::NONE,
                                mpWindowImpl->mpFrameData->mnMouseCode,
                                mpWindowImpl->mpFrameData->mnMouseCode );
@@ -970,16 +970,6 @@ void Window::ImplSetMouseTransparent( bool bTransparent )
         mpWindowImpl->mbMouseTransparent = bTransparent;
 }
 
-Point Window::ImplOutputToFrame( const Point& rPos )
-{
-    return Point( rPos.X()+GetOutDev()->mnOutOffX, 
rPos.Y()+GetOutDev()->mnOutOffY );
-}
-
-Point Window::ImplFrameToOutput( const Point& rPos )
-{
-    return Point( rPos.X()-GetOutDev()->mnOutOffX, 
rPos.Y()-GetOutDev()->mnOutOffY );
-}
-
 void Window::SetCompoundControl( bool bCompound )
 {
     if (mpWindowImpl)
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index d1d8169b11bc..11ef6f572858 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -430,7 +430,7 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& 
xWindow, NotifyEventType n
         // status did not change
         if ( pChild )
         {
-            Point aChildMousePos = pChild->ImplFrameToOutput( aMousePos );
+            Point aChildMousePos = pChild->ScreenToOutputPixel( aMousePos );
             if ( !bMouseLeave &&
                  (pChild == pWinFrameData->mpMouseMoveWin) &&
                  (aChildMousePos.X() == pWinFrameData->mnLastMouseWinX) &&
@@ -489,7 +489,7 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& 
xWindow, NotifyEventType n
                             if( xDragGestureRecognizer.is() )
                             {
                                 // retrieve mouse position relative to mouse 
down window
-                                Point relLoc = 
pMouseDownWin->ImplFrameToOutput( Point(
+                                Point relLoc = 
pMouseDownWin->ScreenToOutputPixel( Point(
                                     
pMouseDownWin->ImplGetFrameData()->mnFirstMouseX,
                                     
pMouseDownWin->ImplGetFrameData()->mnFirstMouseY ) );
 
@@ -533,7 +533,7 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& 
xWindow, NotifyEventType n
         {
             if ( pMouseMoveWin )
             {
-                Point       aLeaveMousePos = pMouseMoveWin->ImplFrameToOutput( 
aMousePos );
+                Point       aLeaveMousePos = 
pMouseMoveWin->ScreenToOutputPixel( aMousePos );
                 MouseEvent  aMLeaveEvt( aLeaveMousePos, nClicks, nMode | 
MouseEventModifiers::LEAVEWINDOW, nCode, nCode );
                 NotifyEvent aNLeaveEvt( NotifyEventType::MOUSEMOVE, 
pMouseMoveWin, &aMLeaveEvt );
                 pWinFrameData->mbInMouseMove = true;
@@ -617,7 +617,7 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& 
xWindow, NotifyEventType n
         return false;
 
     // create mouse event
-    Point aChildPos = pChild->ImplFrameToOutput( aMousePos );
+    Point aChildPos = pChild->ScreenToOutputPixel( aMousePos );
     MouseEvent aMEvt( aChildPos, nClicks, nMode, nCode, nCode );
 
 
@@ -821,7 +821,7 @@ bool ImplLOKHandleMouseEvent(const VclPtr<vcl::Window>& 
xWindow, NotifyEventType
     if (!pFrameData)
         return false;
 
-    Point aWinPos = xWindow->ImplFrameToOutput(aMousePos);
+    Point aWinPos = xWindow->ScreenToOutputPixel(aMousePos);
 
     pFrameData->mnLastMouseX = nX;
     pFrameData->mnLastMouseY = nY;
@@ -876,7 +876,7 @@ bool ImplLOKHandleMouseEvent(const VclPtr<vcl::Window>& 
xWindow, NotifyEventType
             return false;
         }
 
-        Point dragOverPos = pDragWin->ImplFrameToOutput(aMousePos);
+        Point dragOverPos = pDragWin->ScreenToOutputPixel(aMousePos);
         static_cast<DNDListenerContainer *>(xDropTarget.get())->fireDropEvent(
             xDropTargetDropContext,
             css::datatransfer::dnd::DNDConstants::ACTION_MOVE,
@@ -1499,7 +1499,7 @@ static bool ImplHandleInputContextChange( vcl::Window* 
pWindow )
 static bool ImplCallWheelCommand( const VclPtr<vcl::Window>& pWindow, const 
Point& rPos,
                                   const CommandWheelData* pWheelData )
 {
-    Point               aCmdMousePos = pWindow->ImplFrameToOutput( rPos );
+    Point               aCmdMousePos = pWindow->ScreenToOutputPixel( rPos );
     CommandEvent        aCEvt( aCmdMousePos, CommandEventId::Wheel, true, 
pWheelData );
     NotifyEvent         aNCmdEvt( NotifyEventType::COMMAND, pWindow, &aCEvt );
     bool bPreNotify = ImplCallPreNotify( aNCmdEvt );

Reply via email to