Linux capturers: organize X11 and Wayland implementations into separate folders

Bug: webrtc:13429
Change-Id: I2db727797c2ca2bd85937ff732ce3f68bb45469a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/238173
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Mark Foltz <mfoltz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#35471}
diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn
index 787a5c8..072fd55 100644
--- a/modules/desktop_capture/BUILD.gn
+++ b/modules/desktop_capture/BUILD.gn
@@ -249,14 +249,14 @@
           ":libdrm",
         ]
         deps = [ "../../rtc_base" ]
-        extra_header = "linux/pipewire_stub_header.fragment"
+        extra_header = "linux/wayland/pipewire_stub_header.fragment"
         logging_function = "RTC_LOG(LS_VERBOSE)"
         logging_include = "rtc_base/logging.h"
-        output_name = "linux/pipewire_stubs"
+        output_name = "linux/wayland/pipewire_stubs"
         path_from_source = "modules/desktop_capture/linux"
         sigs = [
-          "linux/pipewire.sigs",
-          "linux/drm.sigs",
+          "linux/wayland/pipewire.sigs",
+          "linux/wayland/drm.sigs",
         ]
       }
     }
@@ -406,37 +406,37 @@
     if (build_with_mozilla && (is_linux || is_chromeos)) {
       sources += [
         "app_capturer_linux.cc",
-        "linux/app_capturer_x11.cc",
-        "linux/desktop_device_info_linux.cc",
-        "linux/desktop_device_info_linux.h",
-        "linux/shared_x_util.cc",
-        "linux/shared_x_util.h",
+        "linux/x11/app_capturer_x11.cc",
+        "linux/x11/desktop_device_info_linux.cc",
+        "linux/x11/desktop_device_info_linux.h",
+        "linux/x11/shared_x_util.cc",
+        "linux/x11/shared_x_util.h",
       ]
     }
   }
 
   if (rtc_use_x11_extensions) {
     sources += [
-      "linux/mouse_cursor_monitor_x11.cc",
-      "linux/mouse_cursor_monitor_x11.h",
-      "linux/screen_capturer_x11.cc",
-      "linux/screen_capturer_x11.h",
-      "linux/shared_x_display.cc",
-      "linux/shared_x_display.h",
-      "linux/window_capturer_x11.cc",
-      "linux/window_capturer_x11.h",
-      "linux/window_finder_x11.cc",
-      "linux/window_finder_x11.h",
-      "linux/window_list_utils.cc",
-      "linux/window_list_utils.h",
-      "linux/x_atom_cache.cc",
-      "linux/x_atom_cache.h",
-      "linux/x_error_trap.cc",
-      "linux/x_error_trap.h",
-      "linux/x_server_pixel_buffer.cc",
-      "linux/x_server_pixel_buffer.h",
-      "linux/x_window_property.cc",
-      "linux/x_window_property.h",
+      "linux/x11/mouse_cursor_monitor_x11.cc",
+      "linux/x11/mouse_cursor_monitor_x11.h",
+      "linux/x11/screen_capturer_x11.cc",
+      "linux/x11/screen_capturer_x11.h",
+      "linux/x11/shared_x_display.cc",
+      "linux/x11/shared_x_display.h",
+      "linux/x11/window_capturer_x11.cc",
+      "linux/x11/window_capturer_x11.h",
+      "linux/x11/window_finder_x11.cc",
+      "linux/x11/window_finder_x11.h",
+      "linux/x11/window_list_utils.cc",
+      "linux/x11/window_list_utils.h",
+      "linux/x11/x_atom_cache.cc",
+      "linux/x11/x_atom_cache.h",
+      "linux/x11/x_error_trap.cc",
+      "linux/x11/x_error_trap.h",
+      "linux/x11/x_server_pixel_buffer.cc",
+      "linux/x11/x_server_pixel_buffer.h",
+      "linux/x11/x_window_property.cc",
+      "linux/x11/x_window_property.h",
     ]
     libs = [
       "X11",
@@ -561,10 +561,10 @@
 
   if (rtc_use_pipewire) {
     sources += [
-      "linux/base_capturer_pipewire.cc",
-      "linux/base_capturer_pipewire.h",
-      "linux/egl_dmabuf.cc",
-      "linux/egl_dmabuf.h",
+      "linux/wayland/base_capturer_pipewire.cc",
+      "linux/wayland/base_capturer_pipewire.h",
+      "linux/wayland/egl_dmabuf.cc",
+      "linux/wayland/egl_dmabuf.h",
     ]
 
     configs += [
diff --git a/modules/desktop_capture/desktop_capture_options.h b/modules/desktop_capture/desktop_capture_options.h
index 19bea1f..2044a5b 100644
--- a/modules/desktop_capture/desktop_capture_options.h
+++ b/modules/desktop_capture/desktop_capture_options.h
@@ -14,7 +14,7 @@
 #include "rtc_base/system/rtc_export.h"
 
 #if defined(WEBRTC_USE_X11)
-#include "modules/desktop_capture/linux/shared_x_display.h"
+#include "modules/desktop_capture/linux/x11/shared_x_display.h"
 #endif
 
 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
diff --git a/modules/desktop_capture/linux/base_capturer_pipewire.cc b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
similarity index 96%
rename from modules/desktop_capture/linux/base_capturer_pipewire.cc
rename to modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
index be8b5f3..f68af91 100644
--- a/modules/desktop_capture/linux/base_capturer_pipewire.cc
+++ b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "modules/desktop_capture/linux/base_capturer_pipewire.h"
+#include "modules/desktop_capture/linux/wayland/base_capturer_pipewire.h"
 
 #include <gio/gunixfdlist.h>
 #include <glib-object.h>
@@ -19,9 +19,9 @@
 #include <sys/syscall.h>
 #include <unistd.h>
 
-#include <memory>
 #include <string>
 #include <utility>
+#include <vector>
 
 #include "absl/memory/memory.h"
 #include "modules/desktop_capture/desktop_capture_options.h"
@@ -31,7 +31,7 @@
 #include "rtc_base/string_encode.h"
 
 #if defined(WEBRTC_DLOPEN_PIPEWIRE)
-#include "modules/desktop_capture/linux/pipewire_stubs.h"
+#include "modules/desktop_capture/linux/wayland/pipewire_stubs.h"
 using modules_desktop_capture_linux::InitializeStubs;
 using modules_desktop_capture_linux::kModuleDrm;
 using modules_desktop_capture_linux::kModulePipewire;
@@ -420,8 +420,8 @@
   g_dbus_proxy_new_for_bus(
       G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, /*info=*/nullptr,
       kDesktopBusName, kDesktopObjectPath, kScreenCastInterfaceName,
-      cancellable_,
-      reinterpret_cast<GAsyncReadyCallback>(OnProxyRequested), this);
+      cancellable_, reinterpret_cast<GAsyncReadyCallback>(OnProxyRequested),
+      this);
 }
 
 void BaseCapturerPipeWire::Init() {
@@ -569,9 +569,8 @@
       plane_datas.push_back(data);
     }
 
-    src_unique_ptr =
-        egl_dmabuf_->ImageFromDmaBuf(desktop_size_, spa_video_format_.format,
-                                     plane_datas, modifier_);
+    src_unique_ptr = egl_dmabuf_->ImageFromDmaBuf(
+        desktop_size_, spa_video_format_.format, plane_datas, modifier_);
     src = src_unique_ptr.get();
   } else if (spa_buffer->datas[0].type == SPA_DATA_MemPtr) {
     src = static_cast<uint8_t*>(spa_buffer->datas[0].data);
@@ -728,14 +727,14 @@
       portal_handle_, OnSessionRequestResponseSignal);
 
   RTC_LOG(LS_INFO) << "Screen cast session requested.";
-  g_dbus_proxy_call(
-      proxy_, "CreateSession", g_variant_new("(a{sv})", &builder),
-      G_DBUS_CALL_FLAGS_NONE, /*timeout=*/-1, cancellable_,
-      reinterpret_cast<GAsyncReadyCallback>(OnSessionRequested), this);
+  g_dbus_proxy_call(proxy_, "CreateSession", g_variant_new("(a{sv})", &builder),
+                    G_DBUS_CALL_FLAGS_NONE, /*timeout=*/-1, cancellable_,
+                    reinterpret_cast<GAsyncReadyCallback>(OnSessionRequested),
+                    this);
 }
 
 // static
