Skip to content

Commit 57e0d81

Browse files
author
Trent Gamblin
committed
Immediate clear to black on Windows was not working, fixed.
1 parent c2e9a25 commit 57e0d81

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/win/wwindow.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,6 @@ HWND _al_win_create_window(ALLEGRO_DISPLAY *display, int width, int height, int
177177
NULL,NULL,window_class.hInstance,0);
178178
al_free(window_title);
179179

180-
clear_window(my_window, width, height);
181-
182180
if (_al_win_register_touch_window)
183181
_al_win_register_touch_window(my_window, 0);
184182

@@ -205,6 +203,8 @@ HWND _al_win_create_window(ALLEGRO_DISPLAY *display, int width, int height, int
205203

206204
ShowWindow(my_window, SW_SHOW);
207205

206+
clear_window(my_window, width, height);
207+
208208
if (!(flags & ALLEGRO_RESIZABLE) && !(flags & ALLEGRO_FULLSCREEN)) {
209209
/* Make the window non-resizable */
210210
HMENU menu;
@@ -245,8 +245,6 @@ HWND _al_win_create_faux_fullscreen_window(LPCTSTR devname, ALLEGRO_DISPLAY *dis
245245
NULL,NULL,window_class.hInstance,0);
246246
al_free(window_title);
247247

248-
clear_window(my_window, width, height);
249-
250248
if (_al_win_register_touch_window)
251249
_al_win_register_touch_window(my_window, 0);
252250

@@ -271,6 +269,8 @@ HWND _al_win_create_faux_fullscreen_window(LPCTSTR devname, ALLEGRO_DISPLAY *dis
271269

272270
ChangeDisplaySettingsEx(devname, &mode, NULL, 0, NULL/*CDS_FULLSCREEN*/);
273271

272+
clear_window(my_window, width, height);
273+
274274
return my_window;
275275
}
276276

@@ -1236,9 +1236,13 @@ bool _al_win_set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff)
12361236
win_display->window, HWND_TOP, pos_x-bw/2, pos_y-bh/2, 0, 0, SWP_NOSIZE
12371237
);
12381238
}
1239+
12391240
// Show the window again
12401241
SetWindowPos(win_display->window, 0, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE);
12411242

1243+
// Clear the window to black
1244+
clear_window(win_display->window, display->w, display->h);
1245+
12421246
ASSERT(!!(display->flags & ALLEGRO_FULLSCREEN_WINDOW) == onoff);
12431247
return true;
12441248
case ALLEGRO_MAXIMIZED:

0 commit comments

Comments
 (0)