NSWindow not showing?
I have the following code:
NSRect contentRect = NSZeroRect;
contentRect.size = NSMakeSize(400, 400);
contentRect.origin = NSMakePoint(400, 400);
NSWindow* window = [[NSWindow alloc] initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
[window setBackgroundColor:[NSColor blackColor]];
[window setMovableByWindowBackground:NO];
[window setExcludedFromWindowsMenu:YES];
[window setAlphaValue:0.8];
[window setOpaque:NO];
[window setHasShadow:YES];
[window useOptimizedDrawing:YES];
[NSApp activateIgnoringOtherApps:YES];
[window makeKeyAndOrderFront:nil];
It's called - (BOOL) applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
. This function is called when you click on the dock icon.
Why is my window not showing?
I also noticed that when clicking a dozen times on the dock icon. Someday I see my window pop up for 1/10 of a second. Then he disappears.
+3
source to share