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;
69 [[nodiscard]] SDL_Point layoutPosition()
const;
70 void setLayoutPosition(
const SDL_Point& pos);
72 [[nodiscard]] rdpMonitor monitor(
bool isPrimary)
const;
73 void setMonitor(rdpMonitor monitor);
75 [[nodiscard]]
float scale()
const;
76 [[nodiscard]] SDL_DisplayOrientation orientation()
const;
78 [[nodiscard]]
bool grabKeyboard(
bool enable);
79 [[nodiscard]]
bool grabMouse(
bool enable);
80 void setBordered(
bool bordered);
82 void resizeable(
bool use);
83 void fullscreen(
bool enter,
bool forceOriginalDisplay);
86 [[nodiscard]]
bool resizeToScale();
87 [[nodiscard]]
bool resize(
const SDL_Point& size);
89 [[nodiscard]]
bool drawRect(SDL_Surface* surface, SDL_Point offset,
const SDL_Rect& srcRect);
90 [[nodiscard]]
bool drawRects(SDL_Surface* surface, SDL_Point offset,
91 const std::vector<SDL_Rect>& rects = {});
92 [[nodiscard]]
bool drawScaledRect(SDL_Surface* surface,
const SDL_FPoint& scale,
93 const SDL_Rect& srcRect);
95 [[nodiscard]]
bool drawScaledRects(SDL_Surface* surface,
const SDL_FPoint& scale,
96 const std::vector<SDL_Rect>& rects = {});
98 [[nodiscard]]
bool fill(Uint8 r = 0x00, Uint8 g = 0x00, Uint8 b = 0x00, Uint8 a = 0xff);
100 [[nodiscard]]
bool blit(SDL_Surface* surface,
const SDL_Rect& src, SDL_Rect& dst);
101 [[nodiscard]]
bool upload(SDL_Surface* surface,
const SDL_Rect& src);
102 [[nodiscard]]
bool render(
const SDL_Rect& src,
const SDL_Rect& dst);
104 bool paintResizeFrame(SDL_Surface* surface, SDL_Point off,
bool contentChanged,
105 const SDL_Rect& inset = { 0, 0, 0, 0 },
bool fillRevealed =
true,
106 bool dashedBorder =
true);
108 void updateSurface(
const SdlOverlay* overlay =
nullptr);
109 [[nodiscard]]
const char* rendererName()
const;
115 [[nodiscard]]
bool setVideoOverlay(Uint64
id,
const void* pixels,
int pitch,
int w,
int h,
116 const SDL_FRect& dst,
const std::vector<SDL_FRect>& clip,
122 SdlWindow(SDL_DisplayID
id,
const std::string& title,
const SDL_Rect& rect, Uint32 flags);
123 SdlWindow(SDL_Window* parent,
const SDL_Rect& rect,
bool transparent,
bool tooltip);
125 [[nodiscard]]
static bool fill(SDL_Window* window, Uint8 r = 0x00, Uint8 g = 0x00,
126 Uint8 b = 0x00, Uint8 a = 0xff);
127 [[nodiscard]]
static rdpMonitor query(SDL_Window* window, SDL_DisplayID
id,
128 bool forceAsPrimary =
false);
129 [[nodiscard]]
static SDL_Rect rect(SDL_Window* window,
bool forceAsPrimary =
false);
130 [[nodiscard]]
static SDL_Rect rect(SDL_DisplayID
id,
bool forceAsPrimary =
false);
132 [[nodiscard]]
static bool tryFallback(
bool isFullscreen);
142 [[nodiscard]]
static enum HighDPIMode isHighDPIWindowsMode(SDL_Window* window);
145 void ensureRenderTarget();
146 void drawOverlay(
const SdlOverlay& overlay);
147 bool ensureGdiTexture(SDL_Surface* surface);
149 SDL_Window* _window =
nullptr;
153 SDL_Texture* texture =
nullptr;
157 std::vector<SDL_FRect> clip;
158 bool visible =
false;
160 std::map<Uint64, VideoOverlay> _videoOverlays;
161 void drawVideoOverlays();
163 SDL_Renderer* _renderer =
nullptr;
164 SDL_Texture* _renderTarget =
nullptr;
165 SDL_Texture* _gdiTexture =
nullptr;
166 std::unique_ptr<SdlOverlayPainter> _overlayPainter;
167 int _gdiTextureW = 0;
168 int _gdiTextureH = 0;
171 SDL_DisplayID _displayID = 0;
172 SDL_Point _layoutPosition{};
173 Sint32 _offset_x = 0;
174 Sint32 _offset_y = 0;
175 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)