CGDisplayHideCursor and -[NSWindow toggleFullScreen] don't get along on Lion

  • I'm trying to hide the cursor when in full-screen mode on Lion but the CGDisplayHideCursor call immediately takes the display out of full-screen mode.  It doesn't matter which call comes first, I get the same result every time.

    Here's the code:

    - (void)applicationDidFinishLaunching:(NSNotification*)notification
    {
        if ( NO == [[NSUserDefaults standardUserDefaults] developerMode] )
        {
            // disable idle and display sleep
            [self disableDisplaySleep];
            [self disableIdleSleep];

            // enter full-screen mode
            [self.window toggleFullScreen:self];

            // hide cursor (mouse pointer)
            CGDisplayHideCursor(kCGDirectMainDisplay);
        }

        // create views and pass in model for binding
        menuViewController = [[JTVMenuViewController alloc] initWithPlaylist:self.moviePlaylist];
        [menuViewController loadView];

        movieViewController = [[JTVMovieViewController alloc] initWithPlaylist:self.moviePlaylist];
        [movieViewController loadView];
        movieViewController.delegate = self;

        // start with the menu as the main view
        [self.window.contentView setWantsLayer:YES];
        [self.window.contentView addSubview:menuViewController.view];
    }

    -Michael
  • On Jan 2, 2012, at 10:30 AM, Michael Crawford wrote:

    > I'm trying to hide the cursor when in full-screen mode on Lion but the CGDisplayHideCursor call immediately takes the display out of full-screen mode.  It doesn't matter which call comes first, I get the same result every time.

    Works fine here.

    --
    Seth Willits
  • Seth, don't run from inside Xcode.  Start the app from the finder.  I find that in that instance, it goes to full screen and then immediately exits full screen.

    Here is a trace:

    1/2/12 1:51:21.428 PM JTVideoPlayer: -[JTVAppDelegate window:willUseFullScreenPresentationOptions:]
    1/2/12 1:51:21.429 PM JTVideoPlayer: -[JTVAppDelegate windowWillEnterFullScreen:]
    1/2/12 1:51:21.441 PM JTVideoPlayer: -[JTVAppDelegate window:willUseFullScreenContentSize:]
    1/2/12 1:51:21.448 PM JTVideoPlayer: -[JTVAppDelegate windowDidEnterFullScreen:]
    1/2/12 1:51:21.532 PM JTVideoPlayer: -[JTVAppDelegate windowWillExitFullScreen:]
    1/2/12 1:51:22.886 PM JTVideoPlayer: -[JTVAppDelegate windowDidExitFullScreen:]

    -Michael

    On Jan 2, 2012, at 1:52 PM, Seth Willits wrote:

    > On Jan 2, 2012, at 10:30 AM, Michael Crawford wrote:
    >
    >> I'm trying to hide the cursor when in full-screen mode on Lion but the CGDisplayHideCursor call immediately takes the display out of full-screen mode.  It doesn't matter which call comes first, I get the same result every time.
    >
    > Works fine here.
    >
    >
    >
    > --
    > Seth Willits
  • Still works fine. Can you repeat it in a sample project that I can test?

    On Jan 2, 2012, at 11:27 AM, Michael Crawford wrote:

    > Seth, don't run from inside Xcode.  Start the app from the finder.  I find that in that instance, it goes to full screen and then immediately exits full screen.
    >
    >
    > -Michael
    >
    > On Jan 2, 2012, at 1:52 PM, Seth Willits wrote:
    >
    >> On Jan 2, 2012, at 10:30 AM, Michael Crawford wrote:
    >>
    >>> I'm trying to hide the cursor when in full-screen mode on Lion but the CGDisplayHideCursor call immediately takes the display out of full-screen mode.  It doesn't matter which call comes first, I get the same result every time.
    >>
    >> Works fine here.
    >>
  • On Jan 2, 2012, at 11:27 AM, Michael Crawford <michaelacrawford...> wrote:

    > Seth, don't run from inside Xcode.  Start the app from the finder.  I find that in that instance, it goes to full screen and then immediately exits full screen.

    Try launching with Shift held down to clear restorable window state.

    --Kyle Sluder
  • Thank you, Kyle.  That works.

    -Michael

    On Jan 2, 2012, at 3:16 PM, Kyle Sluder wrote:

    > On Jan 2, 2012, at 11:27 AM, Michael Crawford <michaelacrawford...> wrote:
    >
    >> Seth, don't run from inside Xcode.  Start the app from the finder.  I find that in that instance, it goes to full screen and then immediately exits full screen.
    >
    > Try launching with Shift held down to clear restorable window state.
    >
    > --Kyle Sluder
  • Seth, I appreciate your offer to help out by testing some code.  Now that Kyle has identified what is going on, I'm looking into programmatically disabling or overriding the window restoration behavior for my app.

    -Michael

    On Jan 2, 2012, at 4:44 PM, Michael Crawford wrote:

    > Thank you, Kyle.  That works.
    >
    > -Michael
    >
    > On Jan 2, 2012, at 3:16 PM, Kyle Sluder wrote:
    >
    >> On Jan 2, 2012, at 11:27 AM, Michael Crawford <michaelacrawford...> wrote:
    >>
    >>> Seth, don't run from inside Xcode.  Start the app from the finder.  I find that in that instance, it goes to full screen and then immediately exits full screen.
    >>
    >> Try launching with Shift held down to clear restorable window state.
    >>
    >> --Kyle Sluder

  • For the benefit of anyone else who is watching and also has limited experience with some of the new Lion features, a call to [NSWindow setRestorable:] or flipping a switch in the interface builder UI for the NSWindow instance, handily solves the problem.

    -Michael

    On Jan 2, 2012, at 4:56 PM, Michael Crawford wrote:

    > Seth, I appreciate your offer to help out by testing some code.  Now that Kyle has identified what is going on, I'm looking into programmatically disabling or overriding the window restoration behavior for my app.
    >
    > -Michael
    >
    > On Jan 2, 2012, at 4:44 PM, Michael Crawford wrote:
    >
    >> Thank you, Kyle.  That works.
    >>
    >> -Michael
    >>
    >> On Jan 2, 2012, at 3:16 PM, Kyle Sluder wrote:
    >>
    >>> On Jan 2, 2012, at 11:27 AM, Michael Crawford <michaelacrawford...> wrote:
    >>>
    >>>> Seth, don't run from inside Xcode.  Start the app from the finder.  I find that in that instance, it goes to full screen and then immediately exits full screen.
    >>>
    >>> Try launching with Shift held down to clear restorable window state.
    >>>
    >>> --Kyle Sluder


  • I'm curious.  I swapped out my calls to CGDisplayHideCursor and CGDisplayShowCursor with +[NSCursor hide] and +[NSCursor unhide], respectively.  Same behavior.  I wanted to know if one called the other so I set a breakpoint on the CGDisplay methods and called the NSCursor methods.  They don't appear to be layered.

    I'm curious to know, what if any differences there are between the two sets of calls?  What advantage if any does one set have over the other?

    -Michael

    On Jan 2, 2012, at 5:11 PM, Michael Crawford wrote:

    > For the benefit of anyone else who is watching and also has limited experience with some of the new Lion features, a call to [NSWindow setRestorable:] or flipping a switch in the interface builder UI for the NSWindow instance, handily solves the problem.
    >
    > -Michael
    >
    > On Jan 2, 2012, at 4:56 PM, Michael Crawford wrote:
    >
    >> Seth, I appreciate your offer to help out by testing some code.  Now that Kyle has identified what is going on, I'm looking into programmatically disabling or overriding the window restoration behavior for my app.
    >>
    >> -Michael
    >>
    >> On Jan 2, 2012, at 4:44 PM, Michael Crawford wrote:
    >>
    >>> Thank you, Kyle.  That works.
    >>>
    >>> -Michael
    >>>
    >>> On Jan 2, 2012, at 3:16 PM, Kyle Sluder wrote:
    >>>
    >>>> On Jan 2, 2012, at 11:27 AM, Michael Crawford <michaelacrawford...> wrote:
    >>>>
    >>>>> Seth, don't run from inside Xcode.  Start the app from the finder.  I find that in that instance, it goes to full screen and then immediately exits full screen.
    >>>>
    >>>> Try launching with Shift held down to clear restorable window state.
    >>>>
    >>>> --Kyle Sluder



previous month january 2012 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today