Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_win32window.c @ 3767:abc8acb8e3d7 gsoc2008_manymouse
Proximity events, Pressure detection for multiple windows. Tablet button detection on the way.
author | Szymon Wilczek <kazeuser@gmail.com> |
---|---|
date | Wed, 23 Jul 2008 16:12:43 +0000 |
parents | ba0d62354872 |
children | 1b87a8beab9d |
comparison
equal
deleted
inserted
replaced
3766:24db5d326f57 | 3767:abc8acb8e3d7 |
---|---|
27 #include "SDL_win32video.h" | 27 #include "SDL_win32video.h" |
28 | 28 |
29 /* This is included after SDL_win32video.h, which includes windows.h */ | 29 /* This is included after SDL_win32video.h, which includes windows.h */ |
30 #include "SDL_syswm.h" | 30 #include "SDL_syswm.h" |
31 | 31 |
32 #include <wintab.h> | |
33 #define PACKETDATA ( PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE) | |
34 #define PACKETMODE 0 | |
35 #include <pktdef.h> | |
36 | |
37 extern HCTX* g_hCtx; | |
38 | |
39 int highestId=0; | |
32 | 40 |
33 static int | 41 static int |
34 SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) | 42 SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) |
35 { | 43 { |
36 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; | 44 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; |
130 } | 138 } |
131 | 139 |
132 int | 140 int |
133 WIN_CreateWindow(_THIS, SDL_Window * window) | 141 WIN_CreateWindow(_THIS, SDL_Window * window) |
134 { | 142 { |
143 AXIS TabX,TabY; | |
144 LOGCONTEXT lc; | |
135 HWND hwnd; | 145 HWND hwnd; |
136 HWND top; | 146 HWND top; |
137 RECT rect; | 147 RECT rect; |
138 DWORD style = (WS_CLIPSIBLINGS | WS_CLIPCHILDREN); | 148 DWORD style = (WS_CLIPSIBLINGS | WS_CLIPCHILDREN); |
139 int x, y; | 149 int x, y; |
173 y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2; | 183 y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2; |
174 } else if (window->y == SDL_WINDOWPOS_UNDEFINED) { | 184 } else if (window->y == SDL_WINDOWPOS_UNDEFINED) { |
175 y = CW_USEDEFAULT; | 185 y = CW_USEDEFAULT; |
176 } else { | 186 } else { |
177 y = window->y + rect.top; | 187 y = window->y + rect.top; |
178 } | 188 } |
179 | 189 |
180 hwnd = | 190 hwnd = |
181 CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, NULL, NULL, | 191 CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, NULL, NULL, |
182 SDL_Instance, NULL); | 192 SDL_Instance, NULL); |
193 | |
194 WTInfo(WTI_DEFCONTEXT, 0, &lc); | |
195 | |
196 lc.lcPktData = PACKETDATA; | |
197 lc.lcPktMode = PACKETMODE; | |
198 lc.lcOptions |= CXO_MESSAGES; | |
199 lc.lcMoveMask = PACKETDATA; | |
200 lc.lcBtnDnMask=lc.lcBtnUpMask = PACKETDATA; | |
201 | |
202 WTInfo(WTI_DEVICES,DVC_X,&TabX); | |
203 WTInfo(WTI_DEVICES,DVC_Y,&TabY); | |
204 | |
205 lc.lcInOrgX = 0; | |
206 lc.lcInOrgY = 0; | |
207 | |
208 lc.lcInExtX = TabX.axMax; | |
209 lc.lcInExtY = TabY.axMax; | |
210 | |
211 lc.lcOutOrgX = 0; | |
212 lc.lcOutOrgY = 0; | |
213 | |
214 lc.lcOutExtX = GetSystemMetrics(SM_CXSCREEN); | |
215 lc.lcOutExtY = -GetSystemMetrics(SM_CYSCREEN); | |
216 if(window->id>highestId) | |
217 { | |
218 HCTX* tmp_hctx; | |
219 highestId=window->id; | |
220 tmp_hctx= (HCTX*)SDL_realloc(g_hCtx,(highestId+1)*sizeof(HCTX)); | |
221 if (!tmp_hctx) { | |
222 SDL_OutOfMemory(); | |
223 return -1; | |
224 } | |
225 g_hCtx=tmp_hctx; | |
226 } | |
227 | |
228 g_hCtx[window->id] = WTOpen(hwnd, &lc, TRUE); | |
183 WIN_PumpEvents(_this); | 229 WIN_PumpEvents(_this); |
184 | 230 |
185 if (!hwnd) { | 231 if (!hwnd) { |
186 WIN_SetError("Couldn't create window"); | 232 WIN_SetError("Couldn't create window"); |
187 return -1; | 233 return -1; |
387 WIN_GL_CleanupWindow(_this, window); | 433 WIN_GL_CleanupWindow(_this, window); |
388 } | 434 } |
389 #endif | 435 #endif |
390 ReleaseDC(data->hwnd, data->hdc); | 436 ReleaseDC(data->hwnd, data->hdc); |
391 if (data->created) { | 437 if (data->created) { |
438 WTClose(g_hCtx[window->id]); | |
392 DestroyWindow(data->hwnd); | 439 DestroyWindow(data->hwnd); |
393 } | 440 } |
394 SDL_free(data); | 441 SDL_free(data); |
442 WTClose(g_hCtx[window->id]); | |
395 } | 443 } |
396 } | 444 } |
397 | 445 |
398 SDL_bool | 446 SDL_bool |
399 WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) | 447 WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) |