jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CWrapper.m
author anashaty
Tue, 20 Jan 2015 19:26:14 +0300
changeset 28990 2656e19f0cd6
parent 27052 0b783c32e5c2
permissions -rw-r--r--
8068283: Mac OS Incompatibility between JDK 6 and 8 regarding input method handling Reviewed-by: ant, kizune
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     1
/*
23255
ebd69e3d93c5 8027561: [macosx] Cleanup "may not respond to selector" warnings in native code
pchelko
parents: 23253
diff changeset
     2
 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     4
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    10
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    15
 * accompanied this code).
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    16
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    20
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    23
 * questions.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    24
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    25
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    26
#import <JavaNativeFoundation/JavaNativeFoundation.h>
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    27
#import "ThreadUtilities.h"
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    28
#import "sun_lwawt_macosx_CWrapper_NSWindow.h"
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    29
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    30
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    31
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    32
 * Method:    makeKeyAndOrderFront
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    33
 * Signature: (J)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    34
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    35
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    36
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_makeKeyAndOrderFront
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    37
(JNIEnv *env, jclass cls, jlong windowPtr)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    38
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    39
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    40
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    41
    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
    42
    [ThreadUtilities performOnMainThread:@selector(makeKeyAndOrderFront:)
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
    43
                                      on:window
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
    44
                              withObject:nil
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
    45
                           waitUntilDone:NO];
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    46
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    47
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    48
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    49
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    50
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    51
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
12177
7b84ed7d0efa 7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents: 12047
diff changeset
    52
 * Method:    makeKeyWindow
7b84ed7d0efa 7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents: 12047
diff changeset
    53
 * Signature: (J)V
7b84ed7d0efa 7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents: 12047
diff changeset
    54
 */
7b84ed7d0efa 7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents: 12047
diff changeset
    55
JNIEXPORT void JNICALL
7b84ed7d0efa 7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents: 12047
diff changeset
    56
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_makeKeyWindow
7b84ed7d0efa 7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents: 12047
diff changeset
    57
(JNIEnv *env, jclass cls, jlong windowPtr)
7b84ed7d0efa 7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents: 12047
diff changeset
    58
{
7b84ed7d0efa 7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents: 12047
diff changeset
    59
JNF_COCOA_ENTER(env);
7b84ed7d0efa 7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents: 12047
diff changeset
    60
7b84ed7d0efa 7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents: 12047
diff changeset
    61
    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
    62
    [ThreadUtilities performOnMainThread:@selector(makeKeyWindow)
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
    63
                                      on:window
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
    64
                              withObject:nil
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
    65
                           waitUntilDone:NO];
12177
7b84ed7d0efa 7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents: 12047
diff changeset
    66
7b84ed7d0efa 7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents: 12047
diff changeset
    67
JNF_COCOA_EXIT(env);
7b84ed7d0efa 7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents: 12047
diff changeset
    68
}
7b84ed7d0efa 7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents: 12047
diff changeset
    69
7b84ed7d0efa 7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents: 12047
diff changeset
    70
