[PATCH v3 1/6] d3d8/tests: Test for window changes when it's not active.

Gabriel Ivăncescu gabrielopcode at gmail.com
Mon Jan 10 08:27:33 CST 2022


On 10/01/2022 13:42, Stefan Dösinger wrote:
> Hi,
> 
> I can't help but still be a bit confused. I think you added some separation between Active and Foreground windows, but didn't update the patch topic and code comments.
> 
>> +    ret = SetForegroundWindow(active_window);
>> +    ok(ret, "Failed to set foreground window.\n");
>> +    ok(GetActiveWindow() == active_window, "Unexpected active window.\n");
>> ...
>> +    style = GetWindowLongA(device_window, GWL_EXSTYLE);
>> +    expected_style = device_exstyle | WS_EX_TOPMOST;
>> +    todo_wine ok(style == expected_style || broken(style == (expected_style & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */,
>> +            "Expected device window extended style %#x, got %#x.\n", expected_style, style);
> 
> Afaiu here device window nor focus window are active (active_window is, but it isn't passed to d3d), and d3d does change the style. Do I read it correctly? Might this be a matter of the thread being the foreground thread and not what the involved windows are?
> 

Yes, that's exactly what this test is supposed to show.

>> +    ret = SetForegroundWindow(GetDesktopWindow());
>> +    ok(ret, "Failed to set foreground window.\n");
>> +    SetActiveWindow(active_window);
>> +    ok(GetActiveWindow() == active_window, "Unexpected active window.\n");
>> +
>> +    device_desc.device_window = device_window;
>> +    device_desc.flags = CREATE_DEVICE_FULLSCREEN;
>> ...
>> +    todo_wine ok(style == device_exstyle || broken(style == (device_exstyle & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */,
>> +            "Expected device window extended style %#x, got %#x.\n", device_exstyle, style);
>> +    style = GetWindowLongA(device_window, GWL_STYLE);
>> +    todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */,
>> +            "Expected device window style %#x, got %#x.\n", device_style, style);
> 
> Same thing re device and focus window: They are neither active, nor foreground. active_window is active, but not foreground. The foreground window doesn't belong to the current thread though, and afaiu the device window property shouldn't be changed. Do I read it correctly?

Yes. So with such tests I concluded that d3d8 checks if the foreground 
window is in the current thread to count it as "active" or not, for the 
purposes of doing window changes.

> 
> If I understand the rest of the test right it is to check the device::Reset() path instead of CreateDevice, correct?
> 
> One thing I'd be interested in:
> 
> SetForegroundWindow(GetDesktopWindow());
> SetActiveWindow(device_window);
> 
> That'd make the device window active, but not foreground. If it depends on the thread property rather than window property it'd mean that the window is not made topmost.
> 
> 

I see, I missed that case, should I use focus_window or device_window or 
just check both? d3d9ex for example only checks focus_window (I did add 
tests there, though).



More information about the wine-devel mailing list