http://bugs.winehq.org/show_bug.cgi?id=14272
Summary: Maximized and restored state not reported properly by GetWindowPlacement Product: Wine Version: CVS/GIT Platform: PC OS/Version: Linux Status: NEW Severity: enhancement Priority: P2 Component: winex11.drv AssignedTo: wine-bugs@winehq.org ReportedBy: dylan.ah.smith@gmail.com
Created an attachment (id=14562) --> (http://bugs.winehq.org/attachment.cgi?id=14562) wordpad: Properly save window rect on closing Min/Maximized windows
I initially noticed the bug in wordpad where closing the program while minimized will cause it to be really small when opened the next time. This was because wordpad was using GetWindowRect instead of GetWindowPlacement to get the normal size and position of the window. The attached patch fixes that issue, and I have submitted it to the wine-patches mailing list, however it showed another bug in Wine that isn't in Windows.
Do the following steps to reproduce the bug: 1. Apply the attached patch to fix wordpad 2. Open Wine's version of Wordpad 3. Resize the window to be some size you will remember (e.g. skinny and tall) 4. Maximize the window 5. Close the window 6. Open wordpad again 7. If the window is maximized, then restore it.
Result in Windows: The window is maximized after step 5, and will be restored to the same size the window was resized to in step 3.
Result in Wine: The result depends on the desktop environment settings. If you can take a normal window, drag the corners to resize it to the size of a maximized window, and have it actually be maximize, then the window will be maximized after step 6, otherwise it won't be. Either way, when you restore the window in step 7, it will not be restored to the same window size.
I added in some printf statements to wordpad, and found that IsZoomed() and GetWindowPlacement() were not recognizing the window as being maximized after maximizing the window. GetWindowPlacement returns a WINDOWPLACEMENT structure with a field rcNormalPosition, that should be filled with the position and size the window should be restored to, but this contained the size and position of the maximized window when the window was maximized.
Test case number 2: 1. Open up regedit 2. Change the DWORD value "HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Applets/Wordpad/Options/Maximized" to 1 3. Open Wine's wordpad 4. Restore the window 5. Close the window 6. Open wordpad again
Result in Windows: The window will be the normal window size it was when wordpad was closed in step 5.
Result in Wine: The window will still be maximized.
This time IsZoomed() and GetWindowPlacement() returned values indicating that the window was maximized after the window was restored.
Let me know if there are any problems with reproducing this bug.
My guess is that this is an x11 driver issue, but I haven't looked deep enough into it to actually know. All I know is that my patch fixes the wordpad issues in Windows.