* Removed fullscreen menu option from the "Window" menu
* Updated the BUGS file * Fixed command line parameters when launched from Finder * Implemented setting the icon window caption * Implemented frameless style windows * Added note about SDL_RESIZABLE implementation to SDL_QuartzVideo.m * Window close requests now go through the event filtering system --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%4059
This commit is contained in:
parent
982c4718af
commit
254c4d997c
9 changed files with 106 additions and 86 deletions
6
BUGS
6
BUGS
|
@ -72,12 +72,12 @@ MacOS:
|
||||||
MacOS X:
|
MacOS X:
|
||||||
Joystick and CD-ROM functions are not implemented yet.
|
Joystick and CD-ROM functions are not implemented yet.
|
||||||
|
|
||||||
Closing window from window's close widget not implemented yet.
|
Window management buttons don't draw correctly.
|
||||||
|
|
||||||
Minimizing the window erases the framebuffer to the pinstripe pattern.
|
|
||||||
|
|
||||||
Window may not close when unsetting video mode and resetting.
|
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.
|
Depth switching for windowed mode isn't implemented yet.
|
||||||
|
|
||||||
Palette handling isn't implemented in windowed mode yet.
|
Palette handling isn't implemented in windowed mode yet.
|
||||||
|
|
Binary file not shown.
|
@ -4,5 +4,4 @@
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
- (IBAction)quit:(id)sender;
|
- (IBAction)quit:(id)sender;
|
||||||
- (IBAction)makeFullscreen:(id)sender;
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -23,12 +23,6 @@ static char **gArgv;
|
||||||
SDL_PushEvent(&event);
|
SDL_PushEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Invoked from the "Make fulllscreen" menu item */
|
|
||||||
- (void) makeFullscreen:(id)sender
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set the working directory to the .app's parent directory */
|
/* Set the working directory to the .app's parent directory */
|
||||||
- (void) setupWorkingDirectory
|
- (void) setupWorkingDirectory
|
||||||
{
|
{
|
||||||
|
@ -53,16 +47,16 @@ static char **gArgv;
|
||||||
/* Called when the internal event loop has just started running */
|
/* Called when the internal event loop has just started running */
|
||||||
- (void) applicationDidFinishLaunching: (NSNotification *) note
|
- (void) applicationDidFinishLaunching: (NSNotification *) note
|
||||||
{
|
{
|
||||||
|
int status;
|
||||||
|
|
||||||
/* Set the working directory to the .app's parent directory */
|
/* Set the working directory to the .app's parent directory */
|
||||||
[ self setupWorkingDirectory ];
|
[ self setupWorkingDirectory ];
|
||||||
|
|
||||||
/* This is passed if we are launched by double-clicking */
|
|
||||||
if ( gArgc >= 2 && strncmp (gArgv[1], "-psn", 4) == 0 )
|
|
||||||
gArgc = 1;
|
|
||||||
|
|
||||||
/* Hand off to main application code */
|
/* Hand off to main application code */
|
||||||
SDL_main (gArgc, gArgv);
|
status = SDL_main (gArgc, gArgv);
|
||||||
exit(0);
|
|
||||||
|
/* We're done, thank you for playing */
|
||||||
|
exit(status);
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -76,12 +70,18 @@ int main (int argc, char **argv) {
|
||||||
/* Copy the arguments into a global variable */
|
/* Copy the arguments into a global variable */
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* This is passed if we are launched by double-clicking */
|
||||||
|
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
|
||||||
|
gArgc = 1;
|
||||||
|
} else {
|
||||||
gArgc = argc;
|
gArgc = argc;
|
||||||
gArgv = (char**) malloc (sizeof(*gArgv) * gArgc);
|
}
|
||||||
|
gArgv = (char**) malloc (sizeof(*gArgv) * (gArgc+1));
|
||||||
assert (gArgv != NULL);
|
assert (gArgv != NULL);
|
||||||
for (i = 0; i < gArgc; i++) {
|
for (i = 0; i < gArgc; i++) {
|
||||||
gArgv[i] = strdup (argv[i]);
|
gArgv[i] = argv[i];
|
||||||
}
|
}
|
||||||
|
gArgv[i] = NULL;
|
||||||
|
|
||||||
NSApplicationMain (argc, argv);
|
NSApplicationMain (argc, argv);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -100,10 +100,6 @@ static VideoBootStrap *bootstrap[] = {
|
||||||
};
|
};
|
||||||
SDL_VideoDevice *current_video = NULL;
|
SDL_VideoDevice *current_video = NULL;
|
||||||
|
|
||||||
/* Places to store title and icon text for the app */
|
|
||||||
static char *wm_title = NULL;
|
|
||||||
static char *wm_icon = NULL;
|
|
||||||
|
|
||||||
/* Various local functions */
|
/* Various local functions */
|
||||||
int SDL_VideoInit(const char *driver_name, Uint32 flags);
|
int SDL_VideoInit(const char *driver_name, Uint32 flags);
|
||||||
void SDL_VideoQuit(void);
|
void SDL_VideoQuit(void);
|
||||||
|
@ -1254,13 +1250,13 @@ void SDL_VideoQuit (void)
|
||||||
free(video->gamma);
|
free(video->gamma);
|
||||||
video->gamma = NULL;
|
video->gamma = NULL;
|
||||||
}
|
}
|
||||||
if ( wm_title != NULL ) {
|
if ( video->wm_title != NULL ) {
|
||||||
free(wm_title);
|
free(video->wm_title);
|
||||||
wm_title = NULL;
|
video->wm_title = NULL;
|
||||||
}
|
}
|
||||||
if ( wm_icon != NULL ) {
|
if ( video->wm_icon != NULL ) {
|
||||||
free(wm_icon);
|
free(video->wm_icon);
|
||||||
wm_icon = NULL;
|
video->wm_icon = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finish cleaning up video subsystem */
|
/* Finish cleaning up video subsystem */
|
||||||
|
@ -1539,35 +1535,41 @@ void SDL_WM_SetCaption (const char *title, const char *icon)
|
||||||
SDL_VideoDevice *video = current_video;
|
SDL_VideoDevice *video = current_video;
|
||||||
SDL_VideoDevice *this = current_video;
|
SDL_VideoDevice *this = current_video;
|
||||||
|
|
||||||
|
if ( video ) {
|
||||||
if ( title ) {
|
if ( title ) {
|
||||||
if ( wm_title ) {
|
if ( video->wm_title ) {
|
||||||
free(wm_title);
|
free(video->wm_title);
|
||||||
}
|
}
|
||||||
wm_title = (char *)malloc(strlen(title)+1);
|
video->wm_title = (char *)malloc(strlen(title)+1);
|
||||||
if ( wm_title != NULL ) {
|
if ( video->wm_title != NULL ) {
|
||||||
strcpy(wm_title, title);
|
strcpy(video->wm_title, title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( icon ) {
|
if ( icon ) {
|
||||||
if ( wm_icon ) {
|
if ( video->wm_icon ) {
|
||||||
free(wm_icon);
|
free(video->wm_icon);
|
||||||
}
|
}
|
||||||
wm_icon = (char *)malloc(strlen(icon)+1);
|
video->wm_icon = (char *)malloc(strlen(icon)+1);
|
||||||
if ( wm_icon != NULL ) {
|
if ( video->wm_icon != NULL ) {
|
||||||
strcpy(wm_icon, icon);
|
strcpy(video->wm_icon, icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( (title || icon) && video && (video->SetCaption != NULL) ) {
|
if ( (title || icon) && (video->SetCaption != NULL) ) {
|
||||||
video->SetCaption(this, wm_title, wm_icon);
|
video->SetCaption(this, video->wm_title,video->wm_icon);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void SDL_WM_GetCaption (char **title, char **icon)
|
void SDL_WM_GetCaption (char **title, char **icon)
|
||||||
{
|
{
|
||||||
|
SDL_VideoDevice *video = current_video;
|
||||||
|
|
||||||
|
if ( video ) {
|
||||||
if ( title ) {
|
if ( title ) {
|
||||||
*title = wm_title;
|
*title = video->wm_title;
|
||||||
}
|
}
|
||||||
if ( icon ) {
|
if ( icon ) {
|
||||||
*icon = wm_icon;
|
*icon = video->wm_icon;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
- SetColors sets palette correctly but clears framebuffer
|
- SetColors sets palette correctly but clears framebuffer
|
||||||
- Crash in CG after several mode switches
|
- Crash in CG after several mode switches
|
||||||
- Retained windows don't draw their title bar quite right (OS Bug)
|
- Retained windows don't draw their title bar quite right (OS Bug)
|
||||||
- Should I do depth switching for windowed modes?
|
- Should I do depth switching for windowed modes? - No, not usually.
|
||||||
- Launch times are slow, maybe prebinding will help
|
- Launch times are slow, maybe prebinding will help
|
||||||
- Direct framebuffer access has some artifacts, maybe a driver issue
|
- Direct framebuffer access has some artifacts, maybe a driver issue
|
||||||
- Cursor in 8 bit modes is screwy
|
- Cursor in 8 bit modes is screwy
|
||||||
|
@ -89,7 +89,6 @@ typedef struct SDL_PrivateVideoData {
|
||||||
/* Window-only fields */
|
/* Window-only fields */
|
||||||
NSWindow *window;
|
NSWindow *window;
|
||||||
NSQuickDrawView *view;
|
NSQuickDrawView *view;
|
||||||
NSString *title;
|
|
||||||
|
|
||||||
} SDL_PrivateVideoData ;
|
} SDL_PrivateVideoData ;
|
||||||
|
|
||||||
|
@ -108,7 +107,6 @@ typedef struct SDL_PrivateVideoData {
|
||||||
#define mode_flags (this->hidden->flags)
|
#define mode_flags (this->hidden->flags)
|
||||||
#define window (this->hidden->window)
|
#define window (this->hidden->window)
|
||||||
#define windowView (this->hidden->view)
|
#define windowView (this->hidden->view)
|
||||||
#define windowTitle (this->hidden->title)
|
|
||||||
|
|
||||||
/* Interface for hardware fill not (yet) in the public API */
|
/* Interface for hardware fill not (yet) in the public API */
|
||||||
int CGSDisplayHWFill (CGDirectDisplayID id, unsigned int x, unsigned int y,
|
int CGSDisplayHWFill (CGDirectDisplayID id, unsigned int x, unsigned int y,
|
||||||
|
|
|
@ -132,7 +132,6 @@ static int QZ_VideoInit (_THIS, SDL_PixelFormat *video_format) {
|
||||||
kCFNumberSInt32Type, &device_height);
|
kCFNumberSInt32Type, &device_height);
|
||||||
|
|
||||||
video_format->BitsPerPixel = device_bpp;
|
video_format->BitsPerPixel = device_bpp;
|
||||||
windowTitle = @"";
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -293,6 +292,7 @@ static SDL_Surface* QZ_SetVideoFullScreen (_THIS, SDL_Surface *current, int widt
|
||||||
current->pitch = CGDisplayBytesPerRow (display_id);
|
current->pitch = CGDisplayBytesPerRow (display_id);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
current->flags = 0;
|
||||||
current->w = width;
|
current->w = width;
|
||||||
current->h = height;
|
current->h = height;
|
||||||
current->flags |= SDL_FULLSCREEN;
|
current->flags |= SDL_FULLSCREEN;
|
||||||
|
@ -350,27 +350,37 @@ static SDL_Surface* QZ_SetVideoFullScreen (_THIS, SDL_Surface *current, int widt
|
||||||
|
|
||||||
static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width,
|
static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width,
|
||||||
int height, int bpp, Uint32 flags) {
|
int height, int bpp, Uint32 flags) {
|
||||||
|
unsigned int style;
|
||||||
NSRect rect;
|
NSRect rect;
|
||||||
rect = NSMakeRect (0, 0, width, height);
|
rect = NSMakeRect (0, 0, width, height);
|
||||||
|
|
||||||
|
#if 1 // FIXME - the resize button doesn't show? Also need resize events...
|
||||||
|
flags &= ~SDL_RESIZABLE;
|
||||||
|
#endif
|
||||||
|
/* Set the window style based on input flags */
|
||||||
|
if ( flags & SDL_NOFRAME ) {
|
||||||
|
style = NSBorderlessWindowMask;
|
||||||
|
} else {
|
||||||
|
style = NSTitledWindowMask;
|
||||||
|
style |= (NSMiniaturizableWindowMask | NSClosableWindowMask);
|
||||||
|
if ( flags & SDL_RESIZABLE )
|
||||||
|
style |= NSResizableWindowMask;
|
||||||
|
}
|
||||||
|
|
||||||
/* Manually create a window, avoids having a nib file resource */
|
/* Manually create a window, avoids having a nib file resource */
|
||||||
window = [ [ SDL_QuartzWindow alloc ] initWithContentRect:rect
|
window = [ [ SDL_QuartzWindow alloc ] initWithContentRect:rect
|
||||||
styleMask:(NSTitledWindowMask | NSMiniaturizableWindowMask |
|
styleMask:style backing:NSBackingStoreRetained defer:NO ];
|
||||||
NSClosableWindowMask)
|
|
||||||
backing: //NSBackingStoreBuffered
|
|
||||||
NSBackingStoreRetained
|
|
||||||
defer:NO ];
|
|
||||||
|
|
||||||
if (window == nil) {
|
if (window == nil) {
|
||||||
SDL_SetError ("Could not create the Cocoa window");
|
SDL_SetError ("Could not create the Cocoa window");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
current->flags = 0;
|
||||||
current->w = width;
|
current->w = width;
|
||||||
current->h = height;
|
current->h = height;
|
||||||
|
|
||||||
[ window setReleasedWhenClosed:YES ];
|
[ window setReleasedWhenClosed:YES ];
|
||||||
[ window setTitle:windowTitle ];
|
QZ_SetCaption(this, this->wm_title, this->wm_icon);
|
||||||
[ window setAcceptsMouseMovedEvents:YES ];
|
[ window setAcceptsMouseMovedEvents:YES ];
|
||||||
[ window setViewsNeedDisplay:NO ];
|
[ window setViewsNeedDisplay:NO ];
|
||||||
[ window center ];
|
[ window center ];
|
||||||
|
@ -400,11 +410,17 @@ static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width,
|
||||||
current->pixels = GetPixBaseAddr ( GetPortPixMap ( [ windowView qdPort ] ) );
|
current->pixels = GetPixBaseAddr ( GetPortPixMap ( [ windowView qdPort ] ) );
|
||||||
current->pitch = GetPixRowBytes ( GetPortPixMap ( [ windowView qdPort ] ) );
|
current->pitch = GetPixRowBytes ( GetPortPixMap ( [ windowView qdPort ] ) );
|
||||||
|
|
||||||
/* Offset 22 pixels down to fill the full content region */
|
|
||||||
current->pixels += 22 * current->pitch;
|
|
||||||
|
|
||||||
current->flags |= SDL_SWSURFACE;
|
current->flags |= SDL_SWSURFACE;
|
||||||
current->flags |= SDL_PREALLOC;
|
current->flags |= SDL_PREALLOC;
|
||||||
|
if ( flags & SDL_NOFRAME )
|
||||||
|
current->flags |= SDL_NOFRAME;
|
||||||
|
if ( flags & SDL_RESIZABLE )
|
||||||
|
current->flags |= SDL_RESIZABLE;
|
||||||
|
|
||||||
|
/* Offset 22 pixels down to fill the full content region */
|
||||||
|
if ( ! (current->flags & SDL_NOFRAME) ) {
|
||||||
|
current->pixels += 22 * current->pitch;
|
||||||
|
}
|
||||||
|
|
||||||
this->UpdateRects = QZ_UpdateRects;
|
this->UpdateRects = QZ_UpdateRects;
|
||||||
}
|
}
|
||||||
|
@ -444,15 +460,15 @@ static SDL_Surface* QZ_SetVideoMode (_THIS, SDL_Surface *current, int width,
|
||||||
switch (bpp) {
|
switch (bpp) {
|
||||||
case 16: /* (1)-5-5-5 RGB */
|
case 16: /* (1)-5-5-5 RGB */
|
||||||
amask = 0;
|
amask = 0;
|
||||||
rmask = 0x7c00;
|
rmask = 0x7C00;
|
||||||
gmask = 0x3e0;
|
gmask = 0x03E0;
|
||||||
bmask = 0x1f;
|
bmask = 0x001F;
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
SDL_SetError ("24bpp is not available");
|
SDL_SetError ("24bpp is not available");
|
||||||
return NULL;
|
return NULL;
|
||||||
case 32: /* (8)-8-8-8 ARGB */
|
case 32: /* (8)-8-8-8 ARGB */
|
||||||
amask = 0x00000000; /* per-pixel alpha needs to be fixed */
|
amask = 0x00000000; /* These are the correct semantics */
|
||||||
rmask = 0x00FF0000;
|
rmask = 0x00FF0000;
|
||||||
gmask = 0x0000FF00;
|
gmask = 0x0000FF00;
|
||||||
bmask = 0x000000FF;
|
bmask = 0x000000FF;
|
||||||
|
|
|
@ -122,12 +122,19 @@ static void QZ_CheckMouseMode (_THIS) { }
|
||||||
|
|
||||||
static void QZ_SetCaption (_THIS, const char *title, const char *icon) {
|
static void QZ_SetCaption (_THIS, const char *title, const char *icon) {
|
||||||
|
|
||||||
NSString *str = [ [ NSString alloc ] initWithCString:title ];
|
if ( window != nil ) {
|
||||||
if (window != nil)
|
NSString *string;
|
||||||
[ window setTitle:str ];
|
if ( title != NULL ) {
|
||||||
|
string = [ [ NSString alloc ] initWithCString:title ];
|
||||||
[ windowTitle release ];
|
[ window setTitle:string ];
|
||||||
windowTitle = str;
|
[ string release ];
|
||||||
|
}
|
||||||
|
if ( icon != NULL ) {
|
||||||
|
string = [ [ NSString alloc ] initWithCString:icon ];
|
||||||
|
[ window setMiniwindowTitle:string ];
|
||||||
|
[ string release ];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void QZ_SetIcon (_THIS, SDL_Surface *icon, Uint8 *mask) {
|
static void QZ_SetIcon (_THIS, SDL_Surface *icon, Uint8 *mask) {
|
||||||
|
|
|
@ -35,9 +35,7 @@
|
||||||
@implementation SDL_QuartzWindowDelegate
|
@implementation SDL_QuartzWindowDelegate
|
||||||
- (BOOL)windowShouldClose:(id)sender {
|
- (BOOL)windowShouldClose:(id)sender {
|
||||||
|
|
||||||
SDL_Event event;
|
SDL_PrivateQuit();
|
||||||
event.type = SDL_QUIT;
|
|
||||||
SDL_PushEvent(&event);
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
Loading…
Add table
Add a link
Reference in a new issue