[Libreoffice-commits] core.git: vcl/inc vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Sep 29 14:15:12 UTC 2020
vcl/inc/unx/gtk/gtkframe.hxx | 3 +++
vcl/unx/gtk3/gtk3gtkframe.cxx | 41 +++++++++++++++++++++++++++--------------
2 files changed, 30 insertions(+), 14 deletions(-)
New commits:
commit da8a6139cc338b682cd4d87bdb9202882093c94c
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Sep 29 12:30:18 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Sep 29 16:14:36 2020 +0200
gdk_wayland_window_set_application_id doesn't work when called early
after mapped it definitely works
Change-Id: Ide0fa636ee26acea0d938aef08532b9396fe901a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103609
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 844f6d0c3f36..14142223523b 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -210,6 +210,7 @@ class GtkSalFrame final : public SalFrame
GtkDropTarget* m_pDropTarget;
GtkDragSource* m_pDragSource;
bool m_bGeometryIsProvisional;
+ bool m_bIconSetWhileUnmapped;
GtkSalMenu* m_pSalMenu;
@@ -320,6 +321,8 @@ class GtkSalFrame final : public SalFrame
void SetScreen( unsigned int nNewScreen, SetType eType, tools::Rectangle const *pSize = nullptr );
+ void SetIcon(const char* pIcon);
+
public:
cairo_surface_t* m_pSurface;
basegfx::B2IVector m_aFrameSize;
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 61635a3d8d10..8d030931e993 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -931,6 +931,7 @@ void GtkSalFrame::InitCommon()
m_pDropTarget = nullptr;
m_pDragSource = nullptr;
m_bGeometryIsProvisional = false;
+ m_bIconSetWhileUnmapped = false;
m_bTooltipBlocked = false;
m_ePointerStyle = static_cast<PointerStyle>(0xffff);
m_pSalMenu = nullptr;
@@ -1244,6 +1245,28 @@ void GtkSalFrame::SetTitle( const OUString& rTitle )
}
}
+void GtkSalFrame::SetIcon(const char* appicon)
+{
+ 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);
+
+ // gdk_wayland_window_set_application_id doesn't seem to work before
+ // the window is mapped, so set this for real when/if we are mapped
+ m_bIconSetWhileUnmapped = !gtk_widget_get_mapped(m_pWindow);
+ }
+ }
+#endif
+}
+
void GtkSalFrame::SetIcon( sal_uInt16 nIcon )
{
if( (m_nStyle & (SalFrameStyleFlags::PLUG|SalFrameStyleFlags::SYSTEMCHILD|SalFrameStyleFlags::FLOAT|SalFrameStyleFlags::INTRO|SalFrameStyleFlags::OWNERDRAWDECORATION))
@@ -1267,20 +1290,7 @@ void GtkSalFrame::SetIcon( sal_uInt16 nIcon )
else
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
+ SetIcon(appicon);
g_free (appicon);
}
@@ -3171,6 +3181,9 @@ gboolean GtkSalFrame::signalMap(GtkWidget *, GdkEvent*, gpointer frame)
{
GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
+ if (pThis->m_bIconSetWhileUnmapped)
+ pThis->SetIcon(gtk_window_get_icon_name(GTK_WINDOW(pThis->m_pWindow)));
+
pThis->CallCallbackExc( SalEvent::Resize, nullptr );
pThis->TriggerPaintEvent();
More information about the Libreoffice-commits
mailing list