Fixed some warnings.
[wine.git] / dlls / ttydrv / ttydrv_main.c
blob665bd90dc10ed9f357ccf9011b6ce04800461c63
1 /*
2 * TTYDRV initialization code
3 */
5 #include "config.h"
7 #include <stdio.h>
9 #include "winbase.h"
10 #include "clipboard.h"
11 #include "gdi.h"
12 #include "message.h"
13 #include "monitor.h"
14 #include "mouse.h"
15 #include "ttydrv.h"
16 #include "user.h"
17 #include "win.h"
18 #include "debugtools.h"
20 DEFAULT_DEBUG_CHANNEL(ttydrv);
22 static USER_DRIVER user_driver =
24 /* event functions */
25 TTYDRV_EVENT_Synchronize,
26 TTYDRV_EVENT_CheckFocus,
27 TTYDRV_EVENT_UserRepaintDisable,
28 /* keyboard functions */
29 TTYDRV_KEYBOARD_Init,
30 TTYDRV_KEYBOARD_VkKeyScan,
31 TTYDRV_KEYBOARD_MapVirtualKey,
32 TTYDRV_KEYBOARD_GetKeyNameText,
33 TTYDRV_KEYBOARD_ToAscii,
34 TTYDRV_KEYBOARD_GetBeepActive,
35 TTYDRV_KEYBOARD_SetBeepActive,
36 TTYDRV_KEYBOARD_Beep,
37 TTYDRV_KEYBOARD_GetDIState,
38 TTYDRV_KEYBOARD_GetDIData,
39 TTYDRV_KEYBOARD_GetKeyboardConfig,
40 TTYDRV_KEYBOARD_SetKeyboardConfig,
41 /* mouse functions */
42 TTYDRV_MOUSE_Init,
43 TTYDRV_MOUSE_SetCursor,
44 TTYDRV_MOUSE_MoveCursor,
45 TTYDRV_MOUSE_EnableWarpPointer,
46 /* screen saver functions */
47 TTYDRV_GetScreenSaveActive,
48 TTYDRV_SetScreenSaveActive,
49 TTYDRV_GetScreenSaveTimeout,
50 TTYDRV_SetScreenSaveTimeout,
51 /* windowing functions */
52 TTYDRV_IsSingleWindow
55 int cell_width = 8;
56 int cell_height = 8;
57 #ifdef HAVE_LIBCURSES
58 WINDOW *root_window;
59 #endif /* defined(HAVE_LIBCURSES) */
62 /***********************************************************************
63 * TTYDRV process initialisation routine
65 static void process_attach(void)
67 int rows, cols;
69 USER_Driver = &user_driver;
70 CLIPBOARD_Driver = &TTYDRV_CLIPBOARD_Driver;
71 WND_Driver = &TTYDRV_WND_Driver;
73 #ifdef HAVE_LIBCURSES
74 if ((root_window = initscr()))
76 werase(root_window);
77 wrefresh(root_window);
79 getmaxyx(root_window, rows, cols);
80 #else /* defined(HAVE_LIBCURSES) */
81 rows = 60; /* FIXME: Hardcoded */
82 cols = 80; /* FIXME: Hardcoded */
83 #endif /* defined(HAVE_LIBCURSES) */
85 MONITOR_PrimaryMonitor.rect.left = 0;
86 MONITOR_PrimaryMonitor.rect.top = 0;
87 MONITOR_PrimaryMonitor.rect.right = cell_width * cols;
88 MONITOR_PrimaryMonitor.rect.bottom = cell_height * rows;
89 MONITOR_PrimaryMonitor.depth = 1;
91 TTYDRV_GDI_Initialize();
95 /***********************************************************************
96 * TTYDRV process termination routine
98 static void process_detach(void)
100 TTYDRV_GDI_Finalize();
102 #ifdef HAVE_LIBCURSES
103 if (root_window) endwin();
104 #endif /* defined(HAVE_LIBCURSES) */
106 USER_Driver = NULL;
107 CLIPBOARD_Driver = NULL;
108 WND_Driver = NULL;
112 /***********************************************************************
113 * TTYDRV initialisation routine
115 BOOL WINAPI TTYDRV_Init( HINSTANCE hinst, DWORD reason, LPVOID reserved )
117 static int process_count;
119 switch(reason)
121 case DLL_PROCESS_ATTACH:
122 if (!process_count++) process_attach();
123 break;
125 case DLL_PROCESS_DETACH:
126 if (!--process_count) process_detach();
127 break;
129 return TRUE;
133 /***********************************************************************
134 * TTYDRV_GetScreenSaveActive
136 * Returns the active status of the screen saver
138 BOOL TTYDRV_GetScreenSaveActive(void)
140 return FALSE;
143 /***********************************************************************
144 * TTYDRV_SetScreenSaveActive
146 * Activate/Deactivate the screen saver
148 void TTYDRV_SetScreenSaveActive(BOOL bActivate)
150 FIXME("(%d): stub\n", bActivate);
153 /***********************************************************************
154 * TTYDRV_GetScreenSaveTimeout
156 * Return the screen saver timeout
158 int TTYDRV_GetScreenSaveTimeout(void)
160 return 0;
163 /***********************************************************************
164 * TTYDRV_SetScreenSaveTimeout
166 * Set the screen saver timeout
168 void TTYDRV_SetScreenSaveTimeout(int nTimeout)
170 FIXME("(%d): stub\n", nTimeout);
173 /***********************************************************************
174 * TTYDRV_IsSingleWindow
176 BOOL TTYDRV_IsSingleWindow(void)
178 return TRUE;