comparison src/video/photon/SDL_ph_events.c @ 753:b14fdadd8311

Date: Thu, 4 Dec 2003 07:48:40 +0200 From: "Mike Gorchak" Subject: SDL/QNX6 new patch Here in attachment my patch for the SDL/QNX6 again :) It contain non-crtitical/cosmetic fixes: 1. Fixed window centering at other than the first consoles. 2. Fixed window centering algorithm in case when window height or width are greater than the desktop resolution. 3. Fixed window positioning on other than the first consoles. 4. Fixed occasional input focus lost when switching to fullscreen. 5. Removed the Photon's default chroma color for the overlays, added RGB(12, 6, 12) color instead (very dark pink). 6. Added more checks to the YUV overlay code (fixed crashes during resolution mode switches). 7. Added support for Enter/Backspace keys in unicode mode (used by Maelstrom and by other games). 8. Fixed window restore/maximize function. It works, finally.
author Sam Lantinga <slouken@libsdl.org>
date Wed, 10 Dec 2003 12:35:56 +0000
parents 8bedd6d61642
children b8d311d90021
comparison
equal deleted inserted replaced
752:4bb432a0f6e0 753:b14fdadd8311
215 else if ((winEvent->event_f==Ph_WM_FOCUS) && (winEvent->event_state==Ph_WM_EVSTATE_FOCUS)) 215 else if ((winEvent->event_f==Ph_WM_FOCUS) && (winEvent->event_state==Ph_WM_EVSTATE_FOCUS))
216 { 216 {
217 set_motion_sensitivity(this, -1); 217 set_motion_sensitivity(this, -1);
218 posted = SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS); 218 posted = SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
219 } 219 }
220 /* request to quit */ 220 /* quit request */
221 else if (winEvent->event_f==Ph_WM_CLOSE) 221 else if (winEvent->event_f==Ph_WM_CLOSE)
222 { 222 {
223 posted = SDL_PrivateQuit(); 223 posted = SDL_PrivateQuit();
224 } 224 }
225 /* request to hide/unhide */ 225 /* hide/unhide request */
226 else if (winEvent->event_f==Ph_WM_HIDE) 226 else if (winEvent->event_f==Ph_WM_HIDE)
227 { 227 {
228 if (currently_hided) 228 if (currently_hided)
229 { 229 {
230 /* got unhide window event */ 230 /* got unhide window event */
239 } 239 }
240 } 240 }
241 /* request to resize */ 241 /* request to resize */
242 else if (winEvent->event_f==Ph_WM_RESIZE) 242 else if (winEvent->event_f==Ph_WM_RESIZE)
243 { 243 {
244 SDL_PrivateResize(winEvent->size.w, winEvent->size.h); 244 SDL_PrivateResize(winEvent->size.w+1, winEvent->size.h+1);
245 } 245 }
246 /* request to move */ 246 /* request to move */
247 else if (winEvent->event_f==Ph_WM_MOVE) 247 else if (winEvent->event_f==Ph_WM_MOVE)
248 { 248 {
249 if (current_overlay!=NULL) 249 if (current_overlay!=NULL)
250 { 250 {
251 int lockedstate=current_overlay->hwdata->locked; 251 int lockedstate=current_overlay->hwdata->locked;
252 int chromastate=current_overlay->hwdata->ischromakey; 252 int chromastate=current_overlay->hwdata->ischromakey;
253 int error;
253 SDL_Rect target; 254 SDL_Rect target;
254 255
255 current_overlay->hwdata->locked=1; 256 current_overlay->hwdata->locked=1;
256 target.x=current_overlay->hwdata->CurrentViewPort.pos.x; 257 target.x=current_overlay->hwdata->CurrentViewPort.pos.x;
257 target.y=current_overlay->hwdata->CurrentViewPort.pos.y; 258 target.y=current_overlay->hwdata->CurrentViewPort.pos.y;
258 target.w=current_overlay->hwdata->CurrentViewPort.size.w; 259 target.w=current_overlay->hwdata->CurrentViewPort.size.w;
259 target.h=current_overlay->hwdata->CurrentViewPort.size.h; 260 target.h=current_overlay->hwdata->CurrentViewPort.size.h;
260 current_overlay->hwdata->ischromakey=0; 261 current_overlay->hwdata->ischromakey=0;
261 ph_DisplayYUVOverlay(this, current_overlay, &target); 262 error=ph_DisplayYUVOverlay(this, current_overlay, &target);
262 current_overlay->hwdata->ischromakey=chromastate; 263 if (!error)
263 current_overlay->hwdata->locked=lockedstate; 264 {
264 } 265 current_overlay->hwdata->ischromakey=chromastate;
265 } 266 current_overlay->hwdata->locked=lockedstate;
266 /* request to maximize */ 267 }
268 }
269 }
270 /* maximize request */
267 else if (winEvent->event_f==Ph_WM_MAX) 271 else if (winEvent->event_f==Ph_WM_MAX)
268 { 272 {
269 /* window already moved and resized here */ 273 /* window already moved and resized here */
270 SDL_PrivateResize(winEvent->size.w-winEvent->pos.x, winEvent->size.h-winEvent->pos.y); 274 currently_maximized=1;
271 } 275 }
272 /* request to restore */ 276 /* restore request */
273 else if (winEvent->event_f==Ph_WM_RESTORE) 277 else if (winEvent->event_f==Ph_WM_RESTORE)
274 { 278 {
279 /* window already moved and resized here */
280 currently_maximized=0;
275 } 281 }
276 } 282 }
277 break; 283 break;
278 284
279 /* window has been resized, moved or removed */ 285 /* window has been resized, moved or removed */
283 { 289 {
284 if (SDL_VideoSurface) 290 if (SDL_VideoSurface)
285 { 291 {
286 rect = PhGetRects(event); 292 rect = PhGetRects(event);
287 293
288 for(i=0;i<event->num_rects;i++) 294 for(i=0; i<event->num_rects; i++)
289 { 295 {
290 sdlrects[i].x = rect[i].ul.x; 296 sdlrects[i].x = rect[i].ul.x;
291 sdlrects[i].y = rect[i].ul.y; 297 sdlrects[i].y = rect[i].ul.y;
292 sdlrects[i].w = rect[i].lr.x - rect[i].ul.x + 1; 298 sdlrects[i].w = rect[i].lr.x - rect[i].ul.x + 1;
293 sdlrects[i].h = rect[i].lr.y - rect[i].ul.y + 1; 299 sdlrects[i].h = rect[i].lr.y - rect[i].ul.y + 1;
296 this->UpdateRects(this, event->num_rects, sdlrects); 302 this->UpdateRects(this, event->num_rects, sdlrects);
297 303
298 if (current_overlay!=NULL) 304 if (current_overlay!=NULL)
299 { 305 {
300 int lockedstate=current_overlay->hwdata->locked; 306 int lockedstate=current_overlay->hwdata->locked;
307 int error;
301 SDL_Rect target; 308 SDL_Rect target;
302 309
303 current_overlay->hwdata->locked=1; 310 current_overlay->hwdata->locked=1;
304 target.x=current_overlay->hwdata->CurrentViewPort.pos.x; 311 target.x=current_overlay->hwdata->CurrentViewPort.pos.x;
305 target.y=current_overlay->hwdata->CurrentViewPort.pos.y; 312 target.y=current_overlay->hwdata->CurrentViewPort.pos.y;
306 target.w=current_overlay->hwdata->CurrentViewPort.size.w; 313 target.w=current_overlay->hwdata->CurrentViewPort.size.w;
307 target.h=current_overlay->hwdata->CurrentViewPort.size.h; 314 target.h=current_overlay->hwdata->CurrentViewPort.size.h;
308 current_overlay->hwdata->forcedredraw=1; 315 current_overlay->hwdata->forcedredraw=1;
309 ph_DisplayYUVOverlay(this, current_overlay, &target); 316 error=ph_DisplayYUVOverlay(this, current_overlay, &target);
310 current_overlay->hwdata->forcedredraw=0; 317 if (!error)
311 current_overlay->hwdata->locked=lockedstate; 318 {
319 current_overlay->hwdata->forcedredraw=0;
320 current_overlay->hwdata->locked=lockedstate;
321 }
312 } 322 }
313 } 323 }
314 } 324 }
315 } 325 }
316 break; 326 break;
351 posted = SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELDOWN, 0, 0); 361 posted = SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELDOWN, 0, 0);
352 break; 362 break;
353 } 363 }
354 posted = SDL_PrivateKeyboard(SDL_RELEASED, ph_TranslateKey( keyEvent, &keysym)); 364 posted = SDL_PrivateKeyboard(SDL_RELEASED, ph_TranslateKey( keyEvent, &keysym));
355 } 365 }
366 }
367 break;
368
369 case Ph_EV_INFO:
370 {
356 } 371 }
357 break; 372 break;
358 } 373 }
359 374
360 return(posted); 375 return(posted);
540 int utf8len; 555 int utf8len;
541 wchar_t unicode; 556 wchar_t unicode;
542 557
543 switch (keysym->scancode) 558 switch (keysym->scancode)
544 { 559 {
560 /* Esc key */
545 case 0x01: keysym->unicode = 27; 561 case 0x01: keysym->unicode = 27;
562 break;
563 /* BackSpace key */
564 case 0x0E: keysym->unicode = 127;
565 break;
566 /* Enter key */
567 case 0x1C: keysym->unicode = 10;
546 break; 568 break;
547 default: 569 default:
548 utf8len = PhKeyToMb(utf8, key); 570 utf8len = PhKeyToMb(utf8, key);
549 if (utf8len > 0) 571 if (utf8len > 0)
550 { 572 {
551 utf8len = mbtowc(&unicode, utf8, utf8len); 573 utf8len = mbtowc(&unicode, utf8, utf8len);
552 if (utf8len > 0) 574 if (utf8len > 0)
553 { 575 {
554 keysym->unicode = unicode; 576 keysym->unicode = unicode;
555 } 577 }
556 } 578 }