Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_win32window.c @ 1732:fd65f12b6de6 SDL-1.3
Implemented Win32 input grab
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 08 Jul 2006 20:55:39 +0000 |
parents | 6c63fc2bd986 |
children | 0b1070f2f94d |
comparison
equal
deleted
inserted
replaced
1731:875c3cf1a12c | 1732:fd65f12b6de6 |
---|---|
103 if (style & WS_MINIMIZE) { | 103 if (style & WS_MINIMIZE) { |
104 window->flags |= SDL_WINDOW_MINIMIZED; | 104 window->flags |= SDL_WINDOW_MINIMIZED; |
105 } else { | 105 } else { |
106 window->flags &= ~SDL_WINDOW_MINIMIZED; | 106 window->flags &= ~SDL_WINDOW_MINIMIZED; |
107 } | 107 } |
108 } | |
109 if (GetFocus() == hwnd) { | |
110 int index = data->videodata->keyboard; | |
111 window->flags |= SDL_WINDOW_KEYBOARD_FOCUS; | |
112 SDL_SetKeyboardFocus(index, data->windowID); | |
108 } | 113 } |
109 | 114 |
110 /* All done! */ | 115 /* All done! */ |
111 window->driverdata = data; | 116 window->driverdata = data; |
112 return 0; | 117 return 0; |
372 } | 377 } |
373 | 378 |
374 void | 379 void |
375 WIN_SetWindowGrab(_THIS, SDL_Window * window) | 380 WIN_SetWindowGrab(_THIS, SDL_Window * window) |
376 { | 381 { |
377 /* FIXME! */ | 382 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; |
383 | |
384 if (window->flags & SDL_WINDOW_INPUT_GRABBED) { | |
385 if (window->flags & SDL_WINDOW_KEYBOARD_FOCUS) { | |
386 RECT rect; | |
387 GetClientRect(hwnd, &rect); | |
388 ClientToScreen(hwnd, (LPPOINT) & rect); | |
389 ClientToScreen(hwnd, (LPPOINT) & rect + 1); | |
390 ClipCursor(&rect); | |
391 } else { | |
392 SetFocus(hwnd); | |
393 } | |
394 } else { | |
395 if (window->flags & SDL_WINDOW_KEYBOARD_FOCUS) { | |
396 ClipCursor(NULL); | |
397 } | |
398 } | |
378 } | 399 } |
379 | 400 |
380 void | 401 void |
381 WIN_DestroyWindow(_THIS, SDL_Window * window) | 402 WIN_DestroyWindow(_THIS, SDL_Window * window) |
382 { | 403 { |