From a1c9682716b5f03ae69090ec398b1a1dd9827d54 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Thu, 10 Aug 2017 15:17:40 -0700 Subject: [PATCH] 8153871: [macosx] Low-level error on OS X 10.11 with DnD in Swing Reviewed-by: azvegint --- .../macosx/native/libawt_lwawt/awt/CDragSource.m | 11 ++++++----- .../swing/dnd/8139050/NativeErrorsInTableDnD.java | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m index 5d4f4e65724..2071544d0d3 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -432,12 +432,11 @@ static BOOL sNeedsEnter; NSWindow* window = [fView window]; NSInteger windowNumber = [window windowNumber]; - NSGraphicsContext* graphicsContext = [NSGraphicsContext graphicsContextWithWindow:window]; // Convert mouse coordinates to NS: NSPoint eventLocation = [fView convertPoint:NSMakePoint(fDragPos.x, fDragPos.y) toView:nil]; eventLocation.y = [[fView window] frame].size.height - eventLocation.y; - + // Convert fTriggerEventTimeStamp to NS - AWTEvent.h defines UTC(nsEvent) as ((jlong)[event timestamp] * 1000): NSTimeInterval timeStamp = fTriggerEventTimeStamp / 1000; @@ -452,14 +451,16 @@ static BOOL sNeedsEnter; } // Convert fModifiers (extModifiers) to NS: - NSUInteger modifiers = JavaModifiersToNsKeyModifiers(fModifiers, TRUE); + NSUInteger modifiers = JavaModifiersToNsKeyModifiers(fModifiers, TRUE); // Just a dummy value ... NSInteger eventNumber = 0; + // NSEvent.context is deprecated and unused + NSGraphicsContext* unusedPassNil = nil; // Make a native autoreleased dragging event: NSEvent* dragEvent = [NSEvent mouseEventWithType:mouseButtons location:eventLocation - modifierFlags:modifiers timestamp:timeStamp windowNumber:windowNumber context:graphicsContext + modifierFlags:modifiers timestamp:timeStamp windowNumber:windowNumber context:unusedPassNil eventNumber:eventNumber clickCount:fClickCount pressure:pressure]; return dragEvent; diff --git a/jdk/test/javax/swing/dnd/8139050/NativeErrorsInTableDnD.java b/jdk/test/javax/swing/dnd/8139050/NativeErrorsInTableDnD.java index d31d50e856c..fe84ed4c976 100644 --- a/jdk/test/javax/swing/dnd/8139050/NativeErrorsInTableDnD.java +++ b/jdk/test/javax/swing/dnd/8139050/NativeErrorsInTableDnD.java @@ -39,7 +39,7 @@ import static javax.swing.UIManager.getInstalledLookAndFeels; /** * @test - * @bug 8139050 + * @bug 8139050 8153871 * @library ../../../../lib/testlibrary * @build ExtendedRobot * @run main/othervm/timeout=360 -Xcheck:jni NativeErrorsInTableDnD