Module: wine Branch: master Commit: 992e3055b53b00ca290d8ffbec4923f155fe5726 URL: https://source.winehq.org/git/wine.git/?a=commit;h=992e3055b53b00ca290d8ffbe...
Author: Gabriel Ivăncescu gabrielopcode@gmail.com Date: Thu Jul 30 17:00:29 2020 +0430
ddraw: Check the foreground window in addition to the device state in ddraw_update_lost_surfaces().
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ddraw/ddraw.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 3cbde6ea84..d7545e5c82 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;