Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_win32window.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 | 237b1eb53e4d 0c39b36dd104 |
comparison
equal
deleted
inserted
replaced
4464:fa77a6429698 | 4465:3e69e077cb95 |
---|---|
70 //printf("SHFullscreen(%i)\n",dwState); | 70 //printf("SHFullscreen(%i)\n",dwState); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 #endif | 74 #endif |
75 | |
76 extern HCTX *g_hCtx; /* the table of tablet event contexts, each windows has to have it's own tablet context */ | |
77 static Uint32 highestId = 0; /* the highest id of the tablet context */ | |
78 | 75 |
79 /* Fake window to help with DirectInput events. */ | 76 /* Fake window to help with DirectInput events. */ |
80 HWND SDL_HelperWindow = NULL; | 77 HWND SDL_HelperWindow = NULL; |
81 static WCHAR *SDL_HelperWindowClassName = TEXT("SDLHelperWindowInputCatcher"); | 78 static WCHAR *SDL_HelperWindowClassName = TEXT("SDLHelperWindowInputCatcher"); |
82 static WCHAR *SDL_HelperWindowName = TEXT("SDLHelperWindowInputMsgWindow"); | 79 static WCHAR *SDL_HelperWindowName = TEXT("SDLHelperWindowInputMsgWindow"); |
163 } else { | 160 } else { |
164 window->flags &= ~SDL_WINDOW_MINIMIZED; | 161 window->flags &= ~SDL_WINDOW_MINIMIZED; |
165 } | 162 } |
166 } | 163 } |
167 if (GetFocus() == hwnd) { | 164 if (GetFocus() == hwnd) { |
168 int index = data->videodata->keyboard; | |
169 window->flags |= SDL_WINDOW_INPUT_FOCUS; | 165 window->flags |= SDL_WINDOW_INPUT_FOCUS; |
170 SDL_SetKeyboardFocus(index, data->window); | 166 SDL_SetKeyboardFocus(data->window); |
171 | 167 |
172 if (window->flags & SDL_WINDOW_INPUT_GRABBED) { | 168 if (window->flags & SDL_WINDOW_INPUT_GRABBED) { |
173 RECT rect; | 169 RECT rect; |
174 GetClientRect(hwnd, &rect); | 170 GetClientRect(hwnd, &rect); |
175 ClientToScreen(hwnd, (LPPOINT) & rect); | 171 ClientToScreen(hwnd, (LPPOINT) & rect); |
184 } | 180 } |
185 | 181 |
186 int | 182 int |
187 WIN_CreateWindow(_THIS, SDL_Window * window) | 183 WIN_CreateWindow(_THIS, SDL_Window * window) |
188 { | 184 { |
189 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; | |
190 SDL_VideoDisplay *display = window->display; | 185 SDL_VideoDisplay *display = window->display; |
191 RAWINPUTDEVICE Rid; | |
192 AXIS TabX, TabY; | |
193 LOGCONTEXTA lc; | |
194 HWND hwnd; | 186 HWND hwnd; |
195 HWND top; | 187 HWND top; |
196 RECT rect; | 188 RECT rect; |
197 SDL_Rect bounds; | 189 SDL_Rect bounds; |
198 DWORD style = (WS_CLIPSIBLINGS | WS_CLIPCHILDREN); | 190 DWORD style = (WS_CLIPSIBLINGS | WS_CLIPCHILDREN); |
254 SDL_Instance, NULL); | 246 SDL_Instance, NULL); |
255 if (!hwnd) { | 247 if (!hwnd) { |
256 WIN_SetError("Couldn't create window"); | 248 WIN_SetError("Couldn't create window"); |
257 return -1; | 249 return -1; |
258 } | 250 } |
259 | |
260 /* we're configuring the tablet data. See Wintab reference for more info */ | |
261 if (videodata->wintabDLL | |
262 && videodata->WTInfoA(WTI_DEFSYSCTX, 0, &lc) != 0) { | |
263 lc.lcPktData = PACKETDATA; | |
264 lc.lcPktMode = PACKETMODE; | |
265 lc.lcOptions |= CXO_MESSAGES; | |
266 lc.lcOptions |= CXO_SYSTEM; | |
267 lc.lcMoveMask = PACKETDATA; | |
268 lc.lcBtnDnMask = lc.lcBtnUpMask = PACKETDATA; | |
269 videodata->WTInfoA(WTI_DEVICES, DVC_X, &TabX); | |
270 videodata->WTInfoA(WTI_DEVICES, DVC_Y, &TabY); | |
271 lc.lcInOrgX = 0; | |
272 lc.lcInOrgY = 0; | |
273 lc.lcInExtX = TabX.axMax; | |
274 lc.lcInExtY = TabY.axMax; | |
275 lc.lcOutOrgX = 0; | |
276 lc.lcOutOrgY = 0; | |
277 lc.lcOutExtX = GetSystemMetrics(SM_CXSCREEN); | |
278 lc.lcOutExtY = -GetSystemMetrics(SM_CYSCREEN); | |
279 if (window->id > highestId) { | |
280 HCTX *tmp_hctx; | |
281 highestId = window->id; | |
282 tmp_hctx = | |
283 (HCTX *) SDL_realloc(g_hCtx, (highestId + 1) * sizeof(HCTX)); | |
284 if (!tmp_hctx) { | |
285 SDL_OutOfMemory(); | |
286 DestroyWindow(hwnd); | |
287 return -1; | |
288 } | |
289 g_hCtx = tmp_hctx; | |
290 } | |
291 g_hCtx[window->id] = videodata->WTOpenA(hwnd, &lc, TRUE); | |
292 } | |
293 #ifndef _WIN32_WCE /* has no RawInput */ | |
294 /* we're telling the window, we want it to report raw input events from mice */ | |
295 Rid.usUsagePage = 0x01; | |
296 Rid.usUsage = 0x02; | |
297 Rid.dwFlags = RIDEV_INPUTSINK; | |
298 Rid.hwndTarget = hwnd; | |
299 RegisterRawInputDevices(&Rid, 1, sizeof(Rid)); | |
300 #endif | |
301 | 251 |
302 WIN_PumpEvents(_this); | 252 WIN_PumpEvents(_this); |
303 | 253 |
304 if (SetupWindowData(_this, window, hwnd, SDL_TRUE) < 0) { | 254 if (SetupWindowData(_this, window, hwnd, SDL_TRUE) < 0) { |
305 DestroyWindow(hwnd); | 255 DestroyWindow(hwnd); |
618 } | 568 } |
619 | 569 |
620 void | 570 void |
621 WIN_DestroyWindow(_THIS, SDL_Window * window) | 571 WIN_DestroyWindow(_THIS, SDL_Window * window) |
622 { | 572 { |
623 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; | |
624 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; | 573 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; |
625 | 574 |
626 if (data) { | 575 if (data) { |
627 ReleaseDC(data->hwnd, data->hdc); | 576 ReleaseDC(data->hwnd, data->hdc); |
628 if (data->created) { | 577 if (data->created) { |
629 if (videodata->wintabDLL) { | |
630 videodata->WTClose(g_hCtx[window->id]); | |
631 } | |
632 DestroyWindow(data->hwnd); | 578 DestroyWindow(data->hwnd); |
633 } | 579 } |
634 SDL_free(data); | 580 SDL_free(data); |
635 } | 581 } |
636 } | 582 } |