I've got an old app that I'm looking at (XIB interface) which calls these functions:
If I remove these calls, the application menu doesn't show up at all. With these calls in, the menu bar doesn't respond until the app leaves the foreground and then becomes active again.
I created a new XIB-based app and compared the AppDelegate and raw XIB code to what's in the older app, and they look the same, but the newer app's menus work fine without the above calls.
Of what are these calls a legacy, and does anyone know what changes can be made to get rid of them?
Code Block ProcessSerialNumber psn = { 0, kCurrentProcess }; TransformProcessType(&psn, kProcessTransformToForegroundApplication); SetSystemUIMode(kUIModeNormal, 0);
If I remove these calls, the application menu doesn't show up at all. With these calls in, the menu bar doesn't respond until the app leaves the foreground and then becomes active again.
I created a new XIB-based app and compared the AppDelegate and raw XIB code to what's in the older app, and they look the same, but the newer app's menus work fine without the above calls.
Of what are these calls a legacy, and does anyone know what changes can be made to get rid of them?
Once upon a time, in the long ago when the app was just coming into being, a plist value was set that told the OS that it was an agent app. It shouldn’t normally be visible, and we didn’t want a dock icon for it.
Eons later, when there were bugs filed about the lack of a dock item, the problem was fixed not by removing that plist value but by adding code that forced a dock icon, and forced the app to the foreground. A side effect of this code was that the menus were not usable until the app went to the background and came back the to foreground.
So basically removing the LSUIElement value and all the extra code above fixed the issue.
I think that whoever added the code was unaware that it was the plist value causing the problem in the first place.
Eons later, when there were bugs filed about the lack of a dock item, the problem was fixed not by removing that plist value but by adding code that forced a dock icon, and forced the app to the foreground. A side effect of this code was that the menus were not usable until the app went to the background and came back the to foreground.
So basically removing the LSUIElement value and all the extra code above fixed the issue.
I think that whoever added the code was unaware that it was the plist value causing the problem in the first place.