diff --git a/src/modules/desktop_capture/linux/screen_capturer_x11.cc b/src/modules/desktop_capture/linux/screen_capturer_x11.cc index 1b1707141..02cddd831 100644 --- a/src/modules/desktop_capture/linux/screen_capturer_x11.cc +++ b/src/modules/desktop_capture/linux/screen_capturer_x11.cc @@ -14,7 +14,6 @@ #include #include #include -#include #include #include @@ -155,26 +154,16 @@ void ScreenCapturerX11::InitXrandr() { if (XRRQueryExtension(display(), &randr_event_base_, &error_base_ignored) && XRRQueryVersion(display(), &major_version, &minor_version)) { if (major_version > 1 || (major_version == 1 && minor_version >= 5)) { - // Dynamically link XRRGetMonitors and XRRFreeMonitors as a workaround - // to avoid a dependency issue with Debian 8. - get_monitors_ = reinterpret_cast( - dlsym(RTLD_DEFAULT, "XRRGetMonitors")); - free_monitors_ = reinterpret_cast( - dlsym(RTLD_DEFAULT, "XRRFreeMonitors")); - if (get_monitors_ && free_monitors_) { - use_randr_ = true; - RTC_LOG(LS_INFO) << "Using XRandR extension v" << major_version << '.' - << minor_version << '.'; - monitors_ = - get_monitors_(display(), root_window_, true, &num_monitors_); - - // Register for screen change notifications - XRRSelectInput(display(), root_window_, RRScreenChangeNotifyMask); - options_.x_display()->AddEventHandler( - randr_event_base_ + RRScreenChangeNotify, this); - } else { - RTC_LOG(LS_ERROR) << "Unable to link XRandR monitor functions."; - } + use_randr_ = true; + RTC_LOG(LS_INFO) << "Using XRandR extension v" << major_version << '.' + << minor_version << '.'; + monitors_ = + XRRGetMonitors(display(), root_window_, true, &num_monitors_); + + // Register for screen change notifications + XRRSelectInput(display(), root_window_, RRScreenChangeNotifyMask); + options_.x_display()->AddEventHandler( + randr_event_base_ + RRScreenChangeNotify, this); } else { RTC_LOG(LS_ERROR) << "XRandR entension is older than v1.5."; } @@ -186,11 +175,11 @@ void ScreenCapturerX11::InitXrandr() { RTC_NO_SANITIZE("cfi-icall") void ScreenCapturerX11::UpdateMonitors() { if (monitors_) { - free_monitors_(monitors_); + XRRFreeMonitors(monitors_); monitors_ = nullptr; } - monitors_ = get_monitors_(display(), root_window_, true, &num_monitors_); + monitors_ = XRRGetMonitors(display(), root_window_, true, &num_monitors_); if (selected_monitor_name_) { if (selected_monitor_name_ == static_cast(kFullDesktopScreenId)) { @@ -439,7 +428,7 @@ void ScreenCapturerX11::SynchronizeFrame() { RTC_NO_SANITIZE("cfi-icall") void ScreenCapturerX11::DeinitXlib() { if (monitors_) { - free_monitors_(monitors_); + XRRFreeMonitors(monitors_); monitors_ = nullptr; } diff --git a/src/modules/desktop_capture/linux/screen_capturer_x11.h b/src/modules/desktop_capture/linux/screen_capturer_x11.h index b19e2e46e..074e33168 100644 --- a/src/modules/desktop_capture/linux/screen_capturer_x11.h +++ b/src/modules/desktop_capture/linux/screen_capturer_x11.h @@ -106,10 +106,6 @@ class ScreenCapturerX11 : public DesktopCapturer, // selected_monitor_rect_ should be updated as well. // Setting it to kFullDesktopScreenId here might be misleading. Atom selected_monitor_name_ = 0; - typedef XRRMonitorInfo* (*get_monitors_func)(Display*, Window, Bool, int*); - typedef void (*free_monitors_func)(XRRMonitorInfo*); - get_monitors_func get_monitors_ = nullptr; - free_monitors_func free_monitors_ = nullptr; // XFixes. bool has_xfixes_ = false;