Hi

I'm trying to handle when some other app changes to fullscreen by handling the kEventAppSystemUIModeChanged event.

The event handler is called but then when I check if the menu bar is visibe I get TRUE!

So I figured, either the apps I'm testing fullscreen mode with (VLC, Photoshop) don't really enter fullscreen mode as they should like Mac OS X wants an app too. Or, the event arrives too early, I even tried putting a 2 seconds sleep but get the same result - menu is always visible.

I must be doing something wrong here, maybe there is a simpler Cocoa way?


pascal OSStatus AppEventHandler( EventHandlerCallRef inCallRef, EventRef inEvent, void* inUserData )
{
        #pragma unused( inCallRef, inUserData )
        
        //sleep( 2 );
        
        OSStatus status = eventNotHandledErr;
        
        switch( GetEventClass( inEvent ) )
        {
                case kEventClassApplication:
                {
                        NSLog( @"kEventClassApplication" );
                        
                        // check menu visibility, or ui mode
                        SystemUIMode *outMode;
                        SystemUIOptions *outOptions;
                        
                        GetSystemUIMode( outMode, outOptions );
                        
                        NSLog( @"UI mode: %d %d", *outMode, *outOptions );    
// = 0 0
                        
                        NSLog( @"menu: %d", [NSMenu menuBarVisible] );          
      // = 1
                        NSLog( @"menu: %d", IsMenuBarVisible() );               
      // = 1
                        
                        status = noErr;         // everything went well, event 
handled
                }
                break;
                
                default:
                {
                        NSLog( @"..." );
                }
                break;
        }
        
        
    return status;
}

static const EventTypeSpec sAppEvents[] = { { kEventClassApplication, kEventAppSystemUIModeChanged } };

InstallApplicationEventHandler( NewEventHandlerUPP( AppEventHandler ),
                                                        GetEventTypeCount( 
sAppEvents ),
                                                        sAppEvents, 0, NULL );

Thanks.


Yours sincerely,
            Mohsan Khan.
_______________________________________________________________
www.xybernic.com
There is no place like 127.0.0.1.



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to