[AD] Simple fix for the WinXP black screen bug |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Javier privately suggested a new fix for the WinXP black screen bug, simpler
than the one he originally devised back in October. It allows me to get rid
of the cruft I added to the overlay windowed driver in order to accomodate
to the former fix.
Applied to trunk and branch.
--
Eric Botcazou
Index: src/win/wddovl.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/win/wddovl.c,v
retrieving revision 1.42
diff -u -r1.42 wddovl.c
--- src/win/wddovl.c 15 Oct 2002 18:10:42 -0000 1.42
+++ src/win/wddovl.c 19 May 2003 11:17:35 -0000
@@ -85,8 +85,8 @@
static char gfx_driver_desc[256] = EMPTY_STRING;
static DDRAW_SURFACE *overlay_surface = NULL;
-static BITMAP *viewport = NULL, *background = NULL;
static BOOL overlay_visible = FALSE;
+static HBRUSH overlay_brush;
@@ -110,11 +110,6 @@
HRESULT hr;
RECT dest_rect = {x, y, x + w, y + h};
- /* paint the window background with the overlay color key */
- background->x_ofs = x + viewport->x_ofs;
- background->y_ofs = y + viewport->y_ofs;
- clear_to_color(background, background->vtable->mask_color);
-
/* show the overlay surface */
hr = IDirectDrawSurface2_UpdateOverlay(overlay_surface->id, NULL,
primary_surface->id, &dest_rect,
@@ -310,6 +305,10 @@
if (finalize_directx_init() != 0)
goto Error;
+ /* Paint window background with overlay color key. */
+ overlay_brush = CreateSolidBrush(MASK_COLOR_32);
+ SetClassLong(allegro_wnd, GCL_HBRBACKGROUND, (LONG) overlay_brush);
+
if (adjust_window(w, h) != 0) {
_TRACE("window size not supported.\n");
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Resolution not supported"));
@@ -366,8 +365,6 @@
goto Error;
forefront_bitmap = make_bitmap_from_surface(overlay_surface, w, h, BMP_ID_VIDEO);
- viewport = make_bitmap_from_surface(primary_surface, w, h, BMP_ID_VIDEO);
- background = create_sub_bitmap(viewport, 0, 0, w, h);
/* set the overlay color key */
key.dwColorSpaceLowValue = forefront_bitmap->vtable->mask_color;
@@ -430,16 +427,11 @@
/* destroy the overlay surface */
if (overlay_surface) {
hide_overlay();
+ SetClassLong(allegro_wnd, GCL_HBRBACKGROUND, (LONG) NULL);
+ DeleteObject(overlay_brush);
gfx_directx_destroy_surface(overlay_surface);
overlay_surface = NULL;
forefront_bitmap = NULL;
- }
-
- /* destroy the viewport */
- if (viewport) {
- destroy_bitmap(background);
- free(viewport);
- viewport = NULL;
}
gfx_directx_exit(NULL);
Index: src/win/wwnd.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/win/wwnd.c,v
retrieving revision 1.74
diff -u -r1.74 wwnd.c
--- src/win/wwnd.c 14 Jan 2003 16:51:09 -0000 1.74
+++ src/win/wwnd.c 19 May 2003 11:17:36 -0000
@@ -282,14 +282,6 @@
wnd_height = HIWORD(lparam);
break;
- case WM_ERASEBKGND:
- /* Disable the default background eraser in order
- * to prevent conflicts on NT kernels.
- */
- if (!user_wnd_proc || win_gfx_driver)
- return 1;
- break;
-
case WM_PAINT:
if (!user_wnd_proc || win_gfx_driver) {
BeginPaint(wnd, &ps);
@@ -368,7 +360,7 @@
if (!wnd_class.hIcon)
wnd_class.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wnd_class.hCursor = LoadCursor(NULL, IDC_ARROW);
- wnd_class.hbrBackground = GetStockObject(BLACK_BRUSH);
+ wnd_class.hbrBackground = NULL;
wnd_class.lpszMenuName = NULL;
wnd_class.lpszClassName = ALLEGRO_WND_CLASS;