Use an escape mechanism similar to the x11drv one to set the DC

origin.
This commit is contained in:
Alexandre Julliard 2004-12-09 11:45:16 +00:00
parent f738c146e2
commit 65af698536
4 changed files with 61 additions and 7 deletions

View File

@ -183,3 +183,43 @@ DWORD TTYDRV_SetDCOrg( TTYDRV_PDEVICE *physDev, INT x, INT y )
physDev->org.y = y; physDev->org.y = y;
return ret; return ret;
} }
/**********************************************************************
* ExtEscape (X11DRV.@)
*/
INT TTYDRV_ExtEscape( TTYDRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID in_data,
INT out_count, LPVOID out_data )
{
switch(escape)
{
case QUERYESCSUPPORT:
if (in_data)
{
switch (*(const INT *)in_data)
{
case TTYDRV_ESCAPE:
return TRUE;
}
}
break;
case TTYDRV_ESCAPE:
if (in_data && in_count >= sizeof(enum ttydrv_escape_codes))
{
switch(*(const enum ttydrv_escape_codes *)in_data)
{
case TTYDRV_SET_DRAWABLE:
if (in_count >= sizeof(struct ttydrv_escape_set_drawable))
{
const struct ttydrv_escape_set_drawable *data = (const struct ttydrv_escape_set_drawable *)in_data;
physDev->org = data->org;
return TRUE;
}
break;
}
}
break;
}
return 0;
}

View File

@ -100,6 +100,18 @@ INT TTYDRV_DC_SetDIBitsToDevice(TTYDRV_PDEVICE *physDev, INT xDest, INT yDest, D
extern BOOL TTYDRV_PALETTE_Initialize(void); extern BOOL TTYDRV_PALETTE_Initialize(void);
#define TTYDRV_ESCAPE 6999
enum ttydrv_escape_codes
{
TTYDRV_SET_DRAWABLE /* set current drawable for a DC */
};
struct ttydrv_escape_set_drawable
{
enum ttydrv_escape_codes code; /* escape code (TTYDRV_SET_DRAWABLE) */
POINT org; /* origin of DC relative to drawable */
};
/************************************************************************** /**************************************************************************
* TTY USER driver * TTY USER driver
*/ */

View File

@ -6,6 +6,7 @@
@ cdecl CreateDC(long ptr wstr wstr wstr ptr) TTYDRV_DC_CreateDC @ cdecl CreateDC(long ptr wstr wstr wstr ptr) TTYDRV_DC_CreateDC
@ cdecl DeleteDC(ptr) TTYDRV_DC_DeleteDC @ cdecl DeleteDC(ptr) TTYDRV_DC_DeleteDC
@ cdecl Ellipse(ptr long long long long) TTYDRV_DC_Ellipse @ cdecl Ellipse(ptr long long long long) TTYDRV_DC_Ellipse
@ cdecl ExtEscape(ptr long long ptr long ptr) TTYDRV_ExtEscape
@ cdecl ExtFloodFill(ptr long long long long) TTYDRV_DC_ExtFloodFill @ cdecl ExtFloodFill(ptr long long long long) TTYDRV_DC_ExtFloodFill
@ cdecl ExtTextOut(ptr long long long ptr ptr long ptr long) TTYDRV_DC_ExtTextOut @ cdecl ExtTextOut(ptr long long long ptr ptr long ptr long) TTYDRV_DC_ExtTextOut
@ cdecl GetBitmapBits(long ptr long) TTYDRV_GetBitmapBits @ cdecl GetBitmapBits(long ptr long) TTYDRV_GetBitmapBits

View File

@ -414,22 +414,23 @@ BOOL TTYDRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
{ {
WND *wndPtr = WIN_FindWndPtr(hwnd); WND *wndPtr = WIN_FindWndPtr(hwnd);
HRGN hrgnVisible = 0; HRGN hrgnVisible = 0;
POINT org; struct ttydrv_escape_set_drawable escape;
if (!wndPtr) return FALSE; if (!wndPtr) return FALSE;
if(flags & DCX_WINDOW) if(flags & DCX_WINDOW)
{ {
org.x = wndPtr->rectWindow.left; escape.org.x = wndPtr->rectWindow.left;
org.y = wndPtr->rectWindow.top; escape.org.y = wndPtr->rectWindow.top;
} }
else else
{ {
org.x = wndPtr->rectClient.left; escape.org.x = wndPtr->rectClient.left;
org.y = wndPtr->rectClient.top; escape.org.y = wndPtr->rectClient.top;
} }
SetDCOrg16( HDC_16(hdc), org.x, org.y ); escape.code = TTYDRV_SET_DRAWABLE;
ExtEscape( hdc, TTYDRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
if (SetHookFlags16( HDC_16(hdc), DCHF_VALIDATEVISRGN ) || /* DC was dirty */ if (SetHookFlags16( HDC_16(hdc), DCHF_VALIDATEVISRGN ) || /* DC was dirty */
( flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN) )) ( flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN) ))
@ -463,7 +464,7 @@ BOOL TTYDRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
else else
{ {
hrgnVisible = DCE_GetVisRgn( hwnd, flags, 0, 0 ); hrgnVisible = DCE_GetVisRgn( hwnd, flags, 0, 0 );
OffsetRgn( hrgnVisible, org.x, org.y ); OffsetRgn( hrgnVisible, escape.org.x, escape.org.y );
} }
/* apply additional region operation (if any) */ /* apply additional region operation (if any) */