A better screens prefs change

This commit is contained in:
nigel 2002-05-26 00:12:32 +00:00
parent edc98d37d2
commit c0201dfc68

View File

@ -115,7 +115,7 @@
#import <prefs.h> #import <prefs.h>
#define DEBUG 1 #define DEBUG 0
#import <debug.h> #import <debug.h>
- (PrefsEditor *) init - (PrefsEditor *) init
@ -281,23 +281,26 @@
edited = YES; edited = YES;
} }
// Screen/window changing stuff // This is called when any of the screen/openGL/window,
// width, height or depth is clicked.
//
// Note that sender may not actually be an NSMatrix.
// This is called when any of the screen/window, width, height or depth is changed - (IBAction) ChangeScreen: (NSMatrix *)sender
- (IBAction) ChangeScreen: (id)sender
{ {
NSButton *cell = [sender selectedCell];
short newx = [width intValue]; short newx = [width intValue];
short newy = [height intValue]; short newy = [height intValue];
short newbpp = [depth intValue]; short newbpp = [depth intValue];
short newtype; short newtype;
char str[20]; char str[20];
if ( [openGL state] ) if ( cell == openGL )
newtype = DISPLAY_OPENGL; newtype = DISPLAY_OPENGL;
else if ( [screen state] ) else if ( cell == screen )
newtype = DISPLAY_SCREEN; newtype = DISPLAY_SCREEN;
else if ( [window state] ) else if ( cell == window )
newtype = DISPLAY_WINDOW; newtype = DISPLAY_WINDOW;
else else
newtype = display_type; newtype = display_type;
@ -317,13 +320,8 @@
if ( newtype == DISPLAY_SCREEN ) // If changing to full screen if ( newtype == DISPLAY_SCREEN ) // If changing to full screen
{ {
// supply main screen dimensions as a default // supply main screen dimensions as a default
NSScreen *s = [NSScreen mainScreen]; newx = CGDisplayPixelsWide (kCGDirectMainDisplay);
NSRect sr = [s frame]; newy = CGDisplayPixelsHigh (kCGDirectMainDisplay);
newx = (short) sr.size.width;
newy = (short) sr.size.height;
// This always returns 24, despite the mode
//newbpp = NSBitsPerPixelFromDepth([s depth]);
newbpp = CGDisplayBitsPerPixel(kCGDirectMainDisplay); newbpp = CGDisplayBitsPerPixel(kCGDirectMainDisplay);
} }