/*
7b84ed7d0efa 7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents: 12047
diff changeset
    71
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    72
 * Method:    makeMainWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    73
 * Signature: (J)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    74
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    75
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    76
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_makeMainWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    77
(JNIEnv *env, jclass cls, jlong windowPtr)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    78
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    79
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    80
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    81
    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
    82
    [ThreadUtilities performOnMainThread:@selector(makeMainWindow)
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
    83
                                      on:window
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
    84
                              withObject:nil
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
    85
                           waitUntilDone:NO];
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    86
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    87
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    88
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    89
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    90
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    91
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    92
 * Method:    canBecomeMainWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    93
 * Signature: (J)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    94
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    95
JNIEXPORT jboolean JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    96
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_canBecomeMainWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    97
(JNIEnv *env, jclass cls, jlong windowPtr)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    98
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    99
    __block jboolean canBecomeMainWindow = JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   100
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   101
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   102
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   103
    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   104
    [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   105
        canBecomeMainWindow = [window canBecomeMainWindow];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   106
    }];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   107
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   108
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   109
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   110
    return canBecomeMainWindow;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   111
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   112
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   113
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   114
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   115
 * Method:    isKeyWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   116
 * Signature: (J)Z
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   117
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   118
JNIEXPORT jboolean JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   119
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_isKeyWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   120
(JNIEnv *env, jclass cls, jlong windowPtr)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   121
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   122
    __block jboolean isKeyWindow = JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   123
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   124
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   125
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   126
    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   127
    [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   128
        isKeyWindow = [window isKeyWindow];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   129
    }];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   130
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   131
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   132
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   133
    return isKeyWindow;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   134
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   135
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   136
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   137
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   138
 * Method:    orderFront
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   139
 * Signature: (J)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   140
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   141
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   142
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_orderFront
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   143
(JNIEnv *env, jclass cls, jlong windowPtr)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   144
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   145
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   146
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   147
    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   148
    [ThreadUtilities performOnMainThread:@selector(orderFront:)
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   149
                                      on:window
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   150
                              withObject:window
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   151
                           waitUntilDone:NO];
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   152
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   153
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   154
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   155
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   156
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   157
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   158
 * Method:    orderOut
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   159
 * Signature: (J)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   160
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   161
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   162
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_orderOut
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   163
(JNIEnv *env, jclass cls, jlong windowPtr)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   164
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   165
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   166
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   167
    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   168
    [ThreadUtilities performOnMainThread:@selector(orderOut:)
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   169
                                      on:window
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   170
                              withObject:window
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   171
                           waitUntilDone:NO];
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   172
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   173
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   174
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   175
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   176
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   177
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
27052
0b783c32e5c2 8041734: JFrame in full screen mode leaves empty workspace after close
serb
parents: 26751
diff changeset
   178
 * Method:    close
0b783c32e5c2 8041734: JFrame in full screen mode leaves empty workspace after close
serb
parents: 26751
diff changeset
   179
 * Signature: (J)V
0b783c32e5c2 8041734: JFrame in full screen mode leaves empty workspace after close
serb
parents: 26751
diff changeset
   180
 */
0b783c32e5c2 8041734: JFrame in full screen mode leaves empty workspace after close
serb
parents: 26751
diff changeset
   181
JNIEXPORT void JNICALL
0b783c32e5c2 8041734: JFrame in full screen mode leaves empty workspace after close
serb
parents: 26751
diff changeset
   182
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_close
0b783c32e5c2 8041734: JFrame in full screen mode leaves empty workspace after close
serb
parents: 26751
diff changeset
   183
        (JNIEnv *env, jclass cls, jlong windowPtr)
0b783c32e5c2 8041734: JFrame in full screen mode leaves empty workspace after close
serb
parents: 26751
diff changeset
   184
{
0b783c32e5c2 8041734: JFrame in full screen mode leaves empty workspace after close
serb
parents: 26751
diff changeset
   185
JNF_COCOA_ENTER(env);
0b783c32e5c2 8041734: JFrame in full screen mode leaves empty workspace after close
serb
parents: 26751
diff changeset
   186
    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
0b783c32e5c2 8041734: JFrame in full screen mode leaves empty workspace after close
serb
parents: 26751
diff changeset
   187
    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
0b783c32e5c2 8041734: JFrame in full screen mode leaves empty workspace after close
serb
parents: 26751
diff changeset
   188
        [window close];
0b783c32e5c2 8041734: JFrame in full screen mode leaves empty workspace after close
serb
parents: 26751
diff changeset
   189
    }];
0b783c32e5c2 8041734: JFrame in full screen mode leaves empty workspace after close
serb
parents: 26751
diff changeset
   190
JNF_COCOA_EXIT(env);
0b783c32e5c2 8041734: JFrame in full screen mode leaves empty workspace after close
serb
parents: 26751
diff changeset
   191
}
0b783c32e5c2 8041734: JFrame in full screen mode leaves empty workspace after close
serb
parents: 26751
diff changeset
   192
0b783c32e5c2 8041734: JFrame in full screen mode leaves empty workspace after close
serb
parents: 26751
diff changeset
   193
