[Libreoffice-commits] .: Branch 'libreoffice-3-5' - vcl/generic vcl/inc vcl/unx

Michael Meeks michael at kemper.freedesktop.org
Wed Dec 14 02:45:14 PST 2011


 vcl/generic/app/gensys.cxx            |   70 ++++++++++++++++++++++++++++++++++
 vcl/inc/generic/gensys.h              |    1 
 vcl/unx/generic/plugadapt/salplug.cxx |    6 ++
 vcl/unx/gtk/gdi/salprn-gtk.cxx        |   67 --------------------------------
 vcl/unx/gtk/window/gtkframe.cxx       |    2 
 5 files changed, 79 insertions(+), 67 deletions(-)

New commits:
commit be72ad3676d0aee677567f0ccc2e6b404a59fa5a
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Tue Dec 13 17:52:01 2011 +0000

    Disable gtk3 at run-time, unless in experimental mode.

diff --git a/vcl/generic/app/gensys.cxx b/vcl/generic/app/gensys.cxx
index 2fae484..f7d3f0a 100644
--- a/vcl/generic/app/gensys.cxx
+++ b/vcl/generic/app/gensys.cxx
@@ -40,6 +40,13 @@
 #include <osl/process.h>
 #include <osl/thread.h>
 
+#include "vcl/unohelp.hxx"
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+using namespace com::sun::star;
+
 SalGenericSystem::SalGenericSystem()
 {
 }
@@ -174,4 +181,67 @@ rtl::OString SalGenericSystem::getFrameResName( SalExtStyle nStyle )
     return aBuf.makeStringAndClear();
 }
 
+bool
+SalGenericSystem::enableExperimentalFeatures()
+{
+    bool bEnable = true;
+    try
+    {
+        // get service provider
+        uno::Reference<lang::XMultiServiceFactory> const xSMgr(vcl::unohelper::GetMultiServiceFactory());
+        // create configuration hierachical access name
+        if (xSMgr.is())
+        {
+            try
+            {
+                uno::Reference<lang::XMultiServiceFactory> const xConfigProvider(
+                   uno::Reference<lang::XMultiServiceFactory>(
+                        xSMgr->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+                                        "com.sun.star.configuration.ConfigurationProvider"))),
+                        uno::UNO_QUERY))
+                    ;
+                if (xConfigProvider.is())
+                {
+                    uno::Sequence<uno::Any> aArgs(1);
+                    beans::PropertyValue aVal;
+                    aVal.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath"));
+                    aVal.Value <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Common/Misc"));
+                    aArgs.getArray()[0] <<= aVal;
+                    uno::Reference<container::XNameAccess> const xConfigAccess(
+                        uno::Reference<container::XNameAccess>(
+                            xConfigProvider->createInstanceWithArguments(
+                                rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")),
+                                aArgs),
+                            uno::UNO_QUERY))
+                        ;
+                    if (xConfigAccess.is())
+                    {
+                        try
+                        {
+                            sal_Bool bValue = sal_False;
+                            uno::Any const aAny(xConfigAccess->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ExperimentalMode"))));
+                            if (aAny >>= bValue)
+                                bEnable = bValue;
+                        }
+                        catch (container::NoSuchElementException const&)
+                        {
+                        }
+                        catch (lang::WrappedTargetException const&)
+                        {
+                        }
+                    }
+                }
+            }
+            catch (uno::Exception const&)
+            {
+            }
+        }
+    }
+    catch (lang::WrappedTargetException const&)
+    {
+    }
+
+    return bEnable;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/generic/gensys.h b/vcl/inc/generic/gensys.h
index e485cc5..fd21110 100644
--- a/vcl/inc/generic/gensys.h
+++ b/vcl/inc/generic/gensys.h
@@ -57,6 +57,7 @@ class VCL_DLLPUBLIC SalGenericSystem : public SalSystem
     static const char *getFrameResName();
     static const char *getFrameClassName();
     static rtl::OString getFrameResName( SalExtStyle nStyle );
+    static bool        enableExperimentalFeatures();
 };
 
 #endif // _SV_GENSYS_H
diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx
index a496b7c..72d236f 100644
--- a/vcl/unx/generic/plugadapt/salplug.cxx
+++ b/vcl/unx/generic/plugadapt/salplug.cxx
@@ -33,6 +33,7 @@
 #include "rtl/ustrbuf.hxx"
 
 #include "salinst.hxx"
