comparison src/video/win32/SDL_win32window.c @ 3685:64ce267332c6

Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
author Sam Lantinga <slouken@libsdl.org>
date Thu, 21 Jan 2010 06:21:52 +0000
parents 07c8339c95c6
children f7b03b6838cb
comparison
equal deleted inserted replaced
3684:cc564f08884f 3685:64ce267332c6
84 84
85 static int 85 static int
86 SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) 86 SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
87 { 87 {
88 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; 88 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
89 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); 89 SDL_VideoDisplay *display = window->display;
90 SDL_WindowData *data; 90 SDL_WindowData *data;
91 91
92 /* Allocate the window data */ 92 /* Allocate the window data */
93 data = (SDL_WindowData *) SDL_malloc(sizeof(*data)); 93 data = (SDL_WindowData *) SDL_malloc(sizeof(*data));
94 if (!data) { 94 if (!data) {
95 SDL_OutOfMemory(); 95 SDL_OutOfMemory();
96 return -1; 96 return -1;
97 } 97 }
98 data->windowID = window->id; 98 data->window = window;
99 data->hwnd = hwnd; 99 data->hwnd = hwnd;
100 data->hdc = GetDC(hwnd); 100 data->hdc = GetDC(hwnd);
101 data->created = created; 101 data->created = created;
102 data->mouse_pressed = SDL_FALSE; 102 data->mouse_pressed = SDL_FALSE;
103 data->videodata = videodata; 103 data->videodata = videodata;
165 } 165 }
166 } 166 }
167 if (GetFocus() == hwnd) { 167 if (GetFocus() == hwnd) {
168 int index = data->videodata->keyboard; 168 int index = data->videodata->keyboard;
169 window->flags |= SDL_WINDOW_INPUT_FOCUS; 169 window->flags |= SDL_WINDOW_INPUT_FOCUS;
170 SDL_SetKeyboardFocus(index, data->windowID); 170 SDL_SetKeyboardFocus(index, data->window);
171 171
172 if (window->flags & SDL_WINDOW_INPUT_GRABBED) { 172 if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
173 RECT rect; 173 RECT rect;
174 GetClientRect(hwnd, &rect); 174 GetClientRect(hwnd, &rect);
175 ClientToScreen(hwnd, (LPPOINT) & rect); 175 ClientToScreen(hwnd, (LPPOINT) & rect);
185 185
186 int 186 int
187 WIN_CreateWindow(_THIS, SDL_Window * window) 187 WIN_CreateWindow(_THIS, SDL_Window * window)
188 { 188 {
189 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; 189 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
190 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); 190 SDL_VideoDisplay *display = window->display;
191 RAWINPUTDEVICE Rid; 191 RAWINPUTDEVICE Rid;
192 AXIS TabX, TabY; 192 AXIS TabX, TabY;
193 LOGCONTEXTA lc; 193 LOGCONTEXTA lc;
194 HWND hwnd; 194 HWND hwnd;
195 HWND top; 195 HWND top;
427 } 427 }
428 428
429 void 429 void
430 WIN_SetWindowPosition(_THIS, SDL_Window * window) 430 WIN_SetWindowPosition(_THIS, SDL_Window * window)
431 { 431 {
432 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); 432 SDL_VideoDisplay *display = window->display;
433 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; 433 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
434 RECT rect; 434 RECT rect;
435 SDL_Rect bounds; 435 SDL_Rect bounds;
436 DWORD style; 436 DWORD style;
437 HWND top; 437 HWND top;