framework/source/services/frame.cxx     |    4 ++--
 include/vcl/settings.hxx                |    1 -
 include/vcl/svapp.hxx                   |   12 ++++++------
 sfx2/source/doc/objmisc.cxx             |    2 +-
 solenv/gbuild/CppunitTest.mk            |   14 +++++++++-----
 solenv/gbuild/Module.mk                 |    2 ++
 solenv/gbuild/platform/com_MSC_class.mk |    1 -
 solenv/gbuild/platform/macosx.mk        |    3 ---
 solenv/gbuild/platform/windows.mk       |    3 ---
 vcl/README.vars                         |    2 --
 vcl/inc/svdata.hxx                      |    2 +-
 vcl/source/app/settings.cxx             |   10 ----------
 vcl/source/app/svapp.cxx                |    5 +++--
 vcl/source/opengl/OpenGLHelper.cxx      |   13 +++++--------
 vcl/source/window/dialog.cxx            |    6 +++---
 vcl/source/window/window.cxx            |    2 +-
 vcl/win/window/salframe.cxx             |    3 +--
 vcl/workben/commonfuzzer.hxx            |    2 +-
 vcl/workben/fftester.cxx                |    2 +-
 19 files changed, 36 insertions(+), 53 deletions(-)

New commits:
commit 6cdfe5ebb4f6c06bfa8b0e67e778dd68131c14e3
Author:     Jan-Marek Glogowski <glo...@fbihome.de>
AuthorDate: Tue Oct 9 19:29:54 2018 +0200
Commit:     Jan-Marek Glogowski <glo...@fbihome.de>
CommitDate: Tue Nov 20 09:19:09 2018 +0100

    Drop some headless mode variants
    
    This fixes OSX "make debugrun" by dropping VCL_HIDE_WINDOWS
    handling and removing the internal GetPseudoHeadless() API.
    
    While at it moves the DialogCancelMode enum out of Application.
    
    Change-Id: I4876e752ddbfc39dd44faa673fb0e97810089a75
    Reviewed-on: https://gerrit.libreoffice.org/61598
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de>

diff --git a/framework/source/services/frame.cxx 
b/framework/source/services/frame.cxx
index 8a718d787ecf..66fe3032356a 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -2115,8 +2115,8 @@ void SAL_CALL Frame::disposing()
     //          notifications which we don't need here really.
     //      (b) Don't forget to save the old value of IsDialogCancelEnabled() 
to
     //          restore it afterwards (to not kill headless mode).
-    Application::DialogCancelMode old = Application::GetDialogCancelMode();
-    Application::SetDialogCancelMode( Application::DialogCancelMode::Silent );
+    DialogCancelMode old = Application::GetDialogCancelMode();
+    Application::SetDialogCancelMode( DialogCancelMode::Silent );
 
     // We should be alone for ever and further dispose calls are rejected by 
lines before ...
     // I hope it :-)
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index c70da34cb993..adadeb39662f 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -631,7 +631,6 @@ public:
     bool                            GetDisablePrinting() const;
     void                            SetEnableLocalizedDecimalSep( bool bEnable 
);
     bool                            GetEnableLocalizedDecimalSep() const;
-    bool                            GetPseudoHeadless() const;
 
     bool                            operator ==( const MiscSettings& rSet ) 
const;
     bool                            operator !=( const MiscSettings& rSet ) 
const;
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index 7e7d4c205299..c66142b9035a 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -219,6 +219,12 @@ private:
     std::vector<OUString> aData;
 };
 
