author | ccheung |
Mon, 01 Oct 2018 11:36:48 -0700 | |
changeset 51975 | 94b9b7a09001 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
12047 | 1 |
/* |
23010
6dadb192ad81
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents:
12047
diff
changeset
|
2 |
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
12047 | 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 <JavaNativeFoundation/JavaNativeFoundation.h> |
|
27 |
||
28 |
#import "apple_laf_JRSUIFocus.h" |
|
29 |
#import "apple_laf_JRSUIControl.h" |
|
30 |
||
31 |
#include <Carbon/Carbon.h> |
|
32 |
||
33 |
||
34 |
/* |
|
35 |
* Class: apple_laf_JRSUIFocus |
|
36 |
* Method: beginNativeFocus |
|
37 |
* Signature: (JI)I |
|
38 |
*/ |
|
39 |
JNIEXPORT jint JNICALL Java_apple_laf_JRSUIFocus_beginNativeFocus |
|
40 |
(JNIEnv *env, jclass clazz, jlong cgContext, jint ringStyle) |
|
41 |
{ |
|
42 |
if (cgContext == 0L) return apple_laf_JRSUIFocus_NULL_CG_REF; |
|
43 |
CGContextRef cgRef = (CGContextRef)jlong_to_ptr(cgContext); |
|
44 |
||
45 |
OSStatus status = HIThemeBeginFocus(cgRef, ringStyle, NULL); |
|
46 |
return status == noErr ? apple_laf_JRSUIFocus_SUCCESS : status; |
|
47 |
} |
|
48 |
||
49 |
/* |
|
50 |
* Class: apple_laf_JRSUIFocus |
|
51 |
* Method: endNativeFocus |
|
52 |
* Signature: (J)I |
|
53 |
*/ |
|
54 |
JNIEXPORT jint JNICALL Java_apple_laf_JRSUIFocus_endNativeFocus |
|
55 |
(JNIEnv *env, jclass clazz, jlong cgContext) |
|
56 |
{ |
|
57 |
if (cgContext == 0L) return apple_laf_JRSUIFocus_NULL_CG_REF; |
|
58 |
CGContextRef cgRef = (CGContextRef)jlong_to_ptr(cgContext); |
|
59 |
||
60 |
OSStatus status = HIThemeEndFocus(cgRef); |
|
61 |
return status == noErr ? apple_laf_JRSUIFocus_SUCCESS : status; |
|
62 |
} |