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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue May 11 15:57:23 UTC 2021


 vcl/inc/unx/gtk/gtkdata.hxx |    2 --
 vcl/unx/gtk3/gtkdata.cxx    |    2 --
 vcl/unx/gtk3/gtkframe.cxx   |    4 ++--
 vcl/unx/gtk3/gtkinst.cxx    |    6 ++++--
 4 files changed, 6 insertions(+), 8 deletions(-)

New commits:
commit 8f03cf64ecbf026111cc4c506b1bb021a11187b7
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 11 15:26:59 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue May 11 17:56:29 2021 +0200

    gtk4: have just one way to determine if its an X11 Display
    
    Change-Id: I59e2cd44252616e93c8781ffa9a916f846b24b80
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115434
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index 747ad505abb5..e3cace3c6389 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -170,7 +170,6 @@ class GtkSalDisplay : public SalGenericDisplay
     GdkDisplay*                     m_pGdkDisplay;
     o3tl::enumarray<PointerStyle, GdkCursor*> m_aCursors;
     bool                            m_bStartupCompleted;
-    bool                            m_bX11Display;
 
     GdkCursor* getFromSvg( OUString const & name, int nXHot, int nYHot );
 
@@ -179,7 +178,6 @@ public:
     virtual ~GtkSalDisplay() override;
 
     GdkDisplay* GetGdkDisplay() const { return m_pGdkDisplay; }
-    bool        IsX11Display() const { return m_bX11Display; }
 
     GtkSalSystem* getSystem() const { return m_pSys; }
 
diff --git a/vcl/unx/gtk3/gtkdata.cxx b/vcl/unx/gtk3/gtkdata.cxx
index fc2f7df7ce1b..153fc61d068f 100644
--- a/vcl/unx/gtk3/gtkdata.cxx
+++ b/vcl/unx/gtk3/gtkdata.cxx
@@ -57,8 +57,6 @@ GtkSalDisplay::GtkSalDisplay( GdkDisplay* pDisplay ) :
     if ( getenv( "SAL_IGNOREXERRORS" ) )
         GetGenericUnixSalData()->ErrorTrapPush(); // and leak the trap
 
-    m_bX11Display = DLSYM_GDK_IS_X11_DISPLAY( m_pGdkDisplay );
-
     gtk_widget_set_default_direction(AllSettings::GetLayoutRTL() ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
 }
 
diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index d9d0852b6cd0..050f4ef3d5b2 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -2133,7 +2133,7 @@ void GtkSalFrame::SetScreenNumber( unsigned int nNewScreen )
 
 void GtkSalFrame::updateWMClass()
 {
-    if (!getDisplay()->IsX11Display())
+    if (!DLSYM_GDK_IS_X11_DISPLAY(getGdkDisplay()))
         return;
 
     if (!gtk_widget_get_realized(m_pWindow))
@@ -2190,7 +2190,7 @@ void GtkSalFrame::StartPresentation( bool bStart )
     std::optional<guint> aWindow;
     std::optional<Display*> aDisplay;
 
-    bool bX11 = getDisplay()->IsX11Display();
+    bool bX11 = DLSYM_GDK_IS_X11_DISPLAY(getGdkDisplay());
     if (bX11)
     {
         aWindow = GtkSalFrame::GetNativeWindowHandle(m_pWindow);
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 3f15bf1f9fe0..df35fe0e1a8e 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -1767,7 +1767,8 @@ bool DLSYM_GDK_IS_WAYLAND_DISPLAY(GdkDisplay* pDisplay)
     static auto get_type = reinterpret_cast<GType (*) (void)>(dlsym(nullptr, "gdk_wayland_display_get_type"));
     if (!get_type)
         return false;
-    return G_TYPE_CHECK_INSTANCE_TYPE(pDisplay, get_type());
+    static bool bResult = G_TYPE_CHECK_INSTANCE_TYPE(pDisplay, get_type());
+    return bResult;
 }
 
 bool DLSYM_GDK_IS_X11_DISPLAY(GdkDisplay* pDisplay)
@@ -1775,7 +1776,8 @@ bool DLSYM_GDK_IS_X11_DISPLAY(GdkDisplay* pDisplay)
     static auto get_type = reinterpret_cast<GType (*) (void)>(dlsym(nullptr, "gdk_x11_display_get_type"));
     if (!get_type)
         return false;
-    return G_TYPE_CHECK_INSTANCE_TYPE(pDisplay, get_type());
+    static bool bResult = G_TYPE_CHECK_INSTANCE_TYPE(pDisplay, get_type());
+    return bResult;
 }
 
 #if !GTK_CHECK_VERSION(4, 0, 0)


More information about the Libreoffice-commits mailing list