diff options
Diffstat (limited to 'vcl/unx/source/app/saldisp.cxx')
-rw-r--r-- | vcl/unx/source/app/saldisp.cxx | 150 |
1 files changed, 71 insertions, 79 deletions
diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx index 4bc379846edf..3ba82446c13e 100644 --- a/vcl/unx/source/app/saldisp.cxx +++ b/vcl/unx/source/app/saldisp.cxx @@ -213,7 +213,7 @@ static int sal_significantBits( Pixel nMask ) } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -static BOOL sal_GetVisualInfo( Display *pDisplay, XID nVID, XVisualInfo &rVI ) +static sal_Bool sal_GetVisualInfo( Display *pDisplay, XID nVID, XVisualInfo &rVI ) { int nInfos; XVisualInfo aTemplate; @@ -223,25 +223,25 @@ static BOOL sal_GetVisualInfo( Display *pDisplay, XID nVID, XVisualInfo &rVI ) pInfos = XGetVisualInfo( pDisplay, VisualIDMask, &aTemplate, &nInfos ); if( !pInfos ) - return FALSE; + return sal_False; rVI = *pInfos; XFree( pInfos ); DBG_ASSERT( rVI.visualid == nVID, "sal_GetVisualInfo: could not get correct visual by visualId" ); - return TRUE; + return sal_True; } // --------------------------------------------------------------------------- // check wether displaystring is in format N.M or N. or just N // with N and M beeing natural numbers -static BOOL +static sal_Bool sal_IsDisplayNumber( const char *pDisplayString ) { if ( ! isdigit(*pDisplayString) ) - return FALSE; + return sal_False; while ( isdigit(*(++pDisplayString)) ) ; /* do nothing */ @@ -255,12 +255,12 @@ sal_IsDisplayNumber( const char *pDisplayString ) } // check whether host1 and host2 point to the same ip address -static BOOL +static sal_Bool sal_EqualHosts( const OUString& Host1, const OUString& Host2) { oslSocketAddr pHostAddr1; oslSocketAddr pHostAddr2; - BOOL bEqualAddress = FALSE; + sal_Bool bEqualAddress = sal_False; if ( Host1.toChar() >= '0' && Host1.toChar() <= '9' ) pHostAddr1 = osl_createInetSocketAddr( Host1.pData, 0 ); @@ -273,7 +273,7 @@ sal_EqualHosts( const OUString& Host1, const OUString& Host2) pHostAddr2 = osl_resolveHostname( Host2.pData ); if( pHostAddr1 && pHostAddr2 ) - bEqualAddress = osl_isEqualSocketAddr( pHostAddr1, pHostAddr2 ) ? TRUE : FALSE; + bEqualAddress = osl_isEqualSocketAddr( pHostAddr1, pHostAddr2 ) ? sal_True : sal_False; if( pHostAddr1 ) osl_destroySocketAddr( pHostAddr1 ); @@ -283,14 +283,14 @@ sal_EqualHosts( const OUString& Host1, const OUString& Host2) return bEqualAddress; } -static BOOL +static sal_Bool sal_IsLocalDisplay( Display *pDisplay ) { const char *pDisplayString = DisplayString( pDisplay ); // no string, no idea if ( pDisplayString == NULL || pDisplayString[ 0 ] == '\0') - return FALSE; + return sal_False; // check for ":x.y" if ( pDisplayString[ 0 ] == ':' ) @@ -314,7 +314,7 @@ sal_IsLocalDisplay( Display *pDisplay ) // compare local hostname to displaystring, both may be ip address or // hostname - BOOL bEqual = FALSE; + sal_Bool bEqual = sal_False; char *pDisplayHost = strdup( pDisplayString ); char *pPtr = strrchr( pDisplayHost, ':' ); @@ -339,14 +339,14 @@ sal_IsLocalDisplay( Display *pDisplay ) // since it is not called very often and sal_IsLocalDisplay() is relative // expensive bLocal_ is initialized on first call -BOOL SalDisplay::IsLocal() +sal_Bool SalDisplay::IsLocal() { if ( ! mbLocalIsValid ) { bLocal_ = sal_IsLocalDisplay( pDisp_ ); - mbLocalIsValid = TRUE; + mbLocalIsValid = sal_True; } - return (BOOL)bLocal_; + return (sal_Bool)bLocal_; } // --------------------------------------------------------------------------- @@ -375,11 +375,6 @@ sal_GetServerVendor( Display *p_display ) { vendor_none, NULL, 0 }, }; -#ifdef _USE_PRINT_EXTENSION_ - if ( ! XSalIsDisplay( p_display ) ) - return vendor_xprinter; -#endif - // handle regular server vendors char *p_name = ServerVendor( p_display ); vendor_t *p_vendor; @@ -411,7 +406,7 @@ static sal_Bool sal_IsTrustedSolaris (Display *p_display) // -=-= SalDisplay -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -BOOL SalDisplay::BestVisual( Display *pDisplay, +sal_Bool SalDisplay::BestVisual( Display *pDisplay, int nScreen, XVisualInfo &rVI ) { @@ -436,51 +431,51 @@ BOOL SalDisplay::BestVisual( Display *pDisplay, int i; for( i = 0; i < nVisuals; i++ ) { - BOOL bUsable = FALSE; + sal_Bool bUsable = sal_False; int nTrueColor = 1; if ( pVInfos[i].screen != nScreen ) { - bUsable = FALSE; + bUsable = sal_False; } else if( pVInfos[i].c_class == TrueColor ) { nTrueColor = 2048; if( pVInfos[i].depth == 24 ) - bUsable = TRUE; -#ifdef TRUECOLOR8 + bUsable = sal_True; +#ifdef sal_TrueCOLOR8 else if( pVInfos[i].depth == 8 ) { nTrueColor = -1; // strongly discourage 8 bit true color - bUsable = TRUE; + bUsable = sal_True; } #endif -#ifdef TRUECOLOR15 +#ifdef sal_TrueCOLOR15 else if( pVInfos[i].depth == 15 ) - bUsable = TRUE; + bUsable = sal_True; #endif -#ifdef TRUECOLOR16 +#ifdef sal_TrueCOLOR16 else if( pVInfos[i].depth == 16 ) - bUsable = TRUE; + bUsable = sal_True; #endif -#ifdef TRUECOLOR32 +#ifdef sal_TrueCOLOR32 else if( pVInfos[i].depth == 32 ) { nTrueColor = 256; // we do not have use for an alpha channel // better use a 24 or 16 bit truecolor visual if possible - bUsable = TRUE; + bUsable = sal_True; } #endif } else if( pVInfos[i].c_class == PseudoColor ) { if( pVInfos[i].depth <= 8 ) - bUsable = TRUE; + bUsable = sal_True; #ifdef PSEUDOCOLOR12 else if( pVInfos[i].depth == 12 ) - bUsable = TRUE; + bUsable = sal_True; #endif } pWeight[ i ] = bUsable ? nTrueColor*pVInfos[i].depth : -1024; @@ -508,7 +503,6 @@ BOOL SalDisplay::BestVisual( Display *pDisplay, SalDisplay::SalDisplay( Display *display ) : mpInputMethod( NULL ), - mpFallbackFactory ( NULL ), pDisp_( display ), m_pWMAdaptor( NULL ), m_pDtIntegrator( NULL ), @@ -557,7 +551,6 @@ void SalDisplay::doDestruct() m_pDtIntegrator = NULL; X11SalBitmap::ImplDestroyCache(); X11SalGraphics::releaseGlyphPeer(); - DestroyFontCache(); if( IsDisplay() ) { @@ -650,7 +643,7 @@ fd GetSalData()->m_pInstance->GetYieldMutex()->acquire(); pDisplay->Yield(); GetSalData()->m_pInstance->GetYieldMutex()->release(); - return TRUE; + return sal_True; } SalX11Display::SalX11Display( Display *display ) @@ -818,8 +811,6 @@ void SalDisplay::Init() eWindowManager_ = otherwm; nProperties_ = PROPERTY_DEFAULT; hEventGuard_ = NULL; - m_pFontCache = NULL; - mpFontList = (XlfdStorage*)NULL; mpFactory = (AttributeProvider*)NULL; m_pCapture = NULL; m_bXinerama = false; @@ -859,9 +850,9 @@ void SalDisplay::Init() X11SalBitmap::ImplCreateCache(); hEventGuard_ = osl_createMutex(); - bLocal_ = FALSE; /* dont care, initialize later by + bLocal_ = sal_False; /* dont care, initialize later by calling SalDisplay::IsLocal() */ - mbLocalIsValid = FALSE; /* bLocal_ is not yet initialized */ + mbLocalIsValid = sal_False; /* bLocal_ is not yet initialized */ // - - - - - - - - - - Synchronize - - - - - - - - - - - - - if( getenv( "SAL_SYNCHRONIZE" ) ) @@ -1079,7 +1070,7 @@ unsigned int GetKeySymMask(Display* dpy, KeySym nKeySym) } -void SalDisplay::SimulateKeyPress( USHORT nKeyCode ) +void SalDisplay::SimulateKeyPress( sal_uInt16 nKeyCode ) { if (nKeyCode == KEY_CAPSLOCK) { @@ -1098,10 +1089,10 @@ void SalDisplay::SimulateKeyPress( USHORT nKeyCode ) } } -USHORT SalDisplay::GetIndicatorState() const +sal_uInt16 SalDisplay::GetIndicatorState() const { unsigned int _state = 0; - USHORT nState = 0; + sal_uInt16 nState = 0; XkbGetIndicatorState(pDisp_, XkbUseCoreKbd, &_state); if ((_state & 0x00000001)) @@ -1182,7 +1173,7 @@ void SalDisplay::ModifierMapping() } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -XubString SalDisplay::GetKeyName( USHORT nKeyCode ) const +XubString SalDisplay::GetKeyName( sal_uInt16 nKeyCode ) const { String aStrMap; String aCustomKeyName; @@ -1383,27 +1374,27 @@ XubString SalDisplay::GetKeyName( USHORT nKeyCode ) const #define IsISOKey( n ) (0x0000FE00==((n)&0xFFFFFF00)) #endif -USHORT SalDisplay::GetKeyCode( KeySym keysym, char*pcPrintable ) const +sal_uInt16 SalDisplay::GetKeyCode( KeySym keysym, char*pcPrintable ) const { - USHORT nKey = 0; + sal_uInt16 nKey = 0; if( XK_a <= keysym && XK_z >= keysym ) - nKey = (USHORT)(KEY_A + (keysym - XK_a)); + nKey = (sal_uInt16)(KEY_A + (keysym - XK_a)); else if( XK_A <= keysym && XK_Z >= keysym ) - nKey = (USHORT)(KEY_A + (keysym - XK_A)); + nKey = (sal_uInt16)(KEY_A + (keysym - XK_A)); else if( XK_0 <= keysym && XK_9 >= keysym ) - nKey = (USHORT)(KEY_0 + (keysym - XK_0)); + nKey = (sal_uInt16)(KEY_0 + (keysym - XK_0)); else if( IsModifierKey( keysym ) ) ; else if( IsKeypadKey( keysym ) ) { if( (keysym >= XK_KP_0) && (keysym <= XK_KP_9) ) { - nKey = (USHORT)(KEY_0 + (keysym - XK_KP_0)); + nKey = (sal_uInt16)(KEY_0 + (keysym - XK_KP_0)); *pcPrintable = '0' + nKey - KEY_0; } else if( IsPFKey( keysym ) ) - nKey = (USHORT)(KEY_F1 + (keysym - XK_KP_F1)); + nKey = (sal_uInt16)(KEY_F1 + (keysym - XK_KP_F1)); else switch( keysym ) { case XK_KP_Space: @@ -1482,7 +1473,7 @@ USHORT SalDisplay::GetKeyCode( KeySym keysym, char*pcPrintable ) const if( bNumLockFromXS_ ) { if( keysym >= XK_F1 && keysym <= XK_F26 ) - nKey = (USHORT)(KEY_F1 + keysym - XK_F1); + nKey = (sal_uInt16)(KEY_F1 + keysym - XK_F1); } else switch( keysym ) { @@ -1551,7 +1542,7 @@ USHORT SalDisplay::GetKeyCode( KeySym keysym, char*pcPrintable ) const break; default: if( keysym >= XK_F1 && keysym <= XK_F26 ) - nKey = (USHORT)(KEY_F1 + keysym - XK_F1); + nKey = (sal_uInt16)(KEY_F1 + keysym - XK_F1); break; } } @@ -2258,7 +2249,7 @@ int SalDisplay::CaptureMouse( SalFrame *pCapture ) // Events // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void SalDisplay::SendInternalEvent( SalFrame* pFrame, void* pData, USHORT nEvent ) +void SalDisplay::SendInternalEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent ) { if( osl_acquireMutex( hEventGuard_ ) ) { @@ -2274,7 +2265,7 @@ void SalDisplay::SendInternalEvent( SalFrame* pFrame, void* pData, USHORT nEvent } } -void SalDisplay::CancelInternalEvent( SalFrame* pFrame, void* pData, USHORT nEvent ) +void SalDisplay::CancelInternalEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent ) { if( osl_acquireMutex( hEventGuard_ ) ) { @@ -2301,29 +2292,29 @@ void SalDisplay::CancelInternalEvent( SalFrame* pFrame, void* pData, USHORT nEve } } -BOOL SalX11Display::IsEvent() +sal_Bool SalX11Display::IsEvent() { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( osl_acquireMutex( hEventGuard_ ) ) { if( m_aUserEvents.begin() != m_aUserEvents.end() ) - bRet = TRUE; + bRet = sal_True; osl_releaseMutex( hEventGuard_ ); } if( bRet || XEventsQueued( pDisp_, QueuedAlready ) ) - return TRUE; + return sal_True; XFlush( pDisp_ ); - return FALSE; + return sal_False; } bool SalDisplay::DispatchInternalEvent() { SalFrame* pFrame = NULL; void* pData = NULL; - USHORT nEvent = 0; + sal_uInt16 nEvent = 0; if( osl_acquireMutex( hEventGuard_ ) ) { @@ -2676,6 +2667,7 @@ void SalDisplay::PrintInfo() const fprintf( stderr, "\tProperties \t0x%lX\n", GetProperties() ); if( eWindowManager_ != otherwm ) fprintf( stderr, "\tWindowmanager \t%d\n", eWindowManager_ ); + fprintf( stderr, "\tWMName \t%s\n", rtl::OUStringToOString( getWMAdaptor()->getWindowManagerName(), osl_getThreadTextEncoding() ).getStr() ); } fprintf( stderr, "Screen\n" ); fprintf( stderr, "\tResolution/Size \t%ld*%ld %ld*%ld %.1lf\"\n", @@ -2957,14 +2949,14 @@ SalVisual::~SalVisual() #define SALCOLOR RGB #define SALCOLORREVERSE BGR -BOOL SalVisual::Convert( int &n0, int &n1, int &n2, int &n3 ) +sal_Bool SalVisual::Convert( int &n0, int &n1, int &n2, int &n3 ) { int n; switch( GetMode() ) { case other: - return FALSE; + return sal_False; case SALCOLOR: break; case SALCOLORREVERSE: @@ -2989,17 +2981,17 @@ BOOL SalVisual::Convert( int &n0, int &n1, int &n2, int &n3 ) fprintf( stderr, "SalVisual::Convert %d\n", GetMode() ); abort(); } - return TRUE; + return sal_True; } -BOOL SalVisual::Convert( int &n0, int &n1, int &n2 ) +sal_Bool SalVisual::Convert( int &n0, int &n1, int &n2 ) { int n; switch( GetMode() ) { case other: - return FALSE; + return sal_False; case SALCOLOR: break; case RBG: @@ -3033,7 +3025,7 @@ BOOL SalVisual::Convert( int &n0, int &n1, int &n2 ) fprintf( stderr, "SalVisual::Convert %d\n", GetMode() ); abort(); } - return TRUE; + return sal_True; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -3200,7 +3192,7 @@ SalColormap::SalColormap() } // TrueColor -SalColormap::SalColormap( USHORT nDepth ) +SalColormap::SalColormap( sal_uInt16 nDepth ) : m_pDisplay( GetX11SalData()->GetDisplay() ), m_hColormap( None ), m_nWhitePixel( (1 << nDepth) - 1 ), @@ -3350,14 +3342,14 @@ void SalColormap::GetPalette() } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -static USHORT sal_Lookup( const std::vector<SalColor>& rPalette, +static sal_uInt16 sal_Lookup( const std::vector<SalColor>& rPalette, int r, int g, int b, Pixel nUsed ) { - USHORT nPixel = 0; + sal_uInt16 nPixel = 0; int nBest = ColorDiff( rPalette[0], r, g, b ); - for( USHORT i = 1; i < nUsed; i++ ) + for( sal_uInt16 i = 1; i < nUsed; i++ ) { int n = ColorDiff( rPalette[i], r, g, b ); @@ -3375,7 +3367,7 @@ static USHORT sal_Lookup( const std::vector<SalColor>& rPalette, void SalColormap::GetLookupTable() { - m_aLookupTable = std::vector<USHORT>(16*16*16); + m_aLookupTable = std::vector<sal_uInt16>(16*16*16); int i = 0; for( int r = 0; r < 256; r += 17 ) @@ -3425,7 +3417,7 @@ SalColor SalColormap::GetColor( Pixel nPixel ) const return MAKE_SALCOLOR( aColor.red>>8, aColor.green>>8, aColor.blue>>8 ); } -inline BOOL SalColormap::GetXPixel( XColor &rColor, +inline sal_Bool SalColormap::GetXPixel( XColor &rColor, int r, int g, int b ) const @@ -3436,15 +3428,15 @@ inline BOOL SalColormap::GetXPixel( XColor &rColor, return XAllocColor( GetXDisplay(), m_hColormap, &rColor ); } -BOOL SalColormap::GetXPixels( XColor &rColor, +sal_Bool SalColormap::GetXPixels( XColor &rColor, int r, int g, int b ) const { if( !GetXPixel( rColor, r, g, b ) ) - return FALSE; + return sal_False; if( rColor.pixel & 1 ) - return TRUE; + return sal_True; return GetXPixel( rColor, r^0xFF, g^0xFF, b^0xFF ); } @@ -3532,9 +3524,9 @@ Pixel SalColormap::GetPixel( SalColor nSalColor ) const } // Colormatching ueber Palette - USHORT r = SALCOLOR_RED ( nSalColor ); - USHORT g = SALCOLOR_GREEN( nSalColor ); - USHORT b = SALCOLOR_BLUE ( nSalColor ); + sal_uInt16 r = SALCOLOR_RED ( nSalColor ); + sal_uInt16 g = SALCOLOR_GREEN( nSalColor ); + sal_uInt16 b = SALCOLOR_BLUE ( nSalColor ); return m_aLookupTable[ (((r+8)/17) << 8) + (((g+8)/17) << 4) + ((b+8)/17) ]; |