diff options
-rw-r--r-- | vcl/Library_vcl.mk | 1 | ||||
-rw-r--r-- | vcl/Library_vclplug_gen.mk | 1 | ||||
-rw-r--r-- | vcl/Library_vclplug_gtk3.mk | 1 | ||||
-rw-r--r-- | vcl/generic/app/gensys.cxx (renamed from vcl/unx/generic/app/salsys.cxx) | 84 | ||||
-rw-r--r-- | vcl/inc/generic/gensys.h (renamed from vcl/inc/unx/salsys.h) | 22 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkinst.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtksys.hxx | 4 | ||||
-rw-r--r-- | vcl/inc/unx/saldata.hxx | 5 | ||||
-rw-r--r-- | vcl/inc/unx/x11/x11sys.hxx | 4 | ||||
-rw-r--r-- | vcl/unx/generic/app/saldata.cxx | 63 | ||||
-rw-r--r-- | vcl/unx/generic/window/salframe.cxx | 7 | ||||
-rw-r--r-- | vcl/unx/gtk/app/gtkdata.cxx | 3 | ||||
-rw-r--r-- | vcl/unx/gtk/app/gtkinst.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/gtk/app/gtksys.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk/window/gtkframe.cxx | 16 |
15 files changed, 120 insertions, 99 deletions
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 0b35f1d85bb7..0c626a1814de 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -264,6 +264,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/window/window \ vcl/source/window/winproc \ vcl/source/window/wrkwin \ + vcl/generic/app/gensys \ vcl/generic/app/geninst \ vcl/generic/print/bitmap_gfx \ vcl/generic/print/common_gfx \ diff --git a/vcl/Library_vclplug_gen.mk b/vcl/Library_vclplug_gen.mk index ab2320827a39..a0b1531336cb 100644 --- a/vcl/Library_vclplug_gen.mk +++ b/vcl/Library_vclplug_gen.mk @@ -82,7 +82,6 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gen,\ vcl/unx/generic/app/saldata \ vcl/unx/generic/app/saldisp \ vcl/unx/generic/app/salinst \ - vcl/unx/generic/app/salsys \ vcl/unx/generic/app/saltimer \ vcl/unx/generic/app/sm \ vcl/unx/generic/app/soicon \ diff --git a/vcl/Library_vclplug_gtk3.mk b/vcl/Library_vclplug_gtk3.mk index 9183711f2bd5..d3aa016314ce 100644 --- a/vcl/Library_vclplug_gtk3.mk +++ b/vcl/Library_vclplug_gtk3.mk @@ -70,7 +70,6 @@ $(eval $(call gb_Library_add_libs,vclplug_gtk3,\ )) $(eval $(call gb_Library_add_linked_libs,vclplug_gtk3,\ - vclplug_gen \ vcl \ tl \ utl \ diff --git a/vcl/unx/generic/app/salsys.cxx b/vcl/generic/app/gensys.cxx index 9f68512a97bb..26b36048f19c 100644 --- a/vcl/unx/generic/app/salsys.cxx +++ b/vcl/generic/app/gensys.cxx @@ -29,11 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <unx/salunx.h> -#include <unx/saldata.hxx> -#include <unx/salinst.h> -#include <unx/saldisp.hxx> -#include <unx/salsys.h> +#include <generic/gensys.h> #include <vcl/msgbox.hxx> #include <vcl/button.hxx> @@ -41,18 +37,21 @@ #include <svdata.hxx> #include <rtl/ustrbuf.hxx> +#include <rtl/strbuf.hxx> +#include <rtl/bootstrap.hxx> +#include <osl/process.h> #include <osl/thread.h> -UnxSalSystem::UnxSalSystem() +SalGenericSystem::SalGenericSystem() { } -UnxSalSystem::~UnxSalSystem() +SalGenericSystem::~SalGenericSystem() { } -int UnxSalSystem::ShowNativeMessageBox(const String& rTitle, const String& rMessage, - int nButtonCombination, int nDefaultButton) +int SalGenericSystem::ShowNativeMessageBox( const String& rTitle, const String& rMessage, + int nButtonCombination, int nDefaultButton ) { int nDefButton = 0; std::list< String > aButtons; @@ -110,4 +109,71 @@ int UnxSalSystem::ShowNativeMessageBox(const String& rTitle, const String& rMess return nResult != -1 ? nButtonIds[ nResult ] : 0; } +// ------------------------------------------------------------------------ +// Helpers primarily for X Windowing derivatives +// ------------------------------------------------------------------------ + +const char* SalGenericSystem::getFrameResName() +{ + /* according to ICCCM: + * first search command line for -name parameter + * then try RESOURCE_NAME environment variable + * then use argv[0] stripped by directories + */ + static rtl::OStringBuffer aResName; + if( !aResName.getLength() ) + { + int nArgs = osl_getCommandArgCount(); + for( int n = 0; n < nArgs-1; n++ ) + { + rtl::OUString aArg; + if( ! osl_getCommandArg( n, &aArg.pData ) && + aArg.equalsIgnoreAsciiCaseAscii( "-name" ) && + ! osl_getCommandArg( n+1, &aArg.pData ) ) + { + aResName.append( rtl::OUStringToOString( aArg, osl_getThreadTextEncoding() ) ); + break; + } + } + if( !aResName.getLength() ) + { + const char* pEnv = getenv( "RESOURCE_NAME" ); + if( pEnv && *pEnv ) + aResName.append( pEnv ); + } + if( !aResName.getLength() ) + aResName.append( "VCLSalFrame" ); + } + return aResName.getStr(); +} + +const char* SalGenericSystem::getFrameClassName() +{ + static rtl::OStringBuffer aClassName; + if( !aClassName.getLength() ) + { + rtl::OUString aIni, aProduct; + rtl::Bootstrap::get( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BRAND_BASE_DIR" ) ), aIni ); + aIni += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/program/" SAL_CONFIGFILE( "bootstrap" ) ) ); + rtl::Bootstrap aBootstrap( aIni ); + aBootstrap.getFrom( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ProductKey" ) ), aProduct ); + + if( aProduct.getLength() ) + aClassName.append( rtl::OUStringToOString( aProduct, osl_getThreadTextEncoding() ) ); + else + aClassName.append( "VCLSalFrame" ); + } + return aClassName.getStr(); +} + +rtl::OString SalGenericSystem::getFrameResName( SalExtStyle nStyle ) +{ + rtl::OStringBuffer aBuf( 64 ); + aBuf.append( getFrameResName() ); + if( (nStyle & SAL_FRAME_EXT_STYLE_DOCUMENT) ) + aBuf.append( ".DocumentWindow" ); + + return aBuf.makeStringAndClear(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/salsys.h b/vcl/inc/generic/gensys.h index cd87738736e2..a5f52d6d0010 100644 --- a/vcl/inc/unx/salsys.h +++ b/vcl/inc/generic/gensys.h @@ -27,28 +27,38 @@ ************************************************************************/ // -=-= includes -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -#ifndef _SV_SALSYS_H -#define _SV_SALSYS_H +#ifndef _SV_GENSYS_H +#define _SV_GENSYS_H #include <salsys.hxx> +#include <salframe.hxx> #include <vclpluginapi.h> #include <list> -class VCLPLUG_GEN_PUBLIC UnxSalSystem : public SalSystem +/* + * Helps de-tangle the rather horrible ShowNativeMessageBox API + */ +class VCL_DLLPUBLIC SalGenericSystem : public SalSystem { public: - UnxSalSystem(); - virtual ~UnxSalSystem(); + SalGenericSystem(); + virtual ~SalGenericSystem(); virtual int ShowNativeDialog( const String& rTitle, const String& rMessage, const std::list< String >& rButtons, int nDefButton ) = 0; + virtual int ShowNativeMessageBox( const String& rTitle, const String& rMessage, int nButtonCombination, int nDefaultButton); + + // simple helpers primarily for X Windowing W_CLASS hints + static const char *getFrameResName(); + static const char *getFrameClassName(); + static rtl::OString getFrameResName( SalExtStyle nStyle ); }; -#endif // _SV_SALSYS_H +#endif // _SV_GENSYS_H /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx index d8602e3312f0..b8a80adbd31a 100644 --- a/vcl/inc/unx/gtk/gtkinst.hxx +++ b/vcl/inc/unx/gtk/gtkinst.hxx @@ -30,7 +30,7 @@ #define _VCL_GTKINST_HXX #include <unx/salinst.h> -#include <unx/salsys.h> +#include <generic/gensys.h> #include <unx/headless/svpinst.hxx> #include <gtk/gtk.h> diff --git a/vcl/inc/unx/gtk/gtksys.hxx b/vcl/inc/unx/gtk/gtksys.hxx index 05e58f5d9f94..f378bf35b162 100644 --- a/vcl/inc/unx/gtk/gtksys.hxx +++ b/vcl/inc/unx/gtk/gtksys.hxx @@ -30,10 +30,10 @@ #ifndef _VCL_GTKSYS_HXX_ #define _VCL_GTKSYS_HXX_ -#include "unx/salsys.h" +#include "generic/gensys.h" #include <gtk/gtk.h> -class GtkSalSystem : public UnxSalSystem +class GtkSalSystem : public SalGenericSystem { GdkDisplay *mpDisplay; public: diff --git a/vcl/inc/unx/saldata.hxx b/vcl/inc/unx/saldata.hxx index 8c2d732f7a07..f8dd5a2a95b1 100644 --- a/vcl/inc/unx/saldata.hxx +++ b/vcl/inc/unx/saldata.hxx @@ -93,11 +93,6 @@ public: static int XErrorHdl( Display*, XErrorEvent* ); static int XIOErrorHdl( Display* ); - // set helper functions to set class and res name in W_CLASS hint - static const char* getFrameResName(); - static const char* getFrameClassName(); - static rtl::OString getFrameResName( SalExtStyle nStyle ); - }; inline X11SalData* GetX11SalData() diff --git a/vcl/inc/unx/x11/x11sys.hxx b/vcl/inc/unx/x11/x11sys.hxx index a4385347bfa2..04598346c7e3 100644 --- a/vcl/inc/unx/x11/x11sys.hxx +++ b/vcl/inc/unx/x11/x11sys.hxx @@ -33,10 +33,10 @@ #include <vcl/sv.h> #include <osl/mutex.hxx> #include <osl/thread.hxx> -#include <unx/salsys.h> +#include <generic/gensys.h> #include <vclpluginapi.h> -class VCLPLUG_GEN_PUBLIC X11SalSystem : public UnxSalSystem +class VCLPLUG_GEN_PUBLIC X11SalSystem : public SalGenericSystem { public: X11SalSystem() {} diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx index 0dc426ea3168..9abf1193faf5 100644 --- a/vcl/unx/generic/app/saldata.cxx +++ b/vcl/unx/generic/app/saldata.cxx @@ -806,67 +806,4 @@ void SalXLib::PostUserEvent() Wakeup(); } -const char* X11SalData::getFrameResName() -{ - /* according to ICCCM: - * first search command line for -name parameter - * then try RESOURCE_NAME environment variable - * then use argv[0] stripped by directories - */ - static rtl::OStringBuffer aResName; - if( !aResName.getLength() ) - { - int nArgs = osl_getCommandArgCount(); - for( int n = 0; n < nArgs-1; n++ ) - { - rtl::OUString aArg; - if( ! osl_getCommandArg( n, &aArg.pData ) && - aArg.equalsIgnoreAsciiCaseAscii( "-name" ) && - ! osl_getCommandArg( n+1, &aArg.pData ) ) - { - aResName.append( rtl::OUStringToOString( aArg, osl_getThreadTextEncoding() ) ); - break; - } - } - if( !aResName.getLength() ) - { - const char* pEnv = getenv( "RESOURCE_NAME" ); - if( pEnv && *pEnv ) - aResName.append( pEnv ); - } - if( !aResName.getLength() ) - aResName.append( "VCLSalFrame" ); - } - return aResName.getStr(); -} - -const char* X11SalData::getFrameClassName() -{ - static rtl::OStringBuffer aClassName; - if( !aClassName.getLength() ) - { - rtl::OUString aIni, aProduct; - rtl::Bootstrap::get( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BRAND_BASE_DIR" ) ), aIni ); - aIni += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/program/" SAL_CONFIGFILE( "bootstrap" ) ) ); - rtl::Bootstrap aBootstrap( aIni ); - aBootstrap.getFrom( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ProductKey" ) ), aProduct ); - - if( aProduct.getLength() ) - aClassName.append( rtl::OUStringToOString( aProduct, osl_getThreadTextEncoding() ) ); - else - aClassName.append( "VCLSalFrame" ); - } - return aClassName.getStr(); -} - -rtl::OString X11SalData::getFrameResName( SalExtStyle nStyle ) -{ - rtl::OStringBuffer aBuf( 64 ); - aBuf.append( getFrameResName() ); - if( (nStyle & SAL_FRAME_EXT_STYLE_DOCUMENT) ) - aBuf.append( ".DocumentWindow" ); - - return aBuf.makeStringAndClear(); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index 85a11ecf5d5e..305d01566210 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -68,7 +68,7 @@ #include "unx/i18n_keysym.hxx" #include "unx/i18n_status.hxx" -#include "salinst.hxx" +#include "generic/gensys.h" #include "sallayout.hxx" #include <sal/macros.h> @@ -2154,11 +2154,12 @@ void X11SalFrame::SetApplicationID( const rtl::OUString &rWMClass ) void X11SalFrame::updateWMClass() { XClassHint* pClass = XAllocClassHint(); - rtl::OString aResName = X11SalData::getFrameResName( mnExtStyle ); + rtl::OString aResName = SalGenericSystem::getFrameResName( mnExtStyle ); pClass->res_name = const_cast<char*>(aResName.getStr()); rtl::OString aResClass = rtl::OUStringToOString(m_sWMClass, RTL_TEXTENCODING_ASCII_US); - const char *pResClass = aResClass.getLength() ? aResClass.getStr() : X11SalData::getFrameClassName(); + const char *pResClass = aResClass.getLength() ? aResClass.getStr() : + SalGenericSystem::getFrameClassName(); pClass->res_class = const_cast<char*>(pResClass); XSetClassHint( GetXDisplay(), GetShellWindow(), pClass ); diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index 07b59f28a633..7f7123fc6de5 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -51,6 +51,7 @@ #include <unx/gtk/gtkinst.hxx> #include <unx/gtk/gtkframe.hxx> #include <unx/salobj.h> +#include <generic/geninst.h> #include <osl/thread.h> #include <osl/process.h> @@ -701,7 +702,7 @@ void GtkData::Init() // add executable nParams++; - g_set_application_name(X11SalData::getFrameClassName()); + g_set_application_name(SalGenericSystem::getFrameClassName()); // Set consistant name of the root accessible rtl::OUString aAppName = Application::GetAppName(); diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx index 25056cad874d..af660830a10b 100644 --- a/vcl/unx/gtk/app/gtkinst.cxx +++ b/vcl/unx/gtk/app/gtkinst.cxx @@ -217,10 +217,14 @@ SalFrame* GtkInstance::CreateChildFrame( SystemParentData* pParentData, sal_uLon SalObject* GtkInstance::CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow ) { +#if !GTK_CHECK_VERSION(3,0,0) // there is no method to set a visual for a GtkWidget // so we need the X11SalObject in that case if( pWindowData ) return X11SalObject::CreateObject( pParent, pWindowData, bShow ); +#else +#warning FIXME: Missing CreateObject functionality ... +#endif return new GtkSalObject( static_cast<GtkSalFrame*>(pParent), bShow ); } diff --git a/vcl/unx/gtk/app/gtksys.cxx b/vcl/unx/gtk/app/gtksys.cxx index ae64f0e7c187..6e09b6a8c7f9 100644 --- a/vcl/unx/gtk/app/gtksys.cxx +++ b/vcl/unx/gtk/app/gtksys.cxx @@ -45,7 +45,7 @@ SalSystem *GtkInstance::CreateSalSystem() return GtkSalSystem::GetSingleton(); } -GtkSalSystem::GtkSalSystem() : UnxSalSystem() +GtkSalSystem::GtkSalSystem() : SalGenericSystem() { mpDisplay = gdk_display_get_default(); } diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 645be9a636d8..4cb441b667e5 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -38,6 +38,7 @@ #include <unx/sm.hxx> #include <unx/salbmp.h> #include <generic/genprn.h> +#include <generic/geninst.h> #include <unx/headless/svpgdi.hxx> #include <vcl/floatwin.hxx> #include <vcl/svapp.hxx> @@ -714,6 +715,7 @@ void GtkSalFrame::InitCommon() * after realization. */ +#if !GTK_CHECK_VERSION(3,0,0) extern "C" { typedef void(*setAcceptFn)( GtkWindow*, gboolean ); static setAcceptFn p_gtk_window_set_accept_focus = NULL; @@ -723,15 +725,16 @@ extern "C" { static setUserTimeFn p_gdk_x11_window_set_user_time = NULL; static bool bGetSetUserTimeFn = true; } +#endif static void lcl_set_accept_focus( GtkWindow* pWindow, gboolean bAccept, bool bBeforeRealize ) { +#if !GTK_CHECK_VERSION(3,0,0) if( bGetAcceptFocusFn ) { bGetAcceptFocusFn = false; p_gtk_window_set_accept_focus = (setAcceptFn)osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gtk_window_set_accept_focus" ); } -#if !GTK_CHECK_VERSION(3,0,0) if( p_gtk_window_set_accept_focus && bBeforeRealize ) p_gtk_window_set_accept_focus( pWindow, bAccept ); else if( ! bBeforeRealize ) @@ -1326,6 +1329,7 @@ void GtkSalFrame::SetDefaultSize() static void initClientId() { +#if !GTK_CHECK_VERSION(3,0,0) static bool bOnce = false; if (!bOnce) { @@ -1334,6 +1338,9 @@ static void initClientId() if (!rID.isEmpty()) gdk_set_sm_client_id(rID.getStr()); } +#else + // No session management support for gtk3+ - this is now legacy. +#endif } void GtkSalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate ) @@ -1911,13 +1918,14 @@ void GtkSalFrame::SetScreenNumber( unsigned int nNewScreen ) void GtkSalFrame::updateWMClass() { rtl::OString aResClass = rtl::OUStringToOString(m_sWMClass, RTL_TEXTENCODING_ASCII_US); - const char *pResClass = aResClass.getLength() ? aResClass.getStr() : X11SalData::getFrameClassName(); + const char *pResClass = aResClass.getLength() ? aResClass.getStr() : + SalGenericSystem::getFrameClassName(); #if !GTK_CHECK_VERSION(3,0,0) if( IS_WIDGET_REALIZED( m_pWindow ) ) { XClassHint* pClass = XAllocClassHint(); - rtl::OString aResName = X11SalData::getFrameResName( m_nExtStyle ); + rtl::OString aResName = SalGenericSystem::getFrameResName( m_nExtStyle ); pClass->res_name = const_cast<char*>(aResName.getStr()); pClass->res_class = const_cast<char*>(pResClass); XSetClassHint( getDisplay()->GetDisplay(), @@ -1928,7 +1936,7 @@ void GtkSalFrame::updateWMClass() else #endif gtk_window_set_wmclass( GTK_WINDOW(m_pWindow), - X11SalData::getFrameResName( m_nExtStyle ).getStr(), + SalGenericSystem::getFrameResName( m_nExtStyle ).getStr(), pResClass ); } |