Fixed ttydrv compile when using curses. Cleaned up a few #ifdefs.
This commit is contained in:
parent
c9742b3204
commit
f64c404ea6
|
@ -12,10 +12,10 @@
|
|||
#include "message.h"
|
||||
#include "monitor.h"
|
||||
#include "mouse.h"
|
||||
#include "ttydrv.h"
|
||||
#include "user.h"
|
||||
#include "win.h"
|
||||
#include "debugtools.h"
|
||||
#include "ttydrv.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(ttydrv);
|
||||
|
||||
|
@ -54,9 +54,7 @@ static USER_DRIVER user_driver =
|
|||
|
||||
int cell_width = 8;
|
||||
int cell_height = 8;
|
||||
#ifdef HAVE_LIBCURSES
|
||||
WINDOW *root_window;
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -70,17 +68,17 @@ static void process_attach(void)
|
|||
CLIPBOARD_Driver = &TTYDRV_CLIPBOARD_Driver;
|
||||
WND_Driver = &TTYDRV_WND_Driver;
|
||||
|
||||
#ifdef HAVE_LIBCURSES
|
||||
#ifdef WINE_CURSES
|
||||
if ((root_window = initscr()))
|
||||
{
|
||||
werase(root_window);
|
||||
wrefresh(root_window);
|
||||
}
|
||||
getmaxyx(root_window, rows, cols);
|
||||
#else /* defined(HAVE_LIBCURSES) */
|
||||
#else /* WINE_CURSES */
|
||||
rows = 60; /* FIXME: Hardcoded */
|
||||
cols = 80; /* FIXME: Hardcoded */
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
#endif /* WINE_CURSES */
|
||||
|
||||
MONITOR_PrimaryMonitor.rect.left = 0;
|
||||
MONITOR_PrimaryMonitor.rect.top = 0;
|
||||
|
@ -99,9 +97,9 @@ static void process_detach(void)
|
|||
{
|
||||
TTYDRV_GDI_Finalize();
|
||||
|
||||
#ifdef HAVE_LIBCURSES
|
||||
#ifdef WINE_CURSES
|
||||
if (root_window) endwin();
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
#endif /* WINE_CURSES */
|
||||
|
||||
USER_Driver = NULL;
|
||||
CLIPBOARD_Driver = NULL;
|
||||
|
|
|
@ -44,9 +44,7 @@ BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device,
|
|||
dc->w.devCaps = &TTYDRV_DC_DevCaps;
|
||||
|
||||
if(dc->w.flags & DC_MEMORY){
|
||||
#ifdef HAVE_LIBCURSES
|
||||
physDev->window = NULL;
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
physDev->cellWidth = 1;
|
||||
physDev->cellHeight = 1;
|
||||
|
||||
|
@ -63,9 +61,7 @@ BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device,
|
|||
|
||||
GDI_HEAP_UNLOCK( dc->w.hBitmap );
|
||||
} else {
|
||||
#ifdef HAVE_LIBCURSES
|
||||
physDev->window = TTYDRV_GetRootWindow();
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
physDev->cellWidth = TTYDRV_GetCellWidth();
|
||||
physDev->cellHeight = TTYDRV_GetCellHeight();
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ COLORREF TTYDRV_DC_GetPixel(DC *dc, INT x, INT y)
|
|||
*/
|
||||
BOOL TTYDRV_DC_LineTo(DC *dc, INT x, INT y)
|
||||
{
|
||||
#ifdef HAVE_LIBCURSES
|
||||
#ifdef WINE_CURSES
|
||||
TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
|
||||
INT row1, col1, row2, col2;
|
||||
|
||||
|
@ -110,11 +110,11 @@ BOOL TTYDRV_DC_LineTo(DC *dc, INT x, INT y)
|
|||
wrefresh(physDev->window);
|
||||
|
||||
return TRUE;
|
||||
#else /* defined(HAVE_LIBCURSES) */
|
||||
#else /* defined(WINE_CURSES) */
|
||||
FIXME("(%p, %d, %d): stub\n", dc, x, y);
|
||||
|
||||
return TRUE;
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
#endif /* defined(WINE_CURSES) */
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -184,7 +184,7 @@ BOOL TTYDRV_DC_PolyPolyline(DC *dc, const POINT* pt, const DWORD* counts, DWORD
|
|||
*/
|
||||
BOOL TTYDRV_DC_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom)
|
||||
{
|
||||
#ifdef HAVE_LIBCURSES
|
||||
#ifdef WINE_CURSES
|
||||
TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
|
||||
INT row1, col1, row2, col2;
|
||||
|
||||
|
@ -229,11 +229,11 @@ BOOL TTYDRV_DC_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom)
|
|||
wrefresh(physDev->window);
|
||||
|
||||
return TRUE;
|
||||
#else /* defined(HAVE_LIBCURSES) */
|
||||
#else /* defined(WINE_CURSES) */
|
||||
FIXME("(%p, %d, %d, %d, %d): stub\n", dc, left, top, right, bottom);
|
||||
|
||||
return TRUE;
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
#endif /* defined(WINE_CURSES) */
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -268,7 +268,7 @@ COLORREF TTYDRV_DC_SetBkColor(DC *dc, COLORREF color)
|
|||
*/
|
||||
COLORREF TTYDRV_DC_SetPixel(DC *dc, INT x, INT y, COLORREF color)
|
||||
{
|
||||
#ifdef HAVE_LIBCURSES
|
||||
#ifdef WINE_CURSES
|
||||
TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
|
||||
INT row, col;
|
||||
|
||||
|
@ -284,11 +284,11 @@ COLORREF TTYDRV_DC_SetPixel(DC *dc, INT x, INT y, COLORREF color)
|
|||
wrefresh(physDev->window);
|
||||
|
||||
return RGB(0,0,0); /* FIXME: Always returns black */
|
||||
#else /* defined(HAVE_LIBCURSES) */
|
||||
#else /* defined(WINE_CURSES) */
|
||||
FIXME("(%p, %d, %d, 0x%08lx): stub\n", dc, x, y, color);
|
||||
|
||||
return RGB(0,0,0); /* FIXME: Always returns black */
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
#endif /* defined(WINE_CURSES) */
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "dc.h"
|
||||
#include "debugtools.h"
|
||||
|
@ -22,7 +23,7 @@ BOOL TTYDRV_DC_ExtTextOut(DC *dc, INT x, INT y, UINT flags,
|
|||
const RECT *lpRect, LPCWSTR str, UINT count,
|
||||
const INT *lpDx)
|
||||
{
|
||||
#ifdef HAVE_LIBCURSES
|
||||
#ifdef WINE_CURSES
|
||||
TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
|
||||
INT row, col;
|
||||
LPSTR ascii;
|
||||
|
@ -56,10 +57,10 @@ BOOL TTYDRV_DC_ExtTextOut(DC *dc, INT x, INT y, UINT flags,
|
|||
}
|
||||
|
||||
return TRUE;
|
||||
#else /* defined(HAVE_LIBCURSES) */
|
||||
#else /* defined(WINE_CURSES) */
|
||||
FIXME("(%p, %d, %d, 0x%08x, %p, %s, %d, %p): stub\n",
|
||||
dc, x, y, flags, lpRect, debugstr_wn(str,count), count, lpDx);
|
||||
|
||||
return TRUE;
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
#endif /* defined(WINE_CURSES) */
|
||||
}
|
||||
|
|
|
@ -31,6 +31,10 @@ struct tagWINDOWPOS;
|
|||
struct tagKEYBOARD_CONFIG;
|
||||
struct DIDEVICEOBJECTDATA;
|
||||
|
||||
#if defined(HAVE_LIBCURSES) || defined(HAVE_LIBNCURSES)
|
||||
#define WINE_CURSES
|
||||
#endif
|
||||
|
||||
/**************************************************************************
|
||||
* TTY GDI driver
|
||||
*/
|
||||
|
@ -49,10 +53,12 @@ extern INT TTYDRV_BITMAP_SetDIBits(struct tagBITMAPOBJ *bmp, struct tagDC *dc, U
|
|||
extern INT TTYDRV_BITMAP_GetDIBits(struct tagBITMAPOBJ *bmp, struct tagDC *dc, UINT startscan, UINT lines, LPVOID bits, BITMAPINFO *info, UINT coloruse, HBITMAP hbitmap);
|
||||
extern void TTYDRV_BITMAP_DeleteDIBSection(struct tagBITMAPOBJ *bmp);
|
||||
|
||||
#ifndef WINE_CURSES
|
||||
typedef struct { int dummy; } WINDOW;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
#ifdef HAVE_LIBCURSES
|
||||
WINDOW *window;
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
int cellWidth;
|
||||
int cellHeight;
|
||||
} TTYDRV_PDEVICE;
|
||||
|
@ -119,10 +125,8 @@ extern int cell_height;
|
|||
static inline int TTYDRV_GetCellWidth(void) { return cell_width; }
|
||||
static inline int TTYDRV_GetCellHeight(void) { return cell_height; }
|
||||
|
||||
#ifdef HAVE_LIBCURSES
|
||||
extern WINDOW *root_window;
|
||||
static inline WINDOW *TTYDRV_GetRootWindow(void) { return root_window; }
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
|
||||
extern BOOL TTYDRV_GetScreenSaveActive(void);
|
||||
extern void TTYDRV_SetScreenSaveActive(BOOL bActivate);
|
||||
|
@ -143,12 +147,6 @@ extern BOOL TTYDRV_CLIPBOARD_RegisterFormat( LPCSTR FormatName );
|
|||
extern BOOL TTYDRV_CLIPBOARD_IsSelectionowner();
|
||||
extern void TTYDRV_CLIPBOARD_ResetOwner(struct tagWND *pWnd, BOOL bFooBar);
|
||||
|
||||
/* TTY desktop driver */
|
||||
|
||||
#ifdef HAVE_LIBCURSES
|
||||
extern WINDOW *TTYDRV_DESKTOP_GetCursesRootWindow(struct tagDESKTOP *pDesktop);
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
|
||||
/* TTY event driver */
|
||||
|
||||
extern void TTYDRV_EVENT_Synchronize(void);
|
||||
|
@ -182,16 +180,10 @@ extern LONG TTYDRV_MOUSE_EnableWarpPointer(BOOL bEnable);
|
|||
extern struct tagWND_DRIVER TTYDRV_WND_Driver;
|
||||
|
||||
typedef struct tagTTYDRV_WND_DATA {
|
||||
#ifdef HAVE_LIBCURSES
|
||||
WINDOW *window;
|
||||
#else /* defined(HAVE_LIBCURSES) */
|
||||
int dummy; /* FIXME: Remove later */
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
} TTYDRV_WND_DATA;
|
||||
|
||||
#ifdef HAVE_LIBCURSES
|
||||
WINDOW *TTYDRV_WND_GetCursesWindow(struct tagWND *wndPtr);
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
|
||||
extern void TTYDRV_WND_Initialize(struct tagWND *wndPtr);
|
||||
extern void TTYDRV_WND_Finalize(struct tagWND *wndPtr);
|
||||
|
|
|
@ -20,13 +20,11 @@ DEFAULT_DEBUG_CHANNEL(ttydrv)
|
|||
*
|
||||
* Return the Curses window associated to a window.
|
||||
*/
|
||||
#ifdef HAVE_LIBCURSES
|
||||
WINDOW *TTYDRV_WND_GetCursesWindow(WND *wndPtr)
|
||||
{
|
||||
return wndPtr && wndPtr->pDriverData ?
|
||||
((TTYDRV_WND_DATA *) wndPtr->pDriverData)->window : 0;
|
||||
}
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
|
||||
/**********************************************************************
|
||||
* TTYDRV_WND_Initialize
|
||||
|
@ -40,9 +38,7 @@ void TTYDRV_WND_Initialize(WND *wndPtr)
|
|||
|
||||
wndPtr->pDriverData = (void *) pWndDriverData;
|
||||
|
||||
#ifdef HAVE_LIBCURSES
|
||||
pWndDriverData->window = NULL;
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -60,11 +56,9 @@ void TTYDRV_WND_Finalize(WND *wndPtr)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBCURSES
|
||||
if(pWndDriverData->window) {
|
||||
ERR("WND destroyed without destroying the associated Curses Windows");
|
||||
}
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
|
||||
HeapFree(SystemHeap, 0, pWndDriverData);
|
||||
wndPtr->pDriverData = NULL;
|
||||
|
@ -82,10 +76,7 @@ BOOL TTYDRV_WND_CreateDesktopWindow(WND *wndPtr, CLASS *classPtr, BOOL bUnicode)
|
|||
|
||||
if(!pWndDriverData) { ERR("WND never initialized\n"); return FALSE; }
|
||||
|
||||
#ifdef HAVE_LIBCURSES
|
||||
pWndDriverData->window = TTYDRV_WND_GetCursesRootWindow(wndPtr);
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
|
||||
pWndDriverData->window = TTYDRV_GetRootWindow();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -94,8 +85,8 @@ BOOL TTYDRV_WND_CreateDesktopWindow(WND *wndPtr, CLASS *classPtr, BOOL bUnicode)
|
|||
*/
|
||||
BOOL TTYDRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BOOL bUnicode)
|
||||
{
|
||||
#ifdef HAVE_LIBCURSES
|
||||
WINDOW *window, *rootWindow;
|
||||
#ifdef WINE_CURSES
|
||||
WINDOW *window;
|
||||
INT cellWidth=8, cellHeight=8; /* FIXME: Hardcoded */
|
||||
|
||||
TRACE("(%p, %p, %p, %d)\n", wndPtr, classPtr, cs, bUnicode);
|
||||
|
@ -104,20 +95,17 @@ BOOL TTYDRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BO
|
|||
if(cs->style & WS_CHILD)
|
||||
return TRUE;
|
||||
|
||||
if(!(rootWindow = TTYDRV_WND_GetCursesRootWindow(wndPtr)))
|
||||
return FALSE;
|
||||
|
||||
window = subwin(rootWindow, cs->cy/cellHeight, cs->cx/cellWidth,
|
||||
window = subwin(TTYDRV_GetRootWindow(), cs->cy/cellHeight, cs->cx/cellWidth,
|
||||
cs->y/cellHeight, cs->x/cellWidth);
|
||||
werase(window);
|
||||
wrefresh(window);
|
||||
|
||||
return TRUE;
|
||||
#else /* defined(HAVE_LIBCURSES) */
|
||||
#else /* defined(WINE_CURSES) */
|
||||
FIXME("(%p, %p, %p, %d): stub\n", wndPtr, classPtr, cs, bUnicode);
|
||||
|
||||
return TRUE;
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
#endif /* defined(WINE_CURSES) */
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -125,22 +113,22 @@ BOOL TTYDRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BO
|
|||
*/
|
||||
BOOL TTYDRV_WND_DestroyWindow(WND *wndPtr)
|
||||
{
|
||||
#ifdef HAVE_LIBCURSES
|
||||
#ifdef WINE_CURSES
|
||||
WINDOW *window;
|
||||
|
||||
TRACE("(%p)\n", wndPtr);
|
||||
|
||||
window = TTYDRV_WND_GetCursesWindow(wndPtr);
|
||||
if(window && window != TTYDRV_WND_GetCursesRootWindow(wndPtr)) {
|
||||
if(window && window != TTYDRV_GetRootWindow()) {
|
||||
delwin(window);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
#else /* defined(HAVE_LIBCURSES) */
|
||||
#else /* defined(WINE_CURSES) */
|
||||
FIXME("(%p): stub\n", wndPtr);
|
||||
|
||||
return TRUE;
|
||||
#endif /* defined(HAVE_LIBCURSES) */
|
||||
#endif /* defined(WINE_CURSES) */
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
|
|
Loading…
Reference in New Issue