On Sat, 19 Apr 2025 14:02:36 GMT, Pabulaner IV <d...@openjdk.org> wrote:
>> src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.m line >> 200: >> >>> 198: if (!self) return self; >>> 199: >>> 200: // register for the finish launching and system power off >>> notifications by default >> >> I assume there is a good reason that AWT only registered for these >> notifications if IT is the main toolkit. >> The implications of changing this might be that it will try to handle events >> that should be left to FX in the >> case that FX is the main toolkit. > > Exactly, it only installs the handlers if it doesn't run embedded. > But since JavaFX doesn't handle urls by itself, it still blocks AWT from > receiving those events. > Therefore the only event for now that is forwarded to AWT is the url event. Moving this block up from the end of this method to here doesn't change anything if AWT is embedded. What it will do is allow the handlers to be run if the AWT Toolkit owns the NSApplication (i.e., is _not_ embedded), and the application is using a custom nib. The only short-circuit in the remainder of the `init` method is this: BOOL usingDefaultNib = YES; if ([NSApp isKindOfClass:[NSApplicationAWT class]]) { usingDefaultNib = [NSApp usingDefaultNib]; } if (!usingDefaultNib) return self; Presuming that adding the handler is needed (although I have a high-level question about that in my general review comments), it might be less intrusive to leave the initialization of the existing handlers where they are at the end of the method, and only add the one you need here. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24379#discussion_r2060727798