PDA

View Full Version : Window origin in Fullscreen Mode


Roosterhouse
2004.08.05, 01:10 PM
I've got my fullscreen mode working, pretty much. One strange thing is (and maybe its supposed to work this way and I'm just uneducated) that my fullscreen window's origin (the one that sits on top of CGDisplayCapture's shielding window) is 168 pixels below the bottom of my display, and I have to manually move it up 168 pixels for it to view properly.

The resolution changes from 1024 x 768 to 800 x 600, and I'm sure this is what is causing the problem

I'm using - initWithContentRect: (NSRect)rect ... to build my fullscreen window, and rect is setup as NSMakeRect(0,0,800, 600) . What should I set the origin at to make sure it is placed in the bottom left corner, regardless of the display?

I'm sorry if this doesn't make any sense... I'm not near the computer this code is on, so I'm trying to remeber exactly what the problem is.

Thanks
Chris

OneSadCookie
2004.08.05, 06:27 PM
There is a bug/feature in NSScreen that it doesn't update whilst the screen is captured. This means that Cocoa windows don't show up in the right place in full-screen mode. The simple solution? Don't use a window at all :p. The harder one? Search google for the category someone wrote that changes NSScreen's behavior appropriately.

Roosterhouse
2004.08.06, 07:59 AM
Thanks Keith, that worked perfectly.

For anyone who may be having the same problem and doesn't already know how to fix it, the category OSC was talking about is here (http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/src/video/quartz/SDL_QuartzVideo.m?rev=1.38&content-type=text/x-cvsweb-markup).

Specifically, this code:

@interface NSScreen (NSScreenAccess)
- (void) setFrame:(NSRect)frame;
@end

@implementation NSScreen (NSScreenAccess)
- (void) setFrame:(NSRect)frame;
{
* *_frame = frame;
}
@end

This gives you access to the private variable "frame", and allows you to set it manually to whatever resolution you have switched to -

[[NSScreen mainScreen] setFrame: NSMakeRect(0,0, 800, 600)];

Hope this helps somebody
Chris