https://bugs.winehq.org/show_bug.cgi?id=51672
Bug ID: 51672 Summary: Imperiums: Greek Wars has small black window on launch (caused by wrong position). Product: Wine Version: 6.15 Hardware: x86-64 OS: Linux Status: NEW Severity: normal Priority: P2 Component: user32 Assignee: wine-bugs@winehq.org Reporter: gabrielopcode@gmail.com Distribution: ---
The game depends on some specific detail on Windows for Maximized position placement. Windows seems to "forget" the maximized placement for any non-maximized windows, as well as maximized top-level windows that cover the work area.
Presumably, since applications typically save window positions via placement (such as on exit) to reload them later, it does this to prevent those apps from having weird maximized window positions when reloaded on a different screen or a screen having a different work area, so in this case it forgets it to simply say "just maximize to the entire work area" like normal maximized windows.
The game relies on this implicitly, because it changes styles and borders, which affect its position and size. First, it creates the main game window as hidden with the WS_CLIPCHILDREN | WS_MAXIMIZE | WS_MAXIMIZEBOX styles and the WS_EX_CONTROLPARENT | WS_EX_APPWINDOW exstyles set, so it's actually maximized. Implicitly, it ends up having a border around it, so it's position is something like (-3,-3) on the screen (because it's maximized and not fullscreen), covering the entire screen +3 on other side too.
Then, before showing the window, it sets the style on it again to the same thing, which actually removes the implicit border. Since the window is still hidden, it doesn't get updated by anything (WM or not) so its position remains at (-3,-3). This is still correct even on Windows, despite the fact it's in the wrong position technically speaking, so there's nothing wrong here.
The problem comes next: it shows the window with SW_MAXIMIZE. On Windows, this resets its position to (0,0) since there is no border now. Wine currently keeps its position at (-3,-3), although it does size the window down to be the size of the work area / screen. So for example for 1920x1080 size, this would have its rect be (-3,-3)-(1917,1077) instead of (0,0)-(1920,1080) as it is on Windows. This completely confuses the game, rendering a small black window, which makes it unplayable.
https://bugs.winehq.org/show_bug.cgi?id=51672
Lars Loe madbyte@tuta.io changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |madbyte@tuta.io
--- Comment #1 from Lars Loe madbyte@tuta.io --- I shamelessly want to refer to bug 51526 (https://bugs.winehq.org//show_bug.cgi?id=51526) which MAY have a problem going in a similar direction since the point it breaks appears to be around setWindowPos in winpos.c as well.
https://bugs.winehq.org/show_bug.cgi?id=51672
Gabriel Ivăncescu gabrielopcode@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |54eea6f072a8fed65bef713dfbc | |492bac285568b Status|NEW |RESOLVED Resolution|--- |FIXED
--- Comment #2 from Gabriel Ivăncescu gabrielopcode@gmail.com --- Should be fixed by 54eea6f072a8fed65bef713dfbc492bac285568b.
https://bugs.winehq.org/show_bug.cgi?id=51672
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #3 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 6.17.