Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/macosx/native_NOTIOS/sun/awt/CDragSourceContextPeer.m
38829 views
1
/*
2
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
#import "sun_lwawt_macosx_CDragSourceContextPeer.h"
27
28
#import <JavaNativeFoundation/JavaNativeFoundation.h>
29
30
#import "CDragSource.h"
31
#import "ThreadUtilities.h"
32
33
34
/*
35
* Class: sun_lwawt_macosx_CDragSourceContextPeer
36
* Method: createNativeDragSource
37
* Signature: (Ljava/awt/Component;JLjava/awt/datatransfer/Transferable;
38
Ljava/awt/event/InputEvent;IIIIJIJIII[JLjava/util/Map;)J
39
*/
40
JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CDragSourceContextPeer_createNativeDragSource
41
(JNIEnv *env, jobject jthis, jobject jcomponent, jlong jnativepeer, jobject jtransferable,
42
jobject jtrigger, jint jdragposx, jint jdragposy, jint jextmodifiers, jint jclickcount, jlong jtimestamp,
43
jobject jnsdragimage, jint jdragimageoffsetx, jint jdragimageoffsety,
44
jint jsourceactions, jlongArray jformats, jobject jformatmap)
45
{
46
id controlObj = (id) jlong_to_ptr(jnativepeer);
47
__block CDragSource* dragSource = nil;
48
49
JNF_COCOA_ENTER(env);
50
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
51
dragSource = [[CDragSource alloc] init:jthis
52
component:jcomponent
53
control:controlObj
54
transferable:jtransferable
55
triggerEvent:jtrigger
56
dragPosX:jdragposx
57
dragPosY:jdragposy
58
modifiers:jextmodifiers
59
clickCount:jclickcount
60
timeStamp:jtimestamp
61
dragImage:jnsdragimage
62
dragImageOffsetX:jdragimageoffsetx
63
dragImageOffsetY:jdragimageoffsety
64
sourceActions:jsourceactions
65
formats:jformats
66
formatMap:jformatmap];
67
}];
68
JNF_COCOA_EXIT(env);
69
70
return ptr_to_jlong(dragSource);
71
}
72
73
/*
74
* Class: sun_lwawt_macosx_CDragSourceContextPeer
75
* Method: doDragging
76
* Signature: (J)V
77
*/
78
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CDragSourceContextPeer_doDragging
79
(JNIEnv *env, jobject jthis, jlong nativeDragSourceVal)
80
{
81
AWT_ASSERT_NOT_APPKIT_THREAD;
82
83
CDragSource* dragSource = (CDragSource*) jlong_to_ptr(nativeDragSourceVal);
84
85
JNF_COCOA_ENTER(env);
86
[dragSource drag];
87
JNF_COCOA_EXIT(env);
88
}
89
90
/*
91
* Class: sun_lwawt_macosx_CDragSourceContextPeer
92
* Method: releaseNativeDragSource
93
* Signature: (J)V
94
*/
95
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CDragSourceContextPeer_releaseNativeDragSource
96
(JNIEnv *env, jobject jthis, jlong nativeDragSourceVal)
97
{
98
CDragSource* dragSource = (CDragSource*) jlong_to_ptr(nativeDragSourceVal);
99
100
JNF_COCOA_ENTER(env);
101
[dragSource removeFromView:env];
102
JNF_COCOA_EXIT(env);
103
}
104
105