[Libreoffice-commits] core.git: 3 commits - android/Bootstrap include/vcl sal/android sw/qa vcl/inc vcl/osx vcl/source vcl/unx vcl/win

Tor Lillqvist tml at collabora.com
Mon Mar 30 06:02:41 PDT 2015


 android/Bootstrap/src/org/libreoffice/android/Bootstrap.java |    4 
 include/vcl/svapp.hxx                                        |    7 +
 sal/android/lo-bootstrap.c                                   |   15 --
 sw/qa/extras/tiledrendering/tiledrendering.cxx               |   13 +
 vcl/inc/unx/x11/x11display.hxx                               |   25 +++
 vcl/osx/salinst.cxx                                          |   11 +
 vcl/source/app/svmain.cxx                                    |   17 --
 vcl/unx/generic/app/saldata.cxx                              |   52 -------
 vcl/unx/generic/gdi/x11windowprovider.cxx                    |   72 +++++++++++
 vcl/win/source/app/saldata.cxx                               |   11 +
 10 files changed, 141 insertions(+), 86 deletions(-)

New commits:
commit e69583737701a2d56a8ed5fe17e0f68bff404ec4
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Mar 30 14:47:43 2015 +0300

    Bypass test that fails on OS X without window system access
    
    With this change, 'make' now succeeds for me when logged in through
    ssh to a Mac where I am not logged in on the console or through Screen
    Sharing.
    
    Change-Id: I8aa7f3174b00544fa8e399c8d4dcd9cc801e0dc0

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 3aa33b2..23d3fe2 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -12,6 +12,7 @@
 #include <comphelper/string.hxx>
 #include <svx/svdpage.hxx>
 #include <svx/svdview.hxx>
+#include <vcl/svapp.hxx>
 #include <crsskip.hxx>
 #include <drawdoc.hxx>
 #include <wrtsh.hxx>
@@ -80,6 +81,18 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
 
 void SwTiledRenderingTest::testRegisterCallback()
 {
+#ifdef MACOSX
+    // For some reason this particular test requires window system access on OS X.
+
+    // Without window system access, we do get a number of "<<<WARNING>>>
+    // AquaSalGraphics::CheckContext() FAILED!!!!" [sic] and " <Warning>: CGSConnectionByID: 0 is
+    // not a valid connection ID" warnings while running the other tests, too, but they still
+    // succeed.
+
+    if (!vcl::IsWindowSystemAvailable())
+        return;
+#endif
+
     SwXTextDocument* pXTextDocument = createDoc("dummy.fodt");
     pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
     SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
commit 038d13ef848e0c773d531048637d760395a56d9f
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Mar 30 13:12:34 2015 +0300

    Introduce vcl::IsWindowSystemAvailable()
    
    Change-Id: I6e3f804833db7487ddf7ba75c43d15017dcbe1ba

diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index bca677a..3ef9677 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -1706,6 +1706,13 @@ inline void Application::EndYield()
     PostUserEvent( Link() );
 }
 
+namespace vcl
+{
+
+VCL_DLLPUBLIC bool IsWindowSystemAvailable();
+
+}
+
 #endif // _APP_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/x11/x11display.hxx b/vcl/inc/unx/x11/x11display.hxx
new file mode 100644
index 0000000..8da1c52
--- /dev/null
+++ b/vcl/inc/unx/x11/x11display.hxx
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_INC_UNX_X11_X11DISPLAY_HXX
+#define INCLUDED_VCL_INC_UNX_X11_X11DISPLAY_HXX
+
+#include <prex.h>
+#include <X11/Xproto.h>
+#include <postx.h>
+
+#include <rtl/string.hxx>
+
+#include <vcl/dllapi.h>
+
+Display* VCL_DLLPUBLIC OpenX11Display(OString& rDisplay);
+
+#endif // INCLUDED_VCL_INC_UNX_X11_X11DISPLAY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index 105a9a9..fc8e9e4 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -1070,4 +1070,15 @@ NSImage* CreateNSImage( const Image& rImage )
     return pImage;
 }
 
