58 [[nodiscard]] uint64_t id()
const;
59 [[nodiscard]] SDL_WindowID sdlId()
const;
60 [[nodiscard]] SDL_Window* window()
const;
61 [[nodiscard]] SDL_Renderer* renderer()
const;
66 void updateWindowRect(
const SDL_Rect& rect);
68 [[nodiscard]] SDL_Rect windowRect()
const;
71 void setLocalMoveActive(
bool active);
72 [[nodiscard]]
bool localMoveActive()
const;
74 [[nodiscard]]
bool localMoveSizeChanged()
const;
76 [[nodiscard]] SDL_Point localMoveServerPos()
const;
77 void adoptLocalGeometry(
const SDL_Rect& rect);
79 void setResizeAnchor(
bool right,
bool bottom);
83 [[nodiscard]]
bool isDeleted()
const;
86 [[nodiscard]]
bool geomApplyPending()
const;
87 void clearGeomApplyPending();
91 [[nodiscard]]
bool loopEndPending()
const;
93 void deferSnap(
const SDL_Rect& serverRect);
97 bool maximize =
false;
99 SDL_Rect snapRect = { 0, 0, 0, 0 };
104 [[nodiscard]]
bool takeWmOverride(SDL_Rect& outer);
107 void setVisibilityRects(std::vector<SDL_Rect> rects);
109 void setVisibleOffset(SDL_Point offset);
112 void setMinMaxSize(SDL_Point minSize, SDL_Point maxSize);
115 void setResizeMargins(
int left,
int top,
int right,
int bottom);
116 [[nodiscard]] SDL_Rect resizeMargins()
const;
118 void setFrameMargins(
const SDL_Rect& m);
119 [[nodiscard]] SDL_Rect frameMargins()
const;
122 void setOwner(uint64_t ownerId);
123 [[nodiscard]] uint64_t owner()
const;
125 [[nodiscard]]
bool isPopup()
const;
127 [[nodiscard]]
bool isFullscreen()
const;
129 [[nodiscard]]
bool isLayered()
const;
131 void setShadowAnchored(
bool anchored);
132 void setFrame(
bool frame);
133 [[nodiscard]]
bool isFrame()
const;
135 [[nodiscard]] SDL_Rect insets()
const;
137 [[nodiscard]] SDL_Rect outerRect()
const;
139 [[nodiscard]] SDL_Point serverOrigin()
const;
141 [[nodiscard]] SDL_Rect serverRect(
const SDL_Rect& outer)
const;
143 void setStyle(uint32_t style, uint32_t exStyle);
144 void setTitle(
const std::string& title);
145 void setVisible(
bool visible);
152 [[nodiscard]]
bool takeSurfaceChange(uint32_t surfaceId);
153 void updateGfxSurface(
const void* data, uint32_t stride, uint32_t width, uint32_t height,
154 const RECTANGLE_16* damage, uint32_t nbDamage, uint32_t format);
156 void invalidateAll();
159 [[nodiscard]]
bool railMaximized()
const
161 return _maxState.rail;
163 void setRailMaximized(
bool m)
165 std::unique_lock lock(_gfxLock);
168 void setServerMaximized(
bool m);
169 [[nodiscard]]
bool railMinimized()
const
171 return _minState.rail;
173 void setRailMinimized(
bool m)
175 std::unique_lock lock(_gfxLock);
178 void setServerMinimized(
bool m);
181 void markGeometryDirty()
183 std::unique_lock lock(_gfxLock);
184 _geometryDirty =
true;
187 [[nodiscard]]
bool geometryFrozen()
const
189 return _maxState.rail || _maxState.server || _minState.rail || _minState.server;
192 [[nodiscard]]
bool awaitingRestoreRect()
const
194 std::unique_lock lock(_gfxLock);
195 return restoreRectPending();
198 [[nodiscard]]
bool effectivelyMaximized()
const;
200 [[nodiscard]]
bool stateTransitionPending()
const
203 std::unique_lock lock(_gfxLock);
204 return _maxState.dirty || _minState.dirty || (_maxState.rail != _maxState.server) ||
205 (_minState.rail != _minState.server);
209 bool reconcile(SDL_Window* parent,
const SDL_Rect& parentRect);
211 bool paint(SDL_Surface* primary, SDL_PixelFormat fallbackFormat,
212 const std::vector<SDL_Rect>& damage, SDL_Window* parent,
const SDL_Rect& parentRect);
219 std::atomic<bool> rail{
false };
220 std::atomic<bool> server{
false };
223 void setServerState(StateSync& s,
bool m);
225 bool applyServerState(StateSync& s,
const char* what,
bool (*enter)(SDL_Window*));
227 [[nodiscard]]
bool restoreRectPending()
const;
228 [[nodiscard]]
bool styleResizable()
const;
230 [[nodiscard]]
bool honorsAlpha()
const
232 return _isPopup && !_layered;
235 [[nodiscard]]
const char* role()
const
238 return _layered ?
"overlay-layered" :
"overlay";
239 return _layered ?
"layered" : (_isPopup ?
"popup" :
"app");
241 [[nodiscard]]
bool isFullDisplaySize()
const;
243 [[nodiscard]] SDL_Rect bandMargins()
const;
244 [[nodiscard]] SDL_Rect bandInsets()
const;
245 [[nodiscard]] SDL_Point blitOffset()
const;
246 [[nodiscard]] SDL_Rect targetOuterRect()
const;
247 bool create(SDL_Window* parent,
const SDL_Rect& parentRect);
248 bool paintGfx(SDL_PixelFormat format);
249 bool paintLegacy(SDL_Surface* primary,
const std::vector<SDL_Rect>& damage);
252 std::unique_ptr<SdlWindow> _win;
253 SDL_Rect _windowRect;
255 uint32_t _exStyle = 0;
257 bool _shadowSuppressLogged =
false;
258 bool _everResizable =
false;
259 uint64_t _ownerId = 0;
260 SDL_Rect _resizeMargins = { 0, 0, 0, 0 };
261 SDL_Rect _frameMargins = { 0, 0, 0, 0 };
263 SDL_Rect _appliedInsets = { 0, 0, 0, 0 };
264 bool _wasMaximized =
false;
265 SDL_Point _minSize = { 0, 0 };
266 SDL_Point _maxSize = { 0, 0 };
267 bool _minMaxDirty =
false;
268 bool _isPopup =
false;
269 bool _fullscreen =
false;
270 bool _layered =
false;
271 bool _clickThrough =
false;
272 bool _overlay =
false;
273 bool _popupClassified =
false;
274 bool _shadowAnchored =
false;
276 bool _parentApplied =
false;
279 std::string _title =
"RdpRailWindow";
281 bool _iconDirty =
false;
282 bool _visible =
false;
283 bool _geometryDirty =
true;
284 bool _titleDirty =
false;
285 bool _topmost =
false;
286 bool _topmostDirty =
false;
287 bool _styleDirty =
false;
288 bool _painted =
false;
289 bool _gfxPresented =
false;
290 bool _mapped =
false;
291 bool _localMoveActive =
false;
292 bool _localMoveIsResize =
false;
293 bool _localMoveSizeChanged =
false;
294 SDL_Point _localMoveServerPos = { 0, 0 };
298 bool pending =
false;
299 bool maximize =
false;
301 SDL_Rect snapRect = { 0, 0, 0, 0 };
303 bool _geomApplyPending =
false;
304 bool _wmRefused =
false;
305 SDL_Rect _wmRefusedOuter = { 0, 0, 0, 0 };
306 bool _resizeAnchorRight =
false;
307 bool _resizeAnchorBottom =
false;
309 uint64_t _awaitingFrameUntil = 0;
311 uint64_t _awaitRestoreUntil = 0;
313 SDL_Point _gfxVisOrigin = { 0, 0 };
314 SDL_Rect _extentsApplied = { 0, 0, 0, 0 };
317 mutable std::mutex _gfxLock;
318 std::vector<SDL_Rect> _visRects;
319 SDL_Point _visOffset = { 0, 0 };
320 bool _visOffsetSet =
false;
321 bool _visDirty =
false;
322 bool _deleted =
false;
323 std::vector<uint8_t> _gfxBuffer;
324 uint32_t _gfxStride = 0;
325 uint32_t _surfaceId = 0;
328 bool _hasGfx =
false;
330 bool _gfxHasAlpha =
false;
332 std::vector<SDL_Rect> _gfxDamage;
338 bool _needsFullBlit =
true;