Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/macosx/native_NOTIOS/sun/awt/CDragSourceContextPeer.m
38829 views
/*1* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#import "sun_lwawt_macosx_CDragSourceContextPeer.h"2627#import <JavaNativeFoundation/JavaNativeFoundation.h>2829#import "CDragSource.h"30#import "ThreadUtilities.h"313233/*34* Class: sun_lwawt_macosx_CDragSourceContextPeer35* Method: createNativeDragSource36* Signature: (Ljava/awt/Component;JLjava/awt/datatransfer/Transferable;37Ljava/awt/event/InputEvent;IIIIJIJIII[JLjava/util/Map;)J38*/39JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CDragSourceContextPeer_createNativeDragSource40(JNIEnv *env, jobject jthis, jobject jcomponent, jlong jnativepeer, jobject jtransferable,41jobject jtrigger, jint jdragposx, jint jdragposy, jint jextmodifiers, jint jclickcount, jlong jtimestamp,42jobject jnsdragimage, jint jdragimageoffsetx, jint jdragimageoffsety,43jint jsourceactions, jlongArray jformats, jobject jformatmap)44{45id controlObj = (id) jlong_to_ptr(jnativepeer);46__block CDragSource* dragSource = nil;4748JNF_COCOA_ENTER(env);49[ThreadUtilities performOnMainThreadWaiting:YES block:^(){50dragSource = [[CDragSource alloc] init:jthis51component:jcomponent52control:controlObj53transferable:jtransferable54triggerEvent:jtrigger55dragPosX:jdragposx56dragPosY:jdragposy57modifiers:jextmodifiers58clickCount:jclickcount59timeStamp:jtimestamp60dragImage:jnsdragimage61dragImageOffsetX:jdragimageoffsetx62dragImageOffsetY:jdragimageoffsety63sourceActions:jsourceactions64formats:jformats65formatMap:jformatmap];66}];67JNF_COCOA_EXIT(env);6869return ptr_to_jlong(dragSource);70}7172/*73* Class: sun_lwawt_macosx_CDragSourceContextPeer74* Method: doDragging75* Signature: (J)V76*/77JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CDragSourceContextPeer_doDragging78(JNIEnv *env, jobject jthis, jlong nativeDragSourceVal)79{80AWT_ASSERT_NOT_APPKIT_THREAD;8182CDragSource* dragSource = (CDragSource*) jlong_to_ptr(nativeDragSourceVal);8384JNF_COCOA_ENTER(env);85[dragSource drag];86JNF_COCOA_EXIT(env);87}8889/*90* Class: sun_lwawt_macosx_CDragSourceContextPeer91* Method: releaseNativeDragSource92* Signature: (J)V93*/94JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CDragSourceContextPeer_releaseNativeDragSource95(JNIEnv *env, jobject jthis, jlong nativeDragSourceVal)96{97CDragSource* dragSource = (CDragSource*) jlong_to_ptr(nativeDragSourceVal);9899JNF_COCOA_ENTER(env);100[dragSource removeFromView:env];101JNF_COCOA_EXIT(env);102}103104105