Check for Xrandr extension.
[wine/gsoc_dplay.git] / dlls / ttydrv / dc.c
blob7b651e51f488c03cf13c1010bed0cc03567f6c57
1 /*
2 * TTY DC driver
4 * Copyright 1999 Patrik Stridvall
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "config.h"
23 #include "gdi.h"
24 #include "ttydrv.h"
25 #include "winbase.h"
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(ttydrv);
31 /**********************************************************************
32 * TTYDRV_GDI_Initialize
34 BOOL TTYDRV_GDI_Initialize(void)
36 return TTYDRV_PALETTE_Initialize();
39 /***********************************************************************
40 * TTYDRV_DC_CreateDC
42 BOOL TTYDRV_DC_CreateDC(DC *dc, TTYDRV_PDEVICE **pdev, LPCWSTR driver, LPCWSTR device,
43 LPCWSTR output, const DEVMODEW *initData)
45 TTYDRV_PDEVICE *physDev;
47 TRACE("(%p, %s, %s, %s, %p)\n",
48 dc, debugstr_w(driver), debugstr_w(device),
49 debugstr_w(output), initData);
51 physDev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TTYDRV_PDEVICE));
52 if(!physDev) {
53 ERR("Can't allocate physDev\n");
54 return FALSE;
56 *pdev = physDev;
57 physDev->hdc = dc->hSelf;
58 physDev->org.x = physDev->org.y = 0;
60 if(GetObjectType(dc->hSelf) == OBJ_MEMDC) {
61 physDev->window = NULL;
62 physDev->cellWidth = 1;
63 physDev->cellHeight = 1;
64 } else {
65 physDev->window = root_window;
66 physDev->cellWidth = cell_width;
67 physDev->cellHeight = cell_height;
69 dc->bitsPerPixel = 1;
72 return TRUE;
75 /***********************************************************************
76 * TTYDRV_DC_DeleteDC
78 BOOL TTYDRV_DC_DeleteDC(TTYDRV_PDEVICE *physDev)
80 TRACE("(%p)\n", physDev->hdc);
82 HeapFree( GetProcessHeap(), 0, physDev );
83 return TRUE;
87 /***********************************************************************
88 * GetDeviceCaps (TTYDRV.@)
90 INT TTYDRV_GetDeviceCaps( TTYDRV_PDEVICE *physDev, INT cap )
92 switch(cap)
94 case DRIVERVERSION:
95 return 0x300;
96 case TECHNOLOGY:
97 return DT_RASDISPLAY;
98 case HORZSIZE:
99 return 0; /* FIXME: Screen width in mm */
100 case VERTSIZE:
101 return 0; /* FIXME: Screen height in mm */
102 case HORZRES:
103 return cell_width * screen_cols;
104 case VERTRES:
105 return cell_height * screen_rows;
106 case BITSPIXEL:
107 return 1; /* FIXME */
108 case PLANES:
109 return 1;
110 case NUMBRUSHES:
111 return 16 + 6;
112 case NUMPENS:
113 return 16;
114 case NUMMARKERS:
115 return 0;
116 case NUMFONTS:
117 return 0;
118 case NUMCOLORS:
119 return 100;
120 case PDEVICESIZE:
121 return sizeof(TTYDRV_PDEVICE);
122 case CURVECAPS:
123 return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
124 CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT);
125 case LINECAPS:
126 return (LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
127 LC_STYLED | LC_WIDESTYLED | LC_INTERIORS);
128 case POLYGONALCAPS:
129 return (PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON |
130 PC_SCANLINE | PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS);
131 case TEXTCAPS:
132 return 0;
133 case CLIPCAPS:
134 return CP_REGION;
135 case RASTERCAPS:
136 return (RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 | RC_DI_BITMAP |
137 RC_DIBTODEV | RC_BIGFONT | RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS);
138 case ASPECTX:
139 case ASPECTY:
140 return 36;
141 case ASPECTXY:
142 return 51;
143 case LOGPIXELSX:
144 case LOGPIXELSY:
145 return 72; /* FIXME */
146 case SIZEPALETTE:
147 return 256; /* FIXME */
148 case NUMRESERVED:
149 return 0;
150 case COLORRES:
151 return 0;
152 case PHYSICALWIDTH:
153 case PHYSICALHEIGHT:
154 case PHYSICALOFFSETX:
155 case PHYSICALOFFSETY:
156 case SCALINGFACTORX:
157 case SCALINGFACTORY:
158 case VREFRESH:
159 case DESKTOPVERTRES:
160 case DESKTOPHORZRES:
161 case BTLALIGNMENT:
162 return 0;
163 default:
164 FIXME("(%p): unsupported capability %d, will return 0\n", physDev->hdc, cap );
165 return 0;
170 /***********************************************************************
171 * GetDCOrgEx (TTYDRV.@)
173 BOOL TTYDRV_GetDCOrgEx( TTYDRV_PDEVICE *physDev, LPPOINT pt )
175 *pt = physDev->org;
176 return TRUE;
180 /***********************************************************************
181 * SetDCOrg (TTYDRV.@)
183 DWORD TTYDRV_SetDCOrg( TTYDRV_PDEVICE *physDev, INT x, INT y )
185 DWORD ret = MAKELONG( physDev->org.x, physDev->org.y );
186 physDev->org.x = x;
187 physDev->org.y = y;
188 return ret;