+#include "generic/gensys.h"
 #include "generic/gendata.hxx"
 #include "unx/desktops.hxx"
 #include "vcl/printerinfomanager.hxx"
@@ -52,6 +53,11 @@ static SalInstance* tryInstance( const OUString& rModuleBase )
 {
     SalInstance* pInst = NULL;
 
+    // Disable gtk3 plugin load except in experimental mode for now.
+    if( rModuleBase.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "gtk3" ) ) &&
+        !SalGenericSystem::enableExperimentalFeatures() )
+        return NULL;
+
     OUStringBuffer aModName( 128 );
     aModName.appendAscii( SAL_DLLPREFIX"vclplug_" );
     aModName.append( rModuleBase );
diff --git a/vcl/unx/gtk/gdi/salprn-gtk.cxx b/vcl/unx/gtk/gdi/salprn-gtk.cxx
index 3db1dfe..fb25aec 100644
--- a/vcl/unx/gtk/gdi/salprn-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salprn-gtk.cxx
@@ -39,7 +39,6 @@
 #include "vcl/help.hxx"
 #include "vcl/print.hxx"
 #include "vcl/svapp.hxx"
-#include "vcl/unohelp.hxx"
 #include "vcl/window.hxx"
 
 #include <gtk/gtk.h>
@@ -53,7 +52,6 @@
 #include <com/sun/star/document/XFilter.hpp>
 #include <com/sun/star/frame/XFrame.hpp>
 #include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
 #include <com/sun/star/sheet/XSpreadsheetView.hpp>
@@ -181,72 +179,9 @@ lcl_getGtkSalInstance()
 }
 
 bool
-lcl_enableExperimentalFeatures()
-{
-    bool bEnable = true;
-    try
-    {
-        // get service provider
-        uno::Reference<lang::XMultiServiceFactory> const xSMgr(vcl::unohelper::GetMultiServiceFactory());
-        // create configuration hierachical access name
-        if (xSMgr.is())
-        {
-            try
-            {
-                uno::Reference<lang::XMultiServiceFactory> const xConfigProvider(
-                   uno::Reference<lang::XMultiServiceFactory>(
-                        xSMgr->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
-                                        "com.sun.star.configuration.ConfigurationProvider"))),
-                        UNO_QUERY))
-                    ;
-                if (xConfigProvider.is())
-                {
-                    uno::Sequence<uno::Any> aArgs(1);
-                    beans::PropertyValue aVal;
-                    aVal.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath"));
-                    aVal.Value <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Common/Misc"));
-                    aArgs.getArray()[0] <<= aVal;
-                    uno::Reference<container::XNameAccess> const xConfigAccess(
-                        uno::Reference<container::XNameAccess>(
-                            xConfigProvider->createInstanceWithArguments(
-                                rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")),
-                                aArgs),
-                            UNO_QUERY))
-                        ;
-                    if (xConfigAccess.is())
-                    {
-                        try
-                        {
-                            sal_Bool bValue = sal_False;
-                            uno::Any const aAny(xConfigAccess->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ExperimentalMode"))));
-                            if (aAny >>= bValue)
-                                bEnable = bValue;
-                        }
-                        catch (container::NoSuchElementException const&)
-                        {
-                        }
-                        catch (lang::WrappedTargetException const&)
-                        {
-                        }
-                    }
-                }
-            }
-            catch (uno::Exception const&)
-            {
-            }
-        }
-    }
-    catch (lang::WrappedTargetException const&)
-    {
-    }
-
-    return bEnable;
-}
-
-bool
 lcl_useSystemPrintDialog()
 {
-    return vcl::useSystemPrintDialog() && lcl_enableExperimentalFeatures()
+    return vcl::useSystemPrintDialog() && SalGenericSystem::enableExperimentalFeatures()
         && lcl_getGtkSalInstance().getPrintWrapper()->supportsPrinting();
 }
 
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 2e1c106..0c195d3 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -3285,7 +3285,7 @@ gboolean GtkSalFrame::signalMap( GtkWidget *pWidget, GdkEvent*, gpointer frame )
                         RevertToParent, CurrentTime );
     }
 #else
-    (void)pWidget;
+    (void)pWidget; (void)bSetFocus;
 #  warning FIXME no set input focus ...
 #endif
 


More information about the Libreoffice-commits mailing list