Explicitly set and use WEBRTC_USE_X11 instead of USE_X11.
USE_X11 is magically set by the toolchain. Let's tie this to whether X11 extensions is on or not. WEBRTC_USE_X11 is used in the audio device module so let's be consistent with that. Bug: b/143587130 Change-Id: I15b1744c9acb534dbdf2119deb2dc5d17aa04184 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161901 Commit-Queue: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30080}
This commit is contained in:
committed by
Commit Bot
parent
f2d6fe62f2
commit
0808a8c690
@ -13,6 +13,12 @@ import("../../webrtc.gni")
|
||||
|
||||
use_desktop_capture_differ_sse2 = current_cpu == "x86" || current_cpu == "x64"
|
||||
|
||||
config("x11_config") {
|
||||
if (rtc_use_x11_extensions) {
|
||||
defines = [ "WEBRTC_USE_X11" ]
|
||||
}
|
||||
}
|
||||
|
||||
rtc_library("primitives") {
|
||||
visibility = [ "*" ]
|
||||
sources = [
|
||||
@ -44,6 +50,7 @@ if (rtc_include_tests) {
|
||||
rtc_library("desktop_capture_modules_tests") {
|
||||
testonly = true
|
||||
|
||||
defines = []
|
||||
sources = []
|
||||
deps = [
|
||||
"../../api:function_view",
|
||||
@ -67,12 +74,14 @@ if (rtc_include_tests) {
|
||||
"screen_drawer_unittest.cc",
|
||||
"window_finder_unittest.cc",
|
||||
]
|
||||
public_configs = [ ":x11_config" ]
|
||||
}
|
||||
}
|
||||
|
||||
rtc_library("desktop_capture_unittests") {
|
||||
testonly = true
|
||||
|
||||
defines = []
|
||||
sources = [
|
||||
"blank_detector_desktop_capturer_wrapper_unittest.cc",
|
||||
"cropped_desktop_frame_unittest.cc",
|
||||
@ -116,6 +125,7 @@ if (rtc_include_tests) {
|
||||
"window_capturer_unittest.cc",
|
||||
]
|
||||
deps += [ ":desktop_capture_mock" ]
|
||||
public_configs = [ ":x11_config" ]
|
||||
}
|
||||
}
|
||||
|
||||
@ -267,6 +277,8 @@ if (is_mac) {
|
||||
}
|
||||
|
||||
rtc_library("desktop_capture_generic") {
|
||||
defines = []
|
||||
public_configs = [ ":x11_config" ]
|
||||
visibility = [
|
||||
":desktop_capture",
|
||||
":desktop_capture_objc",
|
||||
|
||||
@ -32,7 +32,7 @@ DesktopCaptureOptions& DesktopCaptureOptions::operator=(
|
||||
// static
|
||||
DesktopCaptureOptions DesktopCaptureOptions::CreateDefault() {
|
||||
DesktopCaptureOptions result;
|
||||
#if defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_X11)
|
||||
result.set_x_display(SharedXDisplay::CreateDefault());
|
||||
#endif
|
||||
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
#if defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_X11)
|
||||
#include "modules/desktop_capture/linux/shared_x_display.h"
|
||||
#endif
|
||||
|
||||
@ -42,7 +42,7 @@ class RTC_EXPORT DesktopCaptureOptions {
|
||||
DesktopCaptureOptions& operator=(const DesktopCaptureOptions& options);
|
||||
DesktopCaptureOptions& operator=(DesktopCaptureOptions&& options);
|
||||
|
||||
#if defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_X11)
|
||||
SharedXDisplay* x_display() const { return x_display_; }
|
||||
void set_x_display(rtc::scoped_refptr<SharedXDisplay> x_display) {
|
||||
x_display_ = x_display;
|
||||
@ -134,7 +134,7 @@ class RTC_EXPORT DesktopCaptureOptions {
|
||||
#endif
|
||||
|
||||
private:
|
||||
#if defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_X11)
|
||||
rtc::scoped_refptr<SharedXDisplay> x_display_;
|
||||
#endif
|
||||
|
||||
@ -150,7 +150,7 @@ class RTC_EXPORT DesktopCaptureOptions {
|
||||
bool allow_directx_capturer_ = false;
|
||||
bool allow_cropping_window_capturer_ = false;
|
||||
#endif
|
||||
#if defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_X11)
|
||||
bool use_update_notifications_ = false;
|
||||
#else
|
||||
bool use_update_notifications_ = true;
|
||||
|
||||
@ -73,7 +73,7 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateScreenCapturer(
|
||||
return capturer;
|
||||
}
|
||||
|
||||
#if defined(WEBRTC_USE_PIPEWIRE) || defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
|
||||
bool DesktopCapturer::IsRunningUnderWayland() {
|
||||
const char* xdg_session_type = getenv("XDG_SESSION_TYPE");
|
||||
if (!xdg_session_type || strncmp(xdg_session_type, "wayland", 7) != 0)
|
||||
@ -84,6 +84,6 @@ bool DesktopCapturer::IsRunningUnderWayland() {
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif // defined(WEBRTC_USE_PIPEWIRE) || defined(USE_X11)
|
||||
#endif // defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -135,9 +135,9 @@ class RTC_EXPORT DesktopCapturer {
|
||||
static std::unique_ptr<DesktopCapturer> CreateScreenCapturer(
|
||||
const DesktopCaptureOptions& options);
|
||||
|
||||
#if defined(WEBRTC_USE_PIPEWIRE) || defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
|
||||
static bool IsRunningUnderWayland();
|
||||
#endif // defined(WEBRTC_USE_PIPEWIRE) || defined(USE_X11)
|
||||
#endif // defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
|
||||
|
||||
protected:
|
||||
// CroppingWindowCapturer needs to create raw capturers without wrappers, so
|
||||
|
||||
@ -13,9 +13,9 @@
|
||||
#include "modules/desktop_capture/desktop_capture_types.h"
|
||||
#include "modules/desktop_capture/mouse_cursor_monitor.h"
|
||||
|
||||
#if defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_X11)
|
||||
#include "modules/desktop_capture/linux/mouse_cursor_monitor_x11.h"
|
||||
#endif // defined(USE_X11)
|
||||
#endif // defined(WEBRTC_USE_X11)
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -23,32 +23,32 @@ namespace webrtc {
|
||||
MouseCursorMonitor* MouseCursorMonitor::CreateForWindow(
|
||||
const DesktopCaptureOptions& options,
|
||||
WindowId window) {
|
||||
#if defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_X11)
|
||||
return MouseCursorMonitorX11::CreateForWindow(options, window);
|
||||
#else
|
||||
return nullptr;
|
||||
#endif // defined(USE_X11)
|
||||
#endif // defined(WEBRTC_USE_X11)
|
||||
}
|
||||
|
||||
// static
|
||||
MouseCursorMonitor* MouseCursorMonitor::CreateForScreen(
|
||||
const DesktopCaptureOptions& options,
|
||||
ScreenId screen) {
|
||||
#if defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_X11)
|
||||
return MouseCursorMonitorX11::CreateForScreen(options, screen);
|
||||
#else
|
||||
return nullptr;
|
||||
#endif // defined(USE_X11)
|
||||
#endif // defined(WEBRTC_USE_X11)
|
||||
}
|
||||
|
||||
// static
|
||||
std::unique_ptr<MouseCursorMonitor> MouseCursorMonitor::Create(
|
||||
const DesktopCaptureOptions& options) {
|
||||
#if defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_X11)
|
||||
return MouseCursorMonitorX11::Create(options);
|
||||
#else
|
||||
return nullptr;
|
||||
#endif // defined(USE_X11)
|
||||
#endif // defined(WEBRTC_USE_X11)
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -17,9 +17,9 @@
|
||||
#include "modules/desktop_capture/linux/screen_capturer_pipewire.h"
|
||||
#endif // defined(WEBRTC_USE_PIPEWIRE)
|
||||
|
||||
#if defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_X11)
|
||||
#include "modules/desktop_capture/linux/screen_capturer_x11.h"
|
||||
#endif // defined(USE_X11)
|
||||
#endif // defined(WEBRTC_USE_X11)
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -32,9 +32,9 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer(
|
||||
}
|
||||
#endif // defined(WEBRTC_USE_PIPEWIRE)
|
||||
|
||||
#if defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_X11)
|
||||
return ScreenCapturerX11::CreateRawScreenCapturer(options);
|
||||
#endif // defined(USE_X11)
|
||||
#endif // defined(WEBRTC_USE_X11)
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -17,9 +17,9 @@
|
||||
#include "modules/desktop_capture/linux/window_capturer_pipewire.h"
|
||||
#endif // defined(WEBRTC_USE_PIPEWIRE)
|
||||
|
||||
#if defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_X11)
|
||||
#include "modules/desktop_capture/linux/window_capturer_x11.h"
|
||||
#endif // defined(USE_X11)
|
||||
#endif // defined(WEBRTC_USE_X11)
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -32,9 +32,9 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer(
|
||||
}
|
||||
#endif // defined(WEBRTC_USE_PIPEWIRE)
|
||||
|
||||
#if defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_X11)
|
||||
return WindowCapturerX11::CreateRawWindowCapturer(options);
|
||||
#endif // defined(USE_X11)
|
||||
#endif // defined(WEBRTC_USE_X11)
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
#if defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_X11)
|
||||
class XAtomCache;
|
||||
#endif
|
||||
|
||||
@ -46,7 +46,7 @@ class WindowFinder {
|
||||
Options(const Options& other);
|
||||
Options(Options&& other);
|
||||
|
||||
#if defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_X11)
|
||||
XAtomCache* cache = nullptr;
|
||||
#endif
|
||||
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
#include "rtc_base/logging.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
#if defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_X11)
|
||||
#include "modules/desktop_capture/linux/shared_x_display.h"
|
||||
#include "modules/desktop_capture/linux/x_atom_cache.h"
|
||||
#endif
|
||||
@ -92,7 +92,7 @@ TEST(WindowFinderTest, FindConsoleWindow) {
|
||||
#else
|
||||
TEST(WindowFinderTest, FindDrawerWindow) {
|
||||
WindowFinder::Options options;
|
||||
#if defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_X11)
|
||||
std::unique_ptr<XAtomCache> cache;
|
||||
const auto shared_x_display = SharedXDisplay::CreateDefault();
|
||||
if (shared_x_display) {
|
||||
@ -148,7 +148,7 @@ TEST(WindowFinderTest, FindDrawerWindow) {
|
||||
|
||||
TEST(WindowFinderTest, ShouldReturnNullWindowIfSpotIsOutOfScreen) {
|
||||
WindowFinder::Options options;
|
||||
#if defined(USE_X11)
|
||||
#if defined(WEBRTC_USE_X11)
|
||||
std::unique_ptr<XAtomCache> cache;
|
||||
const auto shared_x_display = SharedXDisplay::CreateDefault();
|
||||
if (shared_x_display) {
|
||||
|
||||
Reference in New Issue
Block a user