From b664d9290852f3f4f07ea86f9c2234df6e83b2cf Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Tue, 13 Dec 2011 17:52:01 +0000 Subject: Disable gtk3 at run-time, unless in experimental mode. --- 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(-) (limited to 'vcl') diff --git a/vcl/generic/app/gensys.cxx b/vcl/generic/app/gensys.cxx index 2fae4840bbd2..f7d3f0a8b43a 100644 --- a/vcl/generic/app/gensys.cxx +++ b/vcl/generic/app/gensys.cxx @@ -40,6 +40,13 @@ #include #include +#include "vcl/unohelp.hxx" +#include +#include +#include + +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 const xSMgr(vcl::unohelper::GetMultiServiceFactory()); + // create configuration hierachical access name + if (xSMgr.is()) + { + try + { + uno::Reference const xConfigProvider( + uno::Reference( + xSMgr->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationProvider"))), + uno::UNO_QUERY)) + ; + if (xConfigProvider.is()) + { + uno::Sequence 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 const xConfigAccess( + uno::Reference( + 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 e485cc50f215..fd21110a4f97 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 9e6f47fd6a8e..9bd9781e3197 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 3db1dfe4ebea..fb25aeca8e65 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 @@ -53,7 +52,6 @@ #include #include #include -#include #include #include #include @@ -180,73 +178,10 @@ lcl_getGtkSalInstance() return *static_cast(GetGtkSalData()->m_pInstance); } -bool -lcl_enableExperimentalFeatures() -{ - bool bEnable = true; - try - { - // get service provider - uno::Reference const xSMgr(vcl::unohelper::GetMultiServiceFactory()); - // create configuration hierachical access name - if (xSMgr.is()) - { - try - { - uno::Reference const xConfigProvider( - uno::Reference( - xSMgr->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationProvider"))), - UNO_QUERY)) - ; - if (xConfigProvider.is()) - { - uno::Sequence 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 const xConfigAccess( - uno::Reference( - 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 2e1c1068c890..0c195d339de6 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 -- cgit