This repository was archived by the owner on Sep 2, 2022. It is now read-only.
File tree 4 files changed +15
-15
lines changed
src/java.desktop/macosx/native
4 files changed +15
-15
lines changed Original file line number Diff line number Diff line change 1
1
/*
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.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@ extern "C" {
42
42
/*
43
43
* AWTTrayIcon
44
44
*/
45
- @interface AWTTrayIcon : NSObject {
45
+ @interface AWTTrayIcon : NSObject < NSUserNotificationCenterDelegate > {
46
46
jobject peer;
47
47
AWTTrayIconView *view;
48
48
NSStatusItem *theItem;
Original file line number Diff line number Diff line change 1
1
/*
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.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -69,11 +69,14 @@ - (id) initWithPeer:(jobject)thePeer {
69
69
70
70
view = [[AWTTrayIconView alloc ] initWithTrayIcon: self ];
71
71
[theItem setView: view];
72
+ [[NSUserNotificationCenter defaultUserNotificationCenter ] setDelegate: self ];
72
73
73
74
return self;
74
75
}
75
76
76
77
-(void ) dealloc {
78
+ [[NSUserNotificationCenter defaultUserNotificationCenter ] setDelegate: nil ];
79
+
77
80
JNIEnv *env = [ThreadUtilities getJNIEnvUncached ];
78
81
JNFDeleteGlobalRef (env, peer);
79
82
@@ -166,6 +169,12 @@ -(void) deliverJavaMouseEvent: (NSEvent *) event {
166
169
(*env)->DeleteLocalRef (env, jEvent);
167
170
}
168
171
172
+ - (BOOL )userNotificationCenter : (NSUserNotificationCenter *)center
173
+ shouldPresentNotification : (NSUserNotification *)notification
174
+ {
175
+ return YES ; // We always show notifications to the user
176
+ }
177
+
169
178
@end // AWTTrayIcon
170
179
// ================================================
171
180
Original file line number Diff line number Diff line change 1
1
/*
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.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
32
32
#import < Cocoa/Cocoa.h>
33
33
#import < JavaNativeFoundation/JavaNativeFoundation.h>
34
34
35
- JNIEXPORT @interface NSApplicationAWT : NSApplication < NSUserNotificationCenterDelegate > {
35
+ JNIEXPORT @interface NSApplicationAWT : NSApplication {
36
36
NSString *fApplicationName;
37
37
NSWindow *eventTransparentWindow;
38
38
NSTimeInterval dummyEventTimestamp;
Original file line number Diff line number Diff line change 1
1
/*
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.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -77,8 +77,6 @@ - (id) init
77
77
78
78
- (void )dealloc
79
79
{
80
- [[NSUserNotificationCenter defaultUserNotificationCenter ] setDelegate: nil ];
81
-
82
80
[fApplicationName release ];
83
81
fApplicationName = nil ;
84
82
@@ -159,17 +157,10 @@ - (void)finishLaunching
159
157
160
158
[super finishLaunching ];
161
159
162
- [[NSUserNotificationCenter defaultUserNotificationCenter ] setDelegate: self ];
163
-
164
160
// inform any interested parties that the AWT has arrived and is pumping
165
161
[[NSNotificationCenter defaultCenter ] postNotificationName: JNFRunLoopDidStartNotification object: self ];
166
162
}
167
163
168
- - (BOOL )userNotificationCenter : (NSUserNotificationCenter *)center
169
- shouldPresentNotification : (NSUserNotification *)notification
170
- {
171
- return YES ; // We always show notifications to the user
172
- }
173
164
174
165
- (void ) registerWithProcessManager
175
166
{
You can’t perform that action at this time.
0 commit comments