[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jun 29 18:20:43 UTC 2021
vcl/unx/gtk3/gtkinst.cxx | 52 +++++++++++++++++++++++++++++++----------------
1 file changed, 35 insertions(+), 17 deletions(-)
New commits:
commit 7ffa58e3ab68c34d18f62ff29419a160f4e4c397
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jun 29 17:39:53 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jun 29 20:20:09 2021 +0200
gtk[3|4] add a catch-all AnyInput for under X too
which is needed for gtk4, enable it for gtk3 as well, if that turns
out to be a problem for some reason then that's easily fixed
Change-Id: Ie3a1875d7930f4db4ff03d085bae07f1646f6e36
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118127
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 3b4f9afbf1b9..e8a1c3862626 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -428,27 +428,15 @@ bool GtkInstance::IsTimerExpired()
return (m_pTimer && m_pTimer->Expired());
}
-bool GtkInstance::AnyInput( VclInputFlags nType )
+namespace
{
- EnsureInit();
- if( (nType & VclInputFlags::TIMER) && IsTimerExpired() )
- return true;
-
- // strip timer bits now
- nType = nType & ~VclInputFlags::TIMER;
-
- static constexpr VclInputFlags ANY_INPUT_EXCLUDING_TIMER = VCL_INPUT_ANY & ~VclInputFlags::TIMER;
-
- const bool bCheckForAnyInput = nType == ANY_INPUT_EXCLUDING_TIMER;
-
- bool bRet = false;
-
-#if defined(GDK_WINDOWING_WAYLAND)
- if (bCheckForAnyInput)
+ bool DisplayHasAnyInput()
{
GdkDisplay* pDisplay = gdk_display_get_default();
+#if defined(GDK_WINDOWING_WAYLAND)
if (DLSYM_GDK_IS_WAYLAND_DISPLAY(pDisplay))
{
+ bool bRet = false;
wl_display* pWLDisplay = gdk_wayland_display_get_wl_display(pDisplay);
static auto wayland_display_get_fd = reinterpret_cast<int (*) (wl_display*)>(dlsym(nullptr, "wl_display_get_fd"));
if (wayland_display_get_fd)
@@ -458,9 +446,39 @@ bool GtkInstance::AnyInput( VclInputFlags nType )
aPollFD.events = G_IO_IN | G_IO_ERR | G_IO_HUP;
bRet = g_poll(&aPollFD, 1, 0) > 0;
}
+ return bRet;
}
- }
#endif
+#if defined(GDK_WINDOWING_X11)
+ if (DLSYM_GDK_IS_X11_DISPLAY(pDisplay))
+ {
+ GPollFD aPollFD;
+ aPollFD.fd = ConnectionNumber(gdk_x11_display_get_xdisplay(pDisplay));
+ aPollFD.events = G_IO_IN;
+ return g_poll(&aPollFD, 1, 0) > 0;
+ }
+#endif
+ return false;
+ }
+}
+
+bool GtkInstance::AnyInput( VclInputFlags nType )
+{
+ EnsureInit();
+ if( (nType & VclInputFlags::TIMER) && IsTimerExpired() )
+ return true;
+
+ // strip timer bits now
+ nType = nType & ~VclInputFlags::TIMER;
+
+ static constexpr VclInputFlags ANY_INPUT_EXCLUDING_TIMER = VCL_INPUT_ANY & ~VclInputFlags::TIMER;
+
+ const bool bCheckForAnyInput = nType == ANY_INPUT_EXCLUDING_TIMER;
+
+ bool bRet = false;
+
+ if (bCheckForAnyInput)
+ bRet = DisplayHasAnyInput();
#if !GTK_CHECK_VERSION(4, 0, 0)
GdkDisplay* pDisplay = gdk_display_get_default();
More information about the Libreoffice-commits
mailing list