From 65af698536cf77adc6f2731ad15c04e409b4bb14 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 9 Dec 2004 11:45:16 +0000 Subject: [PATCH] Use an escape mechanism similar to the x11drv one to set the DC origin. --- dlls/ttydrv/dc.c | 40 ++++++++++++++++++++++++++++++++++++++++ dlls/ttydrv/ttydrv.h | 12 ++++++++++++ dlls/ttydrv/ttydrv.spec | 1 + dlls/ttydrv/wnd.c | 15 ++++++++------- 4 files changed, 61 insertions(+), 7 deletions(-) diff --git a/dlls/ttydrv/dc.c b/dlls/ttydrv/dc.c index 972ff0bc3cf..2514f1b21f0 100644 --- a/dlls/ttydrv/dc.c +++ b/dlls/ttydrv/dc.c @@ -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; +} diff --git a/dlls/ttydrv/ttydrv.h b/dlls/ttydrv/ttydrv.h index 2d9953572ac..8206ae74498 100644 --- a/dlls/ttydrv/ttydrv.h +++ b/dlls/ttydrv/ttydrv.h @@ -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 */ diff --git a/dlls/ttydrv/ttydrv.spec b/dlls/ttydrv/ttydrv.spec index eafac0ffba1..52877d83a41 100644 --- a/dlls/ttydrv/ttydrv.spec +++ b/dlls/ttydrv/ttydrv.spec @@ -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 diff --git a/dlls/ttydrv/wnd.c b/dlls/ttydrv/wnd.c index eedb48d23f5..93f348e381d 100644 --- a/dlls/ttydrv/wnd.c +++ b/dlls/ttydrv/wnd.c @@ -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) */