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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon May 10 09:17:17 UTC 2021


 vcl/unx/gtk3/gtkdata.cxx |   36 ++++++++++++++++++++++++++++--------
 1 file changed, 28 insertions(+), 8 deletions(-)

New commits:
commit 5def21945183b9e4cd86f6c941873a7e5d5d5f67
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon May 10 09:18:10 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon May 10 11:16:41 2021 +0200

    gtk4: start without crashing
    
    toplevel empty frame now appears
    
    Change-Id: I755525ab5af7a2e532686e8633feafeb7f16f81e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115311
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtkdata.cxx b/vcl/unx/gtk3/gtkdata.cxx
index f515d93ac1eb..eb534b0d42e6 100644
--- a/vcl/unx/gtk3/gtkdata.cxx
+++ b/vcl/unx/gtk3/gtkdata.cxx
@@ -499,9 +499,10 @@ void GtkSalData::Init()
     }
 
     // init gtk/gdk
-#if !GTK_CHECK_VERSION(4, 0, 0)
+#if GTK_CHECK_VERSION(4, 0, 0)
+    gtk_init_check();
+#else
     gtk_init_check( &nParams, &pCmdLineAry );
-    gdk_error_trap_push();
 #endif
 
     for (int i = 0; i < nParams; ++i)
@@ -532,6 +533,8 @@ void GtkSalData::Init()
         exit(0);
     }
 
+    ErrorTrapPush();
+
 #if defined(GDK_WINDOWING_X11)
     if (DLSYM_GDK_IS_X11_DISPLAY(pGdkDisp))
         aOrigXIOErrorHandler = XSetIOErrorHandler(XIOErrorHdl);
@@ -586,23 +589,40 @@ void GtkSalData::Init()
 
 void GtkSalData::ErrorTrapPush()
 {
-#if !GTK_CHECK_VERSION(4, 0, 0)
-    gdk_error_trap_push ();
+#if GTK_CHECK_VERSION(4, 0, 0)
+# if defined(GDK_WINDOWING_X11)
+    GdkDisplay* pGdkDisp = gdk_display_get_default();
+    if (DLSYM_GDK_IS_X11_DISPLAY(pGdkDisp))
+        gdk_x11_display_error_trap_push(pGdkDisp);
+# endif
+#else
+    gdk_error_trap_push();
 #endif
 }
 
 bool GtkSalData::ErrorTrapPop( bool bIgnoreError )
 {
-#if !GTK_CHECK_VERSION(4, 0, 0)
+#if GTK_CHECK_VERSION(4, 0, 0)
+# if defined(GDK_WINDOWING_X11)
+    GdkDisplay* pGdkDisp = gdk_display_get_default();
+    if (DLSYM_GDK_IS_X11_DISPLAY(pGdkDisp))
+    {
+        if (bIgnoreError)
+        {
+            gdk_x11_display_error_trap_pop_ignored(pGdkDisp); // faster
+            return false;
+        }
+        return gdk_x11_display_error_trap_pop(pGdkDisp) != 0;
+    }
+# endif
+    return false;
+#else
     if (bIgnoreError)
     {
         gdk_error_trap_pop_ignored (); // faster
         return false;
     }
     return gdk_error_trap_pop () != 0;
-#else
-    (void)bIgnoreError;
-    return false;
 #endif
 }
 


More information about the Libreoffice-commits mailing list