• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Solved Re: Fullscreen window after hiding Dock works in 10.4 but not 10.3
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Solved Re: Fullscreen window after hiding Dock works in 10.4 but not 10.3


  • Subject: Solved Re: Fullscreen window after hiding Dock works in 10.4 but not 10.3
  • From: Robert MacGregor <email@hidden>
  • Date: Wed, 3 Aug 2005 15:12:28 -0400

Keywords: Kiosk mode, full-screen window, Dock, menu-bar, LSUIPresentationMode

**Summary
Here's one solution to display a window full-screen with no menu-bar or dock:


1) Insert LSUIPresentationMode = 3 into info.plist
2) override - (NSRect)windowWillUseStandardFrame:(NSWindow *)sender defaultFrame:(NSRect)defaultFrame in your window's delegate
3) override - (void)applicationDidBecomeActive:(NSNotification *) aNotification in your app's delegate


Note: Info.plist directives are completely processed when an app receives it's NSApplicationDidBecomeActiveNotification.

**Problem
You want to use OS X to display your application's window without Users seeing the Dock or the menu-bar; possibly without Users interacting through the Dock or menu-bar.


**Detail
The problem Eric describes (see below) has been asked many times on the Java and Cocoa lists. This solution is common to Java or Cocoa apps built using an info.plist. I don't, yet, have an answer for pure- Java apps.


**Solution
This solution works for apps that have an Info.plist file E.g. Cocoa apps and Cocoa-Java Apps


1) Remove the Dock and Menu-bar from the screen. Add a LSUIPresentationMode key to your info.plist file as described here:

-----------------Topic---------------------
Property List Key Reference
http://developer.apple.com/documentation/MacOSX/Conceptual/ BPRuntimeConfig/Concepts/PListKeys.html


"LSUIPresentationMode

This key identifies the initial user-interface mode for the application. You would use this in applications that may need to take over portions of the screen that contain UI elements such as the Dock and menu bar. Most modes affect only UI elements that appear in the content area of the screen, that is, the area of the screen that does not include the menu bar. However, you can request that all UI elements be hidden as well."
-----------------End Topic---------------------


I used a key value of 4 so that the Dock and Menu-bar would re-appear if I hovered my mouse over the position where they should have been. If a value of 3 is used the Dock and Menu-bar will not re-appear. The app's apple-Q key combination will still work; the app quits.


2) Make your app's window as large as possible.
Override - (NSRect)windowWillUseStandardFrame:(NSWindow *)sender defaultFrame:(NSRect)defaultFrame in your window's delegate


- (NSRect)windowWillUseStandardFrame:(NSWindow *)sender defaultFrame: (NSRect)defaultFrame
{
NSLog(@"Setting frame size to Screen");
NSScreen *screen = [sender screen];
return [screen frame];
}


This sets the window's frame-size to the largest area supported by the screen. My second attempt used this code plus [window zoom] to make my window fill the screen. This attempt didn't work because the menu-bar was still visible when windowWillUseStandardFrame was called. I got a large window with a menu-bar sized strip of my Desktop visible. I saw the window appear, zoom and then the menu-bar disappeared.

The problem is that the zoom is called too early; before the Info.plist LSUIPresentationMode key processing completes. So ...


3) override - (void)applicationDidBecomeActive:(NSNotification *) aNotification in your app's delegate
- (void)applicationDidBecomeActive:(NSNotification *)aNotification
{
NSLog(@"Application did become active");


    //Get our application object
    NSApplication *app = [aNotification object];

    //Get the array of windows our application owns
    NSArray *windows = [app windows];
    NSLog(@"windows %@", windows);

    //Assume we have one window for this example
    NSWindow *mywindow = [windows objectAtIndex:0];

    //Make our window the key window and order to the front
    [mywindow makeKeyAndOrderFront:self];

    //Send a zoom message to our window
    [mywindow performZoom:self];
}

AFAIK applicationDidBecomeActive is the last app-delegate method called after an app launches. For this example applicationDidBecomeActive is called late enough that LSUIPresentationMode has taken effect. The menu-bar disappears and the app window zooms. The result is a full-screen window.

The Summary-note, above, is worth considering. Conceptually I'd thought info.plist would be processed before my app started running (before I see a window on the screen). This example shows that assumption isn't true. :-) Worth remembering for the future ...

Note: SetSystemUIMode
http://developer.apple.com/technotes/tn2002/tn2062.html
Although the menu-bar is not visible it's still active; you can shift- apple-Q to logout for example. Use SetSystemUIMode and SystemUIOption to disable the menu-bar functions.


I have a Cocoa-app XCode 2.1 project with the code shown above. All the classes and methods used are available via the Java-bridge. Some delegate methods are never called; I included them for comparison. If you want a copy email me and I'll send the archived project to you. Size is approx 55k.



Rob




On 2-Aug-05, at 9:47 PM, Robert MacGregor wrote:



On 2-Aug-05, at 8:01 PM, Crichlow, Eric wrote:



I've tried 2 different ways of hiding the Dock while my app is running,
NSMenu's setMenuBarVisible call, and SetSystemUIMode. In both cases, if I
make the call and then try to create a full screen window, even if the
window is created several seconds later, after other processing is done, the
Dock is hidden, but the window still comes up and won't cover the area of
the screen where the Dock had been located.




Could this help? The key goes into your info.plist; if your app has one.


Property List Key Reference
http://developer.apple.com/documentation/MacOSX/Conceptual/ BPRuntimeConfig/Concepts/PListKeys.html


"LSUIPresentationMode

This key identifies the initial user-interface mode for the application. You would use this in applications that may need to take over portions of the screen that contain UI elements such as the Dock and menu bar. Most modes affect only UI elements that appear in the content area of the screen, that is, the area of the screen that does not include the menu bar. However, you can request that all UI elements be hidden as well."


Rob





_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Solved Re: Fullscreen window after hiding Dock works in 10.4 but not 10.3
      • From: Ricky Sharp <email@hidden>
  • Prev by Date: Re: Issue resizing a bordered tab view (SOLVED)
  • Next by Date: Re: Inserting an (int) into an NSMutableArray
  • Previous by thread: Re: NSValueTransformer for selectedObjects controller key - bug?
  • Next by thread: Re: Solved Re: Fullscreen window after hiding Dock works in 10.4 but not 10.3
  • Index(es):
    • Date
    • Thread