RFR: JDK-8305712: [MacOS] Deprecated Cocoa-NSEvent names

Phil Race prr at openjdk.org
Tue Apr 11 20:50:41 UTC 2023


On Tue, 11 Apr 2023 20:28:29 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

> There are a few deprecated Cocoa NSEvent names currently in use in JDK.
> 
> https://github.com/openjdk/jdk/blob/jdk-21+17/src/java.desktop/macosx/classes/sun/lwawt/macosx/CocoaConstants.java
> https://developer.apple.com/documentation/appkit/nsmousemoved 
> 
> Since these event names are marked for deprecation it is better to switch to the newer names.

src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m line 1002:

> 1000: 
> 1001: - (void)sendEvent:(NSEvent *)event {
> 1002:         if ([event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown) {

since you are touching this, maybe we can format it for better legibility !

if ([event type] == NSEventTypeLeftMouseDown ||
     [event type] == NSEventTypeRightMouseDown ||
     [event type] == NSEventTypeOtherMouseDown))
{

src/java.desktop/macosx/native/libosxui/ScreenMenu.m line 176:

> 174: 
> 175:     switch (kind) {
> 176:         case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp:

ugh. I've never seen multiple case: clauses on one line.
break these up too.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13435#discussion_r1163307493
PR Review Comment: https://git.openjdk.org/jdk/pull/13435#discussion_r1163311354



More information about the client-libs-dev mailing list