Test for X11 errors for DGA2 and XVidMode extensions.

This commit is contained in:
Lionel Ulmer 2002-07-16 01:16:44 +00:00 committed by Alexandre Julliard
parent b6051dec93
commit 33dfdfcabc
2 changed files with 20 additions and 2 deletions

View File

@ -58,9 +58,15 @@ static void convert_mode(XDGAMode *mode, LPDDHALMODEINFO info)
info->dwWidth, info->dwHeight, info->dwBPP, info->wRefreshRate);
}
static int DGA2ErrorHandler(Display *dpy, XErrorEvent *event, void *arg)
{
return 1;
}
void X11DRV_XF86DGA2_Init(void)
{
int nmodes, major, minor, i;
Bool ok;
if (xf86dga2_modes) return; /* already initialized? */
@ -71,7 +77,10 @@ void X11DRV_XF86DGA2_Init(void)
if (!TSXDGAQueryExtension(gdi_display, &dga_event, &dga_error)) return;
if (!TSXDGAQueryVersion(gdi_display, &major, &minor)) return;
X11DRV_expect_error(gdi_display, DGA2ErrorHandler, NULL);
ok = TSXDGAQueryVersion(gdi_display, &major, &minor);
if (X11DRV_check_error()) ok = FALSE;
if (!ok) return;
if (major < 2) return; /* only bother with DGA 2+ */

View File

@ -93,9 +93,15 @@ static void convert_modeline(int dotclock, const XF86VidModeModeLine *mode, LPDD
info->dwAlphaBitMask = 0;
}
static int XVidModeErrorHandler(Display *dpy, XErrorEvent *event, void *arg)
{
return 1;
}
void X11DRV_XF86VM_Init(void)
{
int nmodes, i;
Bool ok;
if (xf86vm_major) return; /* already initialized? */
@ -106,7 +112,10 @@ void X11DRV_XF86VM_Init(void)
/* see if XVidMode is available */
if (!TSXF86VidModeQueryExtension(gdi_display, &xf86vm_event, &xf86vm_error)) return;
if (!TSXF86VidModeQueryVersion(gdi_display, &xf86vm_major, &xf86vm_minor)) return;
X11DRV_expect_error(gdi_display, XVidModeErrorHandler, NULL);
ok = TSXF86VidModeQueryVersion(gdi_display, &xf86vm_major, &xf86vm_minor);
if (X11DRV_check_error()) ok = FALSE;
if (!ok) return;
#ifdef X_XF86VidModeSetGammaRamp
if (xf86vm_major > 2 || (xf86vm_major == 2 && xf86vm_minor >= 1))