1 /*
   2  * Copyright (c) 2011, 2014, 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 <jni.h>
  27 #import <pthread.h>
  28 #import <QuartzCore/CVDisplayLink.h>
  29 
  30 extern pthread_key_t GlassThreadDataKey;
  31 
  32 extern CVDisplayLinkRef GlassDisplayLink;
  33 
  34 extern JavaVM *jVM;
  35 extern JNIEnv *jEnv;
  36 
  37 extern jclass jApplicationClass;
  38 extern jclass jWindowClass;
  39 extern jclass jViewClass;
  40 
  41 extern jclass jScreenClass;
  42 extern jclass jMenuBarDelegateClass;
  43 extern jclass jIntegerClass;
  44 extern jclass jLongClass;
  45 extern jclass jMapClass;
  46 extern jclass jBooleanClass;
  47 
  48 extern jmethodID jRunnableRun;
  49 
  50 extern jmethodID jWindowNotifyMove;
  51 extern jmethodID jWindowNotifyResize;
  52 extern jmethodID jWindowNotifyClose;
  53 extern jmethodID jWindowNotifyMoveToAnotherScreen;
  54 extern jmethodID jWindowNotifyScaleChanged;
  55 extern jmethodID jWindowNotifyFocus;
  56 extern jmethodID jWindowNotifyFocusUngrab;
  57 extern jmethodID jWindowNotifyFocusDisabled;
  58 extern jmethodID jWindowNotifyDestroy;
  59 extern jmethodID jWindowNotifyDelegatePtr;
  60 
  61 extern jmethodID jViewNotifyEvent;
  62 extern jmethodID jViewNotifyRepaint;
  63 extern jmethodID jViewNotifyResize;
  64 extern jmethodID jViewNotifyKey;
  65 extern jmethodID jViewNotifyMouse;
  66 extern jmethodID jViewNotifyMenu;
  67 extern jmethodID jViewNotifyInputMethod;
  68 extern jmethodID jViewNotifyInputMethodMac;
  69 extern jmethodID jViewNotifyInputMethodCandidatePosRequest;
  70 extern jmethodID jViewNotifyDragEnter;
  71 extern jmethodID jViewNotifyDragOver;
  72 extern jmethodID jViewNotifyDragLeave;
  73 extern jmethodID jViewNotifyDragDrop;
  74 extern jmethodID jViewNotifyDragEnd;
  75 extern jmethodID jViewGetAccessible;
  76 
  77 extern jmethodID jScreenNotifySettingsChanged;
  78 
  79 extern jmethodID jMapGetMethod;
  80 extern jmethodID jBooleanValueMethod;
  81 extern jmethodID jIntegerInitMethod;
  82 extern jmethodID jIntegerValueMethod;
  83 extern jmethodID jLongValueMethod;
  84 
  85 extern jmethodID jSizeInit;
  86 
  87 extern jmethodID jPixelsAttachData;
  88 
  89 typedef struct _tagJavaIDs {
  90     struct {
  91         jmethodID init;
  92         jmethodID enter;
  93         jmethodID leave;
  94     } EventLoop;
  95     struct {
  96         jmethodID add;
  97     } List;
  98     struct {
  99         jmethodID init;
 100     } ArrayList;
 101     struct {
 102         jmethodID init;
 103     } MacFileNSURL;
 104     struct {
 105         jmethodID isFileNSURLEnabled;
 106     } MacCommonDialogs;
 107     struct {
 108         jmethodID init;
 109     } File;
 110     struct {
 111         jmethodID createPixels;
 112         jmethodID getScaleFactor;
 113         jmethodID reportException;
 114         jmethodID enterNestedEventLoop;
 115         jmethodID leaveNestedEventLoop;
 116     } Application;
 117     struct {
 118         jmethodID notifyApplicationDidTerminate;
 119     } MacApplication;
 120     struct {
 121         jmethodID rotateGesturePerformed;
 122         jmethodID scrollGesturePerformed;
 123         jmethodID swipeGesturePerformed;
 124         jmethodID magnifyGesturePerformed;
 125         jmethodID gestureFinished;
 126         jmethodID notifyBeginTouchEvent;
 127         jmethodID notifyNextTouchEvent;
 128         jmethodID notifyEndTouchEvent;
 129     } GestureSupport;
 130     struct {
 131         jmethodID getDescription;
 132         jmethodID extensionsToArray;
 133     } ExtensionFilter;
 134     struct {
 135         jmethodID init;
 136     } FileChooserResult;
 137 } JavaIDs;
 138 extern JavaIDs javaIDs;
 139 
 140 void initJavaIDsList(JNIEnv* env);
 141 void initJavaIDsArrayList(JNIEnv* env);
 142 void initJavaIDsFile(JNIEnv* env);
 143 
 144