Fixed a couple of file descriptor leaks.
[wine/multimedia.git] / include / ttydrv.h
blobcbe978885ccf874ba4c887bece394d6e500ec296
1 /*
2 * TTY driver definitions
3 */
5 #ifndef __WINE_TTYDRV_H
6 #define __WINE_TTYDRV_H
8 #include "config.h"
10 #undef ERR
11 #ifdef HAVE_NCURSES_H
12 # include <ncurses.h>
13 #elif defined(HAVE_CURSES_H)
14 # include <curses.h>
15 #endif
17 #include "windef.h"
18 #include "wingdi.h"
19 #include "wine/winuser16.h"
20 #include "wine/wingdi16.h"
22 struct tagBITMAPOBJ;
23 struct tagCLASS;
24 struct tagDC;
25 struct tagDESKTOP;
26 struct tagPALETTEOBJ;
27 struct tagWND;
28 struct tagCURSORICONINFO;
29 struct tagCREATESTRUCTA;
30 struct tagWINDOWPOS;
31 struct tagKEYBOARD_CONFIG;
32 struct DIDEVICEOBJECTDATA;
34 /**************************************************************************
35 * TTY GDI driver
38 extern struct tagGDI_DRIVER TTYDRV_GDI_Driver;
40 extern BOOL TTYDRV_GDI_Initialize(void);
41 extern void TTYDRV_GDI_Finalize(void);
43 /* TTY GDI bitmap driver */
45 extern HBITMAP TTYDRV_BITMAP_CreateDIBSection(struct tagDC *dc, BITMAPINFO *bmi, UINT usage, LPVOID *bits, HANDLE section, DWORD offset);
46 extern HBITMAP16 TTYDRV_BITMAP_CreateDIBSection16(struct tagDC *dc, BITMAPINFO *bmi, UINT16 usage, SEGPTR *bits, HANDLE section, DWORD offset);
48 extern INT TTYDRV_BITMAP_SetDIBits(struct tagBITMAPOBJ *bmp, struct tagDC *dc, UINT startscan, UINT lines, LPCVOID bits, const BITMAPINFO *info, UINT coloruse, HBITMAP hbitmap);
49 extern INT TTYDRV_BITMAP_GetDIBits(struct tagBITMAPOBJ *bmp, struct tagDC *dc, UINT startscan, UINT lines, LPVOID bits, BITMAPINFO *info, UINT coloruse, HBITMAP hbitmap);
50 extern void TTYDRV_BITMAP_DeleteDIBSection(struct tagBITMAPOBJ *bmp);
52 typedef struct {
53 #ifdef HAVE_LIBCURSES
54 WINDOW *window;
55 #endif /* defined(HAVE_LIBCURSES) */
56 int cellWidth;
57 int cellHeight;
58 } TTYDRV_PDEVICE;
60 typedef struct {
61 int dummy; /* FIXME: Remove later */
62 } TTYDRV_PHYSBITMAP;
64 extern BOOL TTYDRV_DC_CreateBitmap(HBITMAP hbitmap);
66 extern BOOL TTYDRV_DC_Arc(struct tagDC *dc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend);
67 extern LONG TTYDRV_DC_BitmapBits(HBITMAP hbitmap, void *bits, LONG count, WORD flags);
68 extern BOOL TTYDRV_DC_CreateBitmap(HBITMAP hbitmap);
69 extern BOOL TTYDRV_DC_CreateDC(struct tagDC *dc, LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODEA *initData);
70 extern BOOL TTYDRV_DC_DeleteDC(struct tagDC *dc);
71 extern BOOL TTYDRV_DC_DeleteObject(HGDIOBJ handle);
72 extern BOOL TTYDRV_DC_BitBlt(struct tagDC *dcDst, INT xDst, INT yDst, INT width, INT height, struct tagDC *dcSrc, INT xSrc, INT ySrc, DWORD rop);
73 extern BOOL TTYDRV_DC_Chord(struct tagDC *dc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend);
74 extern BOOL TTYDRV_DC_Ellipse(struct tagDC *dc, INT left, INT top, INT right, INT bottom);
75 extern INT TTYDRV_DC_Escape(struct tagDC *dc, INT nEscape, INT cbInput, SEGPTR lpInData, SEGPTR lpOutData);
76 extern BOOL TTYDRV_DC_ExtFloodFill(struct tagDC *dc, INT x, INT y, COLORREF color, UINT fillType);
77 extern BOOL TTYDRV_DC_ExtTextOut(struct tagDC *dc, INT x, INT y, UINT flags, const RECT *lpRect, LPCWSTR str, UINT count, const INT *lpDx);
78 extern BOOL TTYDRV_DC_GetCharWidth(struct tagDC *dc, UINT firstChar, UINT lastChar, LPINT buffer);
79 extern COLORREF TTYDRV_DC_GetPixel(struct tagDC *dc, INT x, INT y);
81 extern BOOL TTYDRV_DC_GetTextExtentPoint(struct tagDC *dc, LPCWSTR str, INT count, LPSIZE size);
82 extern BOOL TTYDRV_DC_GetTextMetrics(struct tagDC *dc, TEXTMETRICA *metrics);
83 extern BOOL TTYDRV_DC_LineTo(struct tagDC *dc, INT x, INT y);
84 extern HANDLE TTYDRV_DC_LoadOEMResource(WORD resid, WORD type);
85 extern BOOL TTYDRV_DC_PaintRgn(struct tagDC *dc, HRGN hrgn);
86 extern BOOL TTYDRV_DC_PatBlt(struct tagDC *dc, INT left, INT top, INT width, INT height, DWORD rop);
87 extern BOOL TTYDRV_DC_Pie(struct tagDC *dc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend);
88 extern BOOL TTYDRV_DC_Polygon(struct tagDC *dc, const POINT* pt, INT count);
89 extern BOOL TTYDRV_DC_Polyline(struct tagDC *dc, const POINT* pt, INT count);
90 extern BOOL TTYDRV_DC_PolyPolygon(struct tagDC *dc, const POINT* pt, const INT* counts, UINT polygons);
91 extern BOOL TTYDRV_DC_PolyPolyline(struct tagDC *dc, const POINT* pt, const DWORD* counts, DWORD polylines);
92 extern BOOL TTYDRV_DC_Rectangle(struct tagDC *dc, INT left, INT top, INT right, INT bottom);
93 extern BOOL TTYDRV_DC_RoundRect(struct tagDC *dc, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height);
94 extern void TTYDRV_DC_SetDeviceClipping(struct tagDC *dc);
95 extern HGDIOBJ TTYDRV_DC_SelectObject(struct tagDC *dc, HGDIOBJ handle);
96 extern COLORREF TTYDRV_DC_SetBkColor(struct tagDC *dc, COLORREF color);
97 extern COLORREF TTYDRV_DC_SetPixel(struct tagDC *dc, INT x, INT y, COLORREF color);
98 extern COLORREF TTYDRV_DC_SetTextColor(struct tagDC *dc, COLORREF color);
99 extern BOOL TTYDRV_DC_StretchBlt(struct tagDC *dcDst, INT xDst, INT yDst, INT widthDst, INT heightDst, struct tagDC *dcSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, DWORD rop);
100 INT TTYDRV_DC_SetDIBitsToDevice(struct tagDC *dc, INT xDest, INT yDest, DWORD cx, DWORD cy, INT xSrc, INT ySrc, UINT startscan, UINT lines, LPCVOID bits, const BITMAPINFO *info, UINT coloruse);
102 /* TTY GDI palette driver */
104 extern struct tagPALETTE_DRIVER TTYDRV_PALETTE_Driver;
106 extern BOOL TTYDRV_PALETTE_Initialize(void);
107 extern void TTYDRV_PALETTE_Finalize(void);
109 extern int TTYDRV_PALETTE_SetMapping(struct tagPALETTEOBJ *palPtr, UINT uStart, UINT uNum, BOOL mapOnly);
110 extern int TTYDRV_PALETTE_UpdateMapping(struct tagPALETTEOBJ *palPtr);
111 extern BOOL TTYDRV_PALETTE_IsDark(int pixel);
113 /**************************************************************************
114 * TTY USER driver
117 extern int cell_width;
118 extern int cell_height;
119 static inline int TTYDRV_GetCellWidth(void) { return cell_width; }
120 static inline int TTYDRV_GetCellHeight(void) { return cell_height; }
122 #ifdef HAVE_LIBCURSES
123 extern WINDOW *root_window;
124 static inline WINDOW *TTYDRV_GetRootWindow(void) { return root_window; }
125 #endif /* defined(HAVE_LIBCURSES) */
127 extern BOOL TTYDRV_GetScreenSaveActive(void);
128 extern void TTYDRV_SetScreenSaveActive(BOOL bActivate);
129 extern int TTYDRV_GetScreenSaveTimeout(void);
130 extern void TTYDRV_SetScreenSaveTimeout(int nTimeout);
131 extern BOOL TTYDRV_IsSingleWindow(void);
133 /* TTY clipboard driver */
135 extern struct tagCLIPBOARD_DRIVER TTYDRV_CLIPBOARD_Driver;
137 extern void TTYDRV_CLIPBOARD_Acquire(void);
138 extern void TTYDRV_CLIPBOARD_Release(void);
139 extern void TTYDRV_CLIPBOARD_SetData(UINT wFormat);
140 extern BOOL TTYDRV_CLIPBOARD_GetData(UINT wFormat);
141 extern BOOL TTYDRV_CLIPBOARD_IsFormatAvailable(UINT wFormat);
142 extern BOOL TTYDRV_CLIPBOARD_RegisterFormat( LPCSTR FormatName );
143 extern BOOL TTYDRV_CLIPBOARD_IsSelectionowner();
144 extern void TTYDRV_CLIPBOARD_ResetOwner(struct tagWND *pWnd, BOOL bFooBar);
146 /* TTY desktop driver */
148 #ifdef HAVE_LIBCURSES
149 extern WINDOW *TTYDRV_DESKTOP_GetCursesRootWindow(struct tagDESKTOP *pDesktop);
150 #endif /* defined(HAVE_LIBCURSES) */
152 /* TTY event driver */
154 extern void TTYDRV_EVENT_Synchronize(void);
155 extern BOOL TTYDRV_EVENT_CheckFocus(void);
156 extern void TTYDRV_EVENT_UserRepaintDisable(BOOL bDisable);
158 /* TTY keyboard driver */
160 extern void TTYDRV_KEYBOARD_Init(void);
161 extern WORD TTYDRV_KEYBOARD_VkKeyScan(CHAR cChar);
162 extern UINT16 TTYDRV_KEYBOARD_MapVirtualKey(UINT16 wCode, UINT16 wMapType);
163 extern INT16 TTYDRV_KEYBOARD_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize);
164 extern INT16 TTYDRV_KEYBOARD_ToAscii(UINT16 virtKey, UINT16 scanCode, LPBYTE lpKeyState, LPVOID lpChar, UINT16 flags);
165 extern BOOL TTYDRV_KEYBOARD_GetBeepActive(void);
166 extern void TTYDRV_KEYBOARD_SetBeepActive(BOOL bActivate);
167 extern void TTYDRV_KEYBOARD_Beep(void);
168 extern BOOL TTYDRV_KEYBOARD_GetDIState(DWORD len, LPVOID ptr);
169 extern BOOL TTYDRV_KEYBOARD_GetDIData(BYTE *keystate, DWORD dodsize, struct DIDEVICEOBJECTDATA *dod, LPDWORD entries, DWORD flags);
170 extern void TTYDRV_KEYBOARD_GetKeyboardConfig(struct tagKEYBOARD_CONFIG *cfg);
171 extern void TTYDRV_KEYBOARD_SetKeyboardConfig(struct tagKEYBOARD_CONFIG *cfg, DWORD mask);
173 /* TTY mouse driver */
175 extern void TTYDRV_MOUSE_Init();
176 extern void TTYDRV_MOUSE_SetCursor(struct tagCURSORICONINFO *lpCursor);
177 extern void TTYDRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY);
178 extern LONG TTYDRV_MOUSE_EnableWarpPointer(BOOL bEnable);
180 /* TTY windows driver */
182 extern struct tagWND_DRIVER TTYDRV_WND_Driver;
184 typedef struct tagTTYDRV_WND_DATA {
185 #ifdef HAVE_LIBCURSES
186 WINDOW *window;
187 #else /* defined(HAVE_LIBCURSES) */
188 int dummy; /* FIXME: Remove later */
189 #endif /* defined(HAVE_LIBCURSES) */
190 } TTYDRV_WND_DATA;
192 #ifdef HAVE_LIBCURSES
193 WINDOW *TTYDRV_WND_GetCursesWindow(struct tagWND *wndPtr);
194 #endif /* defined(HAVE_LIBCURSES) */
196 extern void TTYDRV_WND_Initialize(struct tagWND *wndPtr);
197 extern void TTYDRV_WND_Finalize(struct tagWND *wndPtr);
198 extern BOOL TTYDRV_WND_CreateDesktopWindow(struct tagWND *wndPtr, struct tagCLASS *classPtr, BOOL bUnicode);
199 extern BOOL TTYDRV_WND_CreateWindow(struct tagWND *wndPtr, struct tagCLASS *classPtr, struct tagCREATESTRUCTA *cs, BOOL bUnicode);
200 extern BOOL TTYDRV_WND_DestroyWindow(struct tagWND *pWnd);
201 extern struct tagWND *TTYDRV_WND_SetParent(struct tagWND *wndPtr, struct tagWND *pWndParent);
202 extern void TTYDRV_WND_ForceWindowRaise(struct tagWND *pWnd);
203 extern void TTYDRV_WND_SetWindowPos(struct tagWND *wndPtr, const struct tagWINDOWPOS *winpos, BOOL bSMC_SETXPOS);
204 extern void TTYDRV_WND_SetText(struct tagWND *wndPtr, LPCSTR text);
205 extern void TTYDRV_WND_SetFocus(struct tagWND *wndPtr);
206 extern void TTYDRV_WND_PreSizeMove(struct tagWND *wndPtr);
207 extern void TTYDRV_WND_PostSizeMove(struct tagWND *wndPtr);
208 extern void TTYDRV_WND_ScrollWindow(struct tagWND *wndPtr, struct tagDC *dcPtr, INT dx, INT dy, const RECT *clipRect, BOOL bUpdate);
209 extern void TTYDRV_WND_SetDrawable(struct tagWND *wndPtr, struct tagDC *dc, WORD flags, BOOL bSetClipOrigin);
210 extern BOOL TTYDRV_WND_SetHostAttr(struct tagWND *wndPtr, INT haKey, INT value);
211 extern BOOL TTYDRV_WND_IsSelfClipping(struct tagWND *wndPtr);
213 #endif /* !defined(__WINE_TTYDRV_H) */