Window origin in Fullscreen Mode

Roosterhouse
Unregistered
 
Post: #1
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
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
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 Rasp. The harder one? Search google for the category someone wrote that changes NSScreen's behavior appropriately.
Quote this message in a reply
Roosterhouse
Unregistered
 
Post: #3
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.

Specifically, this code:

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 -

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


Hope this helps somebody
Chris
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  window->fullscreen Duane 8 3,969 Jun 30, 2005 03:42 PM
Last Post: OneSadCookie