/*
0b783c32e5c2 8041734: JFrame in full screen mode leaves empty workspace after close
serb
parents: 26751
diff changeset
   194
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   195
 * Method:    orderFrontRegardless
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   196
 * Signature: (J)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   197
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   198
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   199
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_orderFrontRegardless
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   200
(JNIEnv *env, jclass cls, jlong windowPtr)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   201
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   202
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   203
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   204
    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   205
    [ThreadUtilities performOnMainThread:@selector(orderFrontRegardless)
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   206
                                      on:window
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   207
                              withObject:nil
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   208
                           waitUntilDone:NO];
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   209
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   210
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   211
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   212
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   213
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   214
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   215
 * Method:    orderWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   216
 * Signature: (JIJ)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   217
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   218
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   219
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_orderWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   220
(JNIEnv *env, jclass cls, jlong windowPtr, jint order, jlong relativeToPtr)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   221
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   222
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   223
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   224
    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   225
    NSWindow *relativeTo = (NSWindow *)jlong_to_ptr(relativeToPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   226
    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   227
        [window orderWindow:(NSWindowOrderingMode)order relativeTo:[relativeTo windowNumber]];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   228
    }];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   229
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   230
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   231
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   232
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   233
// Used for CWrapper.NSWindow.setLevel() (and level() which isn't implemented yet)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   234
static NSInteger LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_MAX_WINDOW_LEVELS];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   235
static void initLevels()
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   236
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   237
    static dispatch_once_t pred;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   238
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   239
    dispatch_once(&pred, ^{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   240
        LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_NSNormalWindowLevel] = NSNormalWindowLevel;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   241
        LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_NSFloatingWindowLevel] = NSFloatingWindowLevel;
23253
55425a62017f 7154841: [macosx] Popups appear behind taskbar
pchelko
parents: 21282
diff changeset
   242
        LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_NSPopUpMenuWindowLevel] = NSPopUpMenuWindowLevel;
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   243
    });
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   244
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   245
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   246
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   247
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   248
 * Method:    setLevel
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   249
 * Signature: (JI)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   250
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   251
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   252
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setLevel
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   253
(JNIEnv *env, jclass cls, jlong windowPtr, jint level)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   254
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   255
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   256
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   257
    if (level >= 0 && level < sun_lwawt_macosx_CWrapper_NSWindow_MAX_WINDOW_LEVELS) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   258
        initLevels();
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   259
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   260
        NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   261
        [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   262
            [window setLevel: LEVELS[level]];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   263
        }];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   264
    } else {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   265
        [JNFException raise:env as:kIllegalArgumentException reason:"unknown level"];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   266
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   267
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   268
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   269
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   270
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   271
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   272
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   273
 * Method:    addChildWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   274
 * Signature: (JJI)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   275
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   276
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   277
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_addChildWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   278
(JNIEnv *env, jclass cls, jlong parentPtr, jlong childPtr, jint order)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   279
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   280
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   281
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   282
    NSWindow *parent = (NSWindow *)jlong_to_ptr(parentPtr);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   283
    NSWindow *child = (NSWindow *)jlong_to_ptr(childPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   284
    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   285
        [parent addChildWindow:child ordered:order];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   286
    }];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   287
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   288
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   289
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   290
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   291
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   292
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   293
 * Method:    removeChildWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   294
 * Signature: (JJ)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   295
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   296
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   297
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_removeChildWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   298
(JNIEnv *env, jclass cls, jlong parentPtr, jlong childPtr)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   299
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   300
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   301
23255
ebd69e3d93c5 8027561: [macosx] Cleanup "may not respond to selector" warnings in native code
pchelko
parents: 23253
diff changeset
   302
    NSWindow *parent = (NSWindow *)jlong_to_ptr(parentPtr);
ebd69e3d93c5 8027561: [macosx] Cleanup "may not respond to selector" warnings in native code
pchelko
parents: 23253
diff changeset
   303
    NSWindow *child = (NSWindow *)jlong_to_ptr(childPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   304
    [ThreadUtilities performOnMainThread:@selector(removeChildWindow:)
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   305
                                      on:parent
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   306
                              withObject:child
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   307
                           waitUntilDone:NO];
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   308
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   309
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   310
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   311
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   312
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   313
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   314
 * Method:    setAlphaValue
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   315
 * Signature: (JF)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   316
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   317
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   318
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setAlphaValue
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   319
(JNIEnv *env, jclass cls, jlong windowPtr, jfloat alpha)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   320
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   321
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   322
23255
ebd69e3d93c5 8027561: [macosx] Cleanup "may not respond to selector" warnings in native code
pchelko
parents: 23253
diff changeset
   323
    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   324
    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   325
        [window setAlphaValue:(CGFloat)alpha];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   326
    }];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   327
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   328
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   329
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   330
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   331
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   332
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   333
 * Method:    setOpaque
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   334
 * Signature: (Z)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   335
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   336
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   337
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setOpaque
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   338
(JNIEnv *env, jclass cls, jlong windowPtr, jboolean opaque)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   339
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   340
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   341
23255
ebd69e3d93c5 8027561: [macosx] Cleanup "may not respond to selector" warnings in native code
pchelko
parents: 23253
diff changeset
   342
    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   343
    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   344
        [window setOpaque:(BOOL)opaque];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   345
    }];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   346
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   347
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   348
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   349
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   350
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   351
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   352
 * Method:    setBackgroundColor
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   353
 * Signature: (J)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   354
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   355
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   356
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setBackgroundColor
25196
48d9cfe3f138 8033786: White flashing when opening Dialogs and Menus using Nimbus with dark background
serb
parents: 23255
diff changeset
   357
(JNIEnv *env, jclass cls, jlong windowPtr, jint rgb)
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   358
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   359
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   360
23255
ebd69e3d93c5 8027561: [macosx] Cleanup "may not respond to selector" warnings in native code
pchelko
parents: 23253
diff changeset
   361
    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
25196
48d9cfe3f138 8033786: White flashing when opening Dialogs and Menus using Nimbus with dark background
serb
parents: 23255
diff changeset
   362
    CGFloat alpha = (((rgb >> 24) & 0xff) / 255.0);
48d9cfe3f138 8033786: White flashing when opening Dialogs and Menus using Nimbus with dark background
serb
parents: 23255
diff changeset
   363
    CGFloat red   = (((rgb >> 16) & 0xff) / 255.0);
48d9cfe3f138 8033786: White flashing when opening Dialogs and Menus using Nimbus with dark background
serb
parents: 23255
diff changeset
   364
    CGFloat green = (((rgb >>  8) & 0xff) / 255.0);
48d9cfe3f138 8033786: White flashing when opening Dialogs and Menus using Nimbus with dark background
serb
parents: 23255
diff changeset
   365
    CGFloat blue  = (((rgb >>  0) & 0xff) / 255.0);
48d9cfe3f138 8033786: White flashing when opening Dialogs and Menus using Nimbus with dark background
serb
parents: 23255
diff changeset
   366
    NSColor *color = [NSColor colorWithCalibratedRed:red green:green blue:blue
48d9cfe3f138 8033786: White flashing when opening Dialogs and Menus using Nimbus with dark background
serb
parents: 23255
diff changeset
   367
                                               alpha:alpha];
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   368
    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   369
        [window setBackgroundColor:color];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   370
    }];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   371
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   372
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   373
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   374
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   375
/*
23255
ebd69e3d93c5 8027561: [macosx] Cleanup "may not respond to selector" warnings in native code
pchelko
parents: 23253
diff changeset
   376
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   377
 * Method:    miniaturize
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   378
 * Signature: (J)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   379
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   380
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   381
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_miniaturize
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   382
(JNIEnv *env, jclass cls, jlong windowPtr)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   383
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   384
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   385
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   386
    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   387
    [ThreadUtilities performOnMainThread:@selector(miniaturize:)
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   388
                                      on:window
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   389
                              withObject:nil
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   390
                           waitUntilDone:NO];
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   391
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   392
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   393
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   394
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   395
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   396
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   397
 * Method:    deminiaturize
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   398
 * Signature: (J)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   399
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   400
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   401
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_deminiaturize
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   402
(JNIEnv *env, jclass cls, jlong windowPtr)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   403
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   404
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   405
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   406
    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   407
    [ThreadUtilities performOnMainThread:@selector(deminiaturize:)
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   408
                                      on:window
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   409
                              withObject:nil
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   410
                           waitUntilDone:NO];
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   411
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   412
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   413
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   414
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   415
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   416
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
20457
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   417
 * Method:    isZoomed
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   418
 * Signature: (J)Z
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   419
 */
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   420
JNIEXPORT jboolean JNICALL
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   421
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_isZoomed
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   422
(JNIEnv *env, jclass cls, jlong windowPtr)
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   423
{
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   424
    __block jboolean isZoomed = JNI_FALSE;
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   425
    
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   426
JNF_COCOA_ENTER(env);
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   427
    
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   428
    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   429
    [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   430
        isZoomed = [window isZoomed];
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   431
    }];
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   432
    
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   433
JNF_COCOA_EXIT(env);
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   434
    
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   435
    return isZoomed;
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   436
}
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   437
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   438
/*
ecb935d774a3 8007219: [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
alexsch
parents: 18759
diff changeset
   439
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   440
 * Method:    zoom
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   441
 * Signature: (J)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   442
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   443
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   444
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_zoom
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   445
(JNIEnv *env, jclass cls, jlong windowPtr)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   446
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   447
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   448
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   449
    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   450
    [ThreadUtilities performOnMainThread:@selector(zoom:)
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   451
                                      on:window
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   452
                              withObject:nil
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   453
                           waitUntilDone:NO];
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   454
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   455
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   456
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   457
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   458
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   459
 * Class:     sun_lwawt_macosx_CWrapper$NSWindow
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   460
 * Method:    makeFirstResponder
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   461
 * Signature: (JJ)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   462
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   463
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   464
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_makeFirstResponder
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   465
(JNIEnv *env, jclass cls, jlong windowPtr, jlong responderPtr)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   466
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   467
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   468
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   469
    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   470
    NSResponder *responder = (NSResponder *)jlong_to_ptr(responderPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   471
    [ThreadUtilities performOnMainThread:@selector(makeFirstResponder:)
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   472
                                      on:window
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   473
                              withObject:responder
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   474
                           waitUntilDone:NO];
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   475
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   476
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   477
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   478
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   479
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   480
 * Class:     sun_lwawt_macosx_CWrapper$NSView
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   481
 * Method:    addSubview
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   482
 * Signature: (JJ)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   483
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   484
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   485
Java_sun_lwawt_macosx_CWrapper_00024NSView_addSubview
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   486
(JNIEnv *env, jclass cls, jlong viewPtr, jlong subviewPtr)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   487
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   488
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   489
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   490
    NSView *view = (NSView *)jlong_to_ptr(viewPtr);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   491
    NSView *subview = (NSView *)jlong_to_ptr(subviewPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   492
    [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   493
        [view addSubview:subview];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   494
    }];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   495
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   496
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   497
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   498
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   499
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   500
 * Class:     sun_lwawt_macosx_CWrapper$NSView
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   501
 * Method:    removeFromSuperview
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   502
 * Signature: (J)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   503
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   504
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   505
Java_sun_lwawt_macosx_CWrapper_00024NSView_removeFromSuperview
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   506
(JNIEnv *env, jclass cls, jlong viewPtr)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   507
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   508
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   509
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   510
    NSView *view = (NSView *)jlong_to_ptr(viewPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   511
    [ThreadUtilities performOnMainThread:@selector(removeFromSuperview)
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   512
                                      on:view
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   513
                              withObject:nil
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   514
                           waitUntilDone:NO];
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   515
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   516
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   517
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   518
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   519
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   520
 * Class:     sun_lwawt_macosx_CWrapper$NSView
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   521
 * Method:    setFrame
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   522
 * Signature: (JIIII)V
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   523
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   524
JNIEXPORT void JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   525
Java_sun_lwawt_macosx_CWrapper_00024NSView_setFrame
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   526
(JNIEnv *env, jclass cls, jlong viewPtr, jint x, jint y, jint w, jint h)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   527
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   528
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   529
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   530
    NSView *view = (NSView *)jlong_to_ptr(viewPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   531
    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   532
        [view setFrame:NSMakeRect(x, y, w, h)];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   533
    }];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   534
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   535
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   536
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   537
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   538
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   539
 * Class:     sun_lwawt_macosx_CWrapper$NSView
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   540
 * Method:    window
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   541
 * Signature: (J)J
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   542
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   543
JNIEXPORT jlong JNICALL
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   544
Java_sun_lwawt_macosx_CWrapper_00024NSView_window
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   545
(JNIEnv *env, jclass cls, jlong viewPtr)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   546
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   547
    __block jlong windowPtr = 0L;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   548
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   549
JNF_COCOA_ENTER(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   550
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   551
    NSView *view = (NSView *)jlong_to_ptr(viewPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   552
    [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   553
        windowPtr = ptr_to_jlong([view window]);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   554
    }];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   555
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   556
JNF_COCOA_EXIT(env);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   557
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   558
    return windowPtr;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   559
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   560
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   561
/*
14753
a56a685d137f 7154778: [macosx] NSView-based implementation of sun.awt.EmbeddedFrame
serb
parents: 12177
diff changeset
   562
 * Class:     sun_lwawt_macosx_CWrapper$NSView
a56a685d137f 7154778: [macosx] NSView-based implementation of sun.awt.EmbeddedFrame
serb
parents: 12177
diff changeset
   563
 * Method:    setHidden
a56a685d137f 7154778: [macosx] NSView-based implementation of sun.awt.EmbeddedFrame
serb
parents: 12177
diff changeset
   564
 * Signature: (JZ)V
a56a685d137f 7154778: [macosx] NSView-based implementation of sun.awt.EmbeddedFrame
serb
parents: 12177
diff changeset
   565
 */
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   566
JNIEXPORT void JNICALL
14753
a56a685d137f 7154778: [macosx] NSView-based implementation of sun.awt.EmbeddedFrame
serb
parents: 12177
diff changeset
   567