+namespace vcl
+{
+
+bool IsWindowSystemAvailable()
+{
+    // Yes I know the parens are not needed. I like them in cases like this. So sue me.
+    return ([NSScreen screens] != nil && [[NSScreen screens] count] > 0);
+}
+
+} // namespace vcl
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx
index 2a90eb7..bbb9aba 100644
--- a/vcl/unx/generic/app/saldata.cxx
+++ b/vcl/unx/generic/app/saldata.cxx
@@ -39,10 +39,6 @@
 #include <sys/time.h>
 #endif
 
-#include <prex.h>
-#include <X11/Xproto.h>
-#include <postx.h>
-
 #include <osl/process.h>
 #include <osl/mutex.hxx>
 
@@ -52,6 +48,7 @@
 #include "unx/sm.hxx"
 #include "unx/i18n_im.hxx"
 #include "unx/i18n_xkb.hxx"
+#include "unx/x11/x11display.hxx"
 #include "salinst.hxx"
 
 #include <osl/signal.h>
@@ -395,53 +392,8 @@ void SalXLib::Init()
     pInputMethod->SetLocale();
     XrmInitialize();
 
-    /*
-     * open connection to X11 Display
-     * try in this order:
-     *  o  -display command line parameter,
-     *  o  $DISPLAY environment variable
-     *  o  default display
-     */
-
-    Display *pDisp = NULL;
-
-    // is there a -display command line parameter?
-
-    sal_uInt32 nParams = osl_getCommandArgCount();
-    OUString aParam;
     OString aDisplay;
-    for (sal_uInt16 i=0; i<nParams; i++)
-    {
-        osl_getCommandArg(i, &aParam.pData);
-        if ( aParam == "-display" )
-        {
-            osl_getCommandArg(i+1, &aParam.pData);
-            aDisplay = OUStringToOString(
-                   aParam, osl_getThreadTextEncoding());
-
-            if ((pDisp = XOpenDisplay(aDisplay.getStr()))!=NULL)
-            {
-                /*
-                 * if a -display switch was used, we need
-                 * to set the environment accoringly since
-                 * the clipboard build another connection
-                 * to the xserver using $DISPLAY
-                 */
-                OUString envVar("DISPLAY");
-                osl_setEnvironment(envVar.pData, aParam.pData);
-            }
-            break;
-        }
-    }
-
-    if (!pDisp && aDisplay.isEmpty())
-    {
-        // Open $DISPLAY or default...
-        char *pDisplay = getenv("DISPLAY");
-        if (pDisplay != NULL)
-            aDisplay = OString(pDisplay);
-        pDisp  = XOpenDisplay(pDisplay);
-    }
+    Display *pDisp = OpenX11Display(aDisplay);
 
     if ( !pDisp )
     {
diff --git a/vcl/unx/generic/gdi/x11windowprovider.cxx b/vcl/unx/generic/gdi/x11windowprovider.cxx
index 5eaa3f6..03a7adf 100644
--- a/vcl/unx/generic/gdi/x11windowprovider.cxx
+++ b/vcl/unx/generic/gdi/x11windowprovider.cxx
@@ -7,10 +7,82 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <vcl/svapp.hxx>
+
 #include "unx/x11windowprovider.hxx"
+#include "unx/x11/x11display.hxx"
 
 X11WindowProvider::~X11WindowProvider()
 {
 }
 
+Display *OpenX11Display(OString& rDisplay)
+{
+    /*
+     * open connection to X11 Display
+     * try in this order:
+     *  o  -display command line parameter,
+     *  o  $DISPLAY environment variable
+     *  o  default display
+     */
+
+    Display *pDisp = NULL;
+
+    // is there a -display command line parameter?
+
+    sal_uInt32 nParams = osl_getCommandArgCount();
+    OUString aParam;
+    for (sal_uInt16 i=0; i<nParams; i++)
+    {
+        osl_getCommandArg(i, &aParam.pData);
+        if ( aParam == "-display" )
+        {
+            osl_getCommandArg(i+1, &aParam.pData);
+            rDisplay = OUStringToOString(
+                   aParam, osl_getThreadTextEncoding());
+
+            if ((pDisp = XOpenDisplay(rDisplay.getStr()))!=NULL)
+            {
+                /*
+                 * if a -display switch was used, we need
+                 * to set the environment accoringly since
+                 * the clipboard build another connection
+                 * to the xserver using $DISPLAY
+                 */
+                OUString envVar("DISPLAY");
+                osl_setEnvironment(envVar.pData, aParam.pData);
+            }
+            break;
+        }
+    }
+
+    if (!pDisp && rDisplay.isEmpty())
+    {
+        // Open $DISPLAY or default...
+        char *pDisplay = getenv("DISPLAY");
+        if (pDisplay != NULL)
+            rDisplay = OString(pDisplay);
+        pDisp  = XOpenDisplay(pDisplay);
+    }
+
+    return pDisp;
+}
+
+namespace vcl
+{
+
+bool IsWindowSystemAvailable()
+{
+    Display *pDisp;
+    OString aDisplay;
+
+    pDisp = OpenX11Display(aDisplay);
+    if (pDisp)
+        XCloseDisplay(pDisp);
+
+    return (pDisp != nullptr);
+}
+
+} // namespace vcl
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/win/source/app/saldata.cxx b/vcl/win/source/app/saldata.cxx
index 821790b..7c70bfa 100644
--- a/vcl/win/source/app/saldata.cxx
+++ b/vcl/win/source/app/saldata.cxx
@@ -74,4 +74,15 @@ int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 )
     return nRet;
 }
 
