IDirectDraw,IDirectDraw2,IDirectDraw4 fixed up in regard to COM usage.

This commit is contained in:
Marcus Meissner 2000-07-23 13:39:52 +00:00 committed by Alexandre Julliard
parent f9e4e4808e
commit bfae5c8382
16 changed files with 220 additions and 238 deletions

View File

@ -28,7 +28,7 @@ ICOM_VTABLE(IDirect3DDevice) OpenGL_vtable_dx3;
#undef HAVE_BUGGY_MESAGL #undef HAVE_BUGGY_MESAGL
#define D3DDPRIVATE(x) mesa_d3dd_private *odev=((mesa_d3dd_private*)x->private) #define D3DDPRIVATE(x) mesa_d3dd_private *odev=((mesa_d3dd_private*)x->private)
#define DDPRIVATE(x) x11_dd_private *ddpriv=((x11_dd_private*)(x)->private) #define DDPRIVATE(x) x11_dd_private *ddpriv=((x11_dd_private*)(x)->d->private)
static const float id_mat[16] = { static const float id_mat[16] = {
1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0,

View File

@ -51,7 +51,7 @@ struct ICOM_VTABLE(IDirectDraw4) dga_dd4vt;
static XF86VidModeModeInfo *orig_mode = NULL; static XF86VidModeModeInfo *orig_mode = NULL;
#endif #endif
#define DDPRIVATE(x) dga_dd_private *ddpriv = ((dga_dd_private*)(x)->private) #define DDPRIVATE(x) dga_dd_private *ddpriv = ((dga_dd_private*)(x)->d->private)
#define DPPRIVATE(x) dga_dp_private *dppriv = ((dga_dp_private*)(x)->private) #define DPPRIVATE(x) dga_dp_private *dppriv = ((dga_dp_private*)(x)->private)
/******************************************************************************* /*******************************************************************************
@ -99,9 +99,9 @@ HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface_with_VT(
dsurf->s.surface_desc = *lpddsd; dsurf->s.surface_desc = *lpddsd;
if (!(lpddsd->dwFlags & DDSD_WIDTH)) if (!(lpddsd->dwFlags & DDSD_WIDTH))
dsurf->s.surface_desc.dwWidth = This->d.width; dsurf->s.surface_desc.dwWidth = This->d->width;
if (!(lpddsd->dwFlags & DDSD_HEIGHT)) if (!(lpddsd->dwFlags & DDSD_HEIGHT))
dsurf->s.surface_desc.dwHeight = This->d.height; dsurf->s.surface_desc.dwHeight = This->d->height;
dsurf->s.surface_desc.dwFlags |= DDSD_WIDTH|DDSD_HEIGHT; dsurf->s.surface_desc.dwFlags |= DDSD_WIDTH|DDSD_HEIGHT;
@ -118,7 +118,7 @@ HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface_with_VT(
/* if i == 32 or maximum ... return error */ /* if i == 32 or maximum ... return error */
ddpriv->vpmask|=(1<<i); ddpriv->vpmask|=(1<<i);
lpddsd->lPitch = dsurf->s.surface_desc.lPitch = lpddsd->lPitch = dsurf->s.surface_desc.lPitch =
ddpriv->fb_width*PFGET_BPP(This->d.directdraw_pixelformat); ddpriv->fb_width*PFGET_BPP(This->d->directdraw_pixelformat);
dsurf->s.surface_desc.u1.lpSurface = dsurf->s.surface_desc.u1.lpSurface =
ddpriv->fb_addr + i*fbheight*lpddsd->lPitch; ddpriv->fb_addr + i*fbheight*lpddsd->lPitch;
@ -127,12 +127,12 @@ HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface_with_VT(
/* Add flags if there were not present */ /* Add flags if there were not present */
dsurf->s.surface_desc.dwFlags |= DDSD_WIDTH|DDSD_HEIGHT|DDSD_PITCH|DDSD_LPSURFACE|DDSD_PIXELFORMAT; dsurf->s.surface_desc.dwFlags |= DDSD_WIDTH|DDSD_HEIGHT|DDSD_PITCH|DDSD_LPSURFACE|DDSD_PIXELFORMAT;
dsurf->s.surface_desc.dwWidth = This->d.width; dsurf->s.surface_desc.dwWidth = This->d->width;
dsurf->s.surface_desc.dwHeight = This->d.height; dsurf->s.surface_desc.dwHeight = This->d->height;
TRACE("primary surface: dwWidth=%ld, dwHeight=%ld, lPitch=%ld\n",This->d.width,This->d.height,lpddsd->lPitch); TRACE("primary surface: dwWidth=%ld, dwHeight=%ld, lPitch=%ld\n",This->d->width,This->d->height,lpddsd->lPitch);
/* We put our surface always in video memory */ /* We put our surface always in video memory */
SDDSCAPS(dsurf) |= DDSCAPS_VISIBLE|DDSCAPS_VIDEOMEMORY; SDDSCAPS(dsurf) |= DDSCAPS_VISIBLE|DDSCAPS_VIDEOMEMORY;
dsurf->s.surface_desc.ddpfPixelFormat = This->d.directdraw_pixelformat; dsurf->s.surface_desc.ddpfPixelFormat = This->d->directdraw_pixelformat;
dsurf->s.chain = NULL; dsurf->s.chain = NULL;
if (lpddsd->dwFlags & DDSD_BACKBUFFERCOUNT) { if (lpddsd->dwFlags & DDSD_BACKBUFFERCOUNT) {
@ -221,12 +221,12 @@ static HRESULT WINAPI DGA_IDirectDrawImpl_SetDisplayMode(
return DDERR_UNSUPPORTEDMODE; return DDERR_UNSUPPORTEDMODE;
} }
if (This->d.width < width) { if (This->d->width < width) {
ERR("SetDisplayMode(w=%ld,h=%ld,d=%ld), width %ld exceeds framebuffer width %ld\n",width,height,depth,width,This->d.width); ERR("SetDisplayMode(w=%ld,h=%ld,d=%ld), width %ld exceeds framebuffer width %ld\n",width,height,depth,width,This->d->width);
return DDERR_UNSUPPORTEDMODE; return DDERR_UNSUPPORTEDMODE;
} }
This->d.width = width; This->d->width = width;
This->d.height = height; This->d->height = height;
/* adjust fb_height, so we don't overlap */ /* adjust fb_height, so we don't overlap */
if (ddpriv->fb_height < height) if (ddpriv->fb_height < height)
@ -373,7 +373,7 @@ static HRESULT WINAPI DGA_IDirectDraw2Impl_CreatePalette(
dppriv = (dga_dp_private*)ddpal->private; dppriv = (dga_dp_private*)ddpal->private;
ICOM_VTBL(ddpal)= &dga_ddpalvt; ICOM_VTBL(ddpal)= &dga_ddpalvt;
if (This->d.directdraw_pixelformat.u.dwRGBBitCount<=8) { if (This->d->directdraw_pixelformat.u.dwRGBBitCount<=8) {
dppriv->cm = TSXCreateColormap(display,DefaultRootWindow(display),DefaultVisualOfScreen(X11DRV_GetXScreen()),AllocAll); dppriv->cm = TSXCreateColormap(display,DefaultRootWindow(display),DefaultVisualOfScreen(X11DRV_GetXScreen()),AllocAll);
} else { } else {
ERR("why are we doing CreatePalette in hi/truecolor?\n"); ERR("why are we doing CreatePalette in hi/truecolor?\n");
@ -411,29 +411,32 @@ static ULONG WINAPI DGA_IDirectDraw2Impl_Release(LPDIRECTDRAW2 iface) {
TRACE("(%p)->() decrementing from %lu.\n", This, This->ref ); TRACE("(%p)->() decrementing from %lu.\n", This, This->ref );
if (!--(This->ref)) { if (!--(This->ref)) {
VirtualFree(ddpriv->fb_addr, 0, MEM_RELEASE); if (!--(This->d->ref)) {
TSXF86DGADirectVideo(display,DefaultScreen(display),0); VirtualFree(ddpriv->fb_addr, 0, MEM_RELEASE);
if (This->d.window && GetPropA(This->d.window,ddProp)) TSXF86DGADirectVideo(display,DefaultScreen(display),0);
DestroyWindow(This->d.window); if (This->d->window && GetPropA(This->d->window,ddProp))
DestroyWindow(This->d->window);
#ifdef HAVE_LIBXXF86VM #ifdef HAVE_LIBXXF86VM
if (orig_mode) { if (orig_mode) {
TSXF86VidModeSwitchToMode( TSXF86VidModeSwitchToMode(
display, display,
DefaultScreen(display), DefaultScreen(display),
orig_mode orig_mode
); );
if (orig_mode->privsize) if (orig_mode->privsize)
TSXFree(orig_mode->private); TSXFree(orig_mode->private);
free(orig_mode); free(orig_mode);
orig_mode = NULL; orig_mode = NULL;
} }
#endif #endif
#ifdef RESTORE_SIGNALS #ifdef RESTORE_SIGNALS
SIGNAL_Init(); SIGNAL_Init();
#endif #endif
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This->d);
return S_OK; }
HeapFree(GetProcessHeap(),0,This);
return S_OK;
} }
return This->ref; return This->ref;
} }
@ -453,30 +456,31 @@ HRESULT WINAPI DGA_IDirectDraw2Impl_QueryInterface(
return S_OK; return S_OK;
} }
if ( IsEqualGUID( &IID_IDirectDraw, refiid ) ) { if ( IsEqualGUID( &IID_IDirectDraw, refiid ) ) {
ICOM_VTBL(This) = (ICOM_VTABLE(IDirectDraw2)*)&dga_ddvt; IDirectDrawImpl *dd = HeapAlloc(GetProcessHeap(),0,sizeof(*dd));
IDirectDraw2_AddRef(iface); ICOM_VTBL(dd) = &dga_ddvt;dd->ref = 1;dd->d = This->d;This->d++;
*obj = This; *obj = dd;
IDirectDraw2_AddRef(iface);
TRACE(" Creating IDirectDraw interface (%p)\n", *obj); TRACE(" Creating IDirectDraw interface (%p)\n", *obj);
return S_OK; return S_OK;
} }
if ( IsEqualGUID( &IID_IDirectDraw2, refiid ) ) { if ( IsEqualGUID( &IID_IDirectDraw2, refiid ) ) {
ICOM_VTBL(This) = (ICOM_VTABLE(IDirectDraw2)*)&dga_dd2vt; IDirectDraw2Impl *dd = HeapAlloc(GetProcessHeap(),0,sizeof(*dd));
ICOM_VTBL(dd) = &dga_dd2vt;dd->ref = 1;dd->d = This->d;This->d++;
*obj = dd;
IDirectDraw2_AddRef(iface); IDirectDraw2_AddRef(iface);
*obj = This;
TRACE(" Creating IDirectDraw2 interface (%p)\n", *obj); TRACE(" Creating IDirectDraw2 interface (%p)\n", *obj);
return S_OK; return S_OK;
} }
if ( IsEqualGUID( &IID_IDirectDraw4, refiid ) ) { if ( IsEqualGUID( &IID_IDirectDraw4, refiid ) ) {
ICOM_VTBL(This) = (ICOM_VTABLE(IDirectDraw2)*)&dga_dd4vt; IDirectDraw2Impl *dd = HeapAlloc(GetProcessHeap(),0,sizeof(*dd));
ICOM_VTBL(dd) = &dga_dd2vt;dd->ref = 1;dd->d = This->d;This->d++;
*obj = dd;
IDirectDraw2_AddRef(iface); IDirectDraw2_AddRef(iface);
*obj = This;
TRACE(" Creating IDirectDraw4 interface (%p)\n", *obj); TRACE(" Creating IDirectDraw4 interface (%p)\n", *obj);
return S_OK; return S_OK;
} }
FIXME("(%p):interface for IID %s _NOT_ found!\n",This,debugstr_guid(refiid)); FIXME("(%p):interface for IID %s _NOT_ found!\n",This,debugstr_guid(refiid));
@ -579,13 +583,13 @@ HRESULT WINAPI DGA_IDirectDraw2Impl_GetDisplayMode(
TRACE("(%p)->(%p)\n",This,lpddsfd); TRACE("(%p)->(%p)\n",This,lpddsfd);
lpddsfd->dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PITCH|DDSD_BACKBUFFERCOUNT|DDSD_PIXELFORMAT|DDSD_CAPS; lpddsfd->dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PITCH|DDSD_BACKBUFFERCOUNT|DDSD_PIXELFORMAT|DDSD_CAPS;
lpddsfd->dwHeight = This->d.height; lpddsfd->dwHeight = This->d->height;
lpddsfd->dwWidth = This->d.width; lpddsfd->dwWidth = This->d->width;
lpddsfd->lPitch = ddpriv->fb_width*PFGET_BPP(This->d.directdraw_pixelformat); lpddsfd->lPitch = ddpriv->fb_width*PFGET_BPP(This->d->directdraw_pixelformat);
lpddsfd->dwBackBufferCount = 2; lpddsfd->dwBackBufferCount = 2;
lpddsfd->u.dwRefreshRate = 60; lpddsfd->u.dwRefreshRate = 60;
lpddsfd->ddsCaps.dwCaps = DDSCAPS_PALETTE; lpddsfd->ddsCaps.dwCaps = DDSCAPS_PALETTE;
lpddsfd->ddpfPixelFormat = This->d.directdraw_pixelformat; lpddsfd->ddpfPixelFormat = This->d->directdraw_pixelformat;
if (TRACE_ON(ddraw)) if (TRACE_ON(ddraw))
_dump_surface_desc(lpddsfd); _dump_surface_desc(lpddsfd);
return DD_OK; return DD_OK;

View File

@ -29,7 +29,7 @@ struct ICOM_VTABLE(IDirectDraw) dga2_ddvt;
struct ICOM_VTABLE(IDirectDraw2) dga2_dd2vt; struct ICOM_VTABLE(IDirectDraw2) dga2_dd2vt;
struct ICOM_VTABLE(IDirectDraw4) dga2_dd4vt; struct ICOM_VTABLE(IDirectDraw4) dga2_dd4vt;
#define DDPRIVATE(x) dga2_dd_private *ddpriv = ((dga2_dd_private*)(x)->private) #define DDPRIVATE(x) dga2_dd_private *ddpriv = ((dga2_dd_private*)(x)->d->private)
#define DPPRIVATE(x) dga2_dp_private *dppriv = ((dga2_dp_private*)(x)->private) #define DPPRIVATE(x) dga2_dp_private *dppriv = ((dga2_dp_private*)(x)->private)
/******************************************************************************* /*******************************************************************************
@ -69,7 +69,7 @@ static HRESULT WINAPI DGA2_IDirectDraw2Impl_SetCooperativeLevel(
} }
void _DGA2_Initialize_FrameBuffer(IDirectDrawImpl *This, int mode) { void _DGA2_Initialize_FrameBuffer(IDirectDrawImpl *This, int mode) {
DDPIXELFORMAT *pf = &(This->d.directdraw_pixelformat); DDPIXELFORMAT *pf = &(This->d->directdraw_pixelformat);
DDPRIVATE(This); DDPRIVATE(This);
/* Now, get the device / mode description */ /* Now, get the device / mode description */
@ -89,8 +89,8 @@ void _DGA2_Initialize_FrameBuffer(IDirectDrawImpl *This, int mode) {
/* Get the screen dimensions as seen by Wine. /* Get the screen dimensions as seen by Wine.
* In that case, it may be better to ignore the -desktop mode and return the * In that case, it may be better to ignore the -desktop mode and return the
* real screen size => print a warning */ * real screen size => print a warning */
This->d.height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor); This->d->height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
This->d.width = MONITOR_GetWidth(&MONITOR_PrimaryMonitor); This->d->width = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
ddpriv->DGA.fb_addr = ddpriv->dev->data; ddpriv->DGA.fb_addr = ddpriv->dev->data;
ddpriv->DGA.fb_memsize = (ddpriv->dev->mode.imageWidth * ddpriv->DGA.fb_memsize = (ddpriv->dev->mode.imageWidth *
ddpriv->dev->mode.imageHeight * ddpriv->dev->mode.imageHeight *
@ -113,7 +113,7 @@ void _DGA2_Initialize_FrameBuffer(IDirectDrawImpl *This, int mode) {
pf->u3.dwBBitMask = ddpriv->dev->mode.blueMask; pf->u3.dwBBitMask = ddpriv->dev->mode.blueMask;
} }
pf->u4.dwRGBAlphaBitMask= 0; pf->u4.dwRGBAlphaBitMask= 0;
This->d.screen_pixelformat = *pf; This->d->screen_pixelformat = *pf;
} }
static HRESULT WINAPI DGA2_IDirectDrawImpl_SetDisplayMode( static HRESULT WINAPI DGA2_IDirectDrawImpl_SetDisplayMode(
@ -185,7 +185,7 @@ static HRESULT WINAPI DGA2_IDirectDraw2Impl_CreatePalette(
dppriv = (dga_dp_private*)ddpal->private; dppriv = (dga_dp_private*)ddpal->private;
ICOM_VTBL(ddpal)= &dga_ddpalvt; ICOM_VTBL(ddpal)= &dga_ddpalvt;
if (This->d.directdraw_pixelformat.u.dwRGBBitCount<=8) { if (This->d->directdraw_pixelformat.u.dwRGBBitCount<=8) {
dppriv->cm = TSXDGACreateColormap(display,DefaultScreen(display), ddpriv->dev, AllocAll); dppriv->cm = TSXDGACreateColormap(display,DefaultScreen(display), ddpriv->dev, AllocAll);
} else { } else {
ERR("why are we doing CreatePalette in hi/truecolor?\n"); ERR("why are we doing CreatePalette in hi/truecolor?\n");
@ -223,23 +223,25 @@ static ULONG WINAPI DGA2_IDirectDraw2Impl_Release(LPDIRECTDRAW2 iface) {
TRACE("(%p)->() decrementing from %lu.\n", This, This->ref ); TRACE("(%p)->() decrementing from %lu.\n", This, This->ref );
if (!--(This->ref)) { if (!--(This->ref)) {
TRACE("Closing access to the FrameBuffer\n"); if (!--(This->d->ref)) {
VirtualFree(ddpriv->DGA.fb_addr, 0, MEM_RELEASE); TRACE("Closing access to the FrameBuffer\n");
TSXDGACloseFramebuffer(display, DefaultScreen(display)); VirtualFree(ddpriv->DGA.fb_addr, 0, MEM_RELEASE);
TRACE("Going back to normal X mode of operation\n"); TSXDGACloseFramebuffer(display, DefaultScreen(display));
TSXDGASetMode(display, DefaultScreen(display), 0); TRACE("Going back to normal X mode of operation\n");
TSXDGASetMode(display, DefaultScreen(display), 0);
/* Set the input handling back to absolute */
X11DRV_EVENT_SetInputMethod(X11DRV_INPUT_ABSOLUTE);
/* Remove the handling of DGA2 events */
X11DRV_EVENT_SetDGAStatus(0, -1);
/* Free the modes list */
TSXFree(ddpriv->modes);
/* Set the input handling back to absolute */
X11DRV_EVENT_SetInputMethod(X11DRV_INPUT_ABSOLUTE);
/* Remove the handling of DGA2 events */
X11DRV_EVENT_SetDGAStatus(0, -1);
/* Free the modes list */
TSXFree(ddpriv->modes);
HeapFree(GetProcessHeap(),0,This->d);
}
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This);
return S_OK; return 0;
} }
return This->ref; return This->ref;
} }

View File

@ -46,7 +46,7 @@ HRESULT WINAPI IDirectDraw2Impl_SetCooperativeLevel(
FIXME("(%p)->(%08lx,%08lx)\n",This,(DWORD)hwnd,cooplevel); FIXME("(%p)->(%08lx,%08lx)\n",This,(DWORD)hwnd,cooplevel);
_dump_cooperativelevel(cooplevel); _dump_cooperativelevel(cooplevel);
This->d.mainWindow = hwnd; This->d->mainWindow = hwnd;
return DD_OK; return DD_OK;
} }
@ -60,45 +60,45 @@ void _common_IDirectDrawImpl_SetDisplayMode(IDirectDrawImpl* This) {
RECT rect; RECT rect;
/* Do destroy only our window */ /* Do destroy only our window */
if (This->d.window && GetPropA(This->d.window,ddProp)) { if (This->d->window && GetPropA(This->d->window,ddProp)) {
DestroyWindow(This->d.window); DestroyWindow(This->d->window);
This->d.window = 0; This->d->window = 0;
} }
/* Sanity check cooperative window before assigning it to drawing. */ /* Sanity check cooperative window before assigning it to drawing. */
if (IsWindow(This->d.mainWindow) && if (IsWindow(This->d->mainWindow) &&
IsWindowVisible(This->d.mainWindow) IsWindowVisible(This->d->mainWindow)
) { ) {
GetWindowRect(This->d.mainWindow,&rect); GetWindowRect(This->d->mainWindow,&rect);
if ((((rect.right-rect.left) >= This->d.width) && if ((((rect.right-rect.left) >= This->d->width) &&
((rect.bottom-rect.top) >= This->d.height)) ((rect.bottom-rect.top) >= This->d->height))
) { ) {
This->d.window = This->d.mainWindow; This->d->window = This->d->mainWindow;
/* FIXME: resizing is not windows compatible behaviour, need test */ /* FIXME: resizing is not windows compatible behaviour, need test */
/* SetWindowPos(This->d.mainWindow,HWND_TOPMOST,0,0,This->d.width,This->d.height,SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOOWNERZORDER); */ /* SetWindowPos(This->d->mainWindow,HWND_TOPMOST,0,0,This->d->width,This->d->height,SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOOWNERZORDER); */
This->d.paintable = 1; /* don't wait for WM_PAINT */ This->d->paintable = 1; /* don't wait for WM_PAINT */
} }
} }
/* ... failed, create new one. */ /* ... failed, create new one. */
if (!This->d.window) { if (!This->d->window) {
This->d.window = CreateWindowExA( This->d->window = CreateWindowExA(
0, 0,
"WINE_DirectDraw", "WINE_DirectDraw",
"WINE_DirectDraw", "WINE_DirectDraw",
WS_POPUP, WS_POPUP,
0,0, 0,0,
This->d.width, This->d->width,
This->d.height, This->d->height,
0, 0,
0, 0,
0, 0,
NULL NULL
); );
/*Store THIS with the window. We'll use it in the window procedure*/ /*Store THIS with the window. We'll use it in the window procedure*/
SetPropA(This->d.window,ddProp,(LONG)This); SetPropA(This->d->window,ddProp,(LONG)This);
ShowWindow(This->d.window,TRUE); ShowWindow(This->d->window,TRUE);
UpdateWindow(This->d.window); UpdateWindow(This->d->window);
} }
SetFocus(This->d.window); SetFocus(This->d->window);
} }
HRESULT WINAPI IDirectDrawImpl_SetDisplayMode( HRESULT WINAPI IDirectDrawImpl_SetDisplayMode(
@ -107,8 +107,8 @@ HRESULT WINAPI IDirectDrawImpl_SetDisplayMode(
ICOM_THIS(IDirectDrawImpl,iface); ICOM_THIS(IDirectDrawImpl,iface);
FIXME("(%p)->SetDisplayMode(%ld,%ld,%ld), needs to be implemented for your display adapter!\n",This,width,height,depth); FIXME("(%p)->SetDisplayMode(%ld,%ld,%ld), needs to be implemented for your display adapter!\n",This,width,height,depth);
This->d.width = width; This->d->width = width;
This->d.height = height; This->d->height = height;
_common_IDirectDrawImpl_SetDisplayMode(This); _common_IDirectDrawImpl_SetDisplayMode(This);
return DD_OK; return DD_OK;
} }
@ -192,7 +192,7 @@ HRESULT WINAPI common_IDirectDraw2Impl_CreatePalette(
ERR("unhandled palette format\n"); ERR("unhandled palette format\n");
*psize = size; *psize = size;
if (This->d.palette_convert == NULL) { if (This->d->palette_convert == NULL) {
/* No depth conversion - create 8<->8 identity map */ /* No depth conversion - create 8<->8 identity map */
int ent; int ent;
for (ent=0; ent<256; ent++) for (ent=0; ent<256; ent++)
@ -200,11 +200,11 @@ HRESULT WINAPI common_IDirectDraw2Impl_CreatePalette(
} }
if (palent) { if (palent) {
/* Now, if we are in depth conversion mode, create the screen palette */ /* Now, if we are in depth conversion mode, create the screen palette */
if (This->d.palette_convert != NULL) if (This->d->palette_convert != NULL)
This->d.palette_convert(palent,(*lpddpal)->screen_palents,0,size); This->d->palette_convert(palent,(*lpddpal)->screen_palents,0,size);
memcpy((*lpddpal)->palents, palent, size * sizeof(PALETTEENTRY)); memcpy((*lpddpal)->palents, palent, size * sizeof(PALETTEENTRY));
} else if (This->d.palette_convert != NULL) { } else if (This->d->palette_convert != NULL) {
/* In that case, put all 0xFF */ /* In that case, put all 0xFF */
memset((*lpddpal)->screen_palents, 0xFF, 256 * sizeof(int)); memset((*lpddpal)->screen_palents, 0xFF, 256 * sizeof(int));
} }
@ -253,8 +253,11 @@ ULONG WINAPI IDirectDraw2Impl_Release(LPDIRECTDRAW2 iface) {
TRACE("(%p)->() decrementing from %lu.\n", This, This->ref ); TRACE("(%p)->() decrementing from %lu.\n", This, This->ref );
if (!--(This->ref)) { if (!--(This->ref)) {
if (This->d.window && GetPropA(This->d.window,ddProp)) if (!--(This->d->ref)) {
DestroyWindow(This->d.window); if (This->d->window && GetPropA(This->d->window,ddProp))
DestroyWindow(This->d->window);
HeapFree(GetProcessHeap(),0,This->d);
}
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This);
return S_OK; return S_OK;
} }
@ -379,13 +382,13 @@ HRESULT WINAPI IDirectDraw2Impl_GetDisplayMode(
ICOM_THIS(IDirectDraw2Impl,iface); ICOM_THIS(IDirectDraw2Impl,iface);
TRACE("(%p)->GetDisplayMode(%p)\n",This,lpddsfd); TRACE("(%p)->GetDisplayMode(%p)\n",This,lpddsfd);
lpddsfd->dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PITCH|DDSD_BACKBUFFERCOUNT|DDSD_PIXELFORMAT|DDSD_CAPS; lpddsfd->dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PITCH|DDSD_BACKBUFFERCOUNT|DDSD_PIXELFORMAT|DDSD_CAPS;
lpddsfd->dwHeight = This->d.height; lpddsfd->dwHeight = This->d->height;
lpddsfd->dwWidth = This->d.width; lpddsfd->dwWidth = This->d->width;
lpddsfd->lPitch =lpddsfd->dwWidth*PFGET_BPP(This->d.directdraw_pixelformat); lpddsfd->lPitch =lpddsfd->dwWidth*PFGET_BPP(This->d->directdraw_pixelformat);
lpddsfd->dwBackBufferCount = 2; lpddsfd->dwBackBufferCount = 2;
lpddsfd->u.dwRefreshRate = 60; lpddsfd->u.dwRefreshRate = 60;
lpddsfd->ddsCaps.dwCaps = DDSCAPS_PALETTE; lpddsfd->ddsCaps.dwCaps = DDSCAPS_PALETTE;
lpddsfd->ddpfPixelFormat = This->d.directdraw_pixelformat; lpddsfd->ddpfPixelFormat = This->d->directdraw_pixelformat;
if (TRACE_ON(ddraw)) if (TRACE_ON(ddraw))
_dump_surface_desc(lpddsfd); _dump_surface_desc(lpddsfd);
return DD_OK; return DD_OK;
@ -444,7 +447,7 @@ HRESULT WINAPI IDirectDraw2Impl_GetScanLine(
FIXME("(%p)->(%p)\n", This, lpdwScanLine); FIXME("(%p)->(%p)\n", This, lpdwScanLine);
if (lpdwScanLine) if (lpdwScanLine)
*lpdwScanLine = 0; *lpdwScanLine = 1;
return DD_OK; return DD_OK;
} }
@ -543,7 +546,7 @@ HRESULT common_off_screen_CreateSurface(
/* This is a standard image */ /* This is a standard image */
if (!(lpdsf->s.surface_desc.dwFlags & DDSD_PIXELFORMAT)) { if (!(lpdsf->s.surface_desc.dwFlags & DDSD_PIXELFORMAT)) {
/* No pixel format => use DirectDraw's format */ /* No pixel format => use DirectDraw's format */
lpdsf->s.surface_desc.ddpfPixelFormat = This->d.directdraw_pixelformat; lpdsf->s.surface_desc.ddpfPixelFormat = This->d->directdraw_pixelformat;
lpdsf->s.surface_desc.dwFlags |= DDSD_PIXELFORMAT; lpdsf->s.surface_desc.dwFlags |= DDSD_PIXELFORMAT;
} }
bpp = GET_BPP(lpdsf->s.surface_desc); bpp = GET_BPP(lpdsf->s.surface_desc);

View File

@ -29,7 +29,7 @@ DEFAULT_DEBUG_CHANNEL(ddraw);
#include "x11_private.h" #include "x11_private.h"
#define DDPRIVATE(x) x11_dd_private *ddpriv = ((x11_dd_private*)(x)->private) #define DDPRIVATE(x) x11_dd_private *ddpriv = ((x11_dd_private*)(x)->d->private)
#define DPPRIVATE(x) x11_dp_private *dppriv = ((x11_dp_private*)(x)->private) #define DPPRIVATE(x) x11_dp_private *dppriv = ((x11_dp_private*)(x)->private)
#define DSPRIVATE(x) x11_ds_private *dspriv = ((x11_ds_private*)(x)->private) #define DSPRIVATE(x) x11_ds_private *dspriv = ((x11_ds_private*)(x)->private)
@ -46,11 +46,11 @@ int _common_depth_to_pixelformat(DWORD depth,LPDIRECTDRAW ddraw)
int nvisuals, npixmap, i; int nvisuals, npixmap, i;
int match = 0; int match = 0;
int index = -2; int index = -2;
DDPIXELFORMAT *pixelformat = &(This->d.directdraw_pixelformat); DDPIXELFORMAT *pixelformat = &(This->d->directdraw_pixelformat);
DDPIXELFORMAT *screen_pixelformat = &(This->d.screen_pixelformat); DDPIXELFORMAT *screen_pixelformat = &(This->d->screen_pixelformat);
This->d.pixel_convert = NULL; This->d->pixel_convert = NULL;
This->d.palette_convert = NULL; This->d->palette_convert = NULL;
vi = TSXGetVisualInfo(display, VisualNoMask, &vt, &nvisuals); vi = TSXGetVisualInfo(display, VisualNoMask, &vt, &nvisuals);
pf = TSXListPixmapFormats(display, &npixmap); pf = TSXListPixmapFormats(display, &npixmap);
@ -76,17 +76,14 @@ int _common_depth_to_pixelformat(DWORD depth,LPDIRECTDRAW ddraw)
pixelformat->dwFourCC = 0; pixelformat->dwFourCC = 0;
pixelformat->u.dwRGBBitCount = pf[i].bits_per_pixel; pixelformat->u.dwRGBBitCount = pf[i].bits_per_pixel;
pixelformat->u4.dwRGBAlphaBitMask= 0; pixelformat->u4.dwRGBAlphaBitMask= 0;
*screen_pixelformat = *pixelformat; *screen_pixelformat = *pixelformat;
This->d->pixmap_depth = depth;
This->d.pixmap_depth = vi[j].depth;
match = 1; match = 1;
index = -1; index = -1;
goto clean_up_and_exit; goto clean_up_and_exit;
} }
} }
WARN("No visual corresponding to pixmap format !\n"); FIXME("No visual corresponding to pixmap format (depth=%ld)!\n",depth);
} }
} }
@ -131,19 +128,19 @@ int _common_depth_to_pixelformat(DWORD depth,LPDIRECTDRAW ddraw)
pixelformat->u3.dwBBitMask = ModeEmulations[c].dest.bmask; pixelformat->u3.dwBBitMask = ModeEmulations[c].dest.bmask;
} }
pixelformat->u4.dwRGBAlphaBitMask= 0; pixelformat->u4.dwRGBAlphaBitMask= 0;
This->d.pixmap_depth = vi[j].depth; This->d->pixmap_depth = vi[j].depth;
match = 2; match = 2;
index = c; index = c;
This->d.pixel_convert =ModeEmulations[c].funcs.pixel_convert; This->d->pixel_convert =ModeEmulations[c].funcs.pixel_convert;
This->d.palette_convert=ModeEmulations[c].funcs.palette_convert; This->d->palette_convert=ModeEmulations[c].funcs.palette_convert;
goto clean_up_and_exit; goto clean_up_and_exit;
} }
ERR("No visual corresponding to pixmap format !\n");
} }
} }
} }
} }
} }
ERR("No emulation found for depth %ld!\n",depth);
} }
clean_up_and_exit: clean_up_and_exit:
@ -173,7 +170,7 @@ static XImage *create_xshmimage(
img = TSXShmCreateImage(display, img = TSXShmCreateImage(display,
DefaultVisualOfScreen(X11DRV_GetXScreen()), DefaultVisualOfScreen(X11DRV_GetXScreen()),
This->d.pixmap_depth, This->d->pixmap_depth,
ZPixmap, ZPixmap,
NULL, NULL,
&(dspriv->shminfo), &(dspriv->shminfo),
@ -188,6 +185,7 @@ static XImage *create_xshmimage(
} }
dspriv->shminfo.shmid = shmget( IPC_PRIVATE, img->bytes_per_line * img->height, IPC_CREAT|0777 ); dspriv->shminfo.shmid = shmget( IPC_PRIVATE, img->bytes_per_line * img->height, IPC_CREAT|0777 );
if (dspriv->shminfo.shmid < 0) { if (dspriv->shminfo.shmid < 0) {
FIXME("Couldn't create shared memory segment (due to X11 remote display or failure).\nReverting to standard X images !\n"); FIXME("Couldn't create shared memory segment (due to X11 remote display or failure).\nReverting to standard X images !\n");
ddpriv->xshm_active = 0; ddpriv->xshm_active = 0;
@ -247,8 +245,8 @@ static XImage *create_xshmimage(
shmctl(dspriv->shminfo.shmid, IPC_RMID, 0); shmctl(dspriv->shminfo.shmid, IPC_RMID, 0);
if (This->d.pixel_convert != NULL) { if (This->d->pixel_convert != NULL) {
int bpp = PFGET_BPP(This->d.directdraw_pixelformat); int bpp = PFGET_BPP(This->d->directdraw_pixelformat);
lpdsf->s.surface_desc.u1.lpSurface = VirtualAlloc( lpdsf->s.surface_desc.u1.lpSurface = VirtualAlloc(
NULL, NULL,
lpdsf->s.surface_desc.dwWidth * lpdsf->s.surface_desc.dwWidth *
@ -269,8 +267,8 @@ static XImage *create_ximage(IDirectDraw2Impl* This, IDirectDrawSurface4Impl* lp
XImage *img = NULL; XImage *img = NULL;
DDPRIVATE(This); DDPRIVATE(This);
void *img_data; void *img_data;
int bpp = PFGET_BPP(This->d.directdraw_pixelformat); int bpp = PFGET_BPP(This->d->directdraw_pixelformat);
int screen_bpp = PFGET_BPP(This->d.screen_pixelformat); int screen_bpp = PFGET_BPP(This->d->screen_pixelformat);
#ifdef HAVE_LIBXXSHM #ifdef HAVE_LIBXXSHM
if (ddpriv->xshm_active) if (ddpriv->xshm_active)
@ -288,7 +286,7 @@ static XImage *create_ximage(IDirectDraw2Impl* This, IDirectDrawSurface4Impl* lp
PAGE_READWRITE PAGE_READWRITE
); );
if (This->d.pixel_convert != NULL) if (This->d->pixel_convert != NULL)
img_data = VirtualAlloc( img_data = VirtualAlloc(
NULL, NULL,
lpdsf->s.surface_desc.dwWidth * lpdsf->s.surface_desc.dwWidth *
@ -303,7 +301,7 @@ static XImage *create_ximage(IDirectDraw2Impl* This, IDirectDrawSurface4Impl* lp
/* In this case, create an XImage */ /* In this case, create an XImage */
img = TSXCreateImage(display, img = TSXCreateImage(display,
DefaultVisualOfScreen(X11DRV_GetXScreen()), DefaultVisualOfScreen(X11DRV_GetXScreen()),
This->d.pixmap_depth, This->d->pixmap_depth,
ZPixmap, ZPixmap,
0, 0,
img_data, img_data,
@ -315,7 +313,7 @@ static XImage *create_ximage(IDirectDraw2Impl* This, IDirectDrawSurface4Impl* lp
#ifdef HAVE_LIBXXSHM #ifdef HAVE_LIBXXSHM
} }
#endif #endif
if (This->d.pixel_convert != NULL) if (This->d->pixel_convert != NULL)
lpdsf->s.surface_desc.lPitch = bpp*lpdsf->s.surface_desc.dwWidth; lpdsf->s.surface_desc.lPitch = bpp*lpdsf->s.surface_desc.dwWidth;
else else
lpdsf->s.surface_desc.lPitch = img->bytes_per_line; lpdsf->s.surface_desc.lPitch = img->bytes_per_line;
@ -360,9 +358,9 @@ static HRESULT WINAPI Xlib_IDirectDraw2Impl_CreateSurface(
dsurf->s.surface_desc = *lpddsd; dsurf->s.surface_desc = *lpddsd;
if (!(lpddsd->dwFlags & DDSD_WIDTH)) if (!(lpddsd->dwFlags & DDSD_WIDTH))
dsurf->s.surface_desc.dwWidth = This->d.width; dsurf->s.surface_desc.dwWidth = This->d->width;
if (!(lpddsd->dwFlags & DDSD_HEIGHT)) if (!(lpddsd->dwFlags & DDSD_HEIGHT))
dsurf->s.surface_desc.dwHeight = This->d.height; dsurf->s.surface_desc.dwHeight = This->d->height;
dsurf->s.surface_desc.dwFlags |= DDSD_WIDTH|DDSD_HEIGHT; dsurf->s.surface_desc.dwFlags |= DDSD_WIDTH|DDSD_HEIGHT;
/* Check if this a 'primary surface' or not */ /* Check if this a 'primary surface' or not */
@ -371,6 +369,13 @@ static HRESULT WINAPI Xlib_IDirectDraw2Impl_CreateSurface(
) { ) {
XImage *img; XImage *img;
/* Add flags if there were not present */
dsurf->s.surface_desc.dwFlags |= DDSD_WIDTH|DDSD_HEIGHT|DDSD_PITCH|DDSD_LPSURFACE|DDSD_PIXELFORMAT;
dsurf->s.surface_desc.dwWidth = This->d->width;
dsurf->s.surface_desc.dwHeight = This->d->height;
dsurf->s.surface_desc.ddsCaps.dwCaps |= DDSCAPS_VISIBLE|DDSCAPS_VIDEOMEMORY;
dsurf->s.surface_desc.ddpfPixelFormat = This->d->directdraw_pixelformat;
TRACE("using standard XImage for a primary surface (%p)\n", dsurf); TRACE("using standard XImage for a primary surface (%p)\n", dsurf);
/* Create the XImage */ /* Create the XImage */
img = create_ximage(This,(IDirectDrawSurface4Impl*)dsurf); img = create_ximage(This,(IDirectDrawSurface4Impl*)dsurf);
@ -378,13 +383,6 @@ static HRESULT WINAPI Xlib_IDirectDraw2Impl_CreateSurface(
return DDERR_OUTOFMEMORY; return DDERR_OUTOFMEMORY;
dspriv->image = img; dspriv->image = img;
/* Add flags if there were not present */
dsurf->s.surface_desc.dwFlags |= DDSD_WIDTH|DDSD_HEIGHT|DDSD_PITCH|DDSD_LPSURFACE|DDSD_PIXELFORMAT;
dsurf->s.surface_desc.dwWidth = This->d.width;
dsurf->s.surface_desc.dwHeight = This->d.height;
dsurf->s.surface_desc.ddsCaps.dwCaps |= DDSCAPS_VISIBLE|DDSCAPS_VIDEOMEMORY;
dsurf->s.surface_desc.ddpfPixelFormat = This->d.directdraw_pixelformat;
/* Check for backbuffers */ /* Check for backbuffers */
if (lpddsd->dwFlags & DDSD_BACKBUFFERCOUNT) { if (lpddsd->dwFlags & DDSD_BACKBUFFERCOUNT) {
IDirectDrawSurface4Impl* back; IDirectDrawSurface4Impl* back;
@ -457,7 +455,7 @@ static HRESULT WINAPI Xlib_IDirectDraw2Impl_SetCooperativeLevel(
FIXME("(%p)->(%08lx,%08lx)\n",This,(DWORD)hwnd,cooplevel); FIXME("(%p)->(%08lx,%08lx)\n",This,(DWORD)hwnd,cooplevel);
if (TRACE_ON(ddraw)) if (TRACE_ON(ddraw))
_dump_cooperativelevel(cooplevel); _dump_cooperativelevel(cooplevel);
This->d.mainWindow = hwnd; This->d->mainWindow = hwnd;
/* This will be overwritten in the case of Full Screen mode. /* This will be overwritten in the case of Full Screen mode.
Windowed games could work with that :-) */ Windowed games could work with that :-) */
@ -499,13 +497,13 @@ static HRESULT WINAPI Xlib_IDirectDrawImpl_SetDisplayMode(
DPRINTF("DirectDraw warning: running in depth-conversion mode %d. Should run using a %ld depth for optimal performances.\n", c,depth); DPRINTF("DirectDraw warning: running in depth-conversion mode %d. Should run using a %ld depth for optimal performances.\n", c,depth);
} }
This->d.width = width; This->d->width = width;
This->d.height = height; This->d->height = height;
_common_IDirectDrawImpl_SetDisplayMode(This); _common_IDirectDrawImpl_SetDisplayMode(This);
tmpWnd = WIN_FindWndPtr(This->d.window); tmpWnd = WIN_FindWndPtr(This->d->window);
This->d.paintable = 1; This->d->paintable = 1;
ddpriv->drawable = ((X11DRV_WND_DATA *) tmpWnd->pDriverData)->window; ddpriv->drawable = ((X11DRV_WND_DATA *) tmpWnd->pDriverData)->window;
WIN_ReleaseWndPtr(tmpWnd); WIN_ReleaseWndPtr(tmpWnd);
@ -593,20 +591,6 @@ static HRESULT WINAPI Xlib_IDirectDraw2Impl_CreatePalette(
return DD_OK; return DD_OK;
} }
static ULONG WINAPI Xlib_IDirectDraw2Impl_Release(LPDIRECTDRAW2 iface) {
ICOM_THIS(IDirectDraw2Impl,iface);
TRACE("(%p)->() decrementing from %lu.\n", This, This->ref );
if (!--(This->ref)) {
if (This->d.window && GetPropA(This->d.window,ddProp))
DestroyWindow(This->d.window);
HeapFree(GetProcessHeap(),0,This);
return S_OK;
}
/* FIXME: destroy window ... */
return This->ref;
}
static HRESULT WINAPI Xlib_IDirectDraw2Impl_QueryInterface( static HRESULT WINAPI Xlib_IDirectDraw2Impl_QueryInterface(
LPDIRECTDRAW2 iface,REFIID refiid,LPVOID *obj LPDIRECTDRAW2 iface,REFIID refiid,LPVOID *obj
) { ) {
@ -622,30 +606,32 @@ static HRESULT WINAPI Xlib_IDirectDraw2Impl_QueryInterface(
return S_OK; return S_OK;
} }
if ( IsEqualGUID( &IID_IDirectDraw, refiid ) ) { if ( IsEqualGUID( &IID_IDirectDraw, refiid ) ) {
ICOM_VTBL(This) = (ICOM_VTABLE(IDirectDraw2)*)&xlib_ddvt; IDirectDrawImpl *dd = HeapAlloc(GetProcessHeap(),0,sizeof(*dd));
IDirectDraw2_AddRef(iface); IDirectDraw2_AddRef(iface);
*obj = This;
dd->ref = 1;ICOM_VTBL(dd) = &xlib_ddvt;dd->d = This->d;This->d->ref++;
*obj = dd;
TRACE(" Creating IDirectDraw interface (%p)\n", *obj); TRACE(" Creating IDirectDraw interface (%p)\n", *obj);
return S_OK; return S_OK;
} }
if ( IsEqualGUID( &IID_IDirectDraw2, refiid ) ) { if ( IsEqualGUID( &IID_IDirectDraw2, refiid ) ) {
ICOM_VTBL(This) = (ICOM_VTABLE(IDirectDraw2)*)&xlib_dd2vt; IDirectDraw2Impl *dd = HeapAlloc(GetProcessHeap(),0,sizeof(*dd));
IDirectDraw2_AddRef(iface); IDirectDraw2_AddRef(iface);
*obj = This;
dd->ref = 1;ICOM_VTBL(dd) = &xlib_dd2vt;dd->d = This->d;This->d->ref++;
*obj = dd;
TRACE(" Creating IDirectDraw2 interface (%p)\n", *obj); TRACE(" Creating IDirectDraw2 interface (%p)\n", *obj);
return S_OK; return S_OK;
} }
if ( IsEqualGUID( &IID_IDirectDraw4, refiid ) ) { if ( IsEqualGUID( &IID_IDirectDraw4, refiid ) ) {
ICOM_VTBL(This) = (ICOM_VTABLE(IDirectDraw2)*)&xlib_dd4vt; IDirectDraw4Impl *dd = HeapAlloc(GetProcessHeap(),0,sizeof(*dd));
dd->ref = 1;ICOM_VTBL(dd) = &xlib_dd4vt;dd->d = This->d;This->d->ref++;
*obj = dd;
IDirectDraw2_AddRef(iface); IDirectDraw2_AddRef(iface);
*obj = This;
TRACE(" Creating IDirectDraw4 interface (%p)\n", *obj); TRACE(" Creating IDirectDraw4 interface (%p)\n", *obj);
return S_OK; return S_OK;
} }
#ifdef HAVE_OPENGL #ifdef HAVE_OPENGL
@ -851,24 +837,6 @@ static HRESULT WINAPI Xlib_IDirectDraw2Impl_EnumDisplayModes(
return DD_OK; return DD_OK;
} }
static HRESULT WINAPI Xlib_IDirectDraw2Impl_GetDisplayMode(
LPDIRECTDRAW2 iface,LPDDSURFACEDESC lpddsfd
) {
ICOM_THIS(IDirectDraw2Impl,iface);
TRACE("(%p)->GetDisplayMode(%p)\n",This,lpddsfd);
lpddsfd->dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PITCH|DDSD_BACKBUFFERCOUNT|DDSD_PIXELFORMAT|DDSD_CAPS;
lpddsfd->dwHeight = This->d.height;
lpddsfd->dwWidth = This->d.width;
lpddsfd->lPitch = lpddsfd->dwWidth * PFGET_BPP(This->d.directdraw_pixelformat);
lpddsfd->dwBackBufferCount = 2;
lpddsfd->u.dwRefreshRate = 60;
lpddsfd->ddsCaps.dwCaps = DDSCAPS_PALETTE;
lpddsfd->ddpfPixelFormat = This->d.directdraw_pixelformat;
if (TRACE_ON(ddraw))
_dump_surface_desc(lpddsfd);
return DD_OK;
}
/* Note: Hack so we can reuse the old functions without compiler warnings */ /* Note: Hack so we can reuse the old functions without compiler warnings */
#if !defined(__STRICT_ANSI__) && defined(__GNUC__) #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
# define XCAST(fun) (typeof(xlib_ddvt.fn##fun)) # define XCAST(fun) (typeof(xlib_ddvt.fn##fun))
@ -880,7 +848,7 @@ ICOM_VTABLE(IDirectDraw) xlib_ddvt = {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
XCAST(QueryInterface)Xlib_IDirectDraw2Impl_QueryInterface, XCAST(QueryInterface)Xlib_IDirectDraw2Impl_QueryInterface,
XCAST(AddRef)IDirectDraw2Impl_AddRef, XCAST(AddRef)IDirectDraw2Impl_AddRef,
XCAST(Release)Xlib_IDirectDraw2Impl_Release, XCAST(Release)IDirectDraw2Impl_Release,
XCAST(Compact)IDirectDraw2Impl_Compact, XCAST(Compact)IDirectDraw2Impl_Compact,
XCAST(CreateClipper)IDirectDraw2Impl_CreateClipper, XCAST(CreateClipper)IDirectDraw2Impl_CreateClipper,
XCAST(CreatePalette)Xlib_IDirectDraw2Impl_CreatePalette, XCAST(CreatePalette)Xlib_IDirectDraw2Impl_CreatePalette,
@ -890,7 +858,7 @@ ICOM_VTABLE(IDirectDraw) xlib_ddvt = {
XCAST(EnumSurfaces)IDirectDraw2Impl_EnumSurfaces, XCAST(EnumSurfaces)IDirectDraw2Impl_EnumSurfaces,
XCAST(FlipToGDISurface)IDirectDraw2Impl_FlipToGDISurface, XCAST(FlipToGDISurface)IDirectDraw2Impl_FlipToGDISurface,
XCAST(GetCaps)Xlib_IDirectDraw2Impl_GetCaps, XCAST(GetCaps)Xlib_IDirectDraw2Impl_GetCaps,
XCAST(GetDisplayMode)Xlib_IDirectDraw2Impl_GetDisplayMode, XCAST(GetDisplayMode)IDirectDraw2Impl_GetDisplayMode,
XCAST(GetFourCCCodes)IDirectDraw2Impl_GetFourCCCodes, XCAST(GetFourCCCodes)IDirectDraw2Impl_GetFourCCCodes,
XCAST(GetGDISurface)IDirectDraw2Impl_GetGDISurface, XCAST(GetGDISurface)IDirectDraw2Impl_GetGDISurface,
XCAST(GetMonitorFrequency)IDirectDraw2Impl_GetMonitorFrequency, XCAST(GetMonitorFrequency)IDirectDraw2Impl_GetMonitorFrequency,
@ -931,7 +899,7 @@ ICOM_VTABLE(IDirectDraw2) xlib_dd2vt = {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
Xlib_IDirectDraw2Impl_QueryInterface, Xlib_IDirectDraw2Impl_QueryInterface,
IDirectDraw2Impl_AddRef, IDirectDraw2Impl_AddRef,
Xlib_IDirectDraw2Impl_Release, IDirectDraw2Impl_Release,
IDirectDraw2Impl_Compact, IDirectDraw2Impl_Compact,
IDirectDraw2Impl_CreateClipper, IDirectDraw2Impl_CreateClipper,
Xlib_IDirectDraw2Impl_CreatePalette, Xlib_IDirectDraw2Impl_CreatePalette,
@ -941,7 +909,7 @@ ICOM_VTABLE(IDirectDraw2) xlib_dd2vt = {
IDirectDraw2Impl_EnumSurfaces, IDirectDraw2Impl_EnumSurfaces,
IDirectDraw2Impl_FlipToGDISurface, IDirectDraw2Impl_FlipToGDISurface,
Xlib_IDirectDraw2Impl_GetCaps, Xlib_IDirectDraw2Impl_GetCaps,
Xlib_IDirectDraw2Impl_GetDisplayMode, IDirectDraw2Impl_GetDisplayMode,
IDirectDraw2Impl_GetFourCCCodes, IDirectDraw2Impl_GetFourCCCodes,
IDirectDraw2Impl_GetGDISurface, IDirectDraw2Impl_GetGDISurface,
IDirectDraw2Impl_GetMonitorFrequency, IDirectDraw2Impl_GetMonitorFrequency,
@ -965,7 +933,7 @@ ICOM_VTABLE(IDirectDraw4) xlib_dd4vt = {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
XCAST(QueryInterface)Xlib_IDirectDraw2Impl_QueryInterface, XCAST(QueryInterface)Xlib_IDirectDraw2Impl_QueryInterface,
XCAST(AddRef)IDirectDraw2Impl_AddRef, XCAST(AddRef)IDirectDraw2Impl_AddRef,
XCAST(Release)Xlib_IDirectDraw2Impl_Release, XCAST(Release)IDirectDraw2Impl_Release,
XCAST(Compact)IDirectDraw2Impl_Compact, XCAST(Compact)IDirectDraw2Impl_Compact,
XCAST(CreateClipper)IDirectDraw2Impl_CreateClipper, XCAST(CreateClipper)IDirectDraw2Impl_CreateClipper,
XCAST(CreatePalette)Xlib_IDirectDraw2Impl_CreatePalette, XCAST(CreatePalette)Xlib_IDirectDraw2Impl_CreatePalette,
@ -975,7 +943,7 @@ ICOM_VTABLE(IDirectDraw4) xlib_dd4vt = {
XCAST(EnumSurfaces)IDirectDraw2Impl_EnumSurfaces, XCAST(EnumSurfaces)IDirectDraw2Impl_EnumSurfaces,
XCAST(FlipToGDISurface)IDirectDraw2Impl_FlipToGDISurface, XCAST(FlipToGDISurface)IDirectDraw2Impl_FlipToGDISurface,
XCAST(GetCaps)Xlib_IDirectDraw2Impl_GetCaps, XCAST(GetCaps)Xlib_IDirectDraw2Impl_GetCaps,
XCAST(GetDisplayMode)Xlib_IDirectDraw2Impl_GetDisplayMode, XCAST(GetDisplayMode)IDirectDraw2Impl_GetDisplayMode,
XCAST(GetFourCCCodes)IDirectDraw2Impl_GetFourCCCodes, XCAST(GetFourCCCodes)IDirectDraw2Impl_GetFourCCCodes,
XCAST(GetGDISurface)IDirectDraw2Impl_GetGDISurface, XCAST(GetGDISurface)IDirectDraw2Impl_GetGDISurface,
XCAST(GetMonitorFrequency)IDirectDraw2Impl_GetMonitorFrequency, XCAST(GetMonitorFrequency)IDirectDraw2Impl_GetMonitorFrequency,

View File

@ -52,6 +52,7 @@ extern struct ICOM_VTABLE(IDirectDrawPalette) ddraw_ddpalvt;
*/ */
struct _common_directdrawdata struct _common_directdrawdata
{ {
int ref; /* for this structure, only once per obj */
DDPIXELFORMAT directdraw_pixelformat; DDPIXELFORMAT directdraw_pixelformat;
DDPIXELFORMAT screen_pixelformat; DDPIXELFORMAT screen_pixelformat;
@ -66,6 +67,7 @@ struct _common_directdrawdata
HWND window; HWND window;
PAINTSTRUCT ps; PAINTSTRUCT ps;
int paintable; int paintable;
LPVOID private;
}; };
/***************************************************************************** /*****************************************************************************
@ -79,26 +81,25 @@ struct IDirectDrawImpl
/* IUnknown fields */ /* IUnknown fields */
ICOM_VFIELD(IDirectDraw); ICOM_VFIELD(IDirectDraw);
DWORD ref; DWORD ref;
/* IDirectDraw fields */ /* IDirectDraw fields */
struct _common_directdrawdata d; struct _common_directdrawdata *d;
LPVOID private;
}; };
extern HRESULT WINAPI IDirectDrawImpl_SetDisplayMode(
LPDIRECTDRAW iface,DWORD width,DWORD height,DWORD depth
);
/*
* IDirectDraw2 implementation structure
*/
struct IDirectDraw2Impl struct IDirectDraw2Impl
{ {
/* IUnknown fields */ /* IUnknown fields */
ICOM_VFIELD(IDirectDraw2); ICOM_VFIELD(IDirectDraw2);
DWORD ref; DWORD ref;
/* IDirectDraw2 fields */ /* IDirectDraw fields */
struct _common_directdrawdata d; struct _common_directdrawdata *d;
LPVOID private;
}; };
extern HRESULT WINAPI IDirectDrawImpl_SetDisplayMode(
LPDIRECTDRAW iface,DWORD width,DWORD height,DWORD depth
);
extern HRESULT WINAPI IDirectDraw2Impl_DuplicateSurface( extern HRESULT WINAPI IDirectDraw2Impl_DuplicateSurface(
LPDIRECTDRAW2 iface,LPDIRECTDRAWSURFACE src,LPDIRECTDRAWSURFACE *dst LPDIRECTDRAW2 iface,LPDIRECTDRAWSURFACE src,LPDIRECTDRAWSURFACE *dst
); );
@ -175,9 +176,9 @@ struct IDirectDraw4Impl
ICOM_VFIELD(IDirectDraw4); ICOM_VFIELD(IDirectDraw4);
DWORD ref; DWORD ref;
/* IDirectDraw4 fields */ /* IDirectDraw4 fields */
struct _common_directdrawdata d; struct _common_directdrawdata *d;
LPVOID private;
}; };
extern HRESULT WINAPI IDirectDraw4Impl_GetSurfaceFromDC( extern HRESULT WINAPI IDirectDraw4Impl_GetSurfaceFromDC(
LPDIRECTDRAW4 iface, HDC hdc, LPDIRECTDRAWSURFACE *lpDDS LPDIRECTDRAW4 iface, HDC hdc, LPDIRECTDRAWSURFACE *lpDDS
); );

View File

@ -123,10 +123,10 @@ DGA_Create( LPDIRECTDRAW *lplpDD ) {
*lplpDD = (LPDIRECTDRAW)ddraw; *lplpDD = (LPDIRECTDRAW)ddraw;
ddraw->ref = 1; ddraw->ref = 1;
ICOM_VTBL(ddraw) = &dga_ddvt; ICOM_VTBL(ddraw) = &dga_ddvt;
ddraw->d = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(*(ddraw->d)));
ddraw->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(dga_dd_private)); ddraw->d->ref = 1;
ddraw->d->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(dga_dd_private));
dgpriv = (dga_dd_private*)ddraw->private; dgpriv = (dga_dd_private*)ddraw->d->private;
TSXF86DGAQueryVersion(display,&major,&minor); TSXF86DGAQueryVersion(display,&major,&minor);
TRACE("XF86DGA is version %d.%d\n",major,minor); TRACE("XF86DGA is version %d.%d\n",major,minor);
@ -147,9 +147,9 @@ DGA_Create( LPDIRECTDRAW *lplpDD ) {
* In that case, it may be better to ignore the -desktop mode and * In that case, it may be better to ignore the -desktop mode and
* return the real screen size => print a warning * return the real screen size => print a warning
*/ */
ddraw->d.height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor); ddraw->d->height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
ddraw->d.width = MONITOR_GetWidth(&MONITOR_PrimaryMonitor); ddraw->d->width = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
if ((ddraw->d.height != height) || (ddraw->d.width != width)) if ((ddraw->d->height != height) || (ddraw->d->width != width))
WARN("You seem to be running in -desktop mode. This may prove dangerous in DGA mode...\n"); WARN("You seem to be running in -desktop mode. This may prove dangerous in DGA mode...\n");
dgpriv->fb_addr = addr; dgpriv->fb_addr = addr;
dgpriv->fb_memsize = memsize; dgpriv->fb_memsize = memsize;

View File

@ -101,10 +101,12 @@ DGA2_Create( LPDIRECTDRAW *lplpDD ) {
*lplpDD = (LPDIRECTDRAW)ddraw; *lplpDD = (LPDIRECTDRAW)ddraw;
ddraw->ref = 1; ddraw->ref = 1;
ICOM_VTBL(ddraw) = &dga2_ddvt; ICOM_VTBL(ddraw) = &dga2_ddvt;
ddraw->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(dga2_dd_private));
dgpriv = (dga2_dd_private*)ddraw->private; ddraw->d = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(*(ddraw->d)));
ddraw->d->ref = 1;
ddraw->d->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(dga2_dd_private));
dgpriv = (dga2_dd_private*)ddraw->d->private;
TSXDGAQueryVersion(display,&major,&minor); TSXDGAQueryVersion(display,&major,&minor);
TRACE("XDGA is version %d.%d\n",major,minor); TRACE("XDGA is version %d.%d\n",major,minor);
@ -157,7 +159,7 @@ DGA2_Create( LPDIRECTDRAW *lplpDD ) {
/* Initialize the frame buffer */ /* Initialize the frame buffer */
_DGA2_Initialize_FrameBuffer(ddraw, mode_to_use); _DGA2_Initialize_FrameBuffer(ddraw, mode_to_use);
/* Register frame buffer with the kernel, it is as a potential DIB section */ /* Register frame buffer with the kernel, it is a potential DIB section */
VirtualAlloc(dgpriv->DGA.fb_addr, dgpriv->DGA.fb_memsize, MEM_RESERVE|MEM_SYSTEM, PAGE_READWRITE); VirtualAlloc(dgpriv->DGA.fb_addr, dgpriv->DGA.fb_memsize, MEM_RESERVE|MEM_SYSTEM, PAGE_READWRITE);
/* Set the input handling for relative mouse movements */ /* Set the input handling for relative mouse movements */

View File

@ -19,7 +19,7 @@
DEFAULT_DEBUG_CHANNEL(ddraw); DEFAULT_DEBUG_CHANNEL(ddraw);
#define DPPRIVATE(x) dga_dp_private *dppriv = ((dga_dp_private*)(x)->private) #define DPPRIVATE(x) dga_dp_private *dppriv = ((dga_dp_private*)(x)->private)
#define DDPRIVATE(x) dga_dd_private *ddpriv = ((dga_dd_private*)(x)->private) #define DDPRIVATE(x) dga_dd_private *ddpriv = ((dga_dd_private*)(x)->d->private)
HRESULT WINAPI DGA_IDirectDrawPaletteImpl_SetEntries( HRESULT WINAPI DGA_IDirectDrawPaletteImpl_SetEntries(
LPDIRECTDRAWPALETTE iface,DWORD x,DWORD start,DWORD count,LPPALETTEENTRY palent LPDIRECTDRAWPALETTE iface,DWORD x,DWORD start,DWORD count,LPPALETTEENTRY palent

View File

@ -52,8 +52,8 @@ HRESULT WINAPI IDirectDrawPaletteImpl_SetEntries(
/* Now, if we are in 'depth conversion mode', update the screen palette */ /* Now, if we are in 'depth conversion mode', update the screen palette */
/* FIXME: we need to update the image or we won't get palette fading. */ /* FIXME: we need to update the image or we won't get palette fading. */
if (This->ddraw->d.palette_convert != NULL) if (This->ddraw->d->palette_convert != NULL)
This->ddraw->d.palette_convert(palent,This->screen_palents,start,count); This->ddraw->d->palette_convert(palent,This->screen_palents,start,count);
return DD_OK; return DD_OK;
} }

View File

@ -51,8 +51,8 @@ HRESULT WINAPI Xlib_IDirectDrawPaletteImpl_SetEntries(
/* Now, if we are in 'depth conversion mode', update the screen palette */ /* Now, if we are in 'depth conversion mode', update the screen palette */
/* FIXME: we need to update the image or we won't get palette fading. */ /* FIXME: we need to update the image or we won't get palette fading. */
if (This->ddraw->d.palette_convert != NULL) { if (This->ddraw->d->palette_convert != NULL) {
This->ddraw->d.palette_convert(palent,This->screen_palents,start,count); This->ddraw->d->palette_convert(palent,This->screen_palents,start,count);
} }
return DD_OK; return DD_OK;
} }

View File

@ -19,7 +19,7 @@
DEFAULT_DEBUG_CHANNEL(ddraw); DEFAULT_DEBUG_CHANNEL(ddraw);
#define DDPRIVATE(x) dga_dd_private *ddpriv = ((dga_dd_private*)(x)->private) #define DDPRIVATE(x) dga_dd_private *ddpriv = ((dga_dd_private*)(x)->d->private)
#define DPPRIVATE(x) dga_dp_private *dppriv = ((dga_dp_private*)(x)->private) #define DPPRIVATE(x) dga_dp_private *dppriv = ((dga_dp_private*)(x)->private)
#define DSPRIVATE(x) dga_ds_private *dspriv = ((dga_ds_private*)(x)->private) #define DSPRIVATE(x) dga_ds_private *dspriv = ((dga_ds_private*)(x)->private)

View File

@ -17,7 +17,7 @@
DEFAULT_DEBUG_CHANNEL(ddraw); DEFAULT_DEBUG_CHANNEL(ddraw);
#define DDPRIVATE(x) dga2_dd_private *ddpriv = ((dga2_dd_private*)(x)->private) #define DDPRIVATE(x) dga2_dd_private *ddpriv = ((dga2_dd_private*)(x)->d->private)
#define DPPRIVATE(x) dga2_dp_private *dppriv = ((dga2_dp_private*)(x)->private) #define DPPRIVATE(x) dga2_dp_private *dppriv = ((dga2_dp_private*)(x)->private)
#define DSPRIVATE(x) dga2_ds_private *dspriv = ((dga2_ds_private*)(x)->private) #define DSPRIVATE(x) dga2_ds_private *dspriv = ((dga2_ds_private*)(x)->private)

View File

@ -28,7 +28,7 @@ DEFAULT_DEBUG_CHANNEL(ddraw);
#define VISIBLE(x) (SDDSCAPS(x) & (DDSCAPS_VISIBLE|DDSCAPS_PRIMARYSURFACE)) #define VISIBLE(x) (SDDSCAPS(x) & (DDSCAPS_VISIBLE|DDSCAPS_PRIMARYSURFACE))
#define DDPRIVATE(x) x11_dd_private *ddpriv = ((x11_dd_private*)(x)->private) #define DDPRIVATE(x) x11_dd_private *ddpriv = ((x11_dd_private*)(x)->d->private)
#define DPPRIVATE(x) x11_dp_private *dppriv = ((x11_dp_private*)(x)->private) #define DPPRIVATE(x) x11_dp_private *dppriv = ((x11_dp_private*)(x)->private)
#define DSPRIVATE(x) x11_ds_private *dspriv = ((x11_ds_private*)(x)->private) #define DSPRIVATE(x) x11_ds_private *dspriv = ((x11_ds_private*)(x)->private)
@ -93,10 +93,10 @@ HRESULT WINAPI Xlib_IDirectDrawSurface4Impl_Lock(
ICOM_THIS(IDirectDrawSurface4Impl,iface); ICOM_THIS(IDirectDrawSurface4Impl,iface);
DSPRIVATE(This); DSPRIVATE(This);
DDPRIVATE(This->s.ddraw); DDPRIVATE(This->s.ddraw);
/* DO NOT AddRef the surface! Lock/Unlock are NOT guaranteed to come in /* DO NOT AddRef the surface! Lock/Unlock are NOT guaranteed to come in
* matched pairs! - Marcus Meissner 20000509 */ * matched pairs! - Marcus Meissner 20000509 */
TRACE("(%p)->Lock(%p,%p,%08lx,%08lx)\n",This,lprect,lpddsd,flags,(DWORD)hnd); TRACE("(%p)->Lock(%p,%p,%08lx,%08lx) ret=%p\n",This,lprect,lpddsd,flags,(DWORD)hnd,__builtin_return_address(0));
if (flags & ~(DDLOCK_WAIT|DDLOCK_READONLY|DDLOCK_WRITEONLY)) if (flags & ~(DDLOCK_WAIT|DDLOCK_READONLY|DDLOCK_WRITEONLY))
WARN("(%p)->Lock(%p,%p,%08lx,%08lx)\n", WARN("(%p)->Lock(%p,%p,%08lx,%08lx)\n",
This,lprect,lpddsd,flags,(DWORD)hnd); This,lprect,lpddsd,flags,(DWORD)hnd);
@ -159,7 +159,6 @@ HRESULT WINAPI Xlib_IDirectDrawSurface4Impl_Lock(
static void Xlib_copy_surface_on_screen(IDirectDrawSurface4Impl* This) { static void Xlib_copy_surface_on_screen(IDirectDrawSurface4Impl* This) {
DSPRIVATE(This); DSPRIVATE(This);
DDPRIVATE(This->s.ddraw); DDPRIVATE(This->s.ddraw);
Drawable drawable = ddpriv->drawable; Drawable drawable = ddpriv->drawable;
POINT adjust[2] = {{0, 0}, {0, 0}}; POINT adjust[2] = {{0, 0}, {0, 0}};
SIZE imgsiz; SIZE imgsiz;
@ -194,8 +193,8 @@ static void Xlib_copy_surface_on_screen(IDirectDrawSurface4Impl* This) {
WIN_ReleaseWndPtr(wndPtr); WIN_ReleaseWndPtr(wndPtr);
} }
if (This->s.ddraw->d.pixel_convert != NULL) if (This->s.ddraw->d->pixel_convert != NULL)
This->s.ddraw->d.pixel_convert(This->s.surface_desc.u1.lpSurface, This->s.ddraw->d->pixel_convert(This->s.surface_desc.u1.lpSurface,
dspriv->image->data, dspriv->image->data,
This->s.surface_desc.dwWidth, This->s.surface_desc.dwWidth,
This->s.surface_desc.dwHeight, This->s.surface_desc.dwHeight,
@ -272,7 +271,7 @@ HRESULT WINAPI Xlib_IDirectDrawSurface4Impl_Flip(
IDirectDrawSurface4Impl* iflipto=(IDirectDrawSurface4Impl*)flipto; IDirectDrawSurface4Impl* iflipto=(IDirectDrawSurface4Impl*)flipto;
TRACE("(%p)->Flip(%p,%08lx)\n",This,iflipto,dwFlags); TRACE("(%p)->Flip(%p,%08lx)\n",This,iflipto,dwFlags);
if (!This->s.ddraw->d.paintable) if (!This->s.ddraw->d->paintable)
return DD_OK; return DD_OK;
iflipto = _common_find_flipto(This,iflipto); iflipto = _common_find_flipto(This,iflipto);
@ -339,7 +338,7 @@ HRESULT WINAPI Xlib_IDirectDrawSurface4Impl_SetPalette(
dppriv = (x11_dp_private*)ipal->private; dppriv = (x11_dp_private*)ipal->private;
if (!dppriv->cm && if (!dppriv->cm &&
(This->s.ddraw->d.screen_pixelformat.u.dwRGBBitCount<=8) (This->s.ddraw->d->screen_pixelformat.u.dwRGBBitCount<=8)
) { ) {
dppriv->cm = TSXCreateColormap( dppriv->cm = TSXCreateColormap(
display, display,

View File

@ -213,29 +213,29 @@ static LRESULT WINAPI DDWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
if( ddraw ) { if( ddraw ) {
/* Perform any special direct draw functions */ /* Perform any special direct draw functions */
if (msg==WM_PAINT) if (msg==WM_PAINT)
ddraw->d.paintable = 1; ddraw->d->paintable = 1;
/* Now let the application deal with the rest of this */ /* Now let the application deal with the rest of this */
if( ddraw->d.mainWindow ) { if( ddraw->d->mainWindow ) {
/* Don't think that we actually need to call this but... /* Don't think that we actually need to call this but...
* might as well be on the safe side of things... * might as well be on the safe side of things...
*/ */
/* I changed hwnd to ddraw->d.mainWindow as I did not see why /* I changed hwnd to ddraw->d->mainWindow as I did not see why
* it should be the procedures of our fake window that gets called * it should be the procedures of our fake window that gets called
* instead of those of the window provided by the application. * instead of those of the window provided by the application.
* And with this patch, mouse clicks work with Monkey Island III * And with this patch, mouse clicks work with Monkey Island III
* - Lionel * - Lionel
*/ */
ret = DefWindowProcA( ddraw->d.mainWindow, msg, wParam, lParam ); ret = DefWindowProcA( ddraw->d->mainWindow, msg, wParam, lParam );
if( !ret ) { if( !ret ) {
WND *tmpWnd =WIN_FindWndPtr(ddraw->d.mainWindow); WND *tmpWnd =WIN_FindWndPtr(ddraw->d->mainWindow);
/* We didn't handle the message - give it to the application */ /* We didn't handle the message - give it to the application */
if (ddraw && ddraw->d.mainWindow && tmpWnd) if (ddraw && ddraw->d->mainWindow && tmpWnd)
ret = CallWindowProcA(tmpWnd->winproc, ret = CallWindowProcA(tmpWnd->winproc,
ddraw->d.mainWindow, msg, wParam, lParam ); ddraw->d->mainWindow, msg, wParam, lParam );
WIN_ReleaseWndPtr(tmpWnd); WIN_ReleaseWndPtr(tmpWnd);
} }
return ret; return ret;
@ -320,7 +320,7 @@ HRESULT WINAPI DirectDrawCreate(
wc.hbrBackground = NULL_BRUSH; wc.hbrBackground = NULL_BRUSH;
wc.lpszMenuName = 0; wc.lpszMenuName = 0;
wc.lpszClassName = "WINE_DirectDraw"; wc.lpszClassName = "WINE_DirectDraw";
(*ilplpDD)->d.winclass = RegisterClassA(&wc); (*ilplpDD)->d->winclass = RegisterClassA(&wc);
return ret; return ret;
} }

View File

@ -61,12 +61,15 @@ static HRESULT X11_Create( LPDIRECTDRAW *lplpDD ) {
ddraw = (IDirectDrawImpl*)*lplpDD; ddraw = (IDirectDrawImpl*)*lplpDD;
ICOM_VTBL(ddraw)= &xlib_ddvt; ICOM_VTBL(ddraw)= &xlib_ddvt;
ddraw->ref = 1; ddraw->ref = 1;
ddraw->private = HeapAlloc(
ddraw->d = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(*(ddraw->d)));
ddraw->d->ref = 1;
ddraw->d->private = HeapAlloc(
GetProcessHeap(), GetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
sizeof(x11_dd_private) sizeof(x11_dd_private)
); );
x11priv = (x11_dd_private*)ddraw->private; x11priv = (x11_dd_private*)ddraw->d->private;
/* At DirectDraw creation, the depth is the default depth */ /* At DirectDraw creation, the depth is the default depth */
depth = DefaultDepthOfScreen(X11DRV_GetXScreen()); depth = DefaultDepthOfScreen(X11DRV_GetXScreen());
@ -77,8 +80,8 @@ static HRESULT X11_Create( LPDIRECTDRAW *lplpDD ) {
case 0: MESSAGE("Conversion needed from %d.\n",depth); break; case 0: MESSAGE("Conversion needed from %d.\n",depth); break;
} }
ddraw->d.height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor); ddraw->d->height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
ddraw->d.width = MONITOR_GetWidth(&MONITOR_PrimaryMonitor); ddraw->d->width = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
#ifdef HAVE_LIBXXSHM #ifdef HAVE_LIBXXSHM
/* Test if XShm is available. */ /* Test if XShm is available. */
if ((x11priv->xshm_active = DDRAW_XSHM_Available())) { if ((x11priv->xshm_active = DDRAW_XSHM_Available())) {