diff options
Diffstat (limited to 'vcl/unx/source/app')
-rw-r--r-- | vcl/unx/source/app/i18n_ic.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/source/app/i18n_im.cxx | 9 | ||||
-rw-r--r-- | vcl/unx/source/app/i18n_wrp.cxx | 13 | ||||
-rw-r--r-- | vcl/unx/source/app/keysymnames.cxx | 11 | ||||
-rw-r--r-- | vcl/unx/source/app/makefile.mk | 1 | ||||
-rw-r--r-- | vcl/unx/source/app/saldisp.cxx | 28 | ||||
-rw-r--r-- | vcl/unx/source/app/salinst.cxx | 153 | ||||
-rw-r--r-- | vcl/unx/source/app/wmadaptor.cxx | 6 |
8 files changed, 149 insertions, 76 deletions
diff --git a/vcl/unx/source/app/i18n_ic.cxx b/vcl/unx/source/app/i18n_ic.cxx index 9fba669f338d..817fc2781e8c 100644 --- a/vcl/unx/source/app/i18n_ic.cxx +++ b/vcl/unx/source/app/i18n_ic.cxx @@ -340,7 +340,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : if ( mnPreeditStyle != XIMPreeditNone ) { -#if defined LINUX || defined FREEBSD || defined NETBSD || defined IRIX || defined MACOSX +#if defined LINUX || defined FREEBSD || defined NETBSD || defined IRIX if ( mpPreeditAttributes != NULL ) #endif mpAttributes = XVaAddToNestedList( mpAttributes, @@ -348,7 +348,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : } if ( mnStatusStyle != XIMStatusNone ) { -#if defined LINUX || defined FREEBSD || defined NETBSD || defined IRIX || defined MACOSX +#if defined LINUX || defined FREEBSD || defined NETBSD || defined IRIX if ( mpStatusAttributes != NULL ) #endif mpAttributes = XVaAddToNestedList( mpAttributes, diff --git a/vcl/unx/source/app/i18n_im.cxx b/vcl/unx/source/app/i18n_im.cxx index d4ff59e87864..a47cefcef7dd 100644 --- a/vcl/unx/source/app/i18n_im.cxx +++ b/vcl/unx/source/app/i18n_im.cxx @@ -55,10 +55,6 @@ #include "i18n_im.hxx" #include <i18n_status.hxx> -#ifdef MACOSX -#include <osl/process.h> -#include <tools/string.hxx> -#endif #include <osl/thread.h> using namespace vcl; @@ -253,13 +249,8 @@ SalI18N_InputMethod::SetLocale( const char* pLocale ) char *locale = SetSystemLocale( pLocale ); if ( (!IsXWindowCompatibleLocale(locale)) || IsPosixLocale(locale) ) { - #ifdef MACOSX // MacOS X always uses UTF-8 for the filesystem - osl_setThreadTextEncoding (RTL_TEXTENCODING_UTF8); - locale = SetSystemLocale( "en_US.UTF-8" ); - #else osl_setThreadTextEncoding (RTL_TEXTENCODING_ISO_8859_1); locale = SetSystemLocale( "en_US" ); - #endif #ifdef SOLARIS SetSystemEnvironment( "en_US" ); #endif diff --git a/vcl/unx/source/app/i18n_wrp.cxx b/vcl/unx/source/app/i18n_wrp.cxx index f561e18e0ff0..b3a3ebc8e101 100644 --- a/vcl/unx/source/app/i18n_wrp.cxx +++ b/vcl/unx/source/app/i18n_wrp.cxx @@ -45,10 +45,7 @@ struct XIMArg #include <sal/alloca.h> #include <string.h> -#if !defined(MACOSX) -/* MacOS X doesn't yet support XIM... FIXME */ #include <dlfcn.h> -#endif #include <X11/Xlib.h> #include <X11/Xlibint.h> #include "XIM.h" @@ -66,10 +63,8 @@ typedef XIM (*OpenFunction)(Display*, XrmDatabase, char*, char*, XIMArg*); } /* global variables */ -#if !defined(MACOSX) static void *g_dlmodule = 0; static OpenFunction g_open_im = (OpenFunction)NULL; -#endif /* utility function to transform vararg list into an array of XIMArg */ @@ -213,8 +208,6 @@ XvaOpenIM(Display *display, XrmDatabase rdb, XvaGetArgs( variable, args ); va_end(variable); - /* MacOS X doesn't yet support XIM... FIXME */ -#if !defined(MACOSX) if (!g_dlmodule) { g_dlmodule = dlopen(XIIIMP_LIB, RTLD_LAZY); @@ -235,13 +228,10 @@ XvaOpenIM(Display *display, XrmDatabase rdb, { goto legacy_XIM; } -#endif } // in #if to prevent warning "warning: label 'legacy_XIM' defined but not used" -#if !defined(MACOSX) legacy_XIM: -#endif if (!xim) xim = XOpenIM(display, rdb, res_name, res_class); @@ -257,8 +247,6 @@ Status XvaCloseIM(XIM) { Status s = False; - /* MacOS X doesn't yet support XIM... FIXME */ -#if !defined(MACOSX) if (!g_dlmodule) { /* assuming one XvaOpenIM call */ @@ -267,7 +255,6 @@ Status XvaCloseIM(XIM) g_open_im = (OpenFunction)NULL; s = True; } -#endif return (s); } diff --git a/vcl/unx/source/app/keysymnames.cxx b/vcl/unx/source/app/keysymnames.cxx index 2a78110c35fa..4a2bf13af3e0 100644 --- a/vcl/unx/source/app/keysymnames.cxx +++ b/vcl/unx/source/app/keysymnames.cxx @@ -649,18 +649,7 @@ const char* SalDisplay::GetKeyboardName( BOOL bRefresh ) { XkbDescPtr pXkbDesc = NULL; // try X keyboard extension - #ifdef MACOSX - // FIXME - // XDarwin doesn't yet have very good support for the Xkeyboard extension. - // When we call XkbGetKeyboard(), the XServer throws a message up in the - // console about xkbcomp and files for geometry include. The side effect of - // this is _very_ noticable lag when drawing menus. The file menu, for example, - // takes about 1s to come down on my G4/450 DP and you can see it draw. Therefore - // we are disabling it for the moment until better XDarwin support exists. - if ( 0 ) - #else if( (pXkbDesc = XkbGetKeyboard( GetDisplay(), XkbAllComponentsMask, XkbUseCoreKbd )) ) - #endif { const char* pAtom = NULL; if( pXkbDesc->names->groups[0] ) diff --git a/vcl/unx/source/app/makefile.mk b/vcl/unx/source/app/makefile.mk index 948c2b2de5be..a7f790fd67ab 100644 --- a/vcl/unx/source/app/makefile.mk +++ b/vcl/unx/source/app/makefile.mk @@ -71,6 +71,7 @@ SLOFILES=\ EXCEPTIONSFILES=\ $(SLO)$/wmadaptor.obj \ $(SLO)$/saldata.obj \ + $(SLO)$/salinst.obj \ $(SLO)$/saldisp.obj \ $(SLO)$/i18n_status.obj \ $(SLO)$/i18n_cb.obj \ diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx index e09346d6cfff..95679d77fdfb 100644 --- a/vcl/unx/source/app/saldisp.cxx +++ b/vcl/unx/source/app/saldisp.cxx @@ -65,7 +65,7 @@ #ifdef USE_XINERAMA #ifdef USE_XINERAMA_XORG -#if defined(X86) || defined(X86_64) || defined(MACOSX) +#if defined(X86) || defined(X86_64) #include <X11/extensions/Xinerama.h> #endif #elif defined USE_XINERAMA_XSUN @@ -893,7 +893,7 @@ void SalDisplay::Init() sscanf( pProperties, "%li", &nProperties_ ); else { -#if defined DBG_UTIL || defined SUN || defined LINUX || defined FREEBSD || defined IRIX || defined MACOSX +#if defined DBG_UTIL || defined SUN || defined LINUX || defined FREEBSD || defined IRIX nProperties_ |= PROPERTY_FEATURE_Maximize; #endif // Server Bugs & Properties @@ -919,7 +919,7 @@ void SalDisplay::Init() if( GetServerVendor() == vendor_xfree ) { nProperties_ |= PROPERTY_BUG_XCopyArea_GXxor; -#if defined LINUX || defined FREEBSD || defined MACOSX +#if defined LINUX || defined FREEBSD // otherwm and olwm are a kind of default, which are not detected // carefully. if we are running linux (i.e. not netbsd) on an xfree // display, fvwm is most probable the wm to choose, confusing with mwm @@ -1085,9 +1085,6 @@ void SalDisplay::ModifierMapping() nShiftKeySym_ = sal_XModifier2Keysym( pDisp_, pXModMap, ShiftMapIndex ); nCtrlKeySym_ = sal_XModifier2Keysym( pDisp_, pXModMap, ControlMapIndex ); nMod1KeySym_ = sal_XModifier2Keysym( pDisp_, pXModMap, Mod1MapIndex ); -#ifdef MACOSX - nMod2KeySym_ = sal_XModifier2Keysym( pDisp_, pXModMap, Mod2MapIndex ); -#endif // Auf Sun-Servern und SCO-Severn beruecksichtigt XLookupString // nicht den NumLock Modifier. if( (GetServerVendor() == vendor_sun) @@ -1116,25 +1113,12 @@ XubString SalDisplay::GetKeyName( USHORT nKeyCode ) const String aStrMap; if( nKeyCode & KEY_MOD1 ) - { - if( aStrMap.Len() ) - aStrMap += '+'; aStrMap += GetKeyNameFromKeySym( nCtrlKeySym_ ); - } -#ifdef MACOSX - if( nKeyCode & KEY_MOD3 ) - { - aStrMap += GetKeyNameFromKeySym( nMod2KeySym_ ); - } if( nKeyCode & KEY_MOD2 ) { - if ( aStrMap.Len() ) - aStrMap += '+' ; -#else - if( nKeyCode & KEY_MOD2 ) - { -#endif + if( aStrMap.Len() ) + aStrMap += '+'; aStrMap += GetKeyNameFromKeySym( nMod1KeySym_ ); } @@ -2646,7 +2630,7 @@ void SalDisplay::InitXinerama() } } #elif defined(USE_XINERAMA_XORG) -#if defined( X86 ) || defined( X86_64 ) || defined( MACOSX ) +#if defined( X86 ) || defined( X86_64 ) if( XineramaIsActive( pDisp_ ) ) { int nFramebuffers = 1; diff --git a/vcl/unx/source/app/salinst.cxx b/vcl/unx/source/app/salinst.cxx index 18b24e2cb2f3..c160ea4c2fa5 100644 --- a/vcl/unx/source/app/salinst.cxx +++ b/vcl/unx/source/app/salinst.cxx @@ -35,20 +35,21 @@ #include <stdio.h> #include <stdlib.h> -#include <salunx.h> +#include "salunx.h" -#ifndef _VOS_MUTEX_HXX -#include <vos/mutex.hxx> -#endif -#include <saldata.hxx> -#include <saldisp.hxx> -#include <salinst.h> -#include <salframe.h> -#include <vcl/salwtype.hxx> -#include <vcl/salatype.hxx> -#include <dtint.hxx> -#include <salprn.h> -#include <sm.hxx> +#include "saldata.hxx" +#include "saldisp.hxx" +#include "salinst.h" +#include "salframe.h" +#include "dtint.hxx" +#include "salprn.h" +#include "sm.hxx" + +#include "vcl/salwtype.hxx" +#include "vcl/salatype.hxx" +#include "vcl/helper.hxx" + +#include "vos/mutex.hxx" // ------------------------------------------------------------------------- // @@ -276,3 +277,129 @@ void X11SalInstance::DestroyFrame( SalFrame* pFrame ) { delete pFrame; } + +static void getServerDirectories( std::list< rtl::OString >& o_rFontPaths ) +{ +#ifdef LINUX + /* + * chkfontpath exists on some (RH derived) Linux distributions + */ + static const char* pCommands[] = { + "/usr/sbin/chkfontpath 2>/dev/null", "chkfontpath 2>/dev/null" + }; + ::std::list< ByteString > aLines; + + for( unsigned int i = 0; i < sizeof(pCommands)/sizeof(pCommands[0]); i++ ) + { + FILE* pPipe = popen( pCommands[i], "r" ); + aLines.clear(); + if( pPipe ) + { + char line[1024]; + char* pSearch; + while( fgets( line, sizeof(line), pPipe ) ) + { + int nLen = strlen( line ); + if( line[nLen-1] == '\n' ) + line[nLen-1] = 0; + pSearch = strstr( line, ": " ); + if( pSearch ) + aLines.push_back( pSearch+2 ); + } + if( ! pclose( pPipe ) ) + break; + } + } + + for( ::std::list< ByteString >::iterator it = aLines.begin(); it != aLines.end(); ++it ) + { + if( ! access( it->GetBuffer(), F_OK ) ) + { + o_rFontPaths.push_back( *it ); +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "adding fs dir %s\n", it->GetBuffer() ); +#endif + } + } +#else + (void)o_rFontPaths; +#endif +} + + + +void X11SalInstance::FillFontPathList( std::list< rtl::OString >& o_rFontPaths ) +{ + Display *pDisplay = GetX11SalData()->GetDisplay()->GetDisplay(); + + DBG_ASSERT( pDisplay, "No Display !" ); + if( pDisplay ) + { + // get font paths to look for fonts + int nPaths = 0, i; + char** pPaths = XGetFontPath( pDisplay, &nPaths ); + + bool bServerDirs = false; + for( i = 0; i < nPaths; i++ ) + { + OString aPath( pPaths[i] ); + sal_Int32 nPos = 0; + if( ! bServerDirs + && ( nPos = aPath.indexOf( ':' ) ) > 0 + && ( !aPath.copy(nPos).equals( ":unscaled" ) ) ) + { + bServerDirs = true; + getServerDirectories( o_rFontPaths ); + } + else + { + psp::normPath( aPath ); + o_rFontPaths.push_back( aPath ); + } + } + + if( nPaths ) + XFreeFontPath( pPaths ); + } + + // insert some standard directories + o_rFontPaths.push_back( "/usr/openwin/lib/X11/fonts/TrueType" ); + o_rFontPaths.push_back( "/usr/openwin/lib/X11/fonts/Type1" ); + o_rFontPaths.push_back( "/usr/openwin/lib/X11/fonts/Type1/sun" ); + o_rFontPaths.push_back( "/usr/X11R6/lib/X11/fonts/truetype" ); + o_rFontPaths.push_back( "/usr/X11R6/lib/X11/fonts/Type1" ); + + #ifdef SOLARIS + /* cde specials, from /usr/dt/bin/Xsession: here are the good fonts, + the OWfontpath file may contain as well multiple lines as a comma + separated list of fonts in each line. to make it even more weird + environment variables are allowed as well */ + + const char* lang = getenv("LANG"); + if ( lang != NULL ) + { + String aOpenWinDir( String::CreateFromAscii( "/usr/openwin/lib/locale/" ) ); + aOpenWinDir.AppendAscii( lang ); + aOpenWinDir.AppendAscii( "/OWfontpath" ); + + SvFileStream aStream( aOpenWinDir, STREAM_READ ); + + // TODO: replace environment variables + while( aStream.IsOpen() && ! aStream.IsEof() ) + { + ByteString aLine; + aStream.ReadLine( aLine ); + // need an OString for normpath + OString aNLine( aLine ); + psp::normPath( aNLine ); + aLine = aNLine; + // try to avoid bad fonts in some cases + static bool bAvoid = (strncasecmp( lang, "ar", 2 ) == 0) || (strncasecmp( lang, "he", 2 ) == 0) || strncasecmp( lang, "iw", 2 ) == 0 || (strncasecmp( lang, "hi", 2 ) == 0); + if( bAvoid && aLine.Search( "iso_8859" ) != STRING_NOTFOUND ) + continue; + o_rFontPaths.push_back( aLine ); + } + } + #endif /* SOLARIS */ +} + diff --git a/vcl/unx/source/app/wmadaptor.cxx b/vcl/unx/source/app/wmadaptor.cxx index e099af0de0fb..37015b6e58d6 100644 --- a/vcl/unx/source/app/wmadaptor.cxx +++ b/vcl/unx/source/app/wmadaptor.cxx @@ -405,12 +405,6 @@ WMAdaptor::WMAdaptor( SalDisplay* pDisplay ) : XFree( pProperty ); } } - -#ifdef MACOSX - /* Apple's X11 needs NW gravity with OOo 1.1 */ - m_nWinGravity = NorthWestGravity; - m_nInitWinGravity = NorthWestGravity; -#endif } /* |