Fixed opening of some drivers.
[wine.git] / dlls / ttydrv / ttydrv_main.c
blobbdaa005497c77f5a6e8675cc6185e7db0220f60f
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 "gdi.h"
12 #include "message.h"
13 #include "user.h"
14 #include "win.h"
15 #include "debugtools.h"
16 #include "ttydrv.h"
18 DEFAULT_DEBUG_CHANNEL(ttydrv);
20 int cell_width = 8;
21 int cell_height = 8;
22 int screen_rows = 50; /* default value */
23 int screen_cols = 80; /* default value */
24 WINDOW *root_window;
27 /***********************************************************************
28 * TTYDRV process initialisation routine
30 static void process_attach(void)
32 WND_Driver = &TTYDRV_WND_Driver;
34 #ifdef WINE_CURSES
35 if ((root_window = initscr()))
37 werase(root_window);
38 wrefresh(root_window);
40 getmaxyx(root_window, screen_rows, screen_cols);
41 #endif /* WINE_CURSES */
43 TTYDRV_GDI_Initialize();
45 /* load display.dll */
46 LoadLibrary16( "display" );
50 /***********************************************************************
51 * TTYDRV process termination routine
53 static void process_detach(void)
55 TTYDRV_GDI_Finalize();
57 #ifdef WINE_CURSES
58 if (root_window) endwin();
59 #endif /* WINE_CURSES */
61 WND_Driver = NULL;
65 /***********************************************************************
66 * TTYDRV initialisation routine
68 BOOL WINAPI TTYDRV_Init( HINSTANCE hinst, DWORD reason, LPVOID reserved )
70 switch(reason)
72 case DLL_PROCESS_ATTACH:
73 process_attach();
74 break;
76 case DLL_PROCESS_DETACH:
77 process_detach();
78 break;
80 return TRUE;