-void BaseCapturerPipeWire::OnSessionRequested(GDBusProxy *proxy,
+void BaseCapturerPipeWire::OnSessionRequested(GDBusProxy* proxy,
                                               GAsyncResult* result,
                                               gpointer user_data) {
   BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(user_data);
@@ -841,15 +840,15 @@
       sources_handle_, OnSourcesRequestResponseSignal);
 
   RTC_LOG(LS_INFO) << "Requesting sources from the screen cast session.";
-  g_dbus_proxy_call(
-      proxy_, "SelectSources",
-      g_variant_new("(oa{sv})", session_handle_, &builder),
-      G_DBUS_CALL_FLAGS_NONE, /*timeout=*/-1, cancellable_,
-      reinterpret_cast<GAsyncReadyCallback>(OnSourcesRequested), this);
+  g_dbus_proxy_call(proxy_, "SelectSources",
+                    g_variant_new("(oa{sv})", session_handle_, &builder),
+                    G_DBUS_CALL_FLAGS_NONE, /*timeout=*/-1, cancellable_,
+                    reinterpret_cast<GAsyncReadyCallback>(OnSourcesRequested),
+                    this);
 }
 
 // static
-void BaseCapturerPipeWire::OnSourcesRequested(GDBusProxy *proxy,
+void BaseCapturerPipeWire::OnSourcesRequested(GDBusProxy* proxy,
                                               GAsyncResult* result,
                                               gpointer user_data) {
   BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(user_data);
@@ -935,7 +934,7 @@
 }
 
 // static
-void BaseCapturerPipeWire::OnStartRequested(GDBusProxy *proxy,
+void BaseCapturerPipeWire::OnStartRequested(GDBusProxy* proxy,
                                             GAsyncResult* result,
                                             gpointer user_data) {
   BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(user_data);
@@ -1034,17 +1033,15 @@
   g_dbus_proxy_call_with_unix_fd_list(
       proxy_, "OpenPipeWireRemote",
       g_variant_new("(oa{sv})", session_handle_, &builder),
-      G_DBUS_CALL_FLAGS_NONE, /*timeout=*/-1, /*fd_list=*/nullptr,
-      cancellable_,
+      G_DBUS_CALL_FLAGS_NONE, /*timeout=*/-1, /*fd_list=*/nullptr, cancellable_,
       reinterpret_cast<GAsyncReadyCallback>(OnOpenPipeWireRemoteRequested),
       this);
 }
 
 // static
-void BaseCapturerPipeWire::OnOpenPipeWireRemoteRequested(
-    GDBusProxy *proxy,
-    GAsyncResult* result,
-    gpointer user_data) {
+void BaseCapturerPipeWire::OnOpenPipeWireRemoteRequested(GDBusProxy* proxy,
+                                                         GAsyncResult* result,
+                                                         gpointer user_data) {
   BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(user_data);
   RTC_DCHECK(that);
 
diff --git a/modules/desktop_capture/linux/base_capturer_pipewire.h b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.h
similarity index 91%
rename from modules/desktop_capture/linux/base_capturer_pipewire.h
rename to modules/desktop_capture/linux/wayland/base_capturer_pipewire.h
index a7f954d..238439e 100644
--- a/modules/desktop_capture/linux/base_capturer_pipewire.h
+++ b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.h
@@ -8,18 +8,20 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef MODULES_DESKTOP_CAPTURE_LINUX_BASE_CAPTURER_PIPEWIRE_H_
-#define MODULES_DESKTOP_CAPTURE_LINUX_BASE_CAPTURER_PIPEWIRE_H_
+#ifndef MODULES_DESKTOP_CAPTURE_LINUX_WAYLAND_BASE_CAPTURER_PIPEWIRE_H_
+#define MODULES_DESKTOP_CAPTURE_LINUX_WAYLAND_BASE_CAPTURER_PIPEWIRE_H_
 #include <gio/gio.h>
 #define typeof __typeof__
 #include <pipewire/pipewire.h>
 #include <spa/param/video/format-utils.h>
 #include <spa/utils/result.h>
 
+#include <memory>
+
 #include "absl/types/optional.h"
 #include "modules/desktop_capture/desktop_capture_options.h"
 #include "modules/desktop_capture/desktop_capturer.h"
-#include "modules/desktop_capture/linux/egl_dmabuf.h"
+#include "modules/desktop_capture/linux/wayland/egl_dmabuf.h"
 #include "rtc_base/constructor_magic.h"
 #include "rtc_base/synchronization/mutex.h"
 
@@ -80,7 +82,7 @@
 
   GDBusConnection* connection_ = nullptr;
   GDBusProxy* proxy_ = nullptr;
-  GCancellable *cancellable_ = nullptr;
+  GCancellable* cancellable_ = nullptr;
   gchar* portal_handle_ = nullptr;
   gchar* session_handle_ = nullptr;
   gchar* sources_handle_ = nullptr;
@@ -138,7 +140,7 @@
                                     const gchar* token);
 
   void SessionRequest();
-  static void OnSessionRequested(GDBusProxy *proxy,
+  static void OnSessionRequested(GDBusProxy* proxy,
                                  GAsyncResult* result,
                                  gpointer user_data);
   static void OnSessionRequestResponseSignal(GDBusConnection* connection,
@@ -150,7 +152,7 @@
                                              gpointer user_data);
 
   void SourcesRequest();
-  static void OnSourcesRequested(GDBusProxy *proxy,
+  static void OnSourcesRequested(GDBusProxy* proxy,
                                  GAsyncResult* result,
                                  gpointer user_data);
   static void OnSourcesRequestResponseSignal(GDBusConnection* connection,
@@ -162,7 +164,7 @@
                                              gpointer user_data);
 
   void StartRequest();
-  static void OnStartRequested(GDBusProxy *proxy,
+  static void OnStartRequested(GDBusProxy* proxy,
                                GAsyncResult* result,
                                gpointer user_data);
   static void OnStartRequestResponseSignal(GDBusConnection* connection,
@@ -174,7 +176,7 @@
                                            gpointer user_data);
 
   void OpenPipeWireRemote();
-  static void OnOpenPipeWireRemoteRequested(GDBusProxy *proxy,
+  static void OnOpenPipeWireRemoteRequested(GDBusProxy* proxy,
                                             GAsyncResult* result,
                                             gpointer user_data);
 
@@ -183,4 +185,4 @@
 
 }  // namespace webrtc
 
-#endif  // MODULES_DESKTOP_CAPTURE_LINUX_BASE_CAPTURER_PIPEWIRE_H_
+#endif  // MODULES_DESKTOP_CAPTURE_LINUX_WAYLAND_BASE_CAPTURER_PIPEWIRE_H_
diff --git a/modules/desktop_capture/linux/drm.sigs b/modules/desktop_capture/linux/wayland/drm.sigs
similarity index 100%
rename from modules/desktop_capture/linux/drm.sigs
rename to modules/desktop_capture/linux/wayland/drm.sigs
diff --git a/modules/desktop_capture/linux/egl_dmabuf.cc b/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
similarity index 99%
rename from modules/desktop_capture/linux/egl_dmabuf.cc
rename to modules/desktop_capture/linux/wayland/egl_dmabuf.cc
index 7e464a1..e872636 100644
--- a/modules/desktop_capture/linux/egl_dmabuf.cc
+++ b/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "modules/desktop_capture/linux/egl_dmabuf.h"
+#include "modules/desktop_capture/linux/wayland/egl_dmabuf.h"
 
 #include <asm/ioctl.h>
 #include <dlfcn.h>
diff --git a/modules/desktop_capture/linux/egl_dmabuf.h b/modules/desktop_capture/linux/wayland/egl_dmabuf.h
similarity index 88%
rename from modules/desktop_capture/linux/egl_dmabuf.h
rename to modules/desktop_capture/linux/wayland/egl_dmabuf.h
index 9d7309f..bc512a3 100644
--- a/modules/desktop_capture/linux/egl_dmabuf.h
+++ b/modules/desktop_capture/linux/wayland/egl_dmabuf.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef MODULES_DESKTOP_CAPTURE_LINUX_EGL_DMABUF_H_
-#define MODULES_DESKTOP_CAPTURE_LINUX_EGL_DMABUF_H_
+#ifndef MODULES_DESKTOP_CAPTURE_LINUX_WAYLAND_EGL_DMABUF_H_
+#define MODULES_DESKTOP_CAPTURE_LINUX_WAYLAND_EGL_DMABUF_H_
 
 #include <epoxy/egl.h>
 #include <epoxy/gl.h>
@@ -62,4 +62,4 @@
 
 }  // namespace webrtc
 
-#endif  // MODULES_DESKTOP_CAPTURE_LINUX_EGL_DMABUF_H_
+#endif  // MODULES_DESKTOP_CAPTURE_LINUX_WAYLAND_EGL_DMABUF_H_
diff --git a/modules/desktop_capture/linux/pipewire.sigs b/modules/desktop_capture/linux/wayland/pipewire.sigs
similarity index 100%
rename from modules/desktop_capture/linux/pipewire.sigs
rename to modules/desktop_capture/linux/wayland/pipewire.sigs
diff --git a/modules/desktop_capture/linux/pipewire_stub_header.fragment b/modules/desktop_capture/linux/wayland/pipewire_stub_header.fragment
similarity index 100%
rename from modules/desktop_capture/linux/pipewire_stub_header.fragment
rename to modules/desktop_capture/linux/wayland/pipewire_stub_header.fragment
diff --git a/modules/desktop_capture/linux/mouse_cursor_monitor_x11.cc b/modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.cc
similarity index 97%
rename from modules/desktop_capture/linux/mouse_cursor_monitor_x11.cc
rename to modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.cc
index 761d428..0f4be54 100644
--- a/modules/desktop_capture/linux/mouse_cursor_monitor_x11.cc
+++ b/modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "modules/desktop_capture/linux/mouse_cursor_monitor_x11.h"
+#include "modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.h"
 
 #include <X11/Xlib.h>
 #include <X11/extensions/Xfixes.h>
@@ -23,7 +23,7 @@
 #include "modules/desktop_capture/desktop_capture_types.h"
 #include "modules/desktop_capture/desktop_frame.h"
 #include "modules/desktop_capture/desktop_geometry.h"
-#include "modules/desktop_capture/linux/x_error_trap.h"
+#include "modules/desktop_capture/linux/x11/x_error_trap.h"
 #include "modules/desktop_capture/mouse_cursor.h"
 #include "modules/desktop_capture/mouse_cursor_monitor.h"
 #include "rtc_base/checks.h"
@@ -208,7 +208,7 @@
       new BasicDesktopFrame(DesktopSize(img->width, img->height)));
 
   // Xlib stores 32-bit data in longs, even if longs are 64-bits long.
-  unsigned long* src = img->pixels;
+  unsigned long* src = img->pixels;  // NOLINT(runtime/int)
   uint32_t* dst = reinterpret_cast<uint32_t*>(image->data());
   uint32_t* dst_end = dst + (img->width * img->height);
   while (dst < dst_end) {
diff --git a/modules/desktop_capture/linux/mouse_cursor_monitor_x11.h b/modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.h
similarity index 87%
rename from modules/desktop_capture/linux/mouse_cursor_monitor_x11.h
rename to modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.h
index c34eaf4..980d254 100644
--- a/modules/desktop_capture/linux/mouse_cursor_monitor_x11.h
+++ b/modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef MODULES_DESKTOP_CAPTURE_LINUX_MOUSE_CURSOR_MONITOR_X11_H_
-#define MODULES_DESKTOP_CAPTURE_LINUX_MOUSE_CURSOR_MONITOR_X11_H_
+#ifndef MODULES_DESKTOP_CAPTURE_LINUX_X11_MOUSE_CURSOR_MONITOR_X11_H_
+#define MODULES_DESKTOP_CAPTURE_LINUX_X11_MOUSE_CURSOR_MONITOR_X11_H_
 
 #include <X11/X.h>
 
@@ -18,7 +18,7 @@
 #include "api/scoped_refptr.h"
 #include "modules/desktop_capture/desktop_capture_options.h"
 #include "modules/desktop_capture/desktop_capture_types.h"
-#include "modules/desktop_capture/linux/shared_x_display.h"
+#include "modules/desktop_capture/linux/x11/shared_x_display.h"
 #include "modules/desktop_capture/mouse_cursor.h"
 #include "modules/desktop_capture/mouse_cursor_monitor.h"
 
@@ -65,4 +65,4 @@
 
 }  // namespace webrtc
 
-#endif  // MODULES_DESKTOP_CAPTURE_LINUX_MOUSE_CURSOR_MONITOR_X11_H_
+#endif  // MODULES_DESKTOP_CAPTURE_LINUX_X11_MOUSE_CURSOR_MONITOR_X11_H_
diff --git a/modules/desktop_capture/linux/screen_capturer_x11.cc b/modules/desktop_capture/linux/x11/screen_capturer_x11.cc
similarity index 98%
rename from modules/desktop_capture/linux/screen_capturer_x11.cc
rename to modules/desktop_capture/linux/x11/screen_capturer_x11.cc
index c601a2a..2de3875 100644
--- a/modules/desktop_capture/linux/screen_capturer_x11.cc
+++ b/modules/desktop_capture/linux/x11/screen_capturer_x11.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "modules/desktop_capture/linux/screen_capturer_x11.h"
+#include "modules/desktop_capture/linux/x11/screen_capturer_x11.h"
 
 #include <X11/Xlib.h>
 #include <X11/extensions/Xdamage.h>
@@ -25,7 +25,7 @@
 #include "modules/desktop_capture/desktop_capturer.h"
 #include "modules/desktop_capture/desktop_frame.h"
 #include "modules/desktop_capture/desktop_geometry.h"
-#include "modules/desktop_capture/linux/x_server_pixel_buffer.h"
+#include "modules/desktop_capture/linux/x11/x_server_pixel_buffer.h"
 #include "modules/desktop_capture/screen_capture_frame_queue.h"
 #include "modules/desktop_capture/screen_capturer_helper.h"
 #include "modules/desktop_capture/shared_desktop_frame.h"
diff --git a/modules/desktop_capture/linux/screen_capturer_x11.h b/modules/desktop_capture/linux/x11/screen_capturer_x11.h
similarity index 92%
rename from modules/desktop_capture/linux/screen_capturer_x11.h
rename to modules/desktop_capture/linux/x11/screen_capturer_x11.h
index c98b9fb..ebf18a4 100644
--- a/modules/desktop_capture/linux/screen_capturer_x11.h
+++ b/modules/desktop_capture/linux/x11/screen_capturer_x11.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef MODULES_DESKTOP_CAPTURE_LINUX_SCREEN_CAPTURER_X11_H_
-#define MODULES_DESKTOP_CAPTURE_LINUX_SCREEN_CAPTURER_X11_H_
+#ifndef MODULES_DESKTOP_CAPTURE_LINUX_X11_SCREEN_CAPTURER_X11_H_
+#define MODULES_DESKTOP_CAPTURE_LINUX_X11_SCREEN_CAPTURER_X11_H_
 
 #include <X11/X.h>
 #include <X11/Xlib.h>
@@ -23,9 +23,9 @@
 #include "modules/desktop_capture/desktop_capturer.h"
 #include "modules/desktop_capture/desktop_frame.h"
 #include "modules/desktop_capture/desktop_region.h"
-#include "modules/desktop_capture/linux/shared_x_display.h"
-#include "modules/desktop_capture/linux/x_atom_cache.h"
-#include "modules/desktop_capture/linux/x_server_pixel_buffer.h"
+#include "modules/desktop_capture/linux/x11/shared_x_display.h"
+#include "modules/desktop_capture/linux/x11/x_atom_cache.h"
+#include "modules/desktop_capture/linux/x11/x_server_pixel_buffer.h"
 #include "modules/desktop_capture/screen_capture_frame_queue.h"
 #include "modules/desktop_capture/screen_capturer_helper.h"
 #include "modules/desktop_capture/shared_desktop_frame.h"
@@ -144,4 +144,4 @@
 
 }  // namespace webrtc
 
-#endif  // MODULES_DESKTOP_CAPTURE_LINUX_SCREEN_CAPTURER_X11_H_
+#endif  // MODULES_DESKTOP_CAPTURE_LINUX_X11_SCREEN_CAPTURER_X11_H_
diff --git a/modules/desktop_capture/linux/shared_x_display.cc b/modules/desktop_capture/linux/x11/shared_x_display.cc
similarity index 97%
rename from modules/desktop_capture/linux/shared_x_display.cc
rename to modules/desktop_capture/linux/x11/shared_x_display.cc
index 3133134..ca084d4 100644
--- a/modules/desktop_capture/linux/shared_x_display.cc
+++ b/modules/desktop_capture/linux/x11/shared_x_display.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "modules/desktop_capture/linux/shared_x_display.h"
+#include "modules/desktop_capture/linux/x11/shared_x_display.h"
 
 #include <X11/Xlib.h>
 #include <X11/extensions/XTest.h>
diff --git a/modules/desktop_capture/linux/shared_x_display.h b/modules/desktop_capture/linux/x11/shared_x_display.h
similarity index 92%
rename from modules/desktop_capture/linux/shared_x_display.h
rename to modules/desktop_capture/linux/x11/shared_x_display.h
index da130b0..13e1c8d 100644
--- a/modules/desktop_capture/linux/shared_x_display.h
+++ b/modules/desktop_capture/linux/x11/shared_x_display.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef MODULES_DESKTOP_CAPTURE_LINUX_SHARED_X_DISPLAY_H_
-#define MODULES_DESKTOP_CAPTURE_LINUX_SHARED_X_DISPLAY_H_
+#ifndef MODULES_DESKTOP_CAPTURE_LINUX_X11_SHARED_X_DISPLAY_H_
+#define MODULES_DESKTOP_CAPTURE_LINUX_X11_SHARED_X_DISPLAY_H_
 
 #include <map>
 #include <string>
@@ -81,4 +81,4 @@
 
 }  // namespace webrtc
 
-#endif  // MODULES_DESKTOP_CAPTURE_LINUX_SHARED_X_DISPLAY_H_
+#endif  // MODULES_DESKTOP_CAPTURE_LINUX_X11_SHARED_X_DISPLAY_H_
diff --git a/modules/desktop_capture/linux/window_capturer_x11.cc b/modules/desktop_capture/linux/x11/window_capturer_x11.cc
similarity index 96%
rename from modules/desktop_capture/linux/window_capturer_x11.cc
rename to modules/desktop_capture/linux/x11/window_capturer_x11.cc
index 94f9f92..5b87e8c 100644
--- a/modules/desktop_capture/linux/window_capturer_x11.cc
+++ b/modules/desktop_capture/linux/x11/window_capturer_x11.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "modules/desktop_capture/linux/window_capturer_x11.h"
+#include "modules/desktop_capture/linux/x11/window_capturer_x11.h"
 
 #include <X11/Xutil.h>
 #include <X11/extensions/Xcomposite.h>
@@ -23,9 +23,9 @@
 #include "modules/desktop_capture/desktop_capture_types.h"
 #include "modules/desktop_capture/desktop_frame.h"
 #include "modules/desktop_capture/desktop_region.h"
-#include "modules/desktop_capture/linux/shared_x_display.h"
-#include "modules/desktop_capture/linux/window_finder_x11.h"
-#include "modules/desktop_capture/linux/window_list_utils.h"
+#include "modules/desktop_capture/linux/x11/shared_x_display.h"
+#include "modules/desktop_capture/linux/x11/window_finder_x11.h"
+#include "modules/desktop_capture/linux/x11/window_list_utils.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/trace_event.h"
diff --git a/modules/desktop_capture/linux/window_capturer_x11.h b/modules/desktop_capture/linux/x11/window_capturer_x11.h
similarity index 81%
rename from modules/desktop_capture/linux/window_capturer_x11.h
rename to modules/desktop_capture/linux/x11/window_capturer_x11.h
index d8a085f..f15b147 100644
--- a/modules/desktop_capture/linux/window_capturer_x11.h
+++ b/modules/desktop_capture/linux/x11/window_capturer_x11.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef MODULES_DESKTOP_CAPTURE_LINUX_WINDOW_CAPTURER_X11_H_
-#define MODULES_DESKTOP_CAPTURE_LINUX_WINDOW_CAPTURER_X11_H_
+#ifndef MODULES_DESKTOP_CAPTURE_LINUX_X11_WINDOW_CAPTURER_X11_H_
+#define MODULES_DESKTOP_CAPTURE_LINUX_X11_WINDOW_CAPTURER_X11_H_
 
 #include <X11/X.h>
 #include <X11/Xlib.h>
@@ -21,10 +21,10 @@
 #include "modules/desktop_capture/desktop_capture_options.h"
 #include "modules/desktop_capture/desktop_capturer.h"
 #include "modules/desktop_capture/desktop_geometry.h"
-#include "modules/desktop_capture/linux/shared_x_display.h"
-#include "modules/desktop_capture/linux/window_finder_x11.h"
-#include "modules/desktop_capture/linux/x_atom_cache.h"
-#include "modules/desktop_capture/linux/x_server_pixel_buffer.h"
+#include "modules/desktop_capture/linux/x11/shared_x_display.h"
+#include "modules/desktop_capture/linux/x11/window_finder_x11.h"
+#include "modules/desktop_capture/linux/x11/x_atom_cache.h"
+#include "modules/desktop_capture/linux/x11/x_server_pixel_buffer.h"
 #include "rtc_base/constructor_magic.h"
 
 namespace webrtc {
@@ -71,4 +71,4 @@
 
 }  // namespace webrtc
 
-#endif  // MODULES_DESKTOP_CAPTURE_LINUX_WINDOW_CAPTURER_X11_H_
+#endif  // MODULES_DESKTOP_CAPTURE_LINUX_X11_WINDOW_CAPTURER_X11_H_
diff --git a/modules/desktop_capture/linux/window_finder_x11.cc b/modules/desktop_capture/linux/x11/window_finder_x11.cc
similarity index 90%
rename from modules/desktop_capture/linux/window_finder_x11.cc
rename to modules/desktop_capture/linux/x11/window_finder_x11.cc
index 16fb325..dec17ab 100644
--- a/modules/desktop_capture/linux/window_finder_x11.cc
+++ b/modules/desktop_capture/linux/x11/window_finder_x11.cc
@@ -8,13 +8,13 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "modules/desktop_capture/linux/window_finder_x11.h"
+#include "modules/desktop_capture/linux/x11/window_finder_x11.h"
 
 #include <X11/X.h>
 
 #include <memory>
 
-#include "modules/desktop_capture/linux/window_list_utils.h"
+#include "modules/desktop_capture/linux/x11/window_list_utils.h"
 #include "rtc_base/checks.h"
 
 namespace webrtc {
diff --git a/modules/desktop_capture/linux/window_finder_x11.h b/modules/desktop_capture/linux/x11/window_finder_x11.h
similarity index 81%
rename from modules/desktop_capture/linux/window_finder_x11.h
rename to modules/desktop_capture/linux/x11/window_finder_x11.h
index d0bba86..91de876 100644
--- a/modules/desktop_capture/linux/window_finder_x11.h
+++ b/modules/desktop_capture/linux/x11/window_finder_x11.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef MODULES_DESKTOP_CAPTURE_LINUX_WINDOW_FINDER_X11_H_
-#define MODULES_DESKTOP_CAPTURE_LINUX_WINDOW_FINDER_X11_H_
+#ifndef MODULES_DESKTOP_CAPTURE_LINUX_X11_WINDOW_FINDER_X11_H_
+#define MODULES_DESKTOP_CAPTURE_LINUX_X11_WINDOW_FINDER_X11_H_
 
 #include "modules/desktop_capture/window_finder.h"
 
@@ -32,4 +32,4 @@
 
 }  // namespace webrtc
 
-#endif  // MODULES_DESKTOP_CAPTURE_LINUX_WINDOW_FINDER_X11_H_
+#endif  // MODULES_DESKTOP_CAPTURE_LINUX_X11_WINDOW_FINDER_X11_H_
diff --git a/modules/desktop_capture/linux/window_list_utils.cc b/modules/desktop_capture/linux/x11/window_list_utils.cc
similarity index 96%
rename from modules/desktop_capture/linux/window_list_utils.cc
rename to modules/desktop_capture/linux/x11/window_list_utils.cc
index ade92d2..a366f9e 100644
--- a/modules/desktop_capture/linux/window_list_utils.cc
+++ b/modules/desktop_capture/linux/x11/window_list_utils.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "modules/desktop_capture/linux/window_list_utils.h"
+#include "modules/desktop_capture/linux/x11/window_list_utils.h"
 
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
@@ -16,8 +16,8 @@
 
 #include <algorithm>
 
-#include "modules/desktop_capture/linux/x_error_trap.h"
-#include "modules/desktop_capture/linux/x_window_property.h"
+#include "modules/desktop_capture/linux/x11/x_error_trap.h"
+#include "modules/desktop_capture/linux/x11/x_window_property.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/constructor_magic.h"
 #include "rtc_base/logging.h"
diff --git a/modules/desktop_capture/linux/window_list_utils.h b/modules/desktop_capture/linux/x11/window_list_utils.h
similarity index 89%
rename from modules/desktop_capture/linux/window_list_utils.h
rename to modules/desktop_capture/linux/x11/window_list_utils.h
index 3ffd336..923842d 100644
--- a/modules/desktop_capture/linux/window_list_utils.h
+++ b/modules/desktop_capture/linux/x11/window_list_utils.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef MODULES_DESKTOP_CAPTURE_LINUX_WINDOW_LIST_UTILS_H_
-#define MODULES_DESKTOP_CAPTURE_LINUX_WINDOW_LIST_UTILS_H_
+#ifndef MODULES_DESKTOP_CAPTURE_LINUX_X11_WINDOW_LIST_UTILS_H_
+#define MODULES_DESKTOP_CAPTURE_LINUX_X11_WINDOW_LIST_UTILS_H_
 
 #include <X11/X.h>
 #include <X11/Xlib.h>
@@ -17,7 +17,7 @@
 
 #include "api/function_view.h"
 #include "modules/desktop_capture/desktop_geometry.h"
-#include "modules/desktop_capture/linux/x_atom_cache.h"
+#include "modules/desktop_capture/linux/x11/x_atom_cache.h"
 
 namespace webrtc {
 
@@ -53,4 +53,4 @@
 
 }  // namespace webrtc
 
-#endif  // MODULES_DESKTOP_CAPTURE_LINUX_WINDOW_LIST_UTILS_H_
+#endif  // MODULES_DESKTOP_CAPTURE_LINUX_X11_WINDOW_LIST_UTILS_H_
diff --git a/modules/desktop_capture/linux/x_atom_cache.cc b/modules/desktop_capture/linux/x11/x_atom_cache.cc
similarity index 95%
rename from modules/desktop_capture/linux/x_atom_cache.cc
rename to modules/desktop_capture/linux/x11/x_atom_cache.cc
index 4ea0249..157ba8b 100644
--- a/modules/desktop_capture/linux/x_atom_cache.cc
+++ b/modules/desktop_capture/linux/x11/x_atom_cache.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "modules/desktop_capture/linux/x_atom_cache.h"
+#include "modules/desktop_capture/linux/x11/x_atom_cache.h"
 
 #include "rtc_base/checks.h"
 
diff --git a/modules/desktop_capture/linux/x_atom_cache.h b/modules/desktop_capture/linux/x11/x_atom_cache.h
similarity index 85%
rename from modules/desktop_capture/linux/x_atom_cache.h
rename to modules/desktop_capture/linux/x11/x_atom_cache.h
index 0249c15..39d957e 100644
--- a/modules/desktop_capture/linux/x_atom_cache.h
+++ b/modules/desktop_capture/linux/x11/x_atom_cache.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef MODULES_DESKTOP_CAPTURE_LINUX_X_ATOM_CACHE_H_
-#define MODULES_DESKTOP_CAPTURE_LINUX_X_ATOM_CACHE_H_
+#ifndef MODULES_DESKTOP_CAPTURE_LINUX_X11_X_ATOM_CACHE_H_
+#define MODULES_DESKTOP_CAPTURE_LINUX_X11_X_ATOM_CACHE_H_
 
 #include <X11/X.h>
 #include <X11/Xlib.h>
@@ -42,4 +42,4 @@
 
 }  // namespace webrtc
 
-#endif  // MODULES_DESKTOP_CAPTURE_LINUX_X_ATOM_CACHE_H_
+#endif  // MODULES_DESKTOP_CAPTURE_LINUX_X11_X_ATOM_CACHE_H_
diff --git a/modules/desktop_capture/linux/x_error_trap.cc b/modules/desktop_capture/linux/x11/x_error_trap.cc
similarity index 95%
rename from modules/desktop_capture/linux/x_error_trap.cc
rename to modules/desktop_capture/linux/x11/x_error_trap.cc
index 13233d8..f31565e 100644
--- a/modules/desktop_capture/linux/x_error_trap.cc
+++ b/modules/desktop_capture/linux/x11/x_error_trap.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "modules/desktop_capture/linux/x_error_trap.h"
+#include "modules/desktop_capture/linux/x11/x_error_trap.h"
 
 #include <stddef.h>
 
diff --git a/modules/desktop_capture/linux/x_error_trap.h b/modules/desktop_capture/linux/x11/x_error_trap.h
similarity index 84%
rename from modules/desktop_capture/linux/x_error_trap.h
rename to modules/desktop_capture/linux/x11/x_error_trap.h
index 1fb0fdc..ceb660c 100644
--- a/modules/desktop_capture/linux/x_error_trap.h
+++ b/modules/desktop_capture/linux/x11/x_error_trap.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef MODULES_DESKTOP_CAPTURE_LINUX_X_ERROR_TRAP_H_
-#define MODULES_DESKTOP_CAPTURE_LINUX_X_ERROR_TRAP_H_
+#ifndef MODULES_DESKTOP_CAPTURE_LINUX_X11_X_ERROR_TRAP_H_
+#define MODULES_DESKTOP_CAPTURE_LINUX_X11_X_ERROR_TRAP_H_
 
 #include <X11/Xlib.h>
 
@@ -36,4 +36,4 @@
 
 }  // namespace webrtc
 
