From c49282861fa8c774cd8f8d08932db04425a43ee6 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 18 Sep 2002 15:28:36 +0000 Subject: [PATCH] #103360# mirror geometry on demand --- vcl/source/gdi/salgdilayout.cxx | 24 ++++++++++++++++++++++-- vcl/unx/source/app/i18n_status.cxx | 6 +++--- vcl/unx/source/app/wmadaptor.cxx | 14 +++++++------- vcl/unx/source/window/salframe.cxx | 27 ++++++++++++++++++--------- 4 files changed, 50 insertions(+), 21 deletions(-) diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index bb45e069d82a..e8af5a08610a 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -2,9 +2,9 @@ * * $RCSfile: salgdilayout.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: ssa $ $Date: 2002-09-09 16:30:12 $ + * last change: $Author: pl $ $Date: 2002-09-18 16:28:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -155,6 +155,26 @@ #define IS_NOTRTL_ENABLED() ( pOutDev && !pOutDev->IsRTLEnabled() ) + +// ---------------------------------------------------------------------------- +// The only common SalFrame method +// ---------------------------------------------------------------------------- + +SalFrameGeometry SalFrame::GetGeometry() +{ + // mirror frame coordinates at parent + SalFrame *pParent = GetParent(); + if( pParent && Application::GetSettings().GetLayoutRTL() ) + { + SalFrameGeometry aGeom = maGeometry; + int parent_x = aGeom.nX - pParent->maGeometry.nX; + aGeom.nX = pParent->maGeometry.nX + pParent->maGeometry.nWidth - maGeometry.nWidth - parent_x; + return aGeom; + } + else + return maGeometry; +} + // ---------------------------------------------------------------------------- SalGraphicsLayout::SalGraphicsLayout() : SalGraphics() diff --git a/vcl/unx/source/app/i18n_status.cxx b/vcl/unx/source/app/i18n_status.cxx index a4a70e9f34c5..7eb210aeaec2 100644 --- a/vcl/unx/source/app/i18n_status.cxx +++ b/vcl/unx/source/app/i18n_status.cxx @@ -2,9 +2,9 @@ * * $RCSfile: i18n_status.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: hr $ $Date: 2002-08-27 13:14:05 $ + * last change: $Author: pl $ $Date: 2002-09-18 16:28:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -336,7 +336,7 @@ IIIMPStatusWindow::IIIMPStatusWindow( SalFrame* pParent ) : const SystemEnvData* pEnvData = GetSystemData(); const SystemEnvData* pParentEnvData = pParent->GetSystemData(); - const SalFrameGeometry& rGeom( pParent->GetGeometry() ); + const SalFrameGeometry& rGeom( pParent->GetUnmirroredGeometry() ); int nDistance = rGeom.nTopDecoration; if( nDistance < 20 ) nDistance = 20; diff --git a/vcl/unx/source/app/wmadaptor.cxx b/vcl/unx/source/app/wmadaptor.cxx index cd1371e622fb..c4bc2c02bf5a 100644 --- a/vcl/unx/source/app/wmadaptor.cxx +++ b/vcl/unx/source/app/wmadaptor.cxx @@ -2,9 +2,9 @@ * * $RCSfile: wmadaptor.cxx,v $ * - * $Revision: 1.36 $ + * $Revision: 1.37 $ * - * last change: $Author: pl $ $Date: 2002-07-30 07:35:51 $ + * last change: $Author: pl $ $Date: 2002-09-18 16:28:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1088,7 +1088,7 @@ void NetWMAdaptor::setNetWMState( SalFrame* pFrame ) const } } Rectangle aPosSize = m_aWMWorkAreas[nCurrent]; - const SalFrameGeometry& rGeom( pFrame->GetGeometry() ); + const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() ); aPosSize = Rectangle( Point( aPosSize.Left() + rGeom.nLeftDecoration, aPosSize.Top() + rGeom.nTopDecoration ), Size( aPosSize.GetWidth() @@ -1197,7 +1197,7 @@ void GnomeWMAdaptor::setGnomeWMState( SalFrame* pFrame ) const } } Rectangle aPosSize = m_aWMWorkAreas[nCurrent]; - const SalFrameGeometry& rGeom( pFrame->GetGeometry() ); + const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() ); aPosSize = Rectangle( Point( aPosSize.Left() + rGeom.nLeftDecoration, aPosSize.Top() + rGeom.nTopDecoration ), Size( aPosSize.GetWidth() @@ -1360,7 +1360,7 @@ void WMAdaptor::maximizeFrame( SalFrame* pFrame, bool bHorizontal, bool bVertica pFrame->maFrameData.mbMaximizedVert = bVertical; pFrame->maFrameData.mbMaximizedHorz = bHorizontal; - const SalFrameGeometry& rGeom( pFrame->GetGeometry() ); + const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() ); // discard pending configure notifies for this frame XSync( m_pDisplay, False ); @@ -1522,7 +1522,7 @@ void NetWMAdaptor::maximizeFrame( SalFrame* pFrame, bool bHorizontal, bool bVert pFrame->maFrameData.aRestoreFullScreen_ = Rectangle(); else if( pFrame->maFrameData.aRestoreFullScreen_.IsEmpty() ) { - const SalFrameGeometry& rGeom( pFrame->GetGeometry() ); + const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() ); pFrame->maFrameData.aRestoreFullScreen_ = Rectangle( Point( rGeom.nX, rGeom.nY ), Size( rGeom.nWidth, rGeom.nHeight ) ); } @@ -1577,7 +1577,7 @@ void GnomeWMAdaptor::maximizeFrame( SalFrame* pFrame, bool bHorizontal, bool bVe pFrame->maFrameData.aRestoreFullScreen_ = Rectangle(); else if( pFrame->maFrameData.aRestoreFullScreen_.IsEmpty() ) { - const SalFrameGeometry& rGeom( pFrame->GetGeometry() ); + const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() ); pFrame->maFrameData.aRestoreFullScreen_ = Rectangle( Point( rGeom.nX, rGeom.nY ), Size( rGeom.nWidth, rGeom.nHeight ) ); } diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx index fa10f51a3280..9dbe1f402d12 100644 --- a/vcl/unx/source/window/salframe.cxx +++ b/vcl/unx/source/window/salframe.cxx @@ -2,9 +2,9 @@ * * $RCSfile: salframe.cxx,v $ * - * $Revision: 1.142 $ + * $Revision: 1.143 $ * - * last change: $Author: hr $ $Date: 2002-08-27 17:55:03 $ + * last change: $Author: pl $ $Date: 2002-09-18 16:28:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -449,8 +449,8 @@ void SalFrameData::Init( ULONG nSalFrameStyle, SystemParentData* pParentData ) ( pFrame->maFrameData.mpParent || pFrame->maFrameData.IsOverrideRedirect() || ! ( pFrame->maFrameData.nStyle_ & SAL_FRAME_STYLE_SIZEABLE ) - || ! pFrame->GetGeometry().nWidth - || ! pFrame->GetGeometry().nHeight + || ! pFrame->GetUnmirroredGeometry().nWidth + || ! pFrame->GetUnmirroredGeometry().nHeight ) ) pFrame = pFrame->maFrameData.pNextFrame_; @@ -458,7 +458,7 @@ void SalFrameData::Init( ULONG nSalFrameStyle, SystemParentData* pParentData ) { // set a document position and size // the first frame gets positioned by the window manager - const SalFrameGeometry& rGeom( pFrame->GetGeometry() ); + const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() ); x = rGeom.nX; y = rGeom.nY; w = rGeom.nWidth; @@ -1586,7 +1586,7 @@ void SalFrameData::SetPosSize( const Rectangle &rPosSize ) if( mpParent ) { // --- RTL --- (mirror window pos) - if( pGraphics_ && (pGraphics_->GetLayout() & SAL_LAYOUT_BIDI_RTL) ) + if( Application::GetSettings().GetLayoutRTL() ) values.x = mpParent->maGeometry.nWidth-values.width-1-values.x; XLIB_Window aChild; @@ -2045,6 +2045,12 @@ void SalFrame::SetParent( SalFrame* pNewParent ) } } +SalFrame* SalFrame::GetParent() const +{ + return maFrameData.mpParent; +} + + // Sound // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= void SalFrame::Beep( SoundType eSoundType ) // not fully suported @@ -2276,7 +2282,7 @@ long SalFrameData::HandleMouseEvent( XEvent *pEvent ) nEvent = SALEVENT_WHEELMOUSE; // --- RTL --- (mirror mouse pos) - if( pGraphics_ && (pGraphics_->GetLayout() & SAL_LAYOUT_BIDI_RTL) ) + if( Application::GetSettings().GetLayoutRTL() ) aWheelEvt.mnX = nWidth_-1-aWheelEvt.mnX; return Call( nEvent, &aWheelEvt ); } @@ -2289,7 +2295,7 @@ long SalFrameData::HandleMouseEvent( XEvent *pEvent ) ) { // --- RTL --- (mirror mouse pos) - if( pGraphics_ && (pGraphics_->GetLayout() & SAL_LAYOUT_BIDI_RTL) ) + if( Application::GetSettings().GetLayoutRTL() ) aMouseEvt.mnX = nWidth_-1-aMouseEvt.mnX; return Call( nEvent, &aMouseEvt ); } @@ -2684,7 +2690,7 @@ long SalFrameData::HandleExposeEvent( XEvent *pEvent ) aPEvt.mnBoundHeight = maPaintRegion.GetHeight(); // --- RTL --- (mirror paint rect) - if( pGraphics_ && (pGraphics_->GetLayout() & SAL_LAYOUT_BIDI_RTL) ) + if( Application::GetSettings().GetLayoutRTL() ) aPEvt.mnBoundX = nWidth_-aPEvt.mnBoundWidth-aPEvt.mnBoundX; Call( SALEVENT_PAINT, &aPEvt ); @@ -2880,6 +2886,9 @@ IMPL_LINK( SalFrameData, HandleResizeTimer, void*, pDummy ) aPEvt.mnBoundWidth = maPaintRegion.GetWidth(); aPEvt.mnBoundHeight = maPaintRegion.GetHeight(); + if( Application::GetSettings().GetLayoutRTL() ) + aPEvt.mnBoundX = nWidth_-aPEvt.mnBoundWidth-aPEvt.mnBoundX; + Call( SALEVENT_PAINT, &aPEvt ); maPaintRegion = Rectangle();