[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Apr 14 12:51:34 UTC 2020
vcl/unx/gtk3/gtk3gtkframe.cxx | 16 ++++++++++------
vcl/unx/gtk3/gtk3gtkinst.cxx | 4 ++--
2 files changed, 12 insertions(+), 8 deletions(-)
New commits:
commit fb3a41b328f5e221e96e7f90e28f84988188cbe2
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Apr 14 09:59:02 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Apr 14 14:51:00 2020 +0200
use gdk_window_move_to_rect if available at runtime
vs at buildtime
Change-Id: I22fdf5f98058bf5212248f33cf879e1420748ba3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92152
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 9b221311a8b3..18db569607ee 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -45,6 +45,8 @@
#include <basegfx/vector/b2ivector.hxx>
+#include <dlfcn.h>
+
#include <algorithm>
#if OSL_DEBUG_LEVEL > 1
@@ -2908,7 +2910,6 @@ void GtkSalFrame::sizeAllocated(GtkWidget* pWidget, GdkRectangle *pAllocation, g
pThis->TriggerPaintEvent();
}
-#if GTK_CHECK_VERSION(3,23,0)
namespace {
void swapDirection(GdkGravity& gravity)
@@ -2924,7 +2925,6 @@ void swapDirection(GdkGravity& gravity)
}
}
-#endif
void GtkSalFrame::signalRealize(GtkWidget*, gpointer frame)
{
@@ -2934,8 +2934,13 @@ void GtkSalFrame::signalRealize(GtkWidget*, gpointer frame)
return;
pThis->TriggerPaintEvent();
-#if GTK_CHECK_VERSION(3,23,0)
- if (gtk_check_version(3, 23, 0) == nullptr && pThis->m_bFloatPositioned)
+ if (!pThis->m_bFloatPositioned)
+ return;
+
+ static auto window_move_to_rect = reinterpret_cast<void (*) (GdkWindow*, const GdkRectangle*, GdkGravity,
+ GdkGravity, GdkAnchorHints, gint, gint)>(
+ dlsym(nullptr, "gdk_window_move_to_rect"));
+ if (window_move_to_rect)
{
GdkGravity rect_anchor = GDK_GRAVITY_SOUTH_WEST, menu_anchor = GDK_GRAVITY_NORTH_WEST;
@@ -2969,9 +2974,8 @@ void GtkSalFrame::signalRealize(GtkWidget*, gpointer frame)
static_cast<int>(aFloatRect.GetWidth()), static_cast<int>(aFloatRect.GetHeight())};
GdkWindow* gdkWindow = gtk_widget_get_window(pThis->m_pWindow);
- gdk_window_move_to_rect(gdkWindow, &rect, rect_anchor, menu_anchor, GDK_ANCHOR_FLIP, 0, 0);
+ window_move_to_rect(gdkWindow, &rect, rect_anchor, menu_anchor, GDK_ANCHOR_FLIP, 0, 0);
}
-#endif
}
gboolean GtkSalFrame::signalConfigure(GtkWidget*, GdkEventConfigure* pEvent, gpointer frame)
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 8700a948e28f..809a67c9373d 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1623,7 +1623,7 @@ OpenGLContext* GtkInstance::CreateOpenGLContext()
// tdf#123800 avoid requiring wayland at runtime just because it existed at buildtime
bool DLSYM_GDK_IS_WAYLAND_DISPLAY(GdkDisplay* pDisplay)
{
- auto get_type = reinterpret_cast<GType (*) (void)>(dlsym(nullptr, "gdk_wayland_display_get_type"));
+ 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());
@@ -1631,7 +1631,7 @@ bool DLSYM_GDK_IS_WAYLAND_DISPLAY(GdkDisplay* pDisplay)
bool DLSYM_GDK_IS_X11_DISPLAY(GdkDisplay* pDisplay)
{
- auto get_type = reinterpret_cast<GType (*) (void)>(dlsym(nullptr, "gdk_x11_display_get_type"));
+ 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());
More information about the Libreoffice-commits
mailing list