Fixed warning.
[wine.git] / dlls / ttydrv / ttydrv_main.c
blob0c7f0560e2042029eee8e3366688e2e8e3c1367c
1 /*
2 * TTYDRV initialization code
3 */
5 #include "config.h"
7 #include <stdio.h>
9 #include "winbase.h"
10 #include "wine/winbase16.h"
11 #include "clipboard.h"
12 #include "gdi.h"
13 #include "message.h"
14 #include "monitor.h"
15 #include "mouse.h"
16 #include "user.h"
17 #include "win.h"
18 #include "debugtools.h"
19 #include "ttydrv.h"
21 DEFAULT_DEBUG_CHANNEL(ttydrv);
23 static USER_DRIVER user_driver =
25 /* event functions */
26 TTYDRV_EVENT_Synchronize,
27 TTYDRV_EVENT_CheckFocus,
28 TTYDRV_EVENT_UserRepaintDisable,
29 /* keyboard functions */
30 TTYDRV_KEYBOARD_Init,
31 TTYDRV_KEYBOARD_VkKeyScan,
32 TTYDRV_KEYBOARD_MapVirtualKey,
33 TTYDRV_KEYBOARD_GetKeyNameText,
34 TTYDRV_KEYBOARD_ToAscii,
35 TTYDRV_KEYBOARD_GetBeepActive,
36 TTYDRV_KEYBOARD_SetBeepActive,
37 TTYDRV_KEYBOARD_Beep,
38 TTYDRV_KEYBOARD_GetDIState,
39 TTYDRV_KEYBOARD_GetDIData,
40 TTYDRV_KEYBOARD_GetKeyboardConfig,
41 TTYDRV_KEYBOARD_SetKeyboardConfig,
42 /* mouse functions */
43 TTYDRV_MOUSE_Init,
44 TTYDRV_MOUSE_SetCursor,
45 TTYDRV_MOUSE_MoveCursor,
46 TTYDRV_MOUSE_EnableWarpPointer,
47 /* screen saver functions */
48 TTYDRV_GetScreenSaveActive,
49 TTYDRV_SetScreenSaveActive,
50 TTYDRV_GetScreenSaveTimeout,
51 TTYDRV_SetScreenSaveTimeout,
52 /* windowing functions */
53 TTYDRV_IsSingleWindow
56 int cell_width = 8;
57 int cell_height = 8;
58 WINDOW *root_window;
61 /***********************************************************************
62 * TTYDRV process initialisation routine
64 static void process_attach(void)
66 int rows, cols;
68 USER_Driver = &user_driver;
69 CLIPBOARD_Driver = &TTYDRV_CLIPBOARD_Driver;
70 WND_Driver = &TTYDRV_WND_Driver;
72 #ifdef WINE_CURSES
73 if ((root_window = initscr()))
75 werase(root_window);
76 wrefresh(root_window);
78 getmaxyx(root_window, rows, cols);
79 #else /* WINE_CURSES */
80 rows = 60; /* FIXME: Hardcoded */
81 cols = 80; /* FIXME: Hardcoded */
82 #endif /* WINE_CURSES */
84 MONITOR_PrimaryMonitor.rect.left = 0;
85 MONITOR_PrimaryMonitor.rect.top = 0;
86 MONITOR_PrimaryMonitor.rect.right = cell_width * cols;
87 MONITOR_PrimaryMonitor.rect.bottom = cell_height * rows;
88 MONITOR_PrimaryMonitor.depth = 1;
90 TTYDRV_GDI_Initialize();
92 /* load display.dll */
93 LoadLibrary16( "display" );
97 /***********************************************************************
98 * TTYDRV process termination routine
100 static void process_detach(void)
102 TTYDRV_GDI_Finalize();
104 #ifdef WINE_CURSES
105 if (root_window) endwin();
106 #endif /* WINE_CURSES */
108 USER_Driver = NULL;
109 CLIPBOARD_Driver = NULL;
110 WND_Driver = NULL;
114 /***********************************************************************
115 * TTYDRV initialisation routine
117 BOOL WINAPI TTYDRV_Init( HINSTANCE hinst, DWORD reason, LPVOID reserved )
119 static int process_count;
121 switch(reason)
123 case DLL_PROCESS_ATTACH:
124 if (!process_count++) process_attach();
125 break;
127 case DLL_PROCESS_DETACH:
128 if (!--process_count) process_detach();
129 break;
131 return TRUE;
135 /***********************************************************************
136 * TTYDRV_GetScreenSaveActive
138 * Returns the active status of the screen saver
140 BOOL TTYDRV_GetScreenSaveActive(void)
142 return FALSE;
145 /***********************************************************************
146 * TTYDRV_SetScreenSaveActive
148 * Activate/Deactivate the screen saver
150 void TTYDRV_SetScreenSaveActive(BOOL bActivate)
152 FIXME("(%d): stub\n", bActivate);
155 /***********************************************************************
156 * TTYDRV_GetScreenSaveTimeout
158 * Return the screen saver timeout
160 int TTYDRV_GetScreenSaveTimeout(void)
162 return 0;
165 /***********************************************************************
166 * TTYDRV_SetScreenSaveTimeout
168 * Set the screen saver timeout
170 void TTYDRV_SetScreenSaveTimeout(int nTimeout)
172 FIXME("(%d): stub\n", nTimeout);
175 /***********************************************************************
176 * TTYDRV_IsSingleWindow
178 BOOL TTYDRV_IsSingleWindow(void)
180 return TRUE;