• 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
Could kEventAppSystemUIModeChanged arrive too early to my handler
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Could kEventAppSystemUIModeChanged arrive too early to my handler


  • Subject: Could kEventAppSystemUIModeChanged arrive too early to my handler
  • From: Mohsan Khan <email@hidden>
  • Date: Sun, 15 Jun 2008 18:15:49 +0200

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 (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Could kEventAppSystemUIModeChanged arrive too early to my handler
      • From: Jean-Daniel Dupas <email@hidden>
  • Prev by Date: Re: Static Functions and Variables
  • Next by Date: Automatically Call a Function
  • Previous by thread: Re: Static Functions and Variables
  • Next by thread: Re: Could kEventAppSystemUIModeChanged arrive too early to my handler
  • Index(es):
    • Date
    • Thread