Open zevrix opened 3 years ago
@zevrix -- thanks for posting these suggestions. I tried to apply these two changes to the NSCustomAlert process, but couldn't get the alert to be movable on Monterey. Is that your experience?
Here's what I changed:
#if NON_MOVEABLE
_panel = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100)
styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskDocModalWindow
backing:NSBackingStoreBuffered
defer:YES];
#else
_panel = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100)
styleMask:NSWindowStyleMaskTitled
backing:NSBackingStoreBuffered
defer:YES];
_panel.movableByWindowBackground = YES;
#endif
This works for me on Monterey (and other systems) - which looks like what you posted::
_panel = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100)
styleMask:NSWindowStyleMaskTitled
backing:NSBackingStoreBuffered
defer:YES];
_panel.movableByWindowBackground = YES;
Maybe your NON_MOVEABLE gets in the way and is being called when not needed?
No, NON_MOVEABLE is not even defined. I just put it there to preserve the "original" code before placing your suggestions in the #else section.
Very odd.
FYI -- In MacOS Ventura, Apple has changed the behavior of NSAlert to essentially do what NSCustomAlert does: it will revert to the horizontal format if the text is beyond a specific threshold.
thanks for the info on the changes in Ventura - i didn't know that. well hopefully it's a start and Apple will finally revert the NSAlert look to its normal horizontal layout for all situations. the change in the NSAlert layout was easily the DUMBEST UI change Apple ever made.
still strange that NSCustomAlert isn't moveable for you...
i posted the files I'm using here - maybe i made more changes that i didn't notice by now:
https://zevrix.com/guest/NSCustomAlert.zip
it's only two.h
and .mm
files - I don't use anything else.
also i didn't clean up my own personal comments there... plus my code is non-ARC so change accordingly if needed.
also just in case - that's how I create the alert if it makes any difference:
alert = [[NSCustomAlert new] autorelease];
// set alert properties
[alert runModal]
it's all wrapped in my own category.
Like I mentioned in a reply to you on Apple's forum, it's a great and truly useful project.
One issue in its current state is that the alert cannot be moved around by the user.
The solution I found is the following:
In the
init
method: • Remove theNSWindowStyleMaskDocModalWindow
mask • add_panel.movableByWindowBackground = YES