diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn index eb26f5c7bb..b40b7430f6 100644 --- a/modules/desktop_capture/BUILD.gn +++ b/modules/desktop_capture/BUILD.gn @@ -400,6 +400,7 @@ rtc_library("desktop_capture_generic") { "Xfixes", "Xrender", "Xrandr", + "Xtst", ] } diff --git a/modules/desktop_capture/linux/shared_x_display.cc b/modules/desktop_capture/linux/shared_x_display.cc index c475db6e78..f0b35f62d3 100644 --- a/modules/desktop_capture/linux/shared_x_display.cc +++ b/modules/desktop_capture/linux/shared_x_display.cc @@ -11,6 +11,7 @@ #include "modules/desktop_capture/linux/shared_x_display.h" #include +#include #include @@ -86,4 +87,15 @@ void SharedXDisplay::ProcessPendingXEvents() { } } +void SharedXDisplay::IgnoreXServerGrabs() { + int test_event_base = 0; + int test_error_base = 0; + int major = 0; + int minor = 0; + if (XTestQueryExtension(display(), &test_event_base, &test_error_base, &major, + &minor)) { + XTestGrabControl(display(), true); + } +} + } // namespace webrtc diff --git a/modules/desktop_capture/linux/shared_x_display.h b/modules/desktop_capture/linux/shared_x_display.h index 98b6101904..64c498c134 100644 --- a/modules/desktop_capture/linux/shared_x_display.h +++ b/modules/desktop_capture/linux/shared_x_display.h @@ -18,6 +18,7 @@ #include "api/ref_counted_base.h" #include "api/scoped_refptr.h" #include "rtc_base/constructor_magic.h" +#include "rtc_base/system/rtc_export.h" // Including Xlib.h will involve evil defines (Bool, Status, True, False), which // easily conflict with other headers. @@ -27,7 +28,7 @@ typedef union _XEvent XEvent; namespace webrtc { // A ref-counted object to store XDisplay connection. -class SharedXDisplay : public rtc::RefCountedBase { +class RTC_EXPORT SharedXDisplay : public rtc::RefCountedBase { public: class XEventHandler { public: @@ -62,6 +63,8 @@ class SharedXDisplay : public rtc::RefCountedBase { // Processes pending XEvents, calling corresponding event handlers. void ProcessPendingXEvents(); + void IgnoreXServerGrabs(); + protected: ~SharedXDisplay() override;