Mercurial > sdl-ios-xcode
comparison src/video/quartz/SDL_QuartzVideo.m @ 4265:c7b1d5eaa77d SDL-1.2
Fixed SDL_VIDEO_WINDOW_POS environment variable for Quartz target.
Fixes Bugzilla #628.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Tue, 29 Sep 2009 13:07:36 +0000 |
parents | 1fc8c8a5ff00 |
children | 27f972dd5aff |
comparison
equal
deleted
inserted
replaced
4264:d6f4cc9a5bf6 | 4265:c7b1d5eaa77d |
---|---|
668 current->flags = 0; | 668 current->flags = 0; |
669 current->w = width; | 669 current->w = width; |
670 current->h = height; | 670 current->h = height; |
671 | 671 |
672 contentRect = NSMakeRect (0, 0, width, height); | 672 contentRect = NSMakeRect (0, 0, width, height); |
673 | 673 |
674 /* | 674 /* |
675 Check if we should completely destroy the previous mode | 675 Check if we should completely destroy the previous mode |
676 - If it is fullscreen | 676 - If it is fullscreen |
677 - If it has different noframe or resizable attribute | 677 - If it has different noframe or resizable attribute |
678 - If it is OpenGL (since gl attributes could be different) | 678 - If it is OpenGL (since gl attributes could be different) |
717 if ( flags & SDL_RESIZABLE ) { | 717 if ( flags & SDL_RESIZABLE ) { |
718 style |= NSResizableWindowMask; | 718 style |= NSResizableWindowMask; |
719 current->flags |= SDL_RESIZABLE; | 719 current->flags |= SDL_RESIZABLE; |
720 } | 720 } |
721 } | 721 } |
722 | 722 |
723 if ( QZ_WindowPosition(this, &origin_x, &origin_y) ) { | |
724 center_window = 0; | |
725 contentRect.origin.x = (float)origin_x; | |
726 contentRect.origin.y = (float)origin_y; | |
727 } | |
728 | |
729 /* Manually create a window, avoids having a nib file resource */ | 723 /* Manually create a window, avoids having a nib file resource */ |
730 qz_window = [ [ SDL_QuartzWindow alloc ] | 724 qz_window = [ [ SDL_QuartzWindow alloc ] |
731 initWithContentRect:contentRect | 725 initWithContentRect:contentRect |
732 styleMask:style | 726 styleMask:style |
733 backing:NSBackingStoreBuffered | 727 backing:NSBackingStoreBuffered |
739 CGDisplayFade (fade_token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, FALSE); | 733 CGDisplayFade (fade_token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, FALSE); |
740 CGReleaseDisplayFadeReservation (fade_token); | 734 CGReleaseDisplayFadeReservation (fade_token); |
741 } | 735 } |
742 return NULL; | 736 return NULL; |
743 } | 737 } |
744 | 738 |
745 /*[ qz_window setReleasedWhenClosed:YES ];*/ /* no need to set this as it's the default for NSWindows */ | 739 /*[ qz_window setReleasedWhenClosed:YES ];*/ /* no need to set this as it's the default for NSWindows */ |
746 QZ_SetCaption(this, this->wm_title, this->wm_icon); | 740 QZ_SetCaption(this, this->wm_title, this->wm_icon); |
747 [ qz_window setAcceptsMouseMovedEvents:YES ]; | 741 [ qz_window setAcceptsMouseMovedEvents:YES ]; |
748 [ qz_window setViewsNeedDisplay:NO ]; | 742 [ qz_window setViewsNeedDisplay:NO ]; |
749 if ( center_window ) { | 743 |
744 if ( QZ_WindowPosition(this, &origin_x, &origin_y) ) { | |
745 /* have to flip the Y value (NSPoint is lower left corner origin) */ | |
746 [ qz_window setFrameTopLeftPoint:NSMakePoint((float) origin_x, (float) (this->info.current_h - origin_y))]; | |
747 center_window = 0; | |
748 } | |
749 else if ( center_window ) { | |
750 [ qz_window center ]; | 750 [ qz_window center ]; |
751 } | 751 } |
752 | |
752 [ qz_window setDelegate: | 753 [ qz_window setDelegate: |
753 [ [ SDL_QuartzWindowDelegate alloc ] init ] ]; | 754 [ [ SDL_QuartzWindowDelegate alloc ] init ] ]; |
754 [ qz_window setContentView: [ [ [ SDL_QuartzView alloc ] init ] autorelease ] ]; | 755 [ qz_window setContentView: [ [ [ SDL_QuartzView alloc ] init ] autorelease ] ]; |
755 } | 756 } |
756 /* We already have a window, just change its size */ | 757 /* We already have a window, just change its size */ |