This repository was archived by the owner on Feb 2, 2023. 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
@@ -68,11 +68,14 @@ - (id) initWithPeer:(jobject)thePeer {
68
68
69
69
view = [[AWTTrayIconView alloc ] initWithTrayIcon: self ];
70
70
[theItem setView: view];
71
+ [[NSUserNotificationCenter defaultUserNotificationCenter ] setDelegate: self ];
71
72
72
73
return self;
73
74
}
74
75
75
76
-(void ) dealloc {
77
+ [[NSUserNotificationCenter defaultUserNotificationCenter ] setDelegate: nil ];
78
+
76
79
JNIEnv *env = [ThreadUtilities getJNIEnvUncached ];
77
80
(*env)->DeleteGlobalRef (env, peer);
78
81
@@ -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
26
26
#import " JNIUtilities.h"
27
27
#import < Cocoa/Cocoa.h>
28
28
29
- JNIEXPORT @interface NSApplicationAWT : NSApplication < NSUserNotificationCenterDelegate > {
29
+ JNIEXPORT @interface NSApplicationAWT : NSApplication {
30
30
NSString *fApplicationName;
31
31
NSWindow *eventTransparentWindow;
32
32
NSTimeInterval dummyEventTimestamp;
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2011, 2019 , 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
@@ -158,15 +156,8 @@ - (void)finishLaunching
158
156
}
159
157
160
158
[super finishLaunching ];
161
-
162
- [[NSUserNotificationCenter defaultUserNotificationCenter ] setDelegate: self ];
163
159
}
164
160
165
- - (BOOL )userNotificationCenter : (NSUserNotificationCenter *)center
166
- shouldPresentNotification : (NSUserNotification *)notification
167
- {
168
- return YES ; // We always show notifications to the user
169
- }
170
161
171
162
- (void ) registerWithProcessManager
172
163
{
You can’t perform that action at this time.
0 commit comments