Commit aba4b443 authored by Sam Lantinga's avatar Sam Lantinga

Date: Sat, 1 Jun 2002 17:56:45 -0500

From: Darrell Walisser <dwaliss1@purdue.edu>
Subject: mac patch

In this patch:

- yuv code
- links to QuickTime
- tabs -> 4 spaces
- mouse events fix
- SDLMain path parsing fix
- BUGS updates
- some miscellaneous docs/comments/code cleanup

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40391
parent 455d014f
......@@ -72,26 +72,20 @@ MacOS X:
Joystick code is not extensively tested yet.
Window may not close when unsetting video mode and resetting.
Resizeable windows aren't implemented yet.
Depth switching for windowed mode isn't implemented yet.
Palette handling isn't implemented in windowed mode yet.
Command-line arguments Dialog is not implemented yet.
Command-line arguments dialog is not implemented yet.
Fullscreen drawing has some artifacts.
Fullscreen window covers *all* other windows - even force quit.
Fullscreen OpenGL for the software renderer is broken.
Some OpenGL parameters are not accounted for, for example color bits customization.
Getting OpenGL context parameters is not implemented.
Continuous mouse motion perhaps is not as smooth as it should be.
SDL_WM_GrabInput() is implemented, but it "freezes" the hardware
......
......@@ -51,6 +51,9 @@ static BOOL gFinderLaunch;
/* Set the working directory to the .app's parent directory */
- (void) setupWorkingDirectory:(BOOL)shouldChdir
{
if (shouldChdir)
{
char parentdir[MAXPATHLEN];
char *c;
......@@ -65,8 +68,6 @@ static BOOL gFinderLaunch;
*c++ = '\0'; /* cut off last part (binary name) */
if (shouldChdir)
{
assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */
assert ( chdir ("../../../") == 0 ); /* chdir to the .app's parent */
}
......
......@@ -254,8 +254,7 @@ static void QZ_DoModifiers (unsigned int newMods) {
SDL_PrivateKeyboard (SDL_PRESSED, &key);
SDL_PrivateKeyboard (SDL_RELEASED, &key);
}
else
if ( newMask &&
else if ( newMask &&
currentMask != newMask ) { /* modifier down event */
key.sym = mapping[i];
......@@ -306,7 +305,6 @@ static void QZ_DoDeactivate (_THIS) {
static void QZ_PumpEvents (_THIS)
{
static NSPoint lastMouse;
NSPoint mouse, saveMouse;
Point qdMouse;
......@@ -338,7 +336,8 @@ static void QZ_PumpEvents (_THIS)
if (mouse.x != lastMouse.x || mouse.y != lastMouse.y) {
QZ_PrivateCGToSDL (this, &mouse);
if (inForeground && NSPointInRect (mouse, winRect)) {
/* -note- we now generate mouse motion events if the mouse isn't over the window */
if (inForeground /* && NSPointInRect (mouse, winRect)*/) {
//printf ("Mouse Loc: (%f, %f)\n", mouse.x, mouse.y);
SDL_PrivateMouseMotion (0, 0, mouse.x, mouse.y);
}
......@@ -359,6 +358,7 @@ static void QZ_PumpEvents (_THIS)
inMode: NSDefaultRunLoopMode dequeue:YES ];
if (event != nil) {
unsigned int type;
BOOL isForGameWin;
......@@ -401,7 +401,6 @@ static void QZ_PumpEvents (_THIS)
case NSOtherMouseDown: DO_MOUSE_DOWN (2, 0); break;
case NSRightMouseDown: DO_MOUSE_DOWN (3, 0); break;
case NSLeftMouseUp:
if ( last_virtual_button != 0 ) {
DO_MOUSE_UP (last_virtual_button, 0);
last_virtual_button = 0;
......@@ -422,7 +421,6 @@ static void QZ_PumpEvents (_THIS)
case NSRightMouseDragged:
case 27:
case NSMouseMoved:
if (currentGrabMode == SDL_GRAB_ON) {
/**
......@@ -452,10 +450,8 @@ static void QZ_PumpEvents (_THIS)
warp_flag = 0;
}
}
break;
case NSScrollWheel:
{
if (NSPointInRect([ event locationInWindow ], winRect)) {
float dy;
dy = [ event deltaY ];
......@@ -464,7 +460,6 @@ static void QZ_PumpEvents (_THIS)
else /* Scroll down */
SDL_PrivateMouseButton (SDL_PRESSED, 5, 0, 0);
}
}
break;
case NSKeyUp:
QZ_DoKey (SDL_RELEASED, event);
......@@ -489,7 +484,6 @@ static void QZ_PumpEvents (_THIS)
/* case NSApplicationDefined: break; */
/* case NSPeriodic: break; */
/* case NSCursorUpdate: break; */
default:
[ NSApp sendEvent:event ];
}
......
......@@ -18,7 +18,7 @@
Sam Lantinga
slouken@libsdl.org
*/
*/
/* These are the Macintosh key scancode constants -- from Inside Macintosh */
......
......@@ -33,16 +33,15 @@
- Keyboard repeat/mouse speed adjust (if needed)
- Multiple monitor support (currently only main display)
- Accelerated blitting support
- Set the window icon (dock icon when API is available)
- Fix white OpenGL window on minimize
- Fix white OpenGL window on minimize (fixed)
- Find out what events should be sent/ignored if window is mimimized
- Find a better way to deal with resolution/depth switch while app is running
- Find a way to deal with external resolution/depth switch while app is running
- Resizeable windows
- Check accuracy of QZ_SetGamma()
Problems:
- OGL not working in full screen with software renderer
- SetColors sets palette correctly but clears framebuffer
- Crash in CG after several mode switches
- Crash in CG after several mode switches (I think this has been fixed)
- Retained windows don't draw their title bar quite right (OS Bug) (not using retained windows)
- Cursor in 8 bit modes is screwy (might just be Radeon PCI bug)
- Warping cursor delays mouse events for a fraction of a second,
......@@ -52,6 +51,7 @@
#include <Cocoa/Cocoa.h>
#include <OpenGL/OpenGL.h>
#include <Carbon/Carbon.h>
#include <QuickTime/QuickTime.h>
#include "SDL_video.h"
#include "SDL_error.h"
......@@ -102,6 +102,13 @@ typedef struct SDL_PrivateVideoData {
Uint32 warp_ticks; /* timestamp when the warp occured */
NSWindow *window; /* Cocoa window to implement the SDL window */
NSQuickDrawView *view; /* the window's view; draw 2D into this view */
ImageDescriptionHandle yuv_idh;
MatrixRecordPtr yuv_matrix;
DecompressorComponent yuv_codec;
ImageSequence yuv_seq;
PlanarPixmapInfoYUV420 *yuv_pixmap;
Sint16 yuv_width, yuv_height;
CGrafPtr yuv_port;
} SDL_PrivateVideoData ;
......@@ -121,6 +128,15 @@ typedef struct SDL_PrivateVideoData {
#define video_set (this->hidden->video_set)
#define warp_ticks (this->hidden->warp_ticks)
#define warp_flag (this->hidden->warp_flag)
#define yuv_idh (this->hidden->yuv_idh)
#define yuv_matrix (this->hidden->yuv_matrix)
#define yuv_codec (this->hidden->yuv_codec)
#define yuv_seq (this->hidden->yuv_seq)
#define yuv_pixmap (this->hidden->yuv_pixmap)
#define yuv_data (this->hidden->yuv_data)
#define yuv_width (this->hidden->yuv_width)
#define yuv_height (this->hidden->yuv_height)
#define yuv_port (this->hidden->yuv_port)
/* Obscuring code: maximum number of windows above ours (inclusive) */
#define kMaxWindows 256
......@@ -241,3 +257,7 @@ static int QZ_IconifyWindow (_THIS);
static SDL_GrabMode QZ_GrabInput (_THIS, SDL_GrabMode grab_mode);
/*static int QZ_GetWMInfo (_THIS, SDL_SysWMinfo *info);*/
/* YUV functions */
static SDL_Overlay* QZ_CreateYUVOverlay (_THIS, int width, int height,
Uint32 format, SDL_Surface *display);
This diff is collapsed.
......@@ -246,18 +246,18 @@ static void QZ_SetIcon (_THIS, SDL_Surface *icon, Uint8 *mask)
#define ALPHASHIFT 3
for (i=0;i<masksize;i+=8)
for (j=0;j<8;j++)
surfPtr[ALPHASHIFT+((i+j)<<2)]=(mask[i>>3]&(1<<(7-j)))?0xFF:0x00;
surfPtr[ALPHASHIFT+((i+j)<<2)]=(mask[i>>3]&(1<<(7-j)))?0xFF:0x00;
}
imgrep = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:(unsigned char **)&mergedSurface->pixels
pixelsWide:icon->w pixelsHigh:icon->h bitsPerSample:8 samplesPerPixel:4
hasAlpha:YES isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace
bytesPerRow:icon->w<<2 bitsPerPixel:32];
img = [[NSImage alloc] initWithSize:imgSize];
[img addRepresentation: imgrep];
[NSApp setApplicationIconImage:img];
[img release];
[imgrep release];
imgrep = [ [ NSBitmapImageRep alloc]
initWithBitmapDataPlanes:(unsigned char **)&mergedSurface->pixels
pixelsWide:icon->w pixelsHigh:icon->h bitsPerSample:8 samplesPerPixel:4
hasAlpha:YES isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace
bytesPerRow:icon->w<<2 bitsPerPixel:32 ];
img = [ [ NSImage alloc ] initWithSize:imgSize ];
[ img addRepresentation: imgrep ];
[ NSApp setApplicationIconImage:img ];
[ img release ];
[ imgrep release ];
SDL_FreeSurface(mergedSurface);
freePool:
[pool release];
......@@ -297,7 +297,6 @@ static SDL_GrabMode QZ_GrabInput (_THIS, SDL_GrabMode grab_mode) {
currentGrabMode = SDL_GRAB_ON;
break;
case SDL_GRAB_FULLSCREEN:
break;
}
......
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