-#endif  // MODULES_DESKTOP_CAPTURE_LINUX_X_ERROR_TRAP_H_
+#endif  // MODULES_DESKTOP_CAPTURE_LINUX_X11_X_ERROR_TRAP_H_
diff --git a/modules/desktop_capture/linux/x_server_pixel_buffer.cc b/modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc
similarity index 97%
rename from modules/desktop_capture/linux/x_server_pixel_buffer.cc
rename to modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc
index 84b57f1..fd6fc7d 100644
--- a/modules/desktop_capture/linux/x_server_pixel_buffer.cc
+++ b/modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "modules/desktop_capture/linux/x_server_pixel_buffer.h"
+#include "modules/desktop_capture/linux/x11/x_server_pixel_buffer.h"
 
 #include <X11/Xutil.h>
 #include <stdint.h>
@@ -17,9 +17,9 @@
 #include <sys/shm.h>
 
 #include "modules/desktop_capture/desktop_frame.h"
-#include "modules/desktop_capture/linux/window_list_utils.h"
-#include "modules/desktop_capture/linux/x_error_trap.h"
-#include "modules/desktop_capture/linux/x_window_property.h"
+#include "modules/desktop_capture/linux/x11/window_list_utils.h"
+#include "modules/desktop_capture/linux/x11/x_error_trap.h"
+#include "modules/desktop_capture/linux/x11/x_window_property.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/logging.h"
 
