include/vcl/svapp.hxx | 16 ++++++++-------- vcl/inc/svdata.hxx | 1 + vcl/source/app/salplug.cxx | 7 +++++++ vcl/source/app/svapp.cxx | 12 ++++++++---- vcl/source/opengl/OpenGLHelper.cxx | 13 ++++--------- 5 files changed, 28 insertions(+), 21 deletions(-)
New commits: commit a6dc9f3fd18ad69aa041662628f4f923ab3a82f8 Author: Jan-Marek Glogowski <glo...@fbihome.de> AuthorDate: Fri Nov 23 08:43:04 2018 +0100 Commit: Jan-Marek Glogowski <glo...@fbihome.de> CommitDate: Wed Dec 5 14:39:37 2018 +0100 Add interface for software-only bitmap rendering When SAL_USE_VCLPLUGIN=svp is used, LO is expected to render output only to bitmaps, without real GUI windows. This adds an enabler and a getter function to the Application class, so one can query this information easy as (Enable|Is)BitmapRendering. This can be used by all VCL plugins, which can't fall back to the Cairo based SVP plugin, primary OSX and Win. A working implementation should allow to run all test via SSH. All window-requiring tests already have to set this requirement using gb_CppunitTest_use_vcl_non_headless(_with_windows)? and should be moved to a different make target, or we need some test harness to handle this correctly, before VCL fails the test. Change-Id: I4bd4c81122a6686b090fdd93256d4712ac5f05dd Reviewed-on: https://gerrit.libreoffice.org/64051 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de> diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index 6249e3449e6f..c597ba453de3 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -1218,19 +1218,19 @@ public: /** Enable Console Only mode - Used to disable Mac specific app init that requires an app bundle. + Convenience function to enable headless and bitmap rendering. */ static void EnableConsoleOnly(); - /** Determines if console only mode is enabled. - - Used to see if Mac specific app init has been disabled. + /** Enable software-only bitmap rendering + */ + static void EnableBitmapRendering(); - @returns True if console only mode is on, false if not. + /** Determines if bitmap rendering is enabled - @see EnableConsoleOnly - */ - static bool IsConsoleOnly(); + @return True if bitmap rendering is enabled. + */ + static bool IsBitmapRendering(); ///@} diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 21ca3567b56a..b83607f75c44 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -154,6 +154,7 @@ struct ImplSVAppData bool mbAppQuit = false; // is Application::Quit() called bool mbSettingsInit = false; // true: Settings are initialized DialogCancelMode meDialogCancel = DialogCancelMode::Off; // true: All Dialog::Execute() calls will be terminated immediately with return false + bool mbRenderToBitmaps = false; // set via svp / headless plugin /** Controls whether showing any IME status window is toggled on or off. diff --git a/vcl/source/app/salplug.cxx b/vcl/source/app/salplug.cxx index a79339cd0ad2..205f5dae0526 100644 --- a/vcl/source/app/salplug.cxx +++ b/vcl/source/app/salplug.cxx @@ -243,6 +243,13 @@ SalInstance *CreateSalInstance() #endif rtl::Bootstrap::get( "SAL_USE_VCLPLUGIN", aUsePlugin ); + if (aUsePlugin == "svp") + { + Application::EnableBitmapRendering(); +#ifndef HEADLESS_VCLPLUG + aUsePlugin.clear(); +#endif + } if( !aUsePlugin.isEmpty() ) pInst = tryInstance( aUsePlugin, true ); diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index b42c1f158a9f..40ff79b7d70f 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1438,6 +1438,7 @@ const LocaleDataWrapper& Application::GetAppLocaleDataWrapper() void Application::EnableHeadlessMode( bool dialogsAreFatal ) { + assert(GetDialogCancelMode() == DialogCancelMode::Off); SetDialogCancelMode( dialogsAreFatal ? DialogCancelMode::Fatal : DialogCancelMode::Silent ); } @@ -1447,17 +1448,20 @@ bool Application::IsHeadlessModeEnabled() return IsDialogCancelEnabled() || comphelper::LibreOfficeKit::isActive(); } -static bool bConsoleOnly = false; +void Application::EnableBitmapRendering() +{ + ImplGetSVData()->maAppData.mbRenderToBitmaps = true; +} -bool Application::IsConsoleOnly() +bool Application::IsBitmapRendering() { - return bConsoleOnly; + return ImplGetSVData()->maAppData.mbRenderToBitmaps; } void Application::EnableConsoleOnly() { EnableHeadlessMode(true); - bConsoleOnly = true; + EnableBitmapRendering(); } static bool bEventTestingMode = false; diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index 588ae70cabe0..882f35d424af 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -956,8 +956,8 @@ bool OpenGLHelper::isVCLOpenGLEnabled() static bool bEnable = false; static bool bForceOpenGL = false; - // If we are a console app, then we don't use OpenGL - if ( Application::IsConsoleOnly() ) + // No hardware rendering, so no OpenGL + if (Application::IsBitmapRendering()) return false; //tdf#106155, disable GL while loading certain bitmaps needed for the initial toplevel windows @@ -988,19 +988,14 @@ bool OpenGLHelper::isVCLOpenGLEnabled() else if (bSupportsVCLOpenGL) { static bool bEnableGLEnv = !!getenv("SAL_ENABLEGL"); - static bool bHeadlessPlugin = []{ - OUString plugin; - rtl::Bootstrap::get("SAL_USE_VCLPLUGIN", plugin); - return plugin == "svp"; - }(); bEnable = bEnableGLEnv; if (officecfg::Office::Common::VCL::UseOpenGL::get()) bEnable = true; - // Force disable in safe mode or when running with headless plugin - if (bHeadlessPlugin || Application::IsSafeModeEnabled()) + // Force disable in safe mode + if (Application::IsSafeModeEnabled()) bEnable = false; bRet = bEnable; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits