30#include <freerdp/settings_types.h>
38 [[nodiscard]]
static SdlWindow create(SDL_DisplayID
id,
const std::string& title, Uint32 flags,
39 Uint32 width = 0, Uint32 height = 0);
41 [[nodiscard]]
static SdlWindow create(SDL_DisplayID
id,
const std::string& title, Uint32 flags,
42 const SDL_Rect& rect);
44 [[nodiscard]]
static SdlWindow createPopup(SDL_Window* parent,
const SDL_Rect& rect,
45 bool transparent,
bool tooltip =
false);
46 [[nodiscard]]
static rdpMonitor query(SDL_DisplayID
id,
bool forceAsPrimary =
false);
55 [[nodiscard]] SDL_WindowID id()
const;
56 [[nodiscard]] SDL_DisplayID displayIndex()
const;
57 [[nodiscard]] SDL_Rect rect()
const;
58 [[nodiscard]] SDL_Rect bounds()
const;
59 [[nodiscard]] SDL_Window* window()
const;
60 [[nodiscard]] SDL_Renderer* renderer()
const;
62 [[nodiscard]] Sint32 offsetX()
const;
63 void setOffsetX(Sint32 x);
65 void setOffsetY(Sint32 y);
66 [[nodiscard]] Sint32 offsetY()
const;
68 [[nodiscard]] rdpMonitor monitor(
bool isPrimary)
const;
69 void setMonitor(rdpMonitor monitor);
71 [[nodiscard]]
float scale()
const;
72 [[nodiscard]] SDL_DisplayOrientation orientation()
const;
74 [[nodiscard]]
bool grabKeyboard(
bool enable);
75 [[nodiscard]]
bool grabMouse(
bool enable);
76 void setBordered(
bool bordered);
78 void resizeable(
bool use);
79 void fullscreen(
bool enter,
bool forceOriginalDisplay);
82 [[nodiscard]]
bool resizeToScale();
83 [[nodiscard]]
bool resize(
const SDL_Point& size);
85 [[nodiscard]]
bool drawRect(SDL_Surface* surface, SDL_Point offset,
const SDL_Rect& srcRect);
86 [[nodiscard]]
bool drawRects(SDL_Surface* surface, SDL_Point offset,
87 const std::vector<SDL_Rect>& rects = {});
88 [[nodiscard]]
bool drawScaledRect(SDL_Surface* surface,
const SDL_FPoint& scale,
89 const SDL_Rect& srcRect);
91 [[nodiscard]]
bool drawScaledRects(SDL_Surface* surface,
const SDL_FPoint& scale,
92 const std::vector<SDL_Rect>& rects = {});
94 [[nodiscard]]
bool fill(Uint8 r = 0x00, Uint8 g = 0x00, Uint8 b = 0x00, Uint8 a = 0xff);
96 [[nodiscard]]
bool blit(SDL_Surface* surface,
const SDL_Rect& src, SDL_Rect& dst);
97 [[nodiscard]]
bool upload(SDL_Surface* surface,
const SDL_Rect& src);
98 [[nodiscard]]
bool render(
const SDL_Rect& src,
const SDL_Rect& dst);
100 bool paintResizeFrame(SDL_Surface* surface, SDL_Point off,
bool contentChanged,
101 const SDL_Rect& inset = { 0, 0, 0, 0 },
bool fillRevealed =
true,
102 bool dashedBorder =
true);
104 void updateSurface(
const SdlOverlay* overlay =
nullptr);
105 [[nodiscard]]
const char* rendererName()
const;
111 [[nodiscard]]
bool setVideoOverlay(Uint64
id,
const void* pixels,
int pitch,
int w,
int h,
112 const SDL_FRect& dst,
const std::vector<SDL_FRect>& clip,
118 SdlWindow(SDL_DisplayID
id,
const std::string& title,
const SDL_Rect& rect, Uint32 flags);
119 SdlWindow(SDL_Window* parent,
const SDL_Rect& rect,
bool transparent,
bool tooltip);
121 [[nodiscard]]
static bool fill(SDL_Window* window, Uint8 r = 0x00, Uint8 g = 0x00,
122 Uint8 b = 0x00, Uint8 a = 0xff);
123 [[nodiscard]]
static rdpMonitor query(SDL_Window* window, SDL_DisplayID
id,
124 bool forceAsPrimary =
false);
125 [[nodiscard]]
static SDL_Rect rect(SDL_Window* window,
bool forceAsPrimary =
false);
126 [[nodiscard]]
static SDL_Rect rect(SDL_DisplayID
id,
bool forceAsPrimary =
false);
128 [[nodiscard]]
static bool tryFallback(
bool isFullscreen);
138 [[nodiscard]]
static enum HighDPIMode isHighDPIWindowsMode(SDL_Window* window);
141 void ensureRenderTarget();
142 void drawOverlay(
const SdlOverlay& overlay);
143 bool ensureGdiTexture(SDL_Surface* surface);
145 SDL_Window* _window =
nullptr;
149 SDL_Texture* texture =
nullptr;
153 std::vector<SDL_FRect> clip;
154 bool visible =
false;
156 std::map<Uint64, VideoOverlay> _videoOverlays;
157 void drawVideoOverlays();
159 SDL_Renderer* _renderer =
nullptr;
160 SDL_Texture* _renderTarget =
nullptr;
161 SDL_Texture* _gdiTexture =
nullptr;
162 std::unique_ptr<SdlOverlayPainter> _overlayPainter;
163 int _gdiTextureW = 0;
164 int _gdiTextureH = 0;
167 SDL_DisplayID _displayID = 0;
168 Sint32 _offset_x = 0;
169 Sint32 _offset_y = 0;
170 rdpMonitor _monitor{};
void pruneVideoOverlays(const std::function< bool(Uint64)> &keep)
drops the overlays keep returns false for
bool setVideoOverlay(Uint64 id, const void *pixels, int pitch, int w, int h, const SDL_FRect &dst, const std::vector< SDL_FRect > &clip, bool visible)
redirected video id, drawn over the session at each present at dst (render coordinates),...
SdlWindow(const std::string &title, Sint32 startupX, Sint32 startupY, Sint32 width, Sint32 height, Uint32 flags)