summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/unx/gtk3/gtkinst.cxx52
1 files changed, 35 insertions, 17 deletions
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();