diff --git a/modules/desktop_capture/linux/x_server_pixel_buffer.h b/modules/desktop_capture/linux/x11/x_server_pixel_buffer.h
similarity index 92%
rename from modules/desktop_capture/linux/x_server_pixel_buffer.h
rename to modules/desktop_capture/linux/x11/x_server_pixel_buffer.h
index aa3f903..84e1de3 100644
--- a/modules/desktop_capture/linux/x_server_pixel_buffer.h
+++ b/modules/desktop_capture/linux/x11/x_server_pixel_buffer.h
@@ -10,8 +10,8 @@
 
 // Don't include this file in any .h files because it pulls in some X headers.
 
-#ifndef MODULES_DESKTOP_CAPTURE_LINUX_X_SERVER_PIXEL_BUFFER_H_
-#define MODULES_DESKTOP_CAPTURE_LINUX_X_SERVER_PIXEL_BUFFER_H_
+#ifndef MODULES_DESKTOP_CAPTURE_LINUX_X11_X_SERVER_PIXEL_BUFFER_H_
+#define MODULES_DESKTOP_CAPTURE_LINUX_X11_X_SERVER_PIXEL_BUFFER_H_
 
 #include <X11/Xutil.h>
 #include <X11/extensions/XShm.h>
@@ -86,4 +86,4 @@
 
 }  // namespace webrtc
 
-#endif  // MODULES_DESKTOP_CAPTURE_LINUX_X_SERVER_PIXEL_BUFFER_H_
+#endif  // MODULES_DESKTOP_CAPTURE_LINUX_X11_X_SERVER_PIXEL_BUFFER_H_
diff --git a/modules/desktop_capture/linux/x_window_property.cc b/modules/desktop_capture/linux/x11/x_window_property.cc
similarity index 95%
rename from modules/desktop_capture/linux/x_window_property.cc
rename to modules/desktop_capture/linux/x11/x_window_property.cc
index ba25dee..5e16dac 100644
--- a/modules/desktop_capture/linux/x_window_property.cc
+++ b/modules/desktop_capture/linux/x11/x_window_property.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "modules/desktop_capture/linux/x_window_property.h"
+#include "modules/desktop_capture/linux/x11/x_window_property.h"
 
 namespace webrtc {
 
diff --git a/modules/desktop_capture/linux/x_window_property.h b/modules/desktop_capture/linux/x11/x_window_property.h
similarity index 89%
rename from modules/desktop_capture/linux/x_window_property.h
rename to modules/desktop_capture/linux/x11/x_window_property.h
index ef643b6..71cbf06 100644
--- a/modules/desktop_capture/linux/x_window_property.h
+++ b/modules/desktop_capture/linux/x11/x_window_property.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef MODULES_DESKTOP_CAPTURE_LINUX_X_WINDOW_PROPERTY_H_
-#define MODULES_DESKTOP_CAPTURE_LINUX_X_WINDOW_PROPERTY_H_
+#ifndef MODULES_DESKTOP_CAPTURE_LINUX_X11_X_WINDOW_PROPERTY_H_
+#define MODULES_DESKTOP_CAPTURE_LINUX_X11_X_WINDOW_PROPERTY_H_
 
 #include <X11/X.h>
 #include <X11/Xlib.h>
@@ -60,4 +60,4 @@
 
 }  // namespace webrtc
 
