1999-02-04 11:10:59 +01:00
|
|
|
/*
|
2000-08-10 03:16:19 +02:00
|
|
|
* TTY DC driver
|
1999-02-04 11:10:59 +01:00
|
|
|
*
|
2000-08-10 03:16:19 +02:00
|
|
|
* Copyright 1999 Patrik Stridvall
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
1999-02-04 11:10:59 +01:00
|
|
|
*/
|
|
|
|
|
1999-11-24 00:43:29 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
1999-02-04 11:10:59 +01:00
|
|
|
#include "ttydrv.h"
|
2000-08-10 03:16:19 +02:00
|
|
|
#include "winbase.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
1999-02-04 11:10:59 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ttydrv);
|
2000-08-10 03:16:19 +02:00
|
|
|
|
2001-07-27 21:37:31 +02:00
|
|
|
|
1999-02-04 11:10:59 +01:00
|
|
|
/**********************************************************************
|
|
|
|
* TTYDRV_GDI_Initialize
|
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL TTYDRV_GDI_Initialize(void)
|
1999-02-04 11:10:59 +01:00
|
|
|
{
|
2001-07-27 21:37:31 +02:00
|
|
|
return TTYDRV_PALETTE_Initialize();
|
1999-02-04 11:10:59 +01:00
|
|
|
}
|
|
|
|
|
2000-08-10 03:16:19 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* TTYDRV_DC_CreateDC
|
|
|
|
*/
|
2004-03-04 07:26:11 +01:00
|
|
|
BOOL TTYDRV_DC_CreateDC(HDC hdc, TTYDRV_PDEVICE **pdev, LPCWSTR driver, LPCWSTR device,
|
2003-08-12 22:42:18 +02:00
|
|
|
LPCWSTR output, const DEVMODEW *initData)
|
2000-08-10 03:16:19 +02:00
|
|
|
{
|
|
|
|
TTYDRV_PDEVICE *physDev;
|
|
|
|
|
|
|
|
TRACE("(%p, %s, %s, %s, %p)\n",
|
2004-03-04 07:26:11 +01:00
|
|
|
hdc, debugstr_w(driver), debugstr_w(device), debugstr_w(output), initData);
|
2000-08-10 03:16:19 +02:00
|
|
|
|
2002-06-11 00:52:47 +02:00
|
|
|
physDev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TTYDRV_PDEVICE));
|
|
|
|
if(!physDev) {
|
2000-08-10 03:16:19 +02:00
|
|
|
ERR("Can't allocate physDev\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-06-11 00:52:47 +02:00
|
|
|
*pdev = physDev;
|
2004-03-04 07:26:11 +01:00
|
|
|
physDev->hdc = hdc;
|
2002-06-11 00:52:47 +02:00
|
|
|
physDev->org.x = physDev->org.y = 0;
|
2002-03-28 23:22:05 +01:00
|
|
|
|
2004-03-04 07:26:11 +01:00
|
|
|
if(GetObjectType(hdc) == OBJ_MEMDC) {
|
2000-08-10 03:16:19 +02:00
|
|
|
physDev->window = NULL;
|
|
|
|
physDev->cellWidth = 1;
|
|
|
|
physDev->cellHeight = 1;
|
|
|
|
} else {
|
2001-04-25 01:28:52 +02:00
|
|
|
physDev->window = root_window;
|
2000-08-10 03:16:19 +02:00
|
|
|
physDev->cellWidth = cell_width;
|
|
|
|
physDev->cellHeight = cell_height;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* TTYDRV_DC_DeleteDC
|
|
|
|
*/
|
2002-03-28 23:22:05 +01:00
|
|
|
BOOL TTYDRV_DC_DeleteDC(TTYDRV_PDEVICE *physDev)
|
2000-08-10 03:16:19 +02:00
|
|
|
{
|
2002-10-25 21:00:49 +02:00
|
|
|
TRACE("(%p)\n", physDev->hdc);
|
2000-08-10 03:16:19 +02:00
|
|
|
|
2002-03-28 23:22:05 +01:00
|
|
|
HeapFree( GetProcessHeap(), 0, physDev );
|
|
|
|
return TRUE;
|
2000-08-10 03:16:19 +02:00
|
|
|
}
|
|
|
|
|
2001-07-28 02:18:02 +02:00
|
|
|
|
2000-08-10 03:16:19 +02:00
|
|
|
/***********************************************************************
|
2001-07-28 02:18:02 +02:00
|
|
|
* GetDeviceCaps (TTYDRV.@)
|
2000-08-10 03:16:19 +02:00
|
|
|
*/
|
2002-03-28 23:22:05 +01:00
|
|
|
INT TTYDRV_GetDeviceCaps( TTYDRV_PDEVICE *physDev, INT cap )
|
2000-08-10 03:16:19 +02:00
|
|
|
{
|
2001-07-28 02:18:02 +02:00
|
|
|
switch(cap)
|
|
|
|
{
|
|
|
|
case DRIVERVERSION:
|
|
|
|
return 0x300;
|
|
|
|
case TECHNOLOGY:
|
|
|
|
return DT_RASDISPLAY;
|
|
|
|
case HORZSIZE:
|
|
|
|
return 0; /* FIXME: Screen width in mm */
|
|
|
|
case VERTSIZE:
|
|
|
|
return 0; /* FIXME: Screen height in mm */
|
|
|
|
case HORZRES:
|
2002-05-07 04:08:46 +02:00
|
|
|
return cell_width * screen_cols;
|
2001-07-28 02:18:02 +02:00
|
|
|
case VERTRES:
|
2002-05-07 04:08:46 +02:00
|
|
|
return cell_height * screen_rows;
|
2001-07-28 02:18:02 +02:00
|
|
|
case BITSPIXEL:
|
|
|
|
return 1; /* FIXME */
|
|
|
|
case PLANES:
|
|
|
|
return 1;
|
|
|
|
case NUMBRUSHES:
|
|
|
|
return 16 + 6;
|
|
|
|
case NUMPENS:
|
|
|
|
return 16;
|
|
|
|
case NUMMARKERS:
|
|
|
|
return 0;
|
|
|
|
case NUMFONTS:
|
|
|
|
return 0;
|
|
|
|
case NUMCOLORS:
|
|
|
|
return 100;
|
|
|
|
case PDEVICESIZE:
|
|
|
|
return sizeof(TTYDRV_PDEVICE);
|
|
|
|
case CURVECAPS:
|
|
|
|
return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
|
|
|
|
CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT);
|
|
|
|
case LINECAPS:
|
|
|
|
return (LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
|
|
|
|
LC_STYLED | LC_WIDESTYLED | LC_INTERIORS);
|
|
|
|
case POLYGONALCAPS:
|
|
|
|
return (PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON |
|
|
|
|
PC_SCANLINE | PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS);
|
|
|
|
case TEXTCAPS:
|
|
|
|
return 0;
|
|
|
|
case CLIPCAPS:
|
|
|
|
return CP_REGION;
|
|
|
|
case RASTERCAPS:
|
|
|
|
return (RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 | RC_DI_BITMAP |
|
|
|
|
RC_DIBTODEV | RC_BIGFONT | RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS);
|
|
|
|
case ASPECTX:
|
|
|
|
case ASPECTY:
|
|
|
|
return 36;
|
|
|
|
case ASPECTXY:
|
|
|
|
return 51;
|
|
|
|
case LOGPIXELSX:
|
|
|
|
case LOGPIXELSY:
|
|
|
|
return 72; /* FIXME */
|
|
|
|
case SIZEPALETTE:
|
|
|
|
return 256; /* FIXME */
|
|
|
|
case NUMRESERVED:
|
|
|
|
return 0;
|
|
|
|
case COLORRES:
|
|
|
|
return 0;
|
|
|
|
case PHYSICALWIDTH:
|
|
|
|
case PHYSICALHEIGHT:
|
|
|
|
case PHYSICALOFFSETX:
|
|
|
|
case PHYSICALOFFSETY:
|
|
|
|
case SCALINGFACTORX:
|
|
|
|
case SCALINGFACTORY:
|
|
|
|
case VREFRESH:
|
|
|
|
case DESKTOPVERTRES:
|
|
|
|
case DESKTOPHORZRES:
|
|
|
|
case BTLALIGNMENT:
|
|
|
|
return 0;
|
|
|
|
default:
|
2002-10-25 21:00:49 +02:00
|
|
|
FIXME("(%p): unsupported capability %d, will return 0\n", physDev->hdc, cap );
|
2001-07-28 02:18:02 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2000-08-10 03:16:19 +02:00
|
|
|
}
|
2002-06-11 00:52:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetDCOrgEx (TTYDRV.@)
|
|
|
|
*/
|
|
|
|
BOOL TTYDRV_GetDCOrgEx( TTYDRV_PDEVICE *physDev, LPPOINT pt )
|
|
|
|
{
|
|
|
|
*pt = physDev->org;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SetDCOrg (TTYDRV.@)
|
|
|
|
*/
|
|
|
|
DWORD TTYDRV_SetDCOrg( TTYDRV_PDEVICE *physDev, INT x, INT y )
|
|
|
|
{
|
|
|
|
DWORD ret = MAKELONG( physDev->org.x, physDev->org.y );
|
|
|
|
physDev->org.x = x;
|
|
|
|
physDev->org.y = y;
|
|
|
|
return ret;
|
|
|
|
}
|
2004-12-09 12:45:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* 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;
|
|
|
|
}
|