[fix] resolve compilation errors on Linux

This commit is contained in:
dijunkun
2025-12-01 13:07:36 +08:00
parent 7d3ecf789d
commit 131b4f1795
3 changed files with 14 additions and 11 deletions

View File

@@ -12,9 +12,6 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/types.h> #include <sys/types.h>
#elif __linux__ #elif __linux__
#include <X11/Xlib.h>
#include <X11/Xresource.h>
#include <X11/extensions/Xrandr.h>
#include <fcntl.h> #include <fcntl.h>
#include <net/if.h> #include <net/if.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>

View File

@@ -1,6 +1,9 @@
#include "screen_capturer_x11.h" #include "screen_capturer_x11.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/Xfixes.h> #include <X11/extensions/Xfixes.h>
#include <X11/extensions/Xrandr.h>
#include <chrono> #include <chrono>
#include <thread> #include <thread>

View File

@@ -7,10 +7,14 @@
#ifndef _SCREEN_CAPTURER_X11_H_ #ifndef _SCREEN_CAPTURER_X11_H_
#define _SCREEN_CAPTURER_X11_H_ #define _SCREEN_CAPTURER_X11_H_
#include <X11/Xlib.h> // forward declarations for X11 types
#include <X11/Xutil.h> struct _XDisplay;
#include <X11/extensions/Xrandr.h> typedef struct _XDisplay Display;
#include <X11/extensions/Xfixes.h> typedef unsigned long Window;
struct _XRRScreenResources;
typedef struct _XRRScreenResources XRRScreenResources;
struct _XImage;
typedef struct _XImage XImage;
#include <atomic> #include <atomic>
#include <cstring> #include <cstring>
@@ -43,6 +47,9 @@ class ScreenCapturerX11 : public ScreenCapturer {
void OnFrame(); void OnFrame();
private:
void DrawCursor(XImage* image, int x, int y);
private: private:
Display* display_ = nullptr; Display* display_ = nullptr;
Window root_ = 0; Window root_ = 0;
@@ -60,12 +67,8 @@ class ScreenCapturerX11 : public ScreenCapturer {
cb_desktop_data callback_; cb_desktop_data callback_;
std::vector<DisplayInfo> display_info_list_; std::vector<DisplayInfo> display_info_list_;
// 缓冲区
std::vector<uint8_t> y_plane_; std::vector<uint8_t> y_plane_;
std::vector<uint8_t> uv_plane_; std::vector<uint8_t> uv_plane_;
// 鼠标光标相关
void DrawCursor(XImage* image, int x, int y);
}; };
} // namespace crossdesk } // namespace crossdesk
#endif #endif