vcl/unx/gtk3/gtkinst.cxx | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-)
New commits: commit a75915366490a562afeacb7fc1475d9fe874ee86 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Jun 29 17:14:13 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Jun 30 10:10:15 2021 +0200 gtk[3|4] AnyInput wasn't doing anything useful under wayland which is going to be the case for all backends under gtk4 at least detect if there is evidence that the VCL_INPUT_ANY condition is true to curtail the idle spellchecking (etc) writer loop in favor of user interaction Change-Id: Id1cefd720a921e3a0d1d403769c544c15c6360e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118126 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 0f340ed4e814b445dbdd37b154015585769df589) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118102 diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 65427f880bed..4a6001146f8b 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -438,17 +438,37 @@ bool GtkInstance::AnyInput( VclInputFlags nType ) 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) + { + GdkDisplay* pDisplay = gdk_display_get_default(); + if (DLSYM_GDK_IS_WAYLAND_DISPLAY(pDisplay)) + { + 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) + { + GPollFD aPollFD; + aPollFD.fd = wayland_display_get_fd(pWLDisplay); + aPollFD.events = G_IO_IN | G_IO_ERR | G_IO_HUP; + bRet = g_poll(&aPollFD, 1, 0) > 0; + } + } + } +#endif + #if !GTK_CHECK_VERSION(4, 0, 0) GdkDisplay* pDisplay = gdk_display_get_default(); if (!gdk_display_has_pending(pDisplay)) - return false; -#endif + return bRet; - if (nType == ANY_INPUT_EXCLUDING_TIMER) + if (bCheckForAnyInput) return true; - bool bRet = false; -#if !GTK_CHECK_VERSION(4, 0, 0) std::deque<GdkEvent*> aEvents; GdkEvent *pEvent = nullptr; while ((pEvent = gdk_display_get_event(pDisplay))) @@ -469,6 +489,7 @@ bool GtkInstance::AnyInput( VclInputFlags nType ) aEvents.pop_front(); } #endif + return bRet; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits