File tree Expand file tree Collapse file tree 4 files changed +15
-15
lines changed
src/java.desktop/macosx/native Expand file tree Collapse file tree 4 files changed +15
-15
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2011, 2012 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2011, 2021 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@ extern "C" {
4242/*
4343 * AWTTrayIcon
4444 */
45- @interface AWTTrayIcon : NSObject {
45+ @interface AWTTrayIcon : NSObject < NSUserNotificationCenterDelegate > {
4646 jobject peer;
4747 AWTTrayIconView *view;
4848 NSStatusItem *theItem;
Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2011, 2017 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2011, 2021 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
@@ -68,11 +68,14 @@ - (id) initWithPeer:(jobject)thePeer {
6868
6969 view = [[AWTTrayIconView alloc ] initWithTrayIcon: self ];
7070 [theItem setView: view];
71+ [[NSUserNotificationCenter defaultUserNotificationCenter ] setDelegate: self ];
7172
7273 return self;
7374}
7475
7576-(void ) dealloc {
77+ [[NSUserNotificationCenter defaultUserNotificationCenter ] setDelegate: nil ];
78+
7679 JNIEnv *env = [ThreadUtilities getJNIEnvUncached ];
7780 (*env)->DeleteGlobalRef (env, peer);
7881
@@ -167,6 +170,12 @@ -(void) deliverJavaMouseEvent: (NSEvent *) event {
167170 (*env)->DeleteLocalRef (env, jEvent);
168171}
169172
173+ - (BOOL )userNotificationCenter : (NSUserNotificationCenter *)center
174+ shouldPresentNotification : (NSUserNotification *)notification
175+ {
176+ return YES ; // We always show notifications to the user
177+ }
178+
170179@end // AWTTrayIcon
171180// ================================================
172181
Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2011, 2017 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2011, 2021 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
2626#import " JNIUtilities.h"
2727#import < Cocoa/Cocoa.h>
2828
29- JNIEXPORT @interface NSApplicationAWT : NSApplication < NSUserNotificationCenterDelegate > {
29+ JNIEXPORT @interface NSApplicationAWT : NSApplication {
3030 NSString *fApplicationName;
3131 NSWindow *eventTransparentWindow;
3232 NSTimeInterval dummyEventTimestamp;
Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2011, 2020 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2011, 2021 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
@@ -77,8 +77,6 @@ - (id) init
7777
7878- (void )dealloc
7979{
80- [[NSUserNotificationCenter defaultUserNotificationCenter ] setDelegate: nil ];
81-
8280 [fApplicationName release ];
8381 fApplicationName = nil ;
8482
@@ -158,15 +156,8 @@ - (void)finishLaunching
158156 }
159157
160158 [super finishLaunching ];
161-
162- [[NSUserNotificationCenter defaultUserNotificationCenter ] setDelegate: self ];
163159}
164160
165- - (BOOL )userNotificationCenter : (NSUserNotificationCenter *)center
166- shouldPresentNotification : (NSUserNotification *)notification
167- {
168- return YES ; // We always show notifications to the user
169- }
170161
171162- (void ) registerWithProcessManager
172163{
You can’t perform that action at this time.
0 commit comments