FreeRDP
Loading...
Searching...
No Matches
TestSDLRailWindowStyle.cpp
1#include "../../SDL3/sdl_rail_window_style.hpp"
2
3int TestSDLRailWindowStyle(int argc, char* argv[])
4{
5 (void)argc;
6 (void)argv;
7
8 /* Reproducer: WS_POPUP | WS_SYSMENU | WS_MINIMIZEBOX, unowned tool window. */
9 const auto autocomplete = classifySdlRailWindowStyle(WS_POPUP | WS_SYSMENU | WS_MINIMIZEBOX,
10 WS_EX_TOOLWINDOW | WS_EX_TOPMOST, false);
11 if (!autocomplete.popup)
12 return 1;
13
14 /* A captioned popup remains an ordinary dialog, even when it has an owner. */
15 const auto dialog = classifySdlRailWindowStyle(WS_POPUP | WS_CAPTION | WS_SYSMENU,
16 WS_EX_TOOLWINDOW | WS_EX_LAYERED, true);
17 if (dialog.popup || dialog.layered)
18 return 2;
19
20 /* The same caption-less style remains a toplevel when owned, preserving custom drag loops. */
21 const auto ownedStyledPopup = classifySdlRailWindowStyle(
22 WS_POPUP | WS_SYSMENU | WS_MINIMIZEBOX, WS_EX_TOOLWINDOW | WS_EX_TOPMOST, true);
23 if (ownedStyledPopup.popup)
24 return 3;
25
26 /* Preserve the existing owned tool-window path used by application-driven drag loops. */
27 const auto ownedTool = classifySdlRailWindowStyle(WS_POPUP, WS_EX_TOOLWINDOW, true);
28 if (!ownedTool.popup)
29 return 4;
30
31 /* WS_EX_NOACTIVATE remains sufficient even when the window is not a WS_POPUP. */
32 const auto noActivate = classifySdlRailWindowStyle(WS_OVERLAPPED, WS_EX_NOACTIVATE, true);
33 if (!noActivate.popup)
34 return 5;
35
36 return 0;
37}