comparison src/video/win32/SDL_win32video.c @ 4465:3e69e077cb95

Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API. Plus, this lets me start implementing cursor support.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 09 May 2010 20:47:22 -0700
parents f7b03b6838cb
children eff4e88cc1e8 5284a3b3217a
comparison
equal deleted inserted replaced
4464:fa77a6429698 4465:3e69e077cb95
33 33
34 /* Initialization/Query functions */ 34 /* Initialization/Query functions */
35 static int WIN_VideoInit(_THIS); 35 static int WIN_VideoInit(_THIS);
36 static void WIN_VideoQuit(_THIS); 36 static void WIN_VideoQuit(_THIS);
37 37
38 int total_mice = 0; /* total mouse count */
39 HANDLE *mice = NULL; /* the handles to the detected mice */
40 HCTX *g_hCtx = NULL; /* handles to tablet contexts */
41 int tablet = -1; /* we're assuming that there is no tablet */
42
43 /* WIN32 driver bootstrap functions */ 38 /* WIN32 driver bootstrap functions */
44 39
45 static int 40 static int
46 WIN_Available(void) 41 WIN_Available(void)
47 { 42 {
64 if (data->ddraw) { 59 if (data->ddraw) {
65 data->ddraw->lpVtbl->Release(data->ddraw); 60 data->ddraw->lpVtbl->Release(data->ddraw);
66 FreeLibrary(data->ddrawDLL); 61 FreeLibrary(data->ddrawDLL);
67 } 62 }
68 #endif 63 #endif
69 if (data->wintabDLL) {
70 FreeLibrary(data->wintabDLL);
71 }
72 SDL_free(device->driverdata); 64 SDL_free(device->driverdata);
73 SDL_free(device); 65 SDL_free(device);
74 } 66 }
75 67
76 static SDL_VideoDevice * 68 static SDL_VideoDevice *
83 75
84 /* Initialize all variables that we clean on shutdown */ 76 /* Initialize all variables that we clean on shutdown */
85 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); 77 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
86 if (device) { 78 if (device) {
87 data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); 79 data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
88 } 80 } else {
89 if (!device || !data) { 81 data = NULL;
82 }
83 if (!data) {
90 SDL_OutOfMemory(); 84 SDL_OutOfMemory();
91 if (device) { 85 if (device) {
92 SDL_free(device); 86 SDL_free(device);
93 } 87 }
94 return NULL; 88 return NULL;
128 data->ddrawDLL = NULL; 122 data->ddrawDLL = NULL;
129 data->ddraw = NULL; 123 data->ddraw = NULL;
130 } 124 }
131 } 125 }
132 #endif /* SDL_VIDEO_RENDER_DDRAW */ 126 #endif /* SDL_VIDEO_RENDER_DDRAW */
133
134 data->wintabDLL = LoadLibrary(TEXT("WINTAB32.DLL"));
135 if (data->wintabDLL) {
136 #define PROCNAME(X) #X
137 data->WTInfoA =
138 (UINT(*)(UINT, UINT, LPVOID)) GetProcAddress(data->wintabDLL,
139 PROCNAME(WTInfoA));
140 data->WTOpenA =
141 (HCTX(*)(HWND, LPLOGCONTEXTA, BOOL)) GetProcAddress(data->
142 wintabDLL,
143 PROCNAME
144 (WTOpenA));
145 data->WTPacket =
146 (int (*)(HCTX, UINT, LPVOID)) GetProcAddress(data->wintabDLL,
147 PROCNAME(WTPacket));
148 data->WTClose =
149 (BOOL(*)(HCTX)) GetProcAddress(data->wintabDLL,
150 PROCNAME(WTClose));
151 #undef PROCNAME
152
153 if (!data->WTInfoA || !data->WTOpenA || !data->WTPacket
154 || !data->WTClose) {
155 FreeLibrary(data->wintabDLL);
156 data->wintabDLL = NULL;
157 }
158 }
159 127
160 /* Set the function pointers */ 128 /* Set the function pointers */
161 device->VideoInit = WIN_VideoInit; 129 device->VideoInit = WIN_VideoInit;
162 device->VideoQuit = WIN_VideoQuit; 130 device->VideoQuit = WIN_VideoQuit;
163 device->GetDisplayBounds = WIN_GetDisplayBounds; 131 device->GetDisplayBounds = WIN_GetDisplayBounds;
223 #endif 191 #endif
224 #if SDL_VIDEO_RENDER_GAPI 192 #if SDL_VIDEO_RENDER_GAPI
225 GAPI_AddRenderDriver(_this); 193 GAPI_AddRenderDriver(_this);
226 #endif 194 #endif
227 195
228 g_hCtx = SDL_malloc(sizeof(HCTX));
229 WIN_InitKeyboard(_this); 196 WIN_InitKeyboard(_this);
230 WIN_InitMouse(_this); 197 WIN_InitMouse(_this);
231 198
232 return 0; 199 return 0;
233 } 200 }
236 WIN_VideoQuit(_THIS) 203 WIN_VideoQuit(_THIS)
237 { 204 {
238 WIN_QuitModes(_this); 205 WIN_QuitModes(_this);
239 WIN_QuitKeyboard(_this); 206 WIN_QuitKeyboard(_this);
240 WIN_QuitMouse(_this); 207 WIN_QuitMouse(_this);
241 SDL_free(g_hCtx);
242 } 208 }
243 209
244 /* vim: set ts=4 sw=4 expandtab: */ 210 /* vim: set ts=4 sw=4 expandtab: */