59 [[nodiscard]] uint64_t id()
const;
60 [[nodiscard]] SDL_WindowID sdlId()
const;
61 [[nodiscard]] SDL_Window* window()
const;
62 [[nodiscard]] SDL_Renderer* renderer()
const;
67 void updateWindowRect(
const SDL_Rect& rect);
69 [[nodiscard]] SDL_Rect windowRect()
const;
72 void setLocalMoveActive(
bool active);
73 [[nodiscard]]
bool localMoveActive()
const;
75 [[nodiscard]]
bool localMoveSizeChanged()
const;
77 [[nodiscard]] SDL_Point localMoveServerPos()
const;
78 void adoptLocalGeometry(
const SDL_Rect& rect);
80 void setResizeAnchor(
bool right,
bool bottom);
87 [[nodiscard]]
bool isDeleted()
const;
90 [[nodiscard]]
bool geomApplyPending()
const;
91 void clearGeomApplyPending();
95 [[nodiscard]]
bool loopEndPending()
const;
97 void deferSnap(
const SDL_Rect& serverRect);
101 bool maximize =
false;
103 SDL_Rect snapRect = { 0, 0, 0, 0 };
108 [[nodiscard]]
bool takeWmOverride(SDL_Rect& outer);
111 void setVisibilityRects(std::vector<SDL_Rect> rects);
113 void setVisibleOffset(SDL_Point offset);
116 void setMinMaxSize(SDL_Point minSize, SDL_Point maxSize);
119 void setResizeMargins(
int left,
int top,
int right,
int bottom);
120 [[nodiscard]] SDL_Rect resizeMargins()
const;
122 void setFrameMargins(
const SDL_Rect& m);
123 [[nodiscard]] SDL_Rect frameMargins()
const;
124 [[nodiscard]]
bool takeUnconfirmedReport(SDL_Rect& rect);
127 void setOwner(uint64_t ownerId);
128 [[nodiscard]] uint64_t owner()
const;
130 [[nodiscard]]
bool isPopup()
const;
132 [[nodiscard]]
bool isFullscreen()
const;
134 [[nodiscard]]
bool activatable()
const;
136 [[nodiscard]]
bool isLayered()
const;
138 void setShadowAnchored(
bool anchored);
139 void setFrame(
bool frame);
140 [[nodiscard]]
bool isFrame()
const;
142 [[nodiscard]] SDL_Rect insets()
const;
144 [[nodiscard]] SDL_Rect outerRect()
const;
146 [[nodiscard]] SDL_Point serverOrigin()
const;
149 [[nodiscard]]
bool placedRel(SDL_Point& rel)
const;
150 void placePopup(
const SDL_Rect& vis,
const SDL_Rect& parentRect);
151 void commitPlacement();
153 [[nodiscard]] SDL_Rect serverRect(
const SDL_Rect& outer)
const;
154 void setLocalShift(
const SDL_Point& shift);
156 void setStyle(uint32_t style, uint32_t exStyle);
157 void setTitle(
const std::string& title);
158 void setVisible(
bool visible);
165 [[nodiscard]]
bool takeSurfaceChange(uint32_t surfaceId);
166 void updateGfxSurface(
const void* data, uint32_t stride, uint32_t width, uint32_t height,
167 const RECTANGLE_16* damage, uint32_t nbDamage, uint32_t format);
169 void invalidateAll();
172 [[nodiscard]]
bool railMaximized()
const
174 return _maxState.rail;
176 void setRailMaximized(
bool m)
178 std::unique_lock lock(_gfxLock);
181 void setServerMaximized(
bool m);
182 [[nodiscard]]
bool railMinimized()
const
184 return _minState.rail;
186 void setRailMinimized(
bool m)
188 std::unique_lock lock(_gfxLock);
191 void setServerMinimized(
bool m);
192 void noteLocalRestore();
193 [[nodiscard]]
bool takeRestoreRetry();
196 void markGeometryDirty()
198 std::unique_lock lock(_gfxLock);
199 _geometryDirty =
true;
202 [[nodiscard]]
bool geometryFrozen()
const
204 return _maxState.rail || _maxState.server || _minState.rail || _minState.server;
207 [[nodiscard]]
bool awaitingRestoreRect()
const
209 std::unique_lock lock(_gfxLock);
210 return restoreRectPending();
213 [[nodiscard]]
bool insetsStale()
const;
215 [[nodiscard]]
bool effectivelyMaximized()
const;
217 [[nodiscard]]
bool stateTransitionPending()
const
220 std::unique_lock lock(_gfxLock);
221 return _maxState.dirty || _minState.dirty || (_maxState.rail != _maxState.server) ||
222 (_minState.rail != _minState.server);
226 bool reconcile(SDL_Window* parent,
const SDL_Rect& parentRect);
228 bool paint(SDL_Surface* primary, SDL_PixelFormat fallbackFormat,
229 const std::vector<SDL_Rect>& damage, SDL_Window* parent,
const SDL_Rect& parentRect);
236 std::atomic<bool> rail{
false };
237 std::atomic<bool> server{
false };
240 void setServerState(StateSync& s,
bool m);
242 bool applyServerState(StateSync& s,
const char* what,
bool (*enter)(SDL_Window*));
244 [[nodiscard]]
bool restoreRectPending()
const;
245 void setAppliedInsets(
const SDL_Rect& insets);
246 [[nodiscard]]
bool styleResizable()
const;
248 [[nodiscard]]
bool honorsAlpha()
const
250 return _isPopup && !_layered;
253 [[nodiscard]]
const char* role()
const
256 return _layered ?
"overlay-layered" :
"overlay";
257 return _layered ?
"layered" : (_isPopup ?
"popup" :
"app");
259 [[nodiscard]]
bool isFullDisplaySize()
const;
261 [[nodiscard]] SDL_Rect bandMargins()
const;
262 [[nodiscard]] SDL_Rect bandInsets()
const;
263 [[nodiscard]] SDL_Point blitOffset()
const;
264 [[nodiscard]] SDL_Rect targetOuterRect()
const;
265 bool create(SDL_Window* parent,
const SDL_Rect& parentRect);
266 bool paintGfx(SDL_PixelFormat format);
267 bool paintLegacy(SDL_Surface* primary,
const std::vector<SDL_Rect>& damage);
268 void placeRequested();
269 [[nodiscard]]
bool holdForPlacement();
272 std::unique_ptr<SdlWindow> _win;
273 SDL_Rect _windowRect;
274 SDL_Point _localShift = { 0, 0 };
276 uint32_t _exStyle = 0;
278 bool _shadowSuppressLogged =
false;
279 bool _everResizable =
false;
280 uint64_t _ownerId = 0;
281 SDL_Rect _resizeMargins = { 0, 0, 0, 0 };
282 SDL_Rect _frameMargins = { 0, 0, 0, 0 };
284 SDL_Rect _appliedInsets = { 0, 0, 0, 0 };
285 bool _wasMaximized =
false;
286 SDL_Point _minSize = { 0, 0 };
287 SDL_Point _maxSize = { 0, 0 };
288 bool _minMaxDirty =
false;
289 bool _isPopup =
false;
290 bool _fullscreen =
false;
291 bool _layered =
false;
292 bool _overlay =
false;
293 bool _popupClassified =
false;
294 bool _shadowAnchored =
false;
296 bool _parentApplied =
false;
299 std::string _title =
"RdpRailWindow";
301 bool _iconDirty =
false;
302 bool _visible =
false;
303 bool _geometryDirty =
true;
304 bool _titleDirty =
false;
305 bool _topmost =
false;
306 bool _topmostDirty =
false;
307 bool _styleDirty =
false;
308 bool _painted =
false;
309 bool _gfxPresented =
false;
310 bool _mapped =
false;
311 bool _localMoveActive =
false;
312 bool _localMoveIsResize =
false;
313 bool _localMoveSizeChanged =
false;
314 SDL_Point _localMoveServerPos = { 0, 0 };
318 bool pending =
false;
319 bool maximize =
false;
321 SDL_Rect snapRect = { 0, 0, 0, 0 };
323 bool _geomApplyPending =
false;
324 std::vector<SDL_Rect> _reported;
325 uint64_t _reportCheckAt = 0;
326 bool _wmRefused =
false;
327 SDL_Rect _wmRefusedOuter = { 0, 0, 0, 0 };
328 bool _resizeAnchorRight =
false;
329 bool _resizeAnchorBottom =
false;
331 uint64_t _awaitingFrameUntil = 0;
333 uint64_t _awaitRestoreUntil = 0;
335 uint64_t _localRestoreUntil = 0;
336 bool _restoreRetried =
false;
337 bool _restoreRetry =
false;
339 SDL_Point _gfxVisOrigin = { 0, 0 };
340 SDL_Rect _extentsApplied = { 0, 0, 0, 0 };
343 mutable std::mutex _gfxLock;
344 std::vector<SDL_Rect> _visRects;
345 SDL_Point _visOffset = { 0, 0 };
346 bool _visOffsetSet =
false;
347 bool _visDirty =
false;
348 bool _deleted =
false;
349 std::vector<uint8_t> _gfxBuffer;
350 uint32_t _gfxStride = 0;
351 uint32_t _surfaceId = 0;
354 bool _hasGfx =
false;
356 bool _gfxHasAlpha =
false;
358 std::vector<SDL_Rect> _gfxDamage;
364 bool _needsFullBlit =
true;
365 SDL_Point _requestedRel = { 0, 0 };
366 Uint64 _requestedAt = 0;
367 std::optional<SDL_Point> _pendingRel;
368 std::optional<SDL_Point> _placedRel;
369 bool _placeInFlight =
false;