0

Under Mojave, and under the System preferences custom pane of my screensaver, the Close button of [NSColorPanel sharedColorPanel] is not visible.

I am asking for your help/advice to bring it back.

I am using [NSColorPanel sharedColorPanel] to let the user select a custom color that will be used in my screensaver's rendering of sprites.

Under Mojave this panel stopped having a close button and the user cannot complete the selection. The panel is shown as modal and the user can only force quit via the System preferences (because this is a screensaver, its configuration dialog is being run as a preference pane from the System preferences).

This does not happen in versions previous to Mojave.
To make it more complex, I also have an .app version of the screensaver and the Close button is appearing Ok there. The .app version is a standalone app and does not run via the ScreensaverEngine like the screensavers.

NSColorPanel *panel; // weak ref
panel = [NSColorPanel sharedColorPanel];
[panel setShowsAlpha:NO];
[panel setColor: color ];
[panel setDelegate:self];
[NSApp runModalForWindow:panel]; // <- does not return from that call
[panel setDelegate:nil];
NSColor *result=panel.color;
[panel close];

I tried to enable the button by

[[panel standardWindowButton:NSWindowCloseButton] setEnabled:YES];
[[panel standardWindowButton:NSWindowCloseButton] setHidden:NO];

but it did not help.

You can see the missing Close button on this screenshot https://user-images.githubusercontent.com/4344442/51428774-5f927900-1c10-11e9-8441-ec85e71534c7.png I can also give the public download URLs of the .saver and .app versions if this would help.

Mike
  • 436
  • 5
  • 9
  • 1
    I'm not familiar with screen savers but can't you use `NSColorWell` or `orderFrontColorPanel:`? – Willeke Jan 20 '19 at 14:08
  • Thanks for the suggestion. I have not a big experience in cocoa, but I easily used NSColorWell and ran away from the problem of NSColorPanel. Is there an easy way to make the NSColorWell show the color selection popup window as modal? – Mike Jan 21 '19 at 07:54
  • Panels aren't modal. See the Other Highlight color on the General pane of System Prefs and the Custom Desktop Color on the Desktop & Screen Saver pane. You can close the color panel when you want, if it exists. – Willeke Jan 21 '19 at 08:16

0 Answers0