+enum class DialogCancelMode {
+    Off,      ///< do not automatically cancel dialogs
+    Silent,   ///< silently cancel any dialogs
+    Fatal     ///< cancel any dialogs by std::abort
+};
+
 /**
  @brief Base class used mainly for the LibreOffice Desktop class.
 
@@ -236,12 +242,6 @@ private:
 class VCL_DLLPUBLIC Application
 {
 public:
-    enum class DialogCancelMode {
-        Off,      ///< do not automatically cancel dialogs
-        Silent,   ///< silently cancel any dialogs
-        Fatal     ///< cancel any dialogs by std::abort
-    };
-
     /** @name Initialization
         The following functions perform initialization and deinitialization
         of the application.
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index e245800f2fec..4e1ae9b99327 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1804,7 +1804,7 @@ bool 
SfxObjectShell::IsContinueImportOnFilterExceptions(const OUString& aErrMess
 {
     if (mbContinueImportOnFilterExceptions == undefined)
     {
-        if (Application::GetDialogCancelMode() == 
Application::DialogCancelMode::Off)
+        if (Application::GetDialogCancelMode() == DialogCancelMode::Off)
         {
             // Ask the user to try to continue or abort loading
             OUString aMessage = SfxResId(STR_QMSG_ERROR_OPENING_FILE);
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index 23d72de5716c..2217ffc53fbc 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -25,6 +25,11 @@ export MAX_CONCURRENCY=4
 export MOZILLA_CERTIFICATE_FOLDER=0
 # Avoid hanging if the cups daemon requests a password.
 export SAL_DISABLE_SYNCHRONOUS_PRINTER_DETECTION=1
+# Default unit tests to run with the headless plugin, if not set by the user
+ifeq ($(SAL_USE_VCLPLUGIN),)
+       SAL_USE_VCLPLUGIN := svp
+       export SAL_USE_VCLPLUGIN
+endif
 
 gb_CppunitTest_UNITTESTFAILED ?= 
$(GBUILDDIR)/platform/unittest-failed-default.sh
 gb_CppunitTest_PYTHONDEPS ?= $(call gb_Library_get_target,pyuno_wrapper) $(if 
$(SYSTEM_PYTHON),,$(call gb_Package_get_target,python3))
@@ -119,8 +124,8 @@ ifneq ($(gb_SUPPRESS_TESTS),)
 else
        $(call gb_Output_announce,$*,$(true),CUT,2)
        $(call gb_Helper_abbreviate_dirs,\
-               $(if $(gb_CppunitTest_vcl_hide_windows),export 
VCL_HIDE_WINDOWS=1 && ) \
-               $(if $(gb_CppunitTest_vcl_show_windows),unset VCL_HIDE_WINDOWS 
&& ) \
+               $(if $(and $(gb_CppunitTest__vcl_no_svp), \
+                       $(filter svp,$(SAL_USE_VCLPLUGIN))),unset 
SAL_USE_VCLPLUGIN &&) \
                mkdir -p $(dir $@) && \
                rm -fr $@.user && cp -r $(WORKDIR)/unittest $@.user && \
                $(if $(gb_CppunitTest__use_confpreinit), \
@@ -256,15 +261,14 @@ $(call gb_CppunitTest__use_vcl,$(1),$(true))
 endef
 
 define gb_CppunitTest_use_vcl_non_headless
-$(call gb_CppunitTest_get_target,$(1)) : HEADLESS :=
-$(call gb_CppunitTest_get_target,$(1)) : gb_CppunitTest_vcl_hide_windows := 
$(true)
+$(call gb_CppunitTest_get_target,$(1)) : gb_CppunitTest__vcl_no_svp := $(true)
 $(call gb_CppunitTest__use_vcl,$(1),$(false))
 
 endef
 
 define gb_CppunitTest_use_vcl_non_headless_with_windows
 $(call gb_CppunitTest_get_target,$(1)) : HEADLESS :=
-$(call gb_CppunitTest_get_target,$(1)) : gb_CppunitTest_vcl_show_windows := 
$(true)
+$(call gb_CppunitTest_get_target,$(1)) : gb_CppunitTest__vcl_no_svp := $(true)
 $(call gb_CppunitTest__use_vcl,$(1),$(false))
 
 endef
diff --git a/solenv/gbuild/Module.mk b/solenv/gbuild/Module.mk
index 0d87ccc55379..8b74a425bb2e 100644
--- a/solenv/gbuild/Module.mk
+++ b/solenv/gbuild/Module.mk
@@ -217,6 +217,8 @@ check : unitcheck slowcheck
        $(call gb_Output_announce_bell)
 
 debugrun :
+       export HEADLESS= && \
+       $(if $(filter svp,$(SAL_USE_VCLPLUGIN)),unset SAL_USE_VCLPLUGIN &&) \
        $(call gb_Module_DEBUGRUNCOMMAND)
 
 help :
diff --git a/solenv/gbuild/platform/com_MSC_class.mk 
b/solenv/gbuild/platform/com_MSC_class.mk
index 1fefa80fef61..327d2ae54542 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -428,7 +428,6 @@ endef
 
 define gb_Module_DEBUGRUNCOMMAND
 printf "\nAttach the debugger to soffice.bin\n\n"
-unset VCL_HIDE_WINDOWS && \
 OFFICESCRIPT=`mktemp` && \
 printf "$(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice.exe" > $${OFFICESCRIPT} && \
 printf " --norestore --nologo '--accept=pipe,name=$(USER);urp;'\n" >> 
$${OFFICESCRIPT} && \
diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk
index 4deed67e7d05..b8f5335fca7f 100644
--- a/solenv/gbuild/platform/macosx.mk
+++ b/solenv/gbuild/platform/macosx.mk
@@ -17,9 +17,6 @@
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
 
-# to avoid flashing windows during tests
-export VCL_HIDE_WINDOWS=1
-
 gb_SDKDIR := $(MACOSX_SDK_PATH)
 
 ifeq (PRE_9_1_0,$(shell test $(CLANGVER) -lt 90100 && echo PRE_9_1_0))
diff --git a/solenv/gbuild/platform/windows.mk 
b/solenv/gbuild/platform/windows.mk
index a8ba5b1d1717..b2de9e2a993d 100644
--- a/solenv/gbuild/platform/windows.mk
+++ b/solenv/gbuild/platform/windows.mk
@@ -10,9 +10,6 @@
 # to block heavy exception handling that try to acquire the solarmutex
 export LO_LEAN_EXCEPTION=1
 
-# to avoid flashing windows during tests
-export VCL_HIDE_WINDOWS=1
-
 gb_LICENSE := license.txt
 gb_README = readme_$(1).txt
 
diff --git a/vcl/README.vars b/vcl/README.vars
index 0156aa76fd2b..786be8cbf166 100644
--- a/vcl/README.vars
+++ b/vcl/README.vars
@@ -14,8 +14,6 @@ VCL_DOUBLEBUFFERING_AVOID_PAINT - don't paint the buffer, 
useful to see where we
 VCL_DOUBLEBUFFERING_FORCE_ENABLE - enable double buffered painting
 VCL_DOUBLEBUFFERING_ENABLE - enable a safe subset of double buffered painting 
(currently in Writer, not in any other applications)
 
-VCL_HIDE_WINDOWS - don't draw windows
-
 VCL_DEBUG_DISABLE_PDFCOMPRESSION - disable compression in the PDF writer
 
 Gtk+
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 5ae913a0dbca..21ca3567b56a 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -153,7 +153,7 @@ struct ImplSVAppData
     bool                    mbInAppExecute = false;         // is 
Application::Execute() on stack
     bool                    mbAppQuit = false;              // is 
Application::Quit() called
     bool                    mbSettingsInit = false;         // true: Settings 
are initialized
-    Application::DialogCancelMode meDialogCancel = 
Application::DialogCancelMode::Off; // true: All Dialog::Execute() calls will 
be terminated immediately with return false
+    DialogCancelMode meDialogCancel = DialogCancelMode::Off; // true: All 
Dialog::Execute() calls will be terminated immediately with return false
 
     /** Controls whether showing any IME status window is toggled on or off.
 
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 2dbc330b17fe..193e1155242f 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -208,7 +208,6 @@ struct ImplMiscData
     TriState                        mnEnableATT;
     bool                            mbEnableLocalizedDecimalSep;
     TriState                        mnDisablePrinting;
-    bool                            mbPseudoHeadless;
 };
 
 struct ImplHelpData
@@ -2318,10 +2317,6 @@ ImplMiscData::ImplMiscData() :
 {
     static const char* pEnv = getenv("SAL_DECIMALSEP_ENABLED" ); // set 
default without UI
     mbEnableLocalizedDecimalSep = (pEnv != nullptr);
-    // Should we display any windows?
-
-    // need to hardly mask here for now, needs to be adapted of course...
-    mbPseudoHeadless = getenv("VCL_HIDE_WINDOWS") || 
comphelper::LibreOfficeKit::isActive();
 }
 
 MiscSettings::MiscSettings()
@@ -2498,11 +2493,6 @@ bool MiscSettings::GetEnableLocalizedDecimalSep() const
     return mxData->mbEnableLocalizedDecimalSep;
 }
 
-bool MiscSettings::GetPseudoHeadless() const
-{
-    return mxData->mbPseudoHeadless;
-}
-
 HelpSettings::HelpSettings()
     : mxData(std::make_shared<ImplHelpData>())
 {
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 626214690166..eeba046c39ef 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -75,6 +75,7 @@
 #include <com/sun/star/uno/XNamingService.hpp>
 #include <com/sun/star/util/XModifiable.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/lok.hxx>
 #include <comphelper/solarmutex.hxx>
 #include <osl/process.h>
 
@@ -1333,7 +1334,7 @@ vcl::Window* Application::GetDefDialogParent()
     return nullptr;
 }
 
-Application::DialogCancelMode Application::GetDialogCancelMode()
+DialogCancelMode Application::GetDialogCancelMode()
 {
     return ImplGetSVData()->maAppData.meDialogCancel;
 }
@@ -1442,7 +1443,7 @@ void Application::EnableHeadlessMode( bool 
dialogsAreFatal )
 
 bool Application::IsHeadlessModeEnabled()
 {
-    return IsDialogCancelEnabled();
+    return IsDialogCancelEnabled() || comphelper::LibreOfficeKit::isActive();
 }
 
 static bool bConsoleOnly = false;
diff --git a/vcl/source/opengl/OpenGLHelper.cxx 
b/vcl/source/opengl/OpenGLHelper.cxx
index 6ae47184ae2e..aa876ac60688 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -972,8 +972,6 @@ bool OpenGLHelper::isVCLOpenGLEnabled()
      * There are a number of cases that these environment variables cover:
      *  * SAL_FORCEGL forces OpenGL independent of any other option
      *  * SAL_DISABLEGL or a blacklisted driver avoid the use of OpenGL if 
SAL_FORCEGL is not set
-     *  * SAL_ENABLEGL overrides VCL_HIDE_WINDOWS and the configuration 
variable
-     *  * the configuration variable is checked if no environment variable is 
set
      */
 
     bSet = true;
