Commit 455d014f authored by Sam Lantinga's avatar Sam Lantinga

*** empty log message ***

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40390
parent f1cd55c1
...@@ -51,8 +51,6 @@ static BOOL gFinderLaunch; ...@@ -51,8 +51,6 @@ static BOOL gFinderLaunch;
/* Set the working directory to the .app's parent directory */ /* Set the working directory to the .app's parent directory */
- (void) setupWorkingDirectory:(BOOL)shouldChdir - (void) setupWorkingDirectory:(BOOL)shouldChdir
{ {
if (shouldChdir)
{
char parentdir[MAXPATHLEN]; char parentdir[MAXPATHLEN];
char *c; char *c;
...@@ -67,6 +65,8 @@ static BOOL gFinderLaunch; ...@@ -67,6 +65,8 @@ static BOOL gFinderLaunch;
*c++ = '\0'; /* cut off last part (binary name) */ *c++ = '\0'; /* cut off last part (binary name) */
if (shouldChdir)
{
assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */ assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */
assert ( chdir ("../../../") == 0 ); /* chdir to the .app's parent */ assert ( chdir ("../../../") == 0 ); /* chdir to the .app's parent */
} }
......
...@@ -306,6 +306,7 @@ static void QZ_DoDeactivate (_THIS) { ...@@ -306,6 +306,7 @@ static void QZ_DoDeactivate (_THIS) {
static void QZ_PumpEvents (_THIS) static void QZ_PumpEvents (_THIS)
{ {
static NSPoint lastMouse; static NSPoint lastMouse;
NSPoint mouse, saveMouse; NSPoint mouse, saveMouse;
Point qdMouse; Point qdMouse;
...@@ -313,12 +314,14 @@ static void QZ_PumpEvents (_THIS) ...@@ -313,12 +314,14 @@ static void QZ_PumpEvents (_THIS)
NSDate *distantPast; NSDate *distantPast;
NSEvent *event; NSEvent *event;
NSRect winRect;
NSRect titleBarRect; NSRect titleBarRect;
NSAutoreleasePool *pool; NSAutoreleasePool *pool;
pool = [ [ NSAutoreleasePool alloc ] init ]; pool = [ [ NSAutoreleasePool alloc ] init ];
distantPast = [ NSDate distantPast ]; distantPast = [ NSDate distantPast ];
winRect = NSMakeRect (0, 0, SDL_VideoSurface->w, SDL_VideoSurface->h);
titleBarRect = NSMakeRect ( 0, SDL_VideoSurface->h, SDL_VideoSurface->w, titleBarRect = NSMakeRect ( 0, SDL_VideoSurface->h, SDL_VideoSurface->w,
SDL_VideoSurface->h + 22 ); SDL_VideoSurface->h + 22 );
...@@ -335,7 +338,7 @@ static void QZ_PumpEvents (_THIS) ...@@ -335,7 +338,7 @@ static void QZ_PumpEvents (_THIS)
if (mouse.x != lastMouse.x || mouse.y != lastMouse.y) { if (mouse.x != lastMouse.x || mouse.y != lastMouse.y) {
QZ_PrivateCGToSDL (this, &mouse); QZ_PrivateCGToSDL (this, &mouse);
if (inForeground) { if (inForeground && NSPointInRect (mouse, winRect)) {
//printf ("Mouse Loc: (%f, %f)\n", mouse.x, mouse.y); //printf ("Mouse Loc: (%f, %f)\n", mouse.x, mouse.y);
SDL_PrivateMouseMotion (0, 0, mouse.x, mouse.y); SDL_PrivateMouseMotion (0, 0, mouse.x, mouse.y);
} }
...@@ -361,6 +364,8 @@ static void QZ_PumpEvents (_THIS) ...@@ -361,6 +364,8 @@ static void QZ_PumpEvents (_THIS)
#define DO_MOUSE_DOWN(button, sendToWindow) do { \ #define DO_MOUSE_DOWN(button, sendToWindow) do { \
if ( inForeground ) { \ if ( inForeground ) { \
if ( (SDL_VideoSurface->flags & SDL_FULLSCREEN) || \
NSPointInRect([event locationInWindow], winRect) ) \
SDL_PrivateMouseButton (SDL_PRESSED, button, 0, 0); \ SDL_PrivateMouseButton (SDL_PRESSED, button, 0, 0); \
} \ } \
else { \ else { \
...@@ -417,6 +422,7 @@ static void QZ_PumpEvents (_THIS) ...@@ -417,6 +422,7 @@ static void QZ_PumpEvents (_THIS)
case NSRightMouseDragged: case NSRightMouseDragged:
case 27: case 27:
case NSMouseMoved: case NSMouseMoved:
if (currentGrabMode == SDL_GRAB_ON) { if (currentGrabMode == SDL_GRAB_ON) {
/** /**
...@@ -446,9 +452,11 @@ static void QZ_PumpEvents (_THIS) ...@@ -446,9 +452,11 @@ static void QZ_PumpEvents (_THIS)
warp_flag = 0; warp_flag = 0;
} }
} }
break; break;
case NSScrollWheel: case NSScrollWheel:
{ {
if (NSPointInRect([ event locationInWindow ], winRect)) {
float dy; float dy;
dy = [ event deltaY ]; dy = [ event deltaY ];
if ( dy > 0.0 ) /* Scroll up */ if ( dy > 0.0 ) /* Scroll up */
...@@ -456,6 +464,7 @@ static void QZ_PumpEvents (_THIS) ...@@ -456,6 +464,7 @@ static void QZ_PumpEvents (_THIS)
else /* Scroll down */ else /* Scroll down */
SDL_PrivateMouseButton (SDL_PRESSED, 5, 0, 0); SDL_PrivateMouseButton (SDL_PRESSED, 5, 0, 0);
} }
}
break; break;
case NSKeyUp: case NSKeyUp:
QZ_DoKey (SDL_RELEASED, event); QZ_DoKey (SDL_RELEASED, event);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment