diff options
author | Oliver Bolte <obo@openoffice.org> | 2007-01-25 10:25:53 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2007-01-25 10:25:53 +0000 |
commit | 9801c720fda8e30aaa053b8388ca2ff19237c8fc (patch) | |
tree | 60b4010dc0afa83a1938ba5fe5cb0ac8a3f3b99b /vcl/unx/source/app/salsys.cxx | |
parent | 8530983a31b591c13eada551dff80417c3bee41b (diff) |
INTEGRATION: CWS vcl71 (1.16.98); FILE MERGED
2006/12/22 16:40:42 pl 1.16.98.1: #i72484# add: GetScreenName()
Diffstat (limited to 'vcl/unx/source/app/salsys.cxx')
-rw-r--r-- | vcl/unx/source/app/salsys.cxx | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/vcl/unx/source/app/salsys.cxx b/vcl/unx/source/app/salsys.cxx index b487ca3a55b2..a334400064a2 100644 --- a/vcl/unx/source/app/salsys.cxx +++ b/vcl/unx/source/app/salsys.cxx @@ -4,9 +4,9 @@ * * $RCSfile: salsys.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: kz $ $Date: 2006-10-06 10:04:37 $ + * last change: $Author: obo $ $Date: 2007-01-25 11:25:53 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -47,6 +47,9 @@ #include <saldisp.hxx> #include <salsys.h> +#include <rtl/ustrbuf.hxx> +#include <osl/thread.h> + SalSystem* X11SalInstance::CreateSalSystem() { @@ -104,6 +107,47 @@ Rectangle X11SalSystem::GetDisplayWorkAreaPosSizePixel( unsigned int nScreen ) return GetDisplayScreenPosSizePixel( nScreen ); } +rtl::OUString X11SalSystem::GetScreenName( unsigned int nScreen ) +{ + rtl::OUString aScreenName; + SalDisplay* pSalDisp = GetX11SalData()->GetDisplay(); + if( pSalDisp->IsXinerama() ) + { + const std::vector< Rectangle >& rScreens = pSalDisp->GetXineramaScreens(); + if( nScreen >= rScreens.size() ) + nScreen = 0; + rtl::OUStringBuffer aBuf( 256 ); + aBuf.append( rtl::OStringToOUString( rtl::OString( DisplayString( pSalDisp->GetDisplay() ) ), osl_getThreadTextEncoding() ) ); + aBuf.appendAscii( " [" ); + aBuf.append( static_cast<sal_Int32>(nScreen) ); + aBuf.append( sal_Unicode(']') ); + aScreenName = aBuf.makeStringAndClear(); + } + else + { + if( nScreen >= static_cast<unsigned int>(pSalDisp->GetScreenCount()) ) + nScreen = 0; + rtl::OUStringBuffer aBuf( 256 ); + aBuf.append( rtl::OStringToOUString( rtl::OString( DisplayString( pSalDisp->GetDisplay() ) ), osl_getThreadTextEncoding() ) ); + // search backwards for ':' + int nPos = aBuf.getLength(); + if( nPos > 0 ) + nPos--; + while( nPos > 0 && aBuf.charAt( nPos ) != ':' ) + nPos--; + // search forward to '.' + while( nPos < aBuf.getLength() && aBuf.charAt( nPos ) != '.' ) + nPos++; + if( nPos < aBuf.getLength() ) + aBuf.setLength( nPos+1 ); + else + aBuf.append( sal_Unicode('.') ); + aBuf.append( static_cast<sal_Int32>(nScreen) ); + aScreenName = aBuf.makeStringAndClear(); + } + return aScreenName; +} + int X11SalSystem::ShowNativeDialog( const String& rTitle, const String& rMessage, const std::list< String >& rButtons, int nDefButton ) { int nRet = -1; |