Hello.
At first, I used default settings in sf::Style in sf::RenderWindows
Create function.
Then I decide to create my one
minimize and
exit buttons, so I just used sf::Style::None.
I have issues with both of these approaches.
If I use standard windows settings, then I see an empty Window (after launching a program) with plain white color inside it for a half-second before all other objects are rendered.
If I use
sf::Style::None instead, then, even if I do implement
minimize and
exit buttons by myself, then window somehow becomes unresponsible in terms of minimizing/restoring (but everything rendered just after starting, without empty white windows).
First, minimizing stops working when I click on taskbar. It works with standard settings, but doesn't with sf::Style::None, while the only thing I want to do is hiding default buttons and default window upper bar.
Also, if I minimize all active windows with "Win+D", then my application restoring automatically even when I restored
another application, not mine.
What is the solution?
UPD:Tried something with Winapi.
Creating sfml window with sf::Style::Default and then erased some flags like that:
sf::WindowHandle window_handle = window_render.getSystemHandle();
LONG lStyle = GetWindowLong(window_handle, GWL_STYLE);
lStyle &= ~(WS_CAPTION | WS_BORDER | WS_THICKFRAME | WS_SYSMENU);
SetWindowLongPtr(window_handle, GWL_STYLE, lStyle);
Also tried some other combinations, but with this one I managed to create a simple window with working minimize (unlike sf::Style::None), but again with white empty space at launch (like sf::Style::Default).
Any advice would be appreciated.
UPD2: Well, after reading through WinApi documentation, I tried the following.
Created sfml window with sf::Style::None. Then added a minimize box to it via this code:
LONG lStyle = GetWindowLong(window_handle, GWL_STYLE);
lStyle |= (WS_MINIMIZEBOX);
SetWindowLongPtr(window_handle, GWL_STYLE, lStyle);
SetWindowPos(window_handle, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
After that I still have no minimize box (because I have no caption and borders obviously), but minimizing via taskbar now works. I don't know if it is good solution and want some insight, but sfml probably need a way to handle this thing without requiring a user to write winapi code.