[PATCH 3/3] ddraw: Check the foreground window in addition to the device state in ddraw_update_lost_surfaces().
Henri Verbeet
hverbeet at codeweavers.com
Thu Jul 30 07:12:29 CDT 2020
From: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
This supersedes patch 189882. Handle this in ddraw_update_lost_surfaces(),
instead of ddraw_surface7_Restore().
dlls/ddraw/ddraw.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 3cbde6ea84b..d7545e5c82c 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -4975,6 +4975,19 @@ void ddraw_update_lost_surfaces(struct ddraw *ddraw)
{
struct ddraw_surface *surface;
+ /* Railroad Tycoon 2 tries to restore surfaces from within a
+ * WM_QUERYNEWPALETTE message handler and expects it to succeed. We
+ * haven't received the WM_ACTIVATEAPP message by that point, so the
+ * device state is still DDRAW_DEVICE_STATE_LOST, even though we are in
+ * the foreground. */
+ if (ddraw->device_state == DDRAW_DEVICE_STATE_LOST)
+ {
+ HWND window = ddraw->focuswindow ? ddraw->focuswindow : ddraw->dest_window;
+
+ if (window && GetForegroundWindow() == window)
+ ddraw->device_state = DDRAW_DEVICE_STATE_NOT_RESTORED;
+ }
+
if (ddraw->device_state != DDRAW_DEVICE_STATE_NOT_RESTORED)
return;
--
2.20.1
More information about the wine-devel
mailing list