Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_win32window.c @ 4746:0c39b36dd104
Merge
author | dewyatt |
---|---|
date | Tue, 06 Jul 2010 02:07:42 -0400 |
parents | 8568ebdb5f1f 3e69e077cb95 |
children | 0fa503d49cb4 |
comparison
equal
deleted
inserted
replaced
4745:0aaa54fbd2bc | 4746:0c39b36dd104 |
---|---|
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"); |
165 } else { | 162 } else { |
166 window->flags &= ~SDL_WINDOW_MINIMIZED; | 163 window->flags &= ~SDL_WINDOW_MINIMIZED; |
167 } | 164 } |
168 } | 165 } |
169 if (GetFocus() == hwnd) { | 166 if (GetFocus() == hwnd) { |
170 int index = data->videodata->keyboard; | |
171 window->flags |= SDL_WINDOW_INPUT_FOCUS; | 167 window->flags |= SDL_WINDOW_INPUT_FOCUS; |
172 SDL_SetKeyboardFocus(index, data->window); | 168 SDL_SetKeyboardFocus(data->window); |
173 | 169 |
174 if (window->flags & SDL_WINDOW_INPUT_GRABBED) { | 170 if (window->flags & SDL_WINDOW_INPUT_GRABBED) { |
175 RECT rect; | 171 RECT rect; |
176 GetClientRect(hwnd, &rect); | 172 GetClientRect(hwnd, &rect); |
177 ClientToScreen(hwnd, (LPPOINT) & rect); | 173 ClientToScreen(hwnd, (LPPOINT) & rect); |
186 } | 182 } |
187 | 183 |
188 int | 184 int |
189 WIN_CreateWindow(_THIS, SDL_Window * window) | 185 WIN_CreateWindow(_THIS, SDL_Window * window) |
190 { | 186 { |
191 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; | |
192 SDL_VideoDisplay *display = window->display; | 187 SDL_VideoDisplay *display = window->display; |
193 RAWINPUTDEVICE Rid; | |
194 AXIS TabX, TabY; | |
195 LOGCONTEXTA lc; | |
196 HWND hwnd; | 188 HWND hwnd; |
197 HWND top; | 189 HWND top; |
198 RECT rect; | 190 RECT rect; |
199 SDL_Rect bounds; | 191 SDL_Rect bounds; |
200 DWORD style = (WS_CLIPSIBLINGS | WS_CLIPCHILDREN); | 192 DWORD style = (WS_CLIPSIBLINGS | WS_CLIPCHILDREN); |
256 SDL_Instance, NULL); | 248 SDL_Instance, NULL); |
257 if (!hwnd) { | 249 if (!hwnd) { |
258 WIN_SetError("Couldn't create window"); | 250 WIN_SetError("Couldn't create window"); |
259 return -1; | 251 return -1; |
260 } | 252 } |
261 | |
262 /* we're configuring the tablet data. See Wintab reference for more info */ | |
263 if (videodata->wintabDLL | |
264 && videodata->WTInfoA(WTI_DEFSYSCTX, 0, &lc) != 0) { | |
265 lc.lcPktData = PACKETDATA; | |
266 lc.lcPktMode = PACKETMODE; | |
267 lc.lcOptions |= CXO_MESSAGES; | |
268 lc.lcOptions |= CXO_SYSTEM; | |
269 lc.lcMoveMask = PACKETDATA; | |
270 lc.lcBtnDnMask = lc.lcBtnUpMask = PACKETDATA; | |
271 videodata->WTInfoA(WTI_DEVICES, DVC_X, &TabX); | |
272 videodata->WTInfoA(WTI_DEVICES, DVC_Y, &TabY); | |
273 lc.lcInOrgX = 0; | |
274 lc.lcInOrgY = 0; | |
275 lc.lcInExtX = TabX.axMax; | |
276 lc.lcInExtY = TabY.axMax; | |
277 lc.lcOutOrgX = 0; | |
278 lc.lcOutOrgY = 0; | |
279 lc.lcOutExtX = GetSystemMetrics(SM_CXSCREEN); | |
280 lc.lcOutExtY = -GetSystemMetrics(SM_CYSCREEN); | |
281 if (window->id > highestId) { | |
282 HCTX *tmp_hctx; | |
283 highestId = window->id; | |
284 tmp_hctx = | |
285 (HCTX *) SDL_realloc(g_hCtx, (highestId + 1) * sizeof(HCTX)); | |
286 if (!tmp_hctx) { | |
287 SDL_OutOfMemory(); | |
288 DestroyWindow(hwnd); | |
289 return -1; | |
290 } | |
291 g_hCtx = tmp_hctx; | |
292 } | |
293 g_hCtx[window->id] = videodata->WTOpenA(hwnd, &lc, TRUE); | |
294 } | |
295 #ifndef _WIN32_WCE /* has no RawInput */ | |
296 /* we're telling the window, we want it to report raw input events from mice */ | |
297 Rid.usUsagePage = 0x01; | |
298 Rid.usUsage = 0x02; | |
299 Rid.dwFlags = RIDEV_INPUTSINK; | |
300 Rid.hwndTarget = hwnd; | |
301 RegisterRawInputDevices(&Rid, 1, sizeof(Rid)); | |
302 #endif | |
303 | 253 |
304 WIN_PumpEvents(_this); | 254 WIN_PumpEvents(_this); |
305 | 255 |
306 if (SetupWindowData(_this, window, hwnd, SDL_TRUE) < 0) { | 256 if (SetupWindowData(_this, window, hwnd, SDL_TRUE) < 0) { |
307 DestroyWindow(hwnd); | 257 DestroyWindow(hwnd); |
620 } | 570 } |
621 | 571 |
622 void | 572 void |
623 WIN_DestroyWindow(_THIS, SDL_Window * window) | 573 WIN_DestroyWindow(_THIS, SDL_Window * window) |
624 { | 574 { |
625 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; | |
626 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; | 575 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; |
627 | 576 |
628 if (data) { | 577 if (data) { |
629 ReleaseDC(data->hwnd, data->hdc); | 578 ReleaseDC(data->hwnd, data->hdc); |
630 if (data->created) { | 579 if (data->created) { |
631 if (videodata->wintabDLL) { | |
632 videodata->WTClose(g_hCtx[window->id]); | |
633 } | |
634 DestroyWindow(data->hwnd); | 580 DestroyWindow(data->hwnd); |
635 } | 581 } |
636 SDL_free(data); | 582 SDL_free(data); |
637 } | 583 } |
638 } | 584 } |