Java_sun_lwawt_macosx_CWrapper_00024NSView_setHidden
a56a685d137f 7154778: [macosx] NSView-based implementation of sun.awt.EmbeddedFrame
serb
parents: 12177
diff changeset
   568
(JNIEnv *env, jclass cls, jlong viewPtr, jboolean toHide)
a56a685d137f 7154778: [macosx] NSView-based implementation of sun.awt.EmbeddedFrame
serb
parents: 12177
diff changeset
   569
{    
a56a685d137f 7154778: [macosx] NSView-based implementation of sun.awt.EmbeddedFrame
serb
parents: 12177
diff changeset
   570
    JNF_COCOA_ENTER(env);
a56a685d137f 7154778: [macosx] NSView-based implementation of sun.awt.EmbeddedFrame
serb
parents: 12177
diff changeset
   571
    
a56a685d137f 7154778: [macosx] NSView-based implementation of sun.awt.EmbeddedFrame
serb
parents: 12177
diff changeset
   572
    NSView *view = (NSView *)jlong_to_ptr(viewPtr);
15322
3638f33225ec 7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents: 14753
diff changeset
   573
    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
14753
a56a685d137f 7154778: [macosx] NSView-based implementation of sun.awt.EmbeddedFrame
serb
parents: 12177
diff changeset
   574
        [view setHidden:(BOOL)toHide];
a56a685d137f 7154778: [macosx] NSView-based implementation of sun.awt.EmbeddedFrame
serb
parents: 12177
diff changeset
   575
    }];