@@ -989,17 +987,16 @@ bool OpenGLHelper::isVCLOpenGLEnabled()
     else if (bSupportsVCLOpenGL)
     {
         static bool bEnableGLEnv = !!getenv("SAL_ENABLEGL");
+        static bool bHeadlessPlugin = (getenv("SAL_USE_VCLPLUGIN") &&
+            0 == strcmp(getenv("SAL_USE_VCLPLUGIN"), "svp"));
 
         bEnable = bEnableGLEnv;
 
-        static bool bDuringBuild = getenv("VCL_HIDE_WINDOWS");
-        if (bDuringBuild && !bEnable /* env. enable overrides */)
-            bEnable = false;
-        else if (officecfg::Office::Common::VCL::UseOpenGL::get())
+        if (officecfg::Office::Common::VCL::UseOpenGL::get())
             bEnable = true;
 
-        // Force disable in safe mode
-        if (Application::IsSafeModeEnabled())
+        // Force disable in safe mode or when running with headless plugin
+        if (bHeadlessPlugin || Application::IsSafeModeEnabled())
             bEnable = false;
 
         bRet = bEnable;
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index d91f5aea30f0..e59deb0b685a 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -864,9 +864,9 @@ bool Dialog::ImplStartExecute()
     {
         switch ( Application::GetDialogCancelMode() )
         {
-        case Application::DialogCancelMode::Off:
+        case DialogCancelMode::Off:
             break;
-        case Application::DialogCancelMode::Silent:
+        case DialogCancelMode::Silent:
             if (bModal && GetLOKNotifier())
             {
                 // check if there's already some dialog being ::Execute()d
@@ -887,7 +887,7 @@ bool Dialog::ImplStartExecute()
                     << "\"cancelled in silent mode");
             return false;
         default: // default cannot happen
-        case Application::DialogCancelMode::Fatal:
+        case DialogCancelMode::Fatal:
             std::abort();
         }
 
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 349d4d0b5787..9212e55bef1a 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2322,7 +2322,7 @@ void Window::Show(bool bVisible, ShowFlags nFlags)
             mpWindowImpl->mbSuppressAccessibilityEvents = false;
 
             mpWindowImpl->mbPaintFrame = true;
-            if 
(!Application::GetSettings().GetMiscSettings().GetPseudoHeadless())
+            if (!Application::IsHeadlessModeEnabled())
             {
                 bool bNoActivate(nFlags & 
(ShowFlags::NoActivate|ShowFlags::NoFocusChange));
                 mpWindowImpl->mpFrame->Show( true, bNoActivate );
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index e34600285c22..c3e2d294e155 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -812,8 +812,7 @@ namespace {
 
 void SetForegroundWindow_Impl(HWND hwnd)
 {
-    static bool bUseForegroundWindow = !std::getenv("VCL_HIDE_WINDOWS");
-    if (bUseForegroundWindow)
+    if (!Application::IsHeadlessModeEnabled())
         SetForegroundWindow(hwnd);
 }
 
diff --git a/vcl/workben/commonfuzzer.hxx b/vcl/workben/commonfuzzer.hxx
index 85e772e19468..f3e2208307a8 100644
--- a/vcl/workben/commonfuzzer.hxx
+++ b/vcl/workben/commonfuzzer.hxx
@@ -120,7 +120,7 @@ void CommonInitialize(int *argc, char ***argv)
     comphelper::setProcessServiceFactory( xServiceManager );
     utl::ConfigManager::EnableFuzzing();
     InitVCL();
-    Application::SetDialogCancelMode( Application::DialogCancelMode::Silent );
+    Application::SetDialogCancelMode(DialogCancelMode::Silent);
 
     //we don't have a de-init, so inside this leak disabled region...
     //get the font info
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index e9e398b8b4c7..cbd736efe6ad 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -104,7 +104,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
 
         InitVCL();
 
-        
Application::SetDialogCancelMode(Application::DialogCancelMode::Silent);
+        Application::SetDialogCancelMode(DialogCancelMode::Silent);
 
         if (strcmp(argv[2], "wmf") == 0 || strcmp(argv[2], "emf") == 0)
         {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to