Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_win32window.c @ 2726:f23ebf1ddac4
Dynamically load wintab32.dll
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 26 Aug 2008 06:03:48 +0000 |
parents | 0e2b65f32298 |
children | 2768bd7281e0 |
comparison
equal
deleted
inserted
replaced
2725:6ce6d56b63bf | 2726:f23ebf1ddac4 |
---|---|
146 } | 146 } |
147 | 147 |
148 int | 148 int |
149 WIN_CreateWindow(_THIS, SDL_Window * window) | 149 WIN_CreateWindow(_THIS, SDL_Window * window) |
150 { | 150 { |
151 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; | |
151 RAWINPUTDEVICE Rid; | 152 RAWINPUTDEVICE Rid; |
152 AXIS TabX, TabY; | 153 AXIS TabX, TabY; |
153 LOGCONTEXT lc; | 154 LOGCONTEXT lc; |
154 HWND hwnd; | 155 HWND hwnd; |
155 HWND top; | 156 HWND top; |
203 WIN_SetError("Couldn't create window"); | 204 WIN_SetError("Couldn't create window"); |
204 return -1; | 205 return -1; |
205 } | 206 } |
206 | 207 |
207 /* we're configuring the tablet data. See Wintab reference for more info */ | 208 /* we're configuring the tablet data. See Wintab reference for more info */ |
208 if (WTInfo(WTI_DEFSYSCTX, 0, &lc) != 0) { | 209 if (videodata->wintabDLL && videodata->WTInfo(WTI_DEFSYSCTX, 0, &lc) != 0) { |
209 lc.lcPktData = PACKETDATA; | 210 lc.lcPktData = PACKETDATA; |
210 lc.lcPktMode = PACKETMODE; | 211 lc.lcPktMode = PACKETMODE; |
211 lc.lcOptions |= CXO_MESSAGES; | 212 lc.lcOptions |= CXO_MESSAGES; |
212 lc.lcOptions |= CXO_SYSTEM; | 213 lc.lcOptions |= CXO_SYSTEM; |
213 lc.lcMoveMask = PACKETDATA; | 214 lc.lcMoveMask = PACKETDATA; |
214 lc.lcBtnDnMask = lc.lcBtnUpMask = PACKETDATA; | 215 lc.lcBtnDnMask = lc.lcBtnUpMask = PACKETDATA; |
215 WTInfo(WTI_DEVICES, DVC_X, &TabX); | 216 videodata->WTInfo(WTI_DEVICES, DVC_X, &TabX); |
216 WTInfo(WTI_DEVICES, DVC_Y, &TabY); | 217 videodata->WTInfo(WTI_DEVICES, DVC_Y, &TabY); |
217 lc.lcInOrgX = 0; | 218 lc.lcInOrgX = 0; |
218 lc.lcInOrgY = 0; | 219 lc.lcInOrgY = 0; |
219 lc.lcInExtX = TabX.axMax; | 220 lc.lcInExtX = TabX.axMax; |
220 lc.lcInExtY = TabY.axMax; | 221 lc.lcInExtY = TabY.axMax; |
221 lc.lcOutOrgX = 0; | 222 lc.lcOutOrgX = 0; |
232 DestroyWindow(hwnd); | 233 DestroyWindow(hwnd); |
233 return -1; | 234 return -1; |
234 } | 235 } |
235 g_hCtx = tmp_hctx; | 236 g_hCtx = tmp_hctx; |
236 } | 237 } |
237 g_hCtx[window->id] = WTOpen(hwnd, &lc, TRUE); | 238 g_hCtx[window->id] = videodata->WTOpen(hwnd, &lc, TRUE); |
238 } | 239 } |
239 | 240 |
240 /* we're telling the window, we want it to report raw input events from mice */ | 241 /* we're telling the window, we want it to report raw input events from mice */ |
241 Rid.usUsagePage = 0x01; | 242 Rid.usUsagePage = 0x01; |
242 Rid.usUsage = 0x02; | 243 Rid.usUsage = 0x02; |
436 } | 437 } |
437 | 438 |
438 void | 439 void |
439 WIN_DestroyWindow(_THIS, SDL_Window * window) | 440 WIN_DestroyWindow(_THIS, SDL_Window * window) |
440 { | 441 { |
442 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; | |
441 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; | 443 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; |
442 | 444 |
443 if (data) { | 445 if (data) { |
444 #ifdef SDL_VIDEO_OPENGL_WGL | 446 #ifdef SDL_VIDEO_OPENGL_WGL |
445 if (window->flags & SDL_WINDOW_OPENGL) { | 447 if (window->flags & SDL_WINDOW_OPENGL) { |
446 WIN_GL_CleanupWindow(_this, window); | 448 WIN_GL_CleanupWindow(_this, window); |
447 } | 449 } |
448 #endif | 450 #endif |
449 ReleaseDC(data->hwnd, data->hdc); | 451 ReleaseDC(data->hwnd, data->hdc); |
450 if (data->created) { | 452 if (data->created) { |
451 WTClose(g_hCtx[window->id]); | 453 if (videodata->wintabDLL) { |
454 videodata->WTClose(g_hCtx[window->id]); | |
455 } | |
452 DestroyWindow(data->hwnd); | 456 DestroyWindow(data->hwnd); |
453 } | 457 } |
454 SDL_free(data); | 458 SDL_free(data); |
455 } | 459 } |
456 } | 460 } |