4 * Copyright 1998,1999 Patrik Stridvall
10 #include "debugtools.h"
16 DEFAULT_DEBUG_CHANNEL(ttydrv)
18 /***********************************************************************
19 * TTYDRV_MONITOR_GetCursesRootWindow
21 * Return the Curses root window associated to the MONITOR.
24 WINDOW *TTYDRV_MONITOR_GetCursesRootWindow(MONITOR *pMonitor)
26 TTYDRV_MONITOR_DATA *pTTYMonitor =
27 (TTYDRV_MONITOR_DATA *) pMonitor->pDriverData;
29 return pTTYMonitor->rootWindow;
31 #endif /* defined(HAVE_LIBCURSES) */
33 /***********************************************************************
34 * TTYDRV_MONITOR_GetCellWidth
36 INT TTYDRV_MONITOR_GetCellWidth(MONITOR *pMonitor)
38 TTYDRV_MONITOR_DATA *pTTYMonitor =
39 (TTYDRV_MONITOR_DATA *) pMonitor->pDriverData;
41 return pTTYMonitor->cellWidth;
44 /***********************************************************************
45 * TTYDRV_MONITOR_GetCellHeight
47 INT TTYDRV_MONITOR_GetCellHeight(MONITOR *pMonitor)
49 TTYDRV_MONITOR_DATA *pTTYMonitor =
50 (TTYDRV_MONITOR_DATA *) pMonitor->pDriverData;
52 return pTTYMonitor->cellHeight;
55 /***********************************************************************
56 * TTYDRV_MONITOR_Initialize
58 void TTYDRV_MONITOR_Initialize(MONITOR *pMonitor)
60 TTYDRV_MONITOR_DATA *pTTYMonitor = (TTYDRV_MONITOR_DATA *)
61 HeapAlloc(SystemHeap, 0, sizeof(TTYDRV_MONITOR_DATA));
64 pMonitor->pDriverData = pTTYMonitor;
66 pTTYMonitor->cellWidth = 8;
67 pTTYMonitor->cellHeight = 8;
70 pTTYMonitor->rootWindow = initscr();
71 if(pTTYMonitor->rootWindow) {
72 werase(pTTYMonitor->rootWindow);
73 wrefresh(pTTYMonitor->rootWindow);
76 getmaxyx(pTTYMonitor->rootWindow, rows, cols);
77 #else /* defined(HAVE_LIBCURSES) */
78 rows = 60; /* FIXME: Hardcoded */
79 cols = 80; /* FIXME: Hardcoded */
80 #endif /* defined(HAVE_LIBCURSES) */
82 pTTYMonitor->width = pTTYMonitor->cellWidth*cols;
83 pTTYMonitor->height = pTTYMonitor->cellWidth*rows;
84 pTTYMonitor->depth = 1;
87 /***********************************************************************
88 * TTYDRV_MONITOR_Finalize
90 void TTYDRV_MONITOR_Finalize(MONITOR *pMonitor)
92 TTYDRV_MONITOR_DATA *pTTYMonitor =
93 (TTYDRV_MONITOR_DATA *) pMonitor->pDriverData;
96 if(pTTYMonitor->rootWindow) {
99 #endif /* defined(HAVE_LIBCURSES) */
101 HeapFree(SystemHeap, 0, pTTYMonitor);
104 /***********************************************************************
105 * TTYDRV_MONITOR_IsSingleWindow
107 BOOL TTYDRV_MONITOR_IsSingleWindow(MONITOR *pMonitor)
112 /***********************************************************************
113 * TTYDRV_MONITOR_GetWidth
115 * Return the width of the monitor
117 int TTYDRV_MONITOR_GetWidth(MONITOR *pMonitor)
119 TTYDRV_MONITOR_DATA *pTTYMonitor =
120 (TTYDRV_MONITOR_DATA *) pMonitor->pDriverData;
122 return pTTYMonitor->width;
125 /***********************************************************************
126 * TTYDRV_MONITOR_GetHeight
128 * Return the height of the monitor
130 int TTYDRV_MONITOR_GetHeight(MONITOR *pMonitor)
132 TTYDRV_MONITOR_DATA *pTTYMonitor =
133 (TTYDRV_MONITOR_DATA *) pMonitor->pDriverData;
135 return pTTYMonitor->height;
138 /***********************************************************************
139 * TTYDRV_MONITOR_GetDepth
141 * Return the depth of the monitor
143 int TTYDRV_MONITOR_GetDepth(MONITOR *pMonitor)
145 TTYDRV_MONITOR_DATA *pTTYMonitor =
146 (TTYDRV_MONITOR_DATA *) pMonitor->pDriverData;
148 return pTTYMonitor->depth;
151 /***********************************************************************
152 * TTYDRV_MONITOR_GetScreenSaveActive
154 * Returns the active status of the screen saver
156 BOOL TTYDRV_MONITOR_GetScreenSaveActive(MONITOR *pMonitor)
161 /***********************************************************************
162 * TTYDRV_MONITOR_SetScreenSaveActive
164 * Activate/Deactivate the screen saver
166 void TTYDRV_MONITOR_SetScreenSaveActive(MONITOR *pMonitor, BOOL bActivate)
168 FIXME("(%p, %d): stub\n", pMonitor, bActivate);
171 /***********************************************************************
172 * TTYDRV_MONITOR_GetScreenSaveTimeout
174 * Return the screen saver timeout
176 int TTYDRV_MONITOR_GetScreenSaveTimeout(MONITOR *pMonitor)
181 /***********************************************************************
182 * TTYDRV_MONITOR_SetScreenSaveTimeout
184 * Set the screen saver timeout
186 void TTYDRV_MONITOR_SetScreenSaveTimeout(
187 MONITOR *pMonitor, int nTimeout)
189 FIXME("(%p, %d): stub\n", pMonitor, nTimeout);