Mercurial > sdl-ios-xcode
comparison src/SDL_compat.c @ 1724:6c63fc2bd986 SDL-1.3
Proof of concept done - Win32 GDI implementation mostly complete.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 06 Jul 2006 07:17:11 +0000 |
parents | 5daa04d862f1 |
children | 875c3cf1a12c |
comparison
equal
deleted
inserted
replaced
1723:4bdbb9b2bd0a | 1724:6c63fc2bd986 |
---|---|
162 SDL_Event fake; | 162 SDL_Event fake; |
163 | 163 |
164 switch (event->type) { | 164 switch (event->type) { |
165 case SDL_WINDOWEVENT: | 165 case SDL_WINDOWEVENT: |
166 switch (event->window.event) { | 166 switch (event->window.event) { |
167 case SDL_WINDOWEVENT_EXPOSED: | |
168 if (!SDL_HasEvent(SDL_VIDEOEXPOSEMASK)) { | |
169 fake.type = SDL_VIDEOEXPOSE; | |
170 SDL_PushEvent(&fake); | |
171 } | |
172 break; | |
167 case SDL_WINDOWEVENT_RESIZED: | 173 case SDL_WINDOWEVENT_RESIZED: |
168 fake.type = SDL_VIDEORESIZE; | 174 fake.type = SDL_VIDEORESIZE; |
169 fake.resize.w = event->window.data1; | 175 fake.resize.w = event->window.data1; |
170 fake.resize.h = event->window.data2; | 176 fake.resize.h = event->window.data2; |
171 SDL_PushEvent(&fake); | 177 SDL_PushEvent(&fake); |
202 break; | 208 break; |
203 case SDL_WINDOWEVENT_FOCUS_LOST: | 209 case SDL_WINDOWEVENT_FOCUS_LOST: |
204 fake.type = SDL_ACTIVEEVENT; | 210 fake.type = SDL_ACTIVEEVENT; |
205 fake.active.gain = 1; | 211 fake.active.gain = 1; |
206 fake.active.state = SDL_APPINPUTFOCUS; | 212 fake.active.state = SDL_APPINPUTFOCUS; |
213 SDL_PushEvent(&fake); | |
214 break; | |
215 case SDL_WINDOWEVENT_CLOSE: | |
216 fake.type = SDL_QUIT; | |
207 SDL_PushEvent(&fake); | 217 SDL_PushEvent(&fake); |
208 break; | 218 break; |
209 } | 219 } |
210 case SDL_KEYDOWN: | 220 case SDL_KEYDOWN: |
211 case SDL_KEYUP: | 221 case SDL_KEYUP: |
224 if (unicode) { | 234 if (unicode) { |
225 event->key.keysym.unicode = unicode; | 235 event->key.keysym.unicode = unicode; |
226 } | 236 } |
227 break; | 237 break; |
228 } | 238 } |
239 case SDL_MOUSEWHEEL: | |
240 { | |
241 Uint8 button; | |
242 int selected; | |
243 int x, y; | |
244 | |
245 selected = SDL_SelectMouse(event->wheel.which); | |
246 SDL_GetMouseState(&x, &y); | |
247 SDL_SelectMouse(selected); | |
248 | |
249 if (event->wheel.motion > 0) { | |
250 button = SDL_BUTTON_WHEELUP; | |
251 } else { | |
252 button = SDL_BUTTON_WHEELDOWN; | |
253 } | |
254 | |
255 fake.button.which = event->wheel.windowID; | |
256 fake.button.button = button; | |
257 fake.button.x = x; | |
258 fake.button.y = y; | |
259 fake.button.windowID = event->wheel.windowID; | |
260 | |
261 fake.type = SDL_MOUSEBUTTONDOWN; | |
262 fake.button.state = SDL_PRESSED; | |
263 SDL_PushEvent(&fake); | |
264 | |
265 fake.type = SDL_MOUSEBUTTONUP; | |
266 fake.button.state = SDL_RELEASED; | |
267 SDL_PushEvent(&fake); | |
268 break; | |
269 } | |
270 | |
229 } | 271 } |
230 if (orig_eventfilter) { | 272 if (orig_eventfilter) { |
231 return orig_eventfilter(orig_eventfilterparam, event); | 273 return orig_eventfilter(orig_eventfilterparam, event); |
232 } else { | 274 } else { |
233 return 1; | 275 return 1; |
302 } | 344 } |
303 if (flags & SDL_NOFRAME) { | 345 if (flags & SDL_NOFRAME) { |
304 window_flags |= SDL_WINDOW_BORDERLESS; | 346 window_flags |= SDL_WINDOW_BORDERLESS; |
305 } | 347 } |
306 SDL_VideoWindow = | 348 SDL_VideoWindow = |
307 SDL_CreateWindow(wm_title, 0, 0, width, height, window_flags); | 349 SDL_CreateWindow(wm_title, SDL_WINDOWPOS_UNDEFINED, |
350 SDL_WINDOWPOS_UNDEFINED, width, height, | |
351 window_flags); | |
308 if (!SDL_VideoWindow) { | 352 if (!SDL_VideoWindow) { |
309 return NULL; | 353 return NULL; |
310 } | 354 } |
311 | 355 |
312 window_flags = SDL_GetWindowFlags(SDL_VideoWindow); | 356 window_flags = SDL_GetWindowFlags(SDL_VideoWindow); |