Release 20000326.
[wine/gsoc-2012-control.git] / dlls / ttydrv / ttydrv_main.c
blobb65d6d8ba638a3a7652631ef2187e625a51cd9dd
1 /*
2 * TTYDRV initialization code
3 */
4 #include <stdio.h>
6 #include "winbase.h"
7 #include "clipboard.h"
8 #include "gdi.h"
9 #include "message.h"
10 #include "monitor.h"
11 #include "mouse.h"
12 #include "ttydrv.h"
13 #include "user.h"
14 #include "win.h"
15 #include "debugtools.h"
17 DEFAULT_DEBUG_CHANNEL(ttydrv);
19 static USER_DRIVER user_driver =
21 /* event functions */
22 TTYDRV_EVENT_Synchronize,
23 TTYDRV_EVENT_CheckFocus,
24 TTYDRV_EVENT_UserRepaintDisable,
25 /* keyboard functions */
26 TTYDRV_KEYBOARD_Init,
27 TTYDRV_KEYBOARD_VkKeyScan,
28 TTYDRV_KEYBOARD_MapVirtualKey,
29 TTYDRV_KEYBOARD_GetKeyNameText,
30 TTYDRV_KEYBOARD_ToAscii,
31 TTYDRV_KEYBOARD_GetBeepActive,
32 TTYDRV_KEYBOARD_SetBeepActive,
33 TTYDRV_KEYBOARD_Beep,
34 TTYDRV_KEYBOARD_GetDIState,
35 TTYDRV_KEYBOARD_GetDIData,
36 TTYDRV_KEYBOARD_GetKeyboardConfig,
37 TTYDRV_KEYBOARD_SetKeyboardConfig,
38 /* mouse functions */
39 TTYDRV_MOUSE_Init,
40 TTYDRV_MOUSE_SetCursor,
41 TTYDRV_MOUSE_MoveCursor,
42 TTYDRV_MOUSE_EnableWarpPointer,
43 /* screen saver functions */
44 TTYDRV_GetScreenSaveActive,
45 TTYDRV_SetScreenSaveActive,
46 TTYDRV_GetScreenSaveTimeout,
47 TTYDRV_SetScreenSaveTimeout,
48 /* windowing functions */
49 TTYDRV_IsSingleWindow
52 int cell_width = 8;
53 int cell_height = 8;
54 #ifdef HAVE_LIBCURSES
55 WINDOW *root_window;
56 #endif /* defined(HAVE_LIBCURSES) */
59 /***********************************************************************
60 * TTYDRV process initialisation routine
62 static void process_attach(void)
64 int rows, cols;
66 USER_Driver = &user_driver;
67 CLIPBOARD_Driver = &TTYDRV_CLIPBOARD_Driver;
68 WND_Driver = &TTYDRV_WND_Driver;
70 #ifdef HAVE_LIBCURSES
71 if ((root_window = initscr()))
73 werase(root_window);
74 wrefresh(root_window);
76 getmaxyx(root_window, rows, cols);
77 #else /* defined(HAVE_LIBCURSES) */
78 rows = 60; /* FIXME: Hardcoded */
79 cols = 80; /* FIXME: Hardcoded */
80 #endif /* defined(HAVE_LIBCURSES) */
82 MONITOR_PrimaryMonitor.rect.left = 0;
83 MONITOR_PrimaryMonitor.rect.top = 0;
84 MONITOR_PrimaryMonitor.rect.right = cell_width * cols;
85 MONITOR_PrimaryMonitor.rect.bottom = cell_height * rows;
86 MONITOR_PrimaryMonitor.depth = 1;
88 TTYDRV_GDI_Initialize();
92 /***********************************************************************
93 * TTYDRV process termination routine
95 static void process_detach(void)
97 TTYDRV_GDI_Finalize();
99 #ifdef HAVE_LIBCURSES
100 if (root_window) endwin();
101 #endif /* defined(HAVE_LIBCURSES) */
103 USER_Driver = NULL;
104 CLIPBOARD_Driver = NULL;
105 WND_Driver = NULL;
109 /***********************************************************************
110 * TTYDRV initialisation routine
112 BOOL WINAPI TTYDRV_Init( HINSTANCE hinst, DWORD reason, LPVOID reserved )
114 static int process_count;
116 switch(reason)
118 case DLL_PROCESS_ATTACH:
119 if (!process_count++) process_attach();
120 break;
122 case DLL_PROCESS_DETACH:
123 if (!--process_count) process_detach();
124 break;
126 return TRUE;
130 /***********************************************************************
131 * TTYDRV_GetScreenSaveActive
133 * Returns the active status of the screen saver
135 BOOL TTYDRV_GetScreenSaveActive(void)
137 return FALSE;
140 /***********************************************************************
141 * TTYDRV_SetScreenSaveActive
143 * Activate/Deactivate the screen saver
145 void TTYDRV_SetScreenSaveActive(BOOL bActivate)
147 FIXME("(%d): stub\n", bActivate);
150 /***********************************************************************
151 * TTYDRV_GetScreenSaveTimeout
153 * Return the screen saver timeout
155 int TTYDRV_GetScreenSaveTimeout(void)
157 return 0;
160 /***********************************************************************
161 * TTYDRV_SetScreenSaveTimeout
163 * Set the screen saver timeout
165 void TTYDRV_SetScreenSaveTimeout(int nTimeout)
167 FIXME("(%d): stub\n", nTimeout);
170 /***********************************************************************
171 * TTYDRV_IsSingleWindow
173 BOOL TTYDRV_IsSingleWindow(void)
175 return TRUE;