Fixed sending a size event while setting up a window (fix for DOTA 2 on Source 2)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index 8f3ec68..87d4e60 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -735,7 +735,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
int x, y;
int w, h;
- if (data->in_border_change) {
+ if (data->initializing || data->in_border_change) {
break;
}
diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c
index a1fb020..26db698 100644
--- a/src/video/windows/SDL_windowswindow.c
+++ b/src/video/windows/SDL_windowswindow.c
@@ -130,6 +130,7 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
data->created = created;
data->mouse_button_flags = 0;
data->videodata = videodata;
+ data->initializing = SDL_TRUE;
window->driverdata = data;
@@ -255,6 +256,8 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
/* Enable dropping files */
DragAcceptFiles(hwnd, TRUE);
+ data->initializing = SDL_FALSE;
+
/* All done! */
return 0;
}
diff --git a/src/video/windows/SDL_windowswindow.h b/src/video/windows/SDL_windowswindow.h
index 32ce279..ede1e1e 100644
--- a/src/video/windows/SDL_windowswindow.h
+++ b/src/video/windows/SDL_windowswindow.h
@@ -37,6 +37,7 @@ typedef struct
WNDPROC wndproc;
SDL_bool created;
WPARAM mouse_button_flags;
+ SDL_bool initializing;
SDL_bool expected_resize;
SDL_bool in_border_change;
SDL_bool in_title_click;