You are right, it can be done. It is actually quite trivial on Windows (the majority is just window style conversion between SFML and WINAPI, which I copied from WindowImplWin32):
void setStyle(sf::Window& window, sf::Uint32 style)
{
HWND handle = window.getSystemHandle();
DWORD win32Style = WS_VISIBLE;
if (style == sf::Style::None)
{
win32Style |= WS_POPUP;
}
else
{
if (style & sf::Style::Titlebar) win32Style |= WS_CAPTION | WS_MINIMIZEBOX;
if (style & sf::Style::Resize) win32Style |= WS_THICKFRAME | WS_MAXIMIZEBOX;
if (style & sf::Style::Close) win32Style |= WS_SYSMENU;
}
SetWindowLongPtr(handle, GWL_STYLE, win32Style);
// Force changes to take effect
SetWindowPos(handle, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DRAWFRAME);
}
Combined with sf::Window::setPosition/setSize it works just like desired: very fast, no loss of OpenGL context.