开发者

Set NSWindow location/size on launch and Lion fullscreen resume = bad layout

开发者 https://www.devze.com 2023-03-31 15:58 出处:网络
I\'ve created an application which initially stores and restores window size and location in the app delegate\'s applicationWillFinishLaunching: or applicationDidFinishLaunching.

I've created an application which initially stores and restores window size and location in the app delegate's applicationWillFinishLaunching: or applicationDidFinishLaunching.

Later I have replaces it with calling [NSWindow setFrameUsingName:] and such to store and load window location and size.

Both storing and loading works just fine (with custom code and with setFrameUsingName)

But now the problem: when I have enabled Fullscreen mode on the application and logout with the option "restore windows". It will launch the application in the sep开发者_JAVA技巧arate window to become fullscreen but then my code is called again to set the window size: in effect displaying a small window in the big fullscreen screen.

It seems the lifecycle almost ends with the windowDidEnterFullScreen: call. The applicationWillFinishLaunching: is called way before the window is put in full screen and the NSWindow's styleMask doesn't show fullscreen there yet.

Anyone able to help me?


The problems where caused by an fade-in animation during application launch. Make sure you don't start animation on the window in applicationWillFinishLaunching in the app delegate.


Try setting a flag in windowWillEnterFullScreen to let your window know not to set its size.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号