2 * TTYDRV initialization code
10 #include "wine/winbase16.h"
11 #include "clipboard.h"
17 #include "debugtools.h"
20 DEFAULT_DEBUG_CHANNEL(ttydrv);
22 static USER_DRIVER user_driver =
25 TTYDRV_EVENT_Synchronize,
26 TTYDRV_EVENT_CheckFocus,
27 TTYDRV_EVENT_UserRepaintDisable,
28 /* keyboard functions */
30 TTYDRV_KEYBOARD_VkKeyScan,
31 TTYDRV_KEYBOARD_MapVirtualKey,
32 TTYDRV_KEYBOARD_GetKeyNameText,
33 TTYDRV_KEYBOARD_ToAscii,
34 TTYDRV_KEYBOARD_GetBeepActive,
35 TTYDRV_KEYBOARD_SetBeepActive,
37 TTYDRV_KEYBOARD_GetDIState,
38 TTYDRV_KEYBOARD_GetDIData,
39 TTYDRV_KEYBOARD_GetKeyboardConfig,
40 TTYDRV_KEYBOARD_SetKeyboardConfig,
43 TTYDRV_MOUSE_SetCursor,
44 TTYDRV_MOUSE_MoveCursor,
45 /* screen saver functions */
46 TTYDRV_GetScreenSaveActive,
47 TTYDRV_SetScreenSaveActive,
48 TTYDRV_GetScreenSaveTimeout,
49 TTYDRV_SetScreenSaveTimeout,
50 /* windowing functions */
59 /***********************************************************************
60 * TTYDRV process initialisation routine
62 static void process_attach(void)
66 USER_Driver = &user_driver;
67 CLIPBOARD_Driver = &TTYDRV_CLIPBOARD_Driver;
68 WND_Driver = &TTYDRV_WND_Driver;
71 if ((root_window = initscr()))
74 wrefresh(root_window);
76 getmaxyx(root_window, rows, cols);
77 #else /* WINE_CURSES */
78 rows = 60; /* FIXME: Hardcoded */
79 cols = 80; /* FIXME: Hardcoded */
80 #endif /* WINE_CURSES */
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();
90 /* load display.dll */
91 LoadLibrary16( "display" );
95 /***********************************************************************
96 * TTYDRV process termination routine
98 static void process_detach(void)
100 TTYDRV_GDI_Finalize();
103 if (root_window) endwin();
104 #endif /* WINE_CURSES */
107 CLIPBOARD_Driver = NULL;
112 /***********************************************************************
113 * TTYDRV initialisation routine
115 BOOL WINAPI TTYDRV_Init( HINSTANCE hinst, DWORD reason, LPVOID reserved )
117 static int process_count;
121 case DLL_PROCESS_ATTACH:
122 if (!process_count++) process_attach();
125 case DLL_PROCESS_DETACH:
126 if (!--process_count) process_detach();
133 /***********************************************************************
134 * TTYDRV_GetScreenSaveActive
136 * Returns the active status of the screen saver
138 BOOL TTYDRV_GetScreenSaveActive(void)
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)
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)