+namespace vcl
+{
+
+bool IsWindowSystemAvailable()
+{
+    return true; // FIXME: we want this to return false if logged in
+                 // to some Cygwin ssh session for instance
+}
+
+} // namespace vcl
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 3d177c7b6dae0af7d2e4822b3812757c9f65a0c3
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Mar 30 10:24:53 2015 +0300

    Bootstrap.initVCL is not used by our Android app any more
    
    Change-Id: Id1e58547cf2b0786d7a2ca29eae8bbcdd644fdd5

diff --git a/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java b/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java
index 146ced0..ca7d48b 100644
--- a/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java
+++ b/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java
@@ -43,10 +43,6 @@ public final class Bootstrap
     // Wrapper for putenv()
     public static native void putenv(String string);
 
-    // A wrapper for InitVCL() in libvcl (svmain.cxx), called indirectly
-    // through the lo-bootstrap library
-    public static native void initVCL();
-
     // A wrapper for osl_setCommandArgs(). Before calling
     // osl_setCommandArgs(), argv[0] is prefixed with the parent directory of
     // where the lo-bootstrap library is.
diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c
index 4d318e8..5c47b8f 100644
--- a/sal/android/lo-bootstrap.c
+++ b/sal/android/lo-bootstrap.c
@@ -821,21 +821,6 @@ extract_files(const char *root,
  * functions here in this file.
  */
 
-// public static native void initVCL();
-
-extern void InitVCLWrapper(void);
-
-__attribute__ ((visibility("default")))
-void
-Java_org_libreoffice_android_Bootstrap_initVCL(JNIEnv* env,
-                                               jobject clazz)
-{
-    (void) env;
-    (void) clazz;
-
-    InitVCLWrapper();
-}
-
 extern void osl_setCommandArgs(int, char **);
 
 __attribute__ ((visibility("default")))
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 360dc6a3..a80d576 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -294,23 +294,6 @@ bool InitVCL()
     return true;
 }
 
-#ifdef ANDROID
-
-extern "C" __attribute__ ((visibility("default"))) void
-InitVCLWrapper()
-{
-    uno::Reference<uno::XComponentContext> xContext( cppu::defaultBootstrap_InitialComponentContext() );
-    uno::Reference<lang::XMultiComponentFactory> xFactory( xContext->getServiceManager() );
-
-    uno::Reference<lang::XMultiServiceFactory> xSM( xFactory, uno::UNO_QUERY_THROW );
-
-    comphelper::setProcessServiceFactory( xSM );
-
-    InitVCL();
-}
-
-#endif
-
 namespace
 {
 


More information about the Libreoffice-commits mailing list