-#endif  // MODULES_DESKTOP_CAPTURE_LINUX_X_WINDOW_PROPERTY_H_
+#endif  // MODULES_DESKTOP_CAPTURE_LINUX_X11_X_WINDOW_PROPERTY_H_
diff --git a/modules/desktop_capture/mouse_cursor_monitor_linux.cc b/modules/desktop_capture/mouse_cursor_monitor_linux.cc
index e569f6e..87edb40 100644
--- a/modules/desktop_capture/mouse_cursor_monitor_linux.cc
+++ b/modules/desktop_capture/mouse_cursor_monitor_linux.cc
@@ -14,7 +14,7 @@
 #include "modules/desktop_capture/mouse_cursor_monitor.h"
 
 #if defined(WEBRTC_USE_X11)
-#include "modules/desktop_capture/linux/mouse_cursor_monitor_x11.h"
+#include "modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.h"
 #endif  // defined(WEBRTC_USE_X11)
 
 namespace webrtc {
diff --git a/modules/desktop_capture/screen_capturer_linux.cc b/modules/desktop_capture/screen_capturer_linux.cc
index 6cad2ac..267491a 100644
--- a/modules/desktop_capture/screen_capturer_linux.cc
+++ b/modules/desktop_capture/screen_capturer_linux.cc
@@ -14,11 +14,11 @@
 #include "modules/desktop_capture/desktop_capturer.h"
 
 #if defined(WEBRTC_USE_PIPEWIRE)
-#include "modules/desktop_capture/linux/base_capturer_pipewire.h"
+#include "modules/desktop_capture/linux/wayland/base_capturer_pipewire.h"
 #endif  // defined(WEBRTC_USE_PIPEWIRE)
 
 #if defined(WEBRTC_USE_X11)
-#include "modules/desktop_capture/linux/screen_capturer_x11.h"
+#include "modules/desktop_capture/linux/x11/screen_capturer_x11.h"
 #endif  // defined(WEBRTC_USE_X11)
 
 namespace webrtc {
diff --git a/modules/desktop_capture/screen_drawer_linux.cc b/modules/desktop_capture/screen_drawer_linux.cc
index 8231265..fce036b 100644
--- a/modules/desktop_capture/screen_drawer_linux.cc
+++ b/modules/desktop_capture/screen_drawer_linux.cc
@@ -17,7 +17,7 @@
 #include "api/scoped_refptr.h"
 #include "modules/desktop_capture/desktop_capture_types.h"
 #include "modules/desktop_capture/desktop_geometry.h"
-#include "modules/desktop_capture/linux/shared_x_display.h"
+#include "modules/desktop_capture/linux/x11/shared_x_display.h"
 #include "modules/desktop_capture/rgba_color.h"
 #include "modules/desktop_capture/screen_drawer.h"
 #include "modules/desktop_capture/screen_drawer_lock_posix.h"
diff --git a/modules/desktop_capture/window_capturer_linux.cc b/modules/desktop_capture/window_capturer_linux.cc
index 89ba90d..9c0e2bf 100644
--- a/modules/desktop_capture/window_capturer_linux.cc
+++ b/modules/desktop_capture/window_capturer_linux.cc
@@ -14,11 +14,11 @@
 #include "modules/desktop_capture/desktop_capturer.h"
 
 #if defined(WEBRTC_USE_PIPEWIRE)
-#include "modules/desktop_capture/linux/base_capturer_pipewire.h"
+#include "modules/desktop_capture/linux/wayland/base_capturer_pipewire.h"
 #endif  // defined(WEBRTC_USE_PIPEWIRE)
 
 #if defined(WEBRTC_USE_X11)
-#include "modules/desktop_capture/linux/window_capturer_x11.h"
+#include "modules/desktop_capture/linux/x11/window_capturer_x11.h"
 #endif  // defined(WEBRTC_USE_X11)
 
 namespace webrtc {
diff --git a/modules/desktop_capture/window_finder_unittest.cc b/modules/desktop_capture/window_finder_unittest.cc
index 7a586c7..ac13f12 100644
--- a/modules/desktop_capture/window_finder_unittest.cc
+++ b/modules/desktop_capture/window_finder_unittest.cc
@@ -21,8 +21,8 @@
 #include "test/gtest.h"
 
 #if defined(WEBRTC_USE_X11)
-#include "modules/desktop_capture/linux/shared_x_display.h"
-#include "modules/desktop_capture/linux/x_atom_cache.h"
+#include "modules/desktop_capture/linux/x11/shared_x_display.h"
+#include "modules/desktop_capture/linux/x11/x_atom_cache.h"
 #endif
 
 #if defined(WEBRTC_WIN)