Commit 65af6985 authored by Alexandre Julliard's avatar Alexandre Julliard

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

origin.
parent f738c146
......@@ -183,3 +183,43 @@ DWORD TTYDRV_SetDCOrg( TTYDRV_PDEVICE *physDev, INT x, INT y )
physDev->org.y = y;
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;
}
......@@ -100,6 +100,18 @@ INT TTYDRV_DC_SetDIBitsToDevice(TTYDRV_PDEVICE *physDev, INT xDest, INT yDest, D
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
*/
......
......@@ -6,6 +6,7 @@
@ cdecl CreateDC(long ptr wstr wstr wstr ptr) TTYDRV_DC_CreateDC
@ cdecl DeleteDC(ptr) TTYDRV_DC_DeleteDC
@ 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 ExtTextOut(ptr long long long ptr ptr long ptr long) TTYDRV_DC_ExtTextOut
@ cdecl GetBitmapBits(long ptr long) TTYDRV_GetBitmapBits
......
......@@ -414,22 +414,23 @@ BOOL TTYDRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
{
WND *wndPtr = WIN_FindWndPtr(hwnd);
HRGN hrgnVisible = 0;
POINT org;
struct ttydrv_escape_set_drawable escape;
if (!wndPtr) return FALSE;
if(flags & DCX_WINDOW)
{
org.x = wndPtr->rectWindow.left;
org.y = wndPtr->rectWindow.top;
escape.org.x = wndPtr->rectWindow.left;
escape.org.y = wndPtr->rectWindow.top;
}
else
{
org.x = wndPtr->rectClient.left;
org.y = wndPtr->rectClient.top;
escape.org.x = wndPtr->rectClient.left;
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 */
( flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN) ))
......@@ -463,7 +464,7 @@ BOOL TTYDRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
else
{
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) */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment