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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 8 11:39:44 UTC 2020


 vcl/unx/gtk3/gtk3gtkframe.cxx |   33 ++++++++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 7 deletions(-)

New commits:
commit 2d8e2813ddc87f7ce03b97e4d603df11613461f0
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jul 8 10:13:26 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jul 8 13:38:50 2020 +0200

    use gdk_wayland_window_set_application_id when it becomes available
    
    Change-Id: I60775dcbfbc396f195a71f219668944d0bfecf31
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98325
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 2ddcb832569b..7f2ce207ea7a 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1244,6 +1244,20 @@ void GtkSalFrame::SetIcon( sal_uInt16 nIcon )
         appicon = g_strdup ("libreoffice-startcenter");
 
     gtk_window_set_icon_name (GTK_WINDOW (m_pWindow), appicon);
+
+#if defined(GDK_WINDOWING_WAYLAND)
+    if (DLSYM_GDK_IS_WAYLAND_DISPLAY(getGdkDisplay()))
+    {
+        static auto set_application_id = reinterpret_cast<void (*) (GdkWindow*, const char*)>(
+                                             dlsym(nullptr, "gdk_wayland_window_set_application_id"));
+        if (set_application_id)
+        {
+            GdkWindow* gdkWindow = gtk_widget_get_window(m_pWindow);
+            set_application_id(gdkWindow, appicon);
+        }
+    }
+#endif
+
     g_free (appicon);
 }
 
@@ -1312,13 +1326,18 @@ void GtkSalFrame::Show( bool bVisible, bool /*bNoActivate*/ )
             }
 
 #if defined(GDK_WINDOWING_WAYLAND)
-            //rhbz#1334915, gnome#779143, tdf#100158
-            //gtk under wayland lacks a way to change the app_id
-            //of a window, so brute force everything as a
-            //startcenter when initially shown to at least get
-            //the default LibreOffice icon and not the broken
-            //app icon
-            if (DLSYM_GDK_IS_WAYLAND_DISPLAY(getGdkDisplay()))
+            /*
+             rhbz#1334915, gnome#779143, tdf#100158
+             https://gitlab.gnome.org/GNOME/gtk/-/issues/767
+
+             before gdk_wayland_window_set_application_id was available gtk
+             under wayland lacked a way to change the app_id of a window, so
+             brute force everything as a startcenter when initially shown to at
+             least get the default LibreOffice icon and not the broken app icon
+            */
+            static bool bAppIdImmutable = DLSYM_GDK_IS_WAYLAND_DISPLAY(getGdkDisplay()) &&
+                                          !dlsym(nullptr, "gdk_wayland_window_set_application_id");
+            if (bAppIdImmutable)
             {
                 OString sOrigName(g_get_prgname());
                 g_set_prgname("libreoffice-startcenter");


More information about the Libreoffice-commits mailing list