a56a685d137f 7154778: [macosx] NSView-based implementation of sun.awt.EmbeddedFrame
serb
parents: 12177
diff changeset
   576
    
a56a685d137f 7154778: [macosx] NSView-based implementation of sun.awt.EmbeddedFrame
serb
parents: 12177
diff changeset
   577
    JNF_COCOA_EXIT(env);
a56a685d137f 7154778: [macosx] NSView-based implementation of sun.awt.EmbeddedFrame
serb
parents: 12177
diff changeset
   578
}
a56a685d137f 7154778: [macosx] NSView-based implementation of sun.awt.EmbeddedFrame
serb
parents: 12177
diff changeset
   579
18241
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   580
/*
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   581
 * Class:     sun_lwawt_macosx_CWrapper$NSView
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   582
 * Method:    setToolTip
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   583
 * Signature: (JLjava/lang/String;)V
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   584
 */
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   585
JNIEXPORT void JNICALL
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   586
Java_sun_lwawt_macosx_CWrapper_00024NSView_setToolTip
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   587
(JNIEnv *env, jclass cls, jlong viewPtr, jstring msg)
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   588
{
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   589
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   590
JNF_COCOA_ENTER(env);
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   591
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   592
    NSView *view = (NSView *)jlong_to_ptr(viewPtr);
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   593
    NSString* s = JNFJavaToNSString(env, msg); 
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   594
    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   595
        [view setToolTip: s];
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   596
    }];
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   597
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   598
JNF_COCOA_EXIT(env);
3e009b5be123 8003559: Update display of applet windows
leonidr
parents: 15322
diff changeset
   599
}