winex11: Use GetDCHook to retrieve the dce pointer instead of storing it in the physdev structure.

oldstable
Alexandre Julliard 2008-02-18 11:25:14 +01:00
parent 50dea38178
commit 3bd142e907
3 changed files with 5 additions and 34 deletions

View File

@ -222,7 +222,6 @@ static void delete_clip_rgn( struct dce *dce )
*/
static struct dce *alloc_cache_dce(void)
{
struct x11drv_escape_set_dce escape;
struct dce *dce;
if (!(dce = HeapAlloc( GetProcessHeap(), 0, sizeof(*dce) ))) return NULL;
@ -245,11 +244,6 @@ static struct dce *alloc_cache_dce(void)
EnterCriticalSection( &dce_section );
list_add_head( &dce_list, &dce->entry );
LeaveCriticalSection( &dce_section );
escape.code = X11DRV_SET_DCE;
escape.dce = dce;
ExtEscape( dce->hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape, 0, NULL );
return dce;
}
@ -261,7 +255,6 @@ static struct dce *alloc_cache_dce(void)
*/
void alloc_window_dce( struct x11drv_win_data *data )
{
struct x11drv_escape_set_dce escape;
struct dce *dce;
void *class_ptr = NULL;
LONG style = GetClassLongW( data->hwnd, GCL_STYLE );
@ -320,10 +313,6 @@ void alloc_window_dce( struct x11drv_win_data *data )
list_add_tail( &dce_list, &dce->entry );
LeaveCriticalSection( &dce_section );
data->dce = dce;
escape.code = X11DRV_SET_DCE;
escape.dce = dce;
ExtEscape( dce->hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape, 0, NULL );
}
@ -579,15 +568,13 @@ HDC X11DRV_GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
*/
INT X11DRV_ReleaseDC( HWND hwnd, HDC hdc, BOOL end_paint )
{
enum x11drv_escape_codes escape = X11DRV_GET_DCE;
struct dce *dce;
BOOL ret = FALSE;
TRACE("%p %p\n", hwnd, hdc );
EnterCriticalSection( &dce_section );
if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape,
sizeof(dce), (LPSTR)&dce )) dce = NULL;
dce = (struct dce *)GetDCHook( hdc, NULL );
if (dce && dce->count)
{
if (end_paint || (dce->flags & DCX_CACHE)) delete_clip_rgn( dce );
@ -653,14 +640,11 @@ static BOOL CALLBACK dc_hook( HDC hDC, WORD code, DWORD_PTR data, LPARAM lParam
*/
HWND X11DRV_WindowFromDC( HDC hdc )
{
enum x11drv_escape_codes escape = X11DRV_GET_DCE;
struct dce *dce;
HWND hwnd = 0;
EnterCriticalSection( &dce_section );
if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape,
sizeof(dce), (LPSTR)&dce )) dce = NULL;
if (dce) hwnd = dce->hwnd;
if ((dce = (struct dce *)GetDCHook( hdc, NULL ))) hwnd = dce->hwnd;
LeaveCriticalSection( &dce_section );
return hwnd;
}

View File

@ -408,19 +408,8 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID
}
break;
case X11DRV_GET_DCE:
if (out_count >= sizeof(struct dce *))
{
*(struct dce **)out_data = physDev->dce;
return TRUE;
}
break;
case X11DRV_SET_DCE:
if (in_count >= sizeof(struct x11drv_escape_set_dce))
{
const struct x11drv_escape_set_dce *data = (const struct x11drv_escape_set_dce *)in_data;
physDev->dce = data->dce;
return TRUE;
}
FIXME( "%x escape no longer supported\n", *(const enum x11drv_escape_codes *)in_data );
break;
case X11DRV_GET_GLX_DRAWABLE:
if (out_count >= sizeof(Drawable))

View File

@ -65,7 +65,6 @@ typedef int Status;
#define MAX_DASHLEN 16
struct tagCURSORICONINFO;
struct dce;
extern void wine_tsx11_lock(void);
extern void wine_tsx11_unlock(void);
@ -137,7 +136,6 @@ typedef struct
int textPixel;
int depth; /* bit depth of the DC */
int exposures; /* count of graphics exposures operations */
struct dce *dce; /* opaque pointer to DCE */
int current_pf;
Drawable gl_drawable;
Pixmap pixmap; /* Pixmap for a GLXPixmap gl_drawable */
@ -476,8 +474,8 @@ enum x11drv_escape_codes
X11DRV_SET_DRAWABLE, /* set current drawable for a DC */
X11DRV_START_EXPOSURES, /* start graphics exposures */
X11DRV_END_EXPOSURES, /* end graphics exposures */
X11DRV_GET_DCE, /* get the DCE pointer */
X11DRV_SET_DCE, /* set the DCE pointer */
X11DRV_GET_DCE, /* no longer used */
X11DRV_SET_DCE, /* no longer used */
X11DRV_GET_GLX_DRAWABLE, /* get current glx drawable for a DC */
X11DRV_SYNC_PIXMAP, /* sync the dibsection to its pixmap */
X11DRV_FLUSH_GL_DRAWABLE /* flush changes made to the gl drawable */