comparison src/video/quartz/SDL_QuartzEvents.m @ 664:abfdc08eb289

Date: Sun, 3 Aug 2003 22:07:57 +0200 From: Max Horn Subject: SDL OSX fullscreen FIX the attached patch fixes the fullscreen problems on SDL/OSX. The cause was that click events are bounded by winRect. Now, winRect is set to the size of the video surface. But if you e.g. request a 640x420 surface, you might get a 640x480 "real" surface. Still, SDL_VideoSurface->h will be set to 420! Thus, the upper 60 pixels in my example received no mouse down events. My fix simply disables this clipping when in full screen mode - after all, all clicks then should be inside the screen surface. Higher SDL functions ensure that the coordinates then are clipped to 640x420. It works fine in all my tests here. I don't know if it's the right thing to do in multi screen scenarios, though.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 04 Aug 2003 01:00:30 +0000
parents 52864d66d168
children 5d2f027b3349
comparison
equal deleted inserted replaced
663:8bedd6d61642 664:abfdc08eb289
253 } 253 }
254 } 254 }
255 255
256 static void QZ_DoModifiers (_THIS, unsigned int newMods) { 256 static void QZ_DoModifiers (_THIS, unsigned int newMods) {
257 257
258 const int mapping[] = { SDLK_CAPSLOCK, SDLK_LSHIFT, SDLK_LCTRL, SDLK_LALT, SDLK_LMETA } ; 258 const int mapping[] = { SDLK_CAPSLOCK, SDLK_LSHIFT, SDLK_LCTRL, SDLK_LALT, SDLK_LMETA };
259 259
260 int i; 260 int i;
261 int bit; 261 int bit;
262 SDL_keysym key; 262 SDL_keysym key;
263 263
264 key.scancode = 0; 264 key.scancode = 0;
265 key.sym = SDLK_UNKNOWN; 265 key.sym = SDLK_UNKNOWN;
266 key.unicode = 0; 266 key.unicode = 0;
267 key.mod = KMOD_NONE; 267 key.mod = KMOD_NONE;
268 268
269 /* Iterate through the bits, testing each against the current modifiers */ 269 /* Iterate through the bits, testing each against the current modifiers */
403 CGMouseDelta dx, dy; 403 CGMouseDelta dx, dy;
404 404
405 NSDate *distantPast; 405 NSDate *distantPast;
406 NSEvent *event; 406 NSEvent *event;
407 NSRect winRect; 407 NSRect winRect;
408 NSRect titleBarRect;
409 NSAutoreleasePool *pool; 408 NSAutoreleasePool *pool;
410 409
411 /* Update activity every five seconds to prevent screensaver. --ryan. */ 410 /* Update activity every five seconds to prevent screensaver. --ryan. */
412 static Uint32 screensaverTicks = 0; 411 static Uint32 screensaverTicks = 0;
413 Uint32 nowTicks = SDL_GetTicks(); 412 Uint32 nowTicks = SDL_GetTicks();
419 418
420 pool = [ [ NSAutoreleasePool alloc ] init ]; 419 pool = [ [ NSAutoreleasePool alloc ] init ];
421 distantPast = [ NSDate distantPast ]; 420 distantPast = [ NSDate distantPast ];
422 421
423 winRect = NSMakeRect (0, 0, SDL_VideoSurface->w, SDL_VideoSurface->h); 422 winRect = NSMakeRect (0, 0, SDL_VideoSurface->w, SDL_VideoSurface->h);
424 titleBarRect = NSMakeRect (0, SDL_VideoSurface->h, SDL_VideoSurface->w,
425 SDL_VideoSurface->h + 22);
426 423
427 /* send the first mouse event in absolute coordinates */ 424 /* send the first mouse event in absolute coordinates */
428 firstMouseEvent = 1; 425 firstMouseEvent = 1;
429 426
430 /* accumulate any additional mouse moved events into one SDL mouse event */ 427 /* accumulate any additional mouse moved events into one SDL mouse event */
465 [ NSApp sendEvent:event ]; \ 462 [ NSApp sendEvent:event ]; \
466 } while(0) 463 } while(0)
467 464
468 type = [ event type ]; 465 type = [ event type ];
469 isForGameWin = (qz_window == [ event window ]); 466 isForGameWin = (qz_window == [ event window ]);
470 isInGameWin = NSPointInRect([event locationInWindow], winRect); 467 isInGameWin = (mode_flags & SDL_FULLSCREEN) ? true : NSPointInRect([event locationInWindow], winRect);
471 switch (type) { 468 switch (type) {
472 case NSLeftMouseDown: 469 case NSLeftMouseDown:
473 if ( getenv("SDL_HAS3BUTTONMOUSE") ) { 470 if ( getenv("SDL_HAS3BUTTONMOUSE") ) {
474 DO_MOUSE_DOWN (SDL_BUTTON_LEFT); 471 DO_MOUSE_DOWN (SDL_BUTTON_LEFT);
475 } else { 472 } else {