ooo-build r12905 - in branches/ooo-build-2-4-1: . patches/src680



Author: thorstenb
Date: Mon Jun 16 22:14:30 2008
New Revision: 12905
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12905&view=rev

Log:
	* patches/src680/vcl-linking-randr.diff:
	* patches/src680/apply: now linking directly against libXrandr,
	instead of dlopening it - the latter causes duplicate instances of
	that lib in memory sometimes, when using gtk or kde nwf plugins.



Added:
   branches/ooo-build-2-4-1/patches/src680/vcl-linking-randr.diff
Modified:
   branches/ooo-build-2-4-1/ChangeLog
   branches/ooo-build-2-4-1/patches/src680/apply

Modified: branches/ooo-build-2-4-1/patches/src680/apply
==============================================================================
--- branches/ooo-build-2-4-1/patches/src680/apply	(original)
+++ branches/ooo-build-2-4-1/patches/src680/apply	Mon Jun 16 22:14:30 2008
@@ -2467,3 +2467,4 @@
 
 [ Fixes ]
 cppcanvas-fix-roundcorners.diff, i#361534, rodo
+vcl-linking-randr.diff, i#89718, n#398244, thorsten

Added: branches/ooo-build-2-4-1/patches/src680/vcl-linking-randr.diff
==============================================================================
--- (empty file)
+++ branches/ooo-build-2-4-1/patches/src680/vcl-linking-randr.diff	Mon Jun 16 22:14:30 2008
@@ -0,0 +1,334 @@
+ config_office/configure.in          |   43 ++++++++--------
+ config_office/set_soenv.in          |    2 +
+ vcl/unx/source/app/makefile.mk      |    2 -
+ vcl/unx/source/app/randrwrapper.cxx |   96 ++++++-----------------------------
+ vcl/unx/source/app/saldisp.cxx      |    6 +-
+ vcl/util/makefile.mk                |   21 +++++++-
+ 6 files changed, 65 insertions(+), 105 deletions(-)
+
+diff --git a/config_office/configure.in b/config_office/configure.in
+index 8afaf72..cc2e8eb 100644
+--- config_office/configure.in
++++ config_office/configure.in
+@@ -1132,18 +1132,6 @@ else
+ fi
+ AC_SUBST(ENABLE_FONTCONFIG)
+ 
+-dnl ===================================================================
+-dnl Build options
+-dnl ===================================================================
+-AC_MSG_CHECKING([whether to enable RandR support])
+-if test "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \) ; then
+-   ENABLE_RANDR="TRUE"
+-   AC_MSG_RESULT([yes])
+-else
+-   ENABLE_RANDR=""
+-   AC_MSG_RESULT([no])
+-fi
+-AC_SUBST(ENABLE_RANDR)
+ 
+ dnl ===================================================================
+ dnl Disable legacy binary file formats filters
+@@ -1938,14 +1926,6 @@ if test "$test_cups" = "yes" -a "$ENABLE_CUPS" = "TRUE" ; then
+ fi
+ 
+ dnl ===================================================================
+-dnl Check if X11/extensions/Xrandr.h is available 
+-dnl ===================================================================
+-if test "$test_randr" = "yes" -a "$ENABLE_RANDR" = "TRUE" ; then
+-    AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
+-                    [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
+-fi
+-
+-dnl ===================================================================
+ dnl Check if PAM/pam_appl.h is available on Linux or FreeBSD
+ dnl ===================================================================
+ if test "$_os" = "Linux" -o "$_os" = "FreeBSD" -o "$_os" = "GNU"; then
+@@ -4497,6 +4477,29 @@ AC_SUBST(SYSTEM_XRENDER_HEADERS)
+ AC_SUBST(XRENDER_LINK)
+ 
+ dnl ===================================================================
++dnl Check for system XRandr
++dnl ===================================================================
++AC_MSG_CHECKING([whether to enable RandR support])
++if test "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \) ; then
++   PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
++   if test "$ENABLE_RANDR" != "TRUE"; then
++      AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
++                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
++      XRANDR_CFLAGS=" "
++      AC_CHECK_LIB(Xrandr, XRRQueryExtension, [],
++           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
++      XRANDR_LIBS="-lXrandr "
++      ENABLE_RANDR="TRUE"
++   fi
++else
++   ENABLE_RANDR=""
++   AC_MSG_RESULT([no])
++fi
++AC_SUBST(XRANDR_CFLAGS)
++AC_SUBST(XRANDR_LIBS)
++AC_SUBST(ENABLE_RANDR)
++
++dnl ===================================================================
+ dnl Check for system Mesa
+ dnl ===================================================================
+ AC_MSG_CHECKING([which Mesa headers to use])
+diff --git a/config_office/set_soenv.in b/config_office/set_soenv.in
+index 660e8b4..d4a9816 100644
+--- config_office/set_soenv.in
++++ config_office/set_soenv.in
+@@ -2010,6 +2010,8 @@ ToFile( "FREETYPE_LIBS",     "@FREETYPE_LIBS@",    "e" );
+ ToFile( "SYSTEM_CAIRO",      "@SYSTEM_CAIRO@",     "e" );
+ ToFile( "CAIRO_CFLAGS",      "@CAIRO_CFLAGS@",     "e" );
+ ToFile( "CAIRO_LIBS",        "@CAIRO_LIBS@",       "e" );
++ToFile( "XRANDR_CFLAGS",     "@XRANDR_CFLAGS@",    "e" );
++ToFile( "XRANDR_LIBS",       "@XRANDR_LIBS@",      "e" );
+ ToFile( "SYSTEM_LIBWPD",     "@SYSTEM_LIBWPD@",    "e" );
+ ToFile( "LIBWPD_CFLAGS",     "@LIBWPD_CFLAGS@",    "e" );
+ ToFile( "LIBWPD_LIBS",       "@LIBWPD_LIBS@",      "e" );
+diff --git a/vcl/unx/source/app/makefile.mk b/vcl/unx/source/app/makefile.mk
+index f19464a..d015092 100644
+--- vcl/unx/source/app/makefile.mk
++++ vcl/unx/source/app/makefile.mk
+@@ -84,7 +84,7 @@ EXCEPTIONSFILES=\
+ 
+ .IF "$(ENABLE_RANDR)" != ""
+ .IF "$(OS)" != "SOLARIS"
+-CDEFS+=-DUSE_RANDR
++CDEFS+=-DUSE_RANDR $(XRANDR_CFLAGS)
+ .ENDIF
+ .ENDIF
+ 
+diff --git a/vcl/unx/source/app/randrwrapper.cxx b/vcl/unx/source/app/randrwrapper.cxx
+index 10ec921..9f99637 100644
+--- vcl/unx/source/app/randrwrapper.cxx
++++ vcl/unx/source/app/randrwrapper.cxx
+@@ -46,25 +46,9 @@ namespace
+ {
+ class RandRWrapper
+ {
+-    oslModule m_pRandRLib;
+-    
+-    // function pointers
+-    Bool(*m_pXRRQueryExtension)(Display*,int*,int*);
+-    Status(*m_pXRRQueryVersion)(Display*,int*,int*);
+-    XRRScreenConfiguration*(*m_pXRRGetScreenInfo)(Display*,Drawable);
+-    void(*m_pXRRFreeScreenConfigInfo)(XRRScreenConfiguration*);
+-    void(*m_pXRRSelectInput)(Display*,XLIB_Window,int);
+-    int(*m_pXRRUpdateConfiguration)(XEvent*);
+-    XRRScreenSize*(*m_pXRRSizes)(Display*,int,int*);
+-    XRRScreenSize*(*m_pXRRConfigSizes)(XRRScreenConfiguration*,int*);
+-    SizeID(*m_pXRRConfigCurrentConfiguration)(XRRScreenConfiguration*,Rotation*);
+-    
+     bool m_bValid;
+     
+-    void initFromModule();
+-    
+     RandRWrapper(Display*);
+-    ~RandRWrapper();
+ public:
+     static RandRWrapper& get(Display*);
+     static void releaseWrapper();
+@@ -73,103 +57,52 @@ public:
+     {
+         Bool bRet = False;
+         if( m_bValid )
+-            bRet = m_pXRRQueryExtension( i_pDisp, o_event_base, o_error_base );
++            bRet = ::XRRQueryExtension( i_pDisp, o_event_base, o_error_base );
+         return bRet;
+     }
+     Status XRRQueryVersion( Display* i_pDisp, int* o_major, int* o_minor )
+     {
+-        return m_bValid ? m_pXRRQueryVersion( i_pDisp, o_major, o_minor ) : 0;
++        return m_bValid ? ::XRRQueryVersion( i_pDisp, o_major, o_minor ) : 0;
+     }
+     XRRScreenConfiguration* XRRGetScreenInfo( Display* i_pDisp, Drawable i_aDrawable )
+     {
+-        return m_bValid ? m_pXRRGetScreenInfo( i_pDisp, i_aDrawable ) : NULL;
++        return m_bValid ? ::XRRGetScreenInfo( i_pDisp, i_aDrawable ) : NULL;
+     }
+     void XRRFreeScreenConfigInfo( XRRScreenConfiguration* i_pConfig )
+     {
+         if( m_bValid )
+-            m_pXRRFreeScreenConfigInfo( i_pConfig );
++            ::XRRFreeScreenConfigInfo( i_pConfig );
+     }
+     void XRRSelectInput( Display* i_pDisp, XLIB_Window i_window, int i_nMask )
+     {
+         if( m_bValid )
+-            m_pXRRSelectInput( i_pDisp, i_window, i_nMask );
++            ::XRRSelectInput( i_pDisp, i_window, i_nMask );
+     }
+     int XRRUpdateConfiguration( XEvent* i_pEvent )
+     {
+-        return m_bValid ? m_pXRRUpdateConfiguration( i_pEvent ) : 0;
++        return m_bValid ? ::XRRUpdateConfiguration( i_pEvent ) : 0;
+     }
+     XRRScreenSize* XRRSizes( Display* i_pDisp, int i_screen, int* o_nscreens )
+     {
+-        return m_bValid ? m_pXRRSizes( i_pDisp, i_screen, o_nscreens ) : NULL;
++        return m_bValid ? ::XRRSizes( i_pDisp, i_screen, o_nscreens ) : NULL;
+     }
+     XRRScreenSize* XRRConfigSizes( XRRScreenConfiguration* i_pConfig, int* o_nSizes )
+     {
+-        return m_bValid ? m_pXRRConfigSizes( i_pConfig, o_nSizes ) : NULL;
++        return m_bValid ? ::XRRConfigSizes( i_pConfig, o_nSizes ) : NULL;
+     }
+     SizeID XRRConfigCurrentConfiguration( XRRScreenConfiguration* i_pConfig, Rotation* o_pRot )
+     {
+-        return m_bValid ? m_pXRRConfigCurrentConfiguration( i_pConfig, o_pRot ) : 0;
++        return m_bValid ? ::XRRConfigCurrentConfiguration( i_pConfig, o_pRot ) : 0;
+     }
+ };
+ }
+ 
+-void RandRWrapper::initFromModule()
+-{
+-    m_pXRRQueryExtension = (Bool(*)(Display*,int*,int*))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRQueryExtension" );
+-    m_pXRRQueryVersion = (Status(*)(Display*,int*,int*))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRQueryVersion" );
+-    m_pXRRGetScreenInfo = (XRRScreenConfiguration*(*)(Display*,Drawable))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRGetScreenInfo" );
+-    m_pXRRFreeScreenConfigInfo = (void(*)(XRRScreenConfiguration*))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRFreeScreenConfigInfo" );
+-    m_pXRRSelectInput = (void(*)(Display*,XLIB_Window,int))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRSelectInput" );
+-    m_pXRRUpdateConfiguration = (int(*)(XEvent*))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRUpdateConfiguration" );
+-    m_pXRRSizes = (XRRScreenSize*(*)(Display*,int,int*))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRSizes" );
+-    m_pXRRConfigSizes = (XRRScreenSize*(*)(XRRScreenConfiguration*,int*))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRConfigSizes" );
+-    m_pXRRConfigCurrentConfiguration = (SizeID(*)(XRRScreenConfiguration*,Rotation*))osl_getAsciiFunctionSymbol( m_pRandRLib, "XRRConfigCurrentConfiguration" );
+-    
+-    m_bValid = m_pXRRQueryExtension             &&
+-               m_pXRRQueryVersion               &&
+-               m_pXRRGetScreenInfo              &&
+-               m_pXRRFreeScreenConfigInfo       &&
+-               m_pXRRSelectInput                &&
+-               m_pXRRUpdateConfiguration        &&
+-               m_pXRRSizes                      &&
+-               m_pXRRConfigSizes                &&
+-               m_pXRRConfigCurrentConfiguration
+-               ;
+-}
+-
+ RandRWrapper::RandRWrapper( Display* pDisplay ) :
+-        m_pRandRLib( NULL ),
+-        m_pXRRQueryExtension( NULL ),
+-        m_pXRRQueryVersion( NULL ),
+-        m_pXRRGetScreenInfo( NULL ),
+-        m_pXRRFreeScreenConfigInfo( NULL ),
+-        m_pXRRSelectInput( NULL ),
+-        m_pXRRUpdateConfiguration( NULL ),
+-        m_pXRRSizes( NULL ),
+-        m_pXRRConfigSizes( NULL ),
+-        m_pXRRConfigCurrentConfiguration( NULL ),
+-        m_bValid( false )
+-{
+-    // first try in process space (e.g. gtk links that ?)
+-    initFromModule();
+-    if( ! m_bValid )
+-    {
+-        rtl::OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( "libXrandr.so.2" ) );
+-        m_pRandRLib = osl_loadModule( aLibName.pData, SAL_LOADMODULE_DEFAULT );
+-        initFromModule();
+-    }
+-    if( m_bValid )
+-    {
+-        int nEventBase = 0, nErrorBase = 0;
+-        if( ! m_pXRRQueryExtension( pDisplay, &nEventBase, &nErrorBase ) )
+-            m_bValid = false;
+-    }
+-}
+-
+-RandRWrapper::~RandRWrapper()
++    m_bValid( false )
+ {
+-    if( m_pRandRLib )
+-        osl_unloadModule( m_pRandRLib );
++    int nEventBase = 0, nErrorBase = 0;
++    if( ! XRRQueryExtension( pDisplay, &nEventBase, &nErrorBase ) )
++        m_bValid = false;
+ }
+ 
+ static RandRWrapper* pWrapper = NULL;
+@@ -204,6 +137,9 @@ void SalDisplay::DeInitRandR()
+ {
+     #ifdef USE_RANDR
+     RandRWrapper::releaseWrapper();
++#if OSL_DEBUG_LEVEL > 1
++    fprintf( stderr, "SalDisplay::DeInitRandR()\n" );
++#endif    
+     #endif
+ }
+ 
+diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx
+index 3d9c765..78533d8 100644
+--- vcl/unx/source/app/saldisp.cxx
++++ vcl/unx/source/app/saldisp.cxx
+@@ -595,6 +595,9 @@ SalDisplay::~SalDisplay( )
+ #endif
+         pDisp_ = NULL;
+     }
++    // don't do this in doDestruct since RandR extension adds hooks into Display
++    // that is XCloseDisplay still needs the RandR library if it was used
++    DeInitRandR();
+ }
+ 
+ void SalDisplay::doDestruct()
+@@ -721,9 +724,6 @@ SalX11Display::~SalX11Display()
+ 		XCloseDisplay( pDisp_ );
+ 		pDisp_ = NULL;
+ 	}
+-    // don't do this in doDestruct since RandR extension adds hooks into Display
+-    // that is XCloseDisplay still needs the RandR library if it was used
+-    DeInitRandR();
+ }
+ 
+ void SalDisplay::initScreen( int nScreen ) const
+diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk
+index 78468a2..d367a63 100644
+--- vcl/util/makefile.mk
++++ vcl/util/makefile.mk
+@@ -304,12 +304,18 @@ SHL2STDLIBS+=`pkg-config --libs xrender`
+ 
+ .IF "$(GUIBASE)"=="unx"
+ 
+-SHL2STDLIBS += -lXext -lXtst -lSM -lICE -lX11
++SHL2STDLIBS += -lXext -lXtst -lSM -lICE -lX11 
+ .IF "$(OS)"!="MACOSX" && "$(OS)"!="FREEBSD"
+ # needed by salprnpsp.cxx
+ SHL2STDLIBS+= -ldl
+ .ENDIF
+ 
++.IF "$(ENABLE_RANDR)" != ""
++.IF "$(OS)" != "SOLARIS"
++SHL2STDLIBS+= $(XRANDR_LIBS)
++.ENDIF
++.ENDIF
++
+ .ENDIF          # "$(GUIBASE)"=="unx"
+ 
+ # gtk plugin
+@@ -354,6 +360,12 @@ SHL4STDLIBS+=\
+             $(VOSLIB)           \
+             $(SALLIB)
+ 
++.IF "$(ENABLE_RANDR)" != ""
++.IF "$(OS)" != "SOLARIS"
++SHL4STDLIBS+= $(XRANDR_LIBS)
++.ENDIF
++.ENDIF
++
+ .ENDIF # "$(ENABLE_GTK)" != ""
+ 
+ # KDE plugin
+@@ -376,6 +388,13 @@ SHL5STDLIBS+=\
+         $(TOOLSLIB)     \
+         $(VOSLIB)       \
+         $(SALLIB)
++
++.IF "$(ENABLE_RANDR)" != ""
++.IF "$(OS)" != "SOLARIS"
++SHL5STDLIBS+= $(XRANDR_LIBS)
++.ENDIF
++.ENDIF
++
+ .ENDIF # "$(ENABLE_KDE)" != ""
+ 
+ .ENDIF # UNX



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]