Well... first of all, one has to differentiate between where the VSync is set. In the application or system wide.
If the system doesn't have an override setting and lets each application decide for itself whether VSync should be enabled or not, and most importantly, the SFML application is the only one requesting VSync, then maybe it might be possible.
VSync is an OpenGL thing. Operating systems more often than not don't have any concept of vsync, because frankly, they don't need to. According to the specifications for swap_control on Linux and Windows:
https://www.opengl.org/registry/specs/EXT/swap_control.txthttps://www.opengl.org/registry/specs/SGI/swap_control.txthttps://www.opengl.org/registry/specs/EXT/wgl_swap_control.txtThere is always a way to query the current setting from the GL. But that setting might be local to the application, and doesn't take into account whether the setting would have made a system-wide difference or not. It is simply a number out of many numbers that the driver ends up taking into consideration when performing the real vertical synchronization.
You can have 4 situations:
- True positive: setVerticalSyncEnabled returns true and the system-wide vsync is enabled
- True negative: setVerticalSyncEnabled returns false and the system-wide vsync is disabled
- False positive: setVerticalSyncEnabled returns true and the system-wide vsync is disabled
- False negative: setVerticalSyncEnabled returns false and the system-wide vsync is enabled
In a perfect world, we would never have false positives or negatives. If the application could take exclusive control of the graphics hardware, then maybe that would be the case. If running in windowed mode while other applications are running, it might be the case that the return value is telling the truth, that your application is causing the vsync, or it might be lying because some other application is already causing the vsync and your application's setting doesn't matter at all.
If SFML were to return whether setting vsync was "successful" or not, it would be localized to the application only, and the developer would have to use their good judgement to act on that information. Chances are, if your application is fullscreen and setVerticalSyncEnabled returns true, you are synchronized. If your application isn't fullscreen, it's anybody's guess as to whether vsync was really enabled and whether it even makes a difference.
The other problem I see, is that unlike DirectX, OpenGL doesn't have a concept of "taking exclusive control" of the hardware. For example on Linux, "fullscreen" is often nothing more than a hack: a window without any decorations that just covers the entire screen. There can be multiple "fullscreen" applications running at the same time, and they might all be rendering via OpenGL as well. So even if the developer was smart in this case, they wouldn't be able to discern based on the return value of setVerticalSyncEnabled whether it was really enabled or not.
And finally, nothing prevents the user from disabling vsync all together from their driver control panel. SFML would still return true in this case, and you will have to assume based on that that vsync is enabled?!
Sure... SFML can return a bool for you, but the question is: Will that actually change anything in practice?