On 29 March 2013 03:31, Sam Edwards cfsworks@gmail.com wrote:
Note that the tests are NOT (primarily) intended to make sure that WS_VISIBLE and WS_EX_TOPMOST are still set. The main purpose of this patch is to fix a slightly more serious bug:
- Create a window without WS_VISIBLE.
- Create a fullscreen Direct3D device.
- wined3d applies its own flags (including WS_VISIBLE) to the window, to
make it fullscreen.
- Reset the device back to windowed mode.
- Because wined3d_device_setup_fullscreen_window didn't see the window had
WS_VISIBLE, wined3d_device_restore_fullscreen_window won't restore the style.
This patch corrects that behavior, and the window restores back to its original style as on Windows.
I think the idea is basically ok, but I do have some comments:
I think test_window_style() is a more appropriate place for the tests, and you should add them to the variants in ddraw as well. Ddraw applications in particular are very fragile in this regard. Note that the test_window_style() tests are fairly similar to what your tests do, except that they don't test restoring the window as such. That test also shows that we're actually not supposed to touch the styles at all, but that's hard to make work without calling into winex11.
- SetWindowPos(window, HWND_TOP, 0, 0, w, h, SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOACTIVATE);
- SetWindowPos(window, HWND_TOPMOST, 0, 0, w, h, SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOACTIVATE);
This is really a separate change.
- device->style ^= (device->style^style) & WS_VISIBLE;
Spaces around the (second) ^, please.