[Libreoffice-commits] core.git: vcl/unx

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Oct 12 13:57:29 UTC 2018


 vcl/unx/gtk/gtkinst.cxx |   23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

New commits:
commit 345b5bc75883a5f4c3b8b6a5b70e45cacce0109e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Oct 12 13:16:29 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Oct 12 15:57:01 2018 +0200

    clarify when XInitThreads is called
    
    and make the minor version checks more sensible
    
    Change-Id: Ieee6750e4e8dd79213a0befb040ce7b8a815e357
    Reviewed-on: https://gerrit.libreoffice.org/61713
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx
index 1366bf84a62e..77a6b9dc15ab 100644
--- a/vcl/unx/gtk/gtkinst.cxx
+++ b/vcl/unx/gtk/gtkinst.cxx
@@ -66,13 +66,28 @@ extern "C"
             "vcl.gtk",
             "create vcl plugin instance with gtk version " << gtk_major_version
                 << " " << gtk_minor_version << " " << gtk_micro_version);
+
+#if !GTK_CHECK_VERSION(3,0,0)
         if( gtk_major_version < 2 || // very unlikely sanity check
             ( gtk_major_version == 2 && gtk_minor_version < 4 ) )
         {
             g_warning("require a newer gtk than %d.%d for gdk_threads_set_lock_functions", static_cast<int>(gtk_major_version), gtk_minor_version);
             return nullptr;
         }
+#else
+        if (gtk_major_version == 3 && gtk_minor_version < 18)
+        {
+            g_warning("require gtk >= 3.18 for theme expectations");
+            return nullptr;
+        }
+#endif
 
+        // for gtk2 it is always built with X support, so this is always called
+        // for gtk3 it is normally built with X and Wayland support, if
+        // X is supported GDK_WINDOWING_X11 is defined and this is always
+        // called, regardless of if we're running under X or Wayland.
+        // We can't use (GDK_IS_X11_DISPLAY(pDisplay)) to only do it under
+        // X, because we need to do it earlier than we have a display
 #if !GTK_CHECK_VERSION(3,0,0) || defined(GDK_WINDOWING_X11)
         /* #i92121# workaround deadlocks in the X11 implementation
         */
@@ -85,14 +100,6 @@ extern "C"
             XInitThreads();
 #endif
 
-#if GTK_CHECK_VERSION(3,0,0)
-        if (gtk_minor_version < 18)
-        {
-            g_warning("require a newer gtk than 3.%d for theme expectations", gtk_minor_version);
-            return nullptr;
-        }
-#endif
-
         // init gdk thread protection
         bool const sup = g_thread_supported();
             // extracted from the 'if' to avoid Clang -Wunreachable-code


More information about the Libreoffice-commits mailing list