mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-20 13:30:15 -07:00
Remove awt_xawt
This commit is contained in:
parent
6ceac22aff
commit
84d39544ee
49 changed files with 12 additions and 23578 deletions
|
|
@ -20,7 +20,7 @@ public class JREUtils
|
|||
}
|
||||
|
||||
public static File redirectStdio(boolean current) throws ErrnoException {
|
||||
File logFile = new File(Tools.datapath, (current ? "current" : "latest") + "log.txt");
|
||||
File logFile = new File(current ? Tools.datapath : Tools.MAIN_PATH, (current ? "current" : "latest") + "log.txt");
|
||||
|
||||
FileDescriptor fd = Os.open(logFile.getAbsolutePath(), OsConstants.O_WRONLY | OsConstants.O_CREAT | OsConstants.O_TRUNC, 0666);
|
||||
Os.dup2(fd, OsConstants.STDERR_FILENO);
|
||||
|
|
|
|||
|
|
@ -837,7 +837,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
private FileObserver mLogObserver;
|
||||
private void runCraft() throws Throwable {
|
||||
if (Tools.LAUNCH_TYPE != Tools.LTYPE_PROCESS) {
|
||||
final File currLogFile = JREUtils.redirectStdio(false);
|
||||
final File currLogFile = JREUtils.redirectStdio(true);
|
||||
// DEPRECATED constructor (String) api 29
|
||||
mLogObserver = new FileObserver(currLogFile.getAbsolutePath(), FileObserver.MODIFY){
|
||||
@Override
|
||||
|
|
@ -848,7 +848,8 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
Tools.write(file, "");
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
th.printStackTrace();
|
||||
Tools.showError(MainActivity.this, th);
|
||||
mLogObserver.stopWatching();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,16 +16,6 @@ LOCAL_PATH := $(LOCAL_PATH)/awt_xawt
|
|||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := awt_xawt
|
||||
LOCAL_CFLAGS += -DHEADLESS
|
||||
LOCAL_SRC_FILES := \
|
||||
xawt_fake.c
|
||||
# awt/awt_AWTEvent.c \
|
||||
# awt/awt_DrawingSurface.c \
|
||||
# awt/awt_Event.c \
|
||||
# awt/awt_GraphicsEnv.c \
|
||||
# awt/awt_InputMethod.c \
|
||||
# awt/awt_Insets.c \
|
||||
# awt/awt_Robot.c \
|
||||
|
||||
|
||||
LOCAL_SRC_FILES := xawt_fake.c
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,165 +0,0 @@
|
|||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/* $Xorg: HPkeysym.h,v 1.4 2000/08/18 04:05:43 coskrey Exp $ */
|
||||
/*
|
||||
|
||||
Copyright 1987, 1998 The Open Group
|
||||
|
||||
All Rights Reserved.
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall
|
||||
not be used in advertising or otherwise to promote the sale, use or
|
||||
other dealings in this Software without prior written authorization
|
||||
from The Open Group.
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the names of Hewlett Packard
|
||||
or Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
|
||||
TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. Hewlett-Packard shall not be liable for errors
|
||||
contained herein or direct, indirect, special, incidental or
|
||||
consequential damages in connection with the furnishing,
|
||||
performance, or use of this material.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _HPKEYSYM_H
|
||||
|
||||
#define _HPKEYSYM_H
|
||||
|
||||
#define hpXK_ClearLine 0x1000FF6F
|
||||
#define hpXK_InsertLine 0x1000FF70
|
||||
#define hpXK_DeleteLine 0x1000FF71
|
||||
#define hpXK_InsertChar 0x1000FF72
|
||||
#define hpXK_DeleteChar 0x1000FF73
|
||||
#define hpXK_BackTab 0x1000FF74
|
||||
#define hpXK_KP_BackTab 0x1000FF75
|
||||
#define hpXK_Modelock1 0x1000FF48
|
||||
#define hpXK_Modelock2 0x1000FF49
|
||||
#define hpXK_Reset 0x1000FF6C
|
||||
#define hpXK_System 0x1000FF6D
|
||||
#define hpXK_User 0x1000FF6E
|
||||
#define hpXK_mute_acute 0x100000A8
|
||||
#define hpXK_mute_grave 0x100000A9
|
||||
#define hpXK_mute_asciicircum 0x100000AA
|
||||
#define hpXK_mute_diaeresis 0x100000AB
|
||||
#define hpXK_mute_asciitilde 0x100000AC
|
||||
#define hpXK_lira 0x100000AF
|
||||
#define hpXK_guilder 0x100000BE
|
||||
#define hpXK_Ydiaeresis 0x100000EE
|
||||
#define hpXK_IO 0x100000EE
|
||||
#define hpXK_longminus 0x100000F6
|
||||
#define hpXK_block 0x100000FC
|
||||
|
||||
|
||||
#ifndef _OSF_Keysyms
|
||||
#define _OSF_Keysyms
|
||||
|
||||
#define osfXK_Copy 0x1004FF02
|
||||
#define osfXK_Cut 0x1004FF03
|
||||
#define osfXK_Paste 0x1004FF04
|
||||
#define osfXK_BackTab 0x1004FF07
|
||||
#define osfXK_BackSpace 0x1004FF08
|
||||
#define osfXK_Clear 0x1004FF0B
|
||||
#define osfXK_Escape 0x1004FF1B
|
||||
#define osfXK_AddMode 0x1004FF31
|
||||
#define osfXK_PrimaryPaste 0x1004FF32
|
||||
#define osfXK_QuickPaste 0x1004FF33
|
||||
#define osfXK_PageLeft 0x1004FF40
|
||||
#define osfXK_PageUp 0x1004FF41
|
||||
#define osfXK_PageDown 0x1004FF42
|
||||
#define osfXK_PageRight 0x1004FF43
|
||||
#define osfXK_Activate 0x1004FF44
|
||||
#define osfXK_MenuBar 0x1004FF45
|
||||
#define osfXK_Left 0x1004FF51
|
||||
#define osfXK_Up 0x1004FF52
|
||||
#define osfXK_Right 0x1004FF53
|
||||
#define osfXK_Down 0x1004FF54
|
||||
#define osfXK_EndLine 0x1004FF57
|
||||
#define osfXK_BeginLine 0x1004FF58
|
||||
#define osfXK_EndData 0x1004FF59
|
||||
#define osfXK_BeginData 0x1004FF5A
|
||||
#define osfXK_PrevMenu 0x1004FF5B
|
||||
#define osfXK_NextMenu 0x1004FF5C
|
||||
#define osfXK_PrevField 0x1004FF5D
|
||||
#define osfXK_NextField 0x1004FF5E
|
||||
#define osfXK_Select 0x1004FF60
|
||||
#define osfXK_Insert 0x1004FF63
|
||||
#define osfXK_Undo 0x1004FF65
|
||||
#define osfXK_Menu 0x1004FF67
|
||||
#define osfXK_Cancel 0x1004FF69
|
||||
#define osfXK_Help 0x1004FF6A
|
||||
#define osfXK_SelectAll 0x1004FF71
|
||||
#define osfXK_DeselectAll 0x1004FF72
|
||||
#define osfXK_Reselect 0x1004FF73
|
||||
#define osfXK_Extend 0x1004FF74
|
||||
#define osfXK_Restore 0x1004FF78
|
||||
#define osfXK_Delete 0x1004FFFF
|
||||
|
||||
#endif /* _OSF_Keysyms */
|
||||
|
||||
|
||||
/**************************************************************
|
||||
* The use of the following macros is deprecated.
|
||||
* They are listed below only for backwards compatibility.
|
||||
*/
|
||||
#define XK_Reset 0x1000FF6C
|
||||
#define XK_System 0x1000FF6D
|
||||
#define XK_User 0x1000FF6E
|
||||
#define XK_ClearLine 0x1000FF6F
|
||||
#define XK_InsertLine 0x1000FF70
|
||||
#define XK_DeleteLine 0x1000FF71
|
||||
#define XK_InsertChar 0x1000FF72
|
||||
#define XK_DeleteChar 0x1000FF73
|
||||
#define XK_BackTab 0x1000FF74
|
||||
#define XK_KP_BackTab 0x1000FF75
|
||||
#define XK_Ext16bit_L 0x1000FF76
|
||||
#define XK_Ext16bit_R 0x1000FF77
|
||||
#define XK_mute_acute 0x100000a8
|
||||
#define XK_mute_grave 0x100000a9
|
||||
#define XK_mute_asciicircum 0x100000aa
|
||||
#define XK_mute_diaeresis 0x100000ab
|
||||
#define XK_mute_asciitilde 0x100000ac
|
||||
#define XK_lira 0x100000af
|
||||
#define XK_guilder 0x100000be
|
||||
#ifndef XK_Ydiaeresis
|
||||
#define XK_Ydiaeresis 0x100000ee
|
||||
#endif
|
||||
#define XK_IO 0x100000ee
|
||||
#define XK_longminus 0x100000f6
|
||||
#define XK_block 0x100000fc
|
||||
|
||||
#endif /* _HPKEYSYM_H */
|
||||
|
|
@ -1,233 +0,0 @@
|
|||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* $XFree86: xc/lib/Xrandr/Xrandr.h,v 1.9 2002/09/29 23:39:44 keithp Exp $
|
||||
*
|
||||
* Copyright © 2000 Compaq Computer Corporation, Inc.
|
||||
* Copyright © 2002 Hewlett-Packard Company, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Compaq not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. HP makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ
|
||||
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Jim Gettys, HP Labs, HP.
|
||||
*/
|
||||
|
||||
#ifndef _XRANDR_H_
|
||||
#define _XRANDR_H_
|
||||
|
||||
/*#include <X11/extensions/randr.h>*/
|
||||
#include "randr.h"
|
||||
|
||||
#include <X11/Xfuncproto.h>
|
||||
|
||||
_XFUNCPROTOBEGIN
|
||||
|
||||
|
||||
typedef struct {
|
||||
int width, height;
|
||||
int mwidth, mheight;
|
||||
} XRRScreenSize;
|
||||
|
||||
/*
|
||||
* Events.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
int type; /* event base */
|
||||
unsigned long serial; /* # of last request processed by server */
|
||||
Bool send_event; /* true if this came from a SendEvent request */
|
||||
Display *display; /* Display the event was read from */
|
||||
Window window; /* window which selected for this event */
|
||||
Window root; /* Root window for changed screen */
|
||||
Time timestamp; /* when the screen change occurred */
|
||||
Time config_timestamp; /* when the last configuration change */
|
||||
SizeID size_index;
|
||||
SubpixelOrder subpixel_order;
|
||||
Rotation rotation;
|
||||
int width;
|
||||
int height;
|
||||
int mwidth;
|
||||
int mheight;
|
||||
} XRRScreenChangeNotifyEvent;
|
||||
|
||||
typedef XID RROutput;
|
||||
typedef XID RRCrtc;
|
||||
typedef XID RRMode;
|
||||
|
||||
typedef unsigned long XRRModeFlags;
|
||||
|
||||
typedef struct {
|
||||
RRMode id;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned long dotClock;
|
||||
unsigned int hSyncStart;
|
||||
unsigned int hSyncEnd;
|
||||
unsigned int hTotal;
|
||||
unsigned int hSkew;
|
||||
unsigned int vSyncStart;
|
||||
unsigned int vSyncEnd;
|
||||
unsigned int vTotal;
|
||||
char *name;
|
||||
unsigned int nameLength;
|
||||
XRRModeFlags modeFlags;
|
||||
} XRRModeInfo;
|
||||
|
||||
typedef struct {
|
||||
Time timestamp;
|
||||
Time configTimestamp;
|
||||
int ncrtc;
|
||||
RRCrtc *crtcs;
|
||||
int noutput;
|
||||
RROutput *outputs;
|
||||
int nmode;
|
||||
XRRModeInfo *modes;
|
||||
} XRRScreenResources;
|
||||
|
||||
typedef struct {
|
||||
Time timestamp;
|
||||
RRCrtc crtc;
|
||||
char *name;
|
||||
int nameLen;
|
||||
unsigned long mm_width;
|
||||
unsigned long mm_height;
|
||||
Connection connection;
|
||||
SubpixelOrder subpixel_order;
|
||||
int ncrtc;
|
||||
RRCrtc *crtcs;
|
||||
int nclone;
|
||||
RROutput *clones;
|
||||
int nmode;
|
||||
int npreferred;
|
||||
RRMode *modes;
|
||||
} XRROutputInfo;
|
||||
|
||||
typedef struct {
|
||||
Time timestamp;
|
||||
int x, y;
|
||||
unsigned int width, height;
|
||||
RRMode mode;
|
||||
Rotation rotation;
|
||||
int noutput;
|
||||
RROutput *outputs;
|
||||
Rotation rotations;
|
||||
int npossible;
|
||||
RROutput *possible;
|
||||
} XRRCrtcInfo;
|
||||
|
||||
XRRScreenResources *XRRGetScreenResources (Display *dpy, Window window);
|
||||
|
||||
void XRRFreeScreenResources (XRRScreenResources *resources);
|
||||
|
||||
XRROutputInfo * XRRGetOutputInfo (Display *dpy, XRRScreenResources *resources,
|
||||
RROutput output);
|
||||
void XRRFreeOutputInfo (XRROutputInfo *outputInfo);
|
||||
|
||||
XRRCrtcInfo *XRRGetCrtcInfo (Display *dpy, XRRScreenResources *resources,
|
||||
RRCrtc crtc);
|
||||
void XRRFreeCrtcInfo (XRRCrtcInfo *crtcInfo);
|
||||
|
||||
|
||||
/* internal representation is private to the library */
|
||||
typedef struct _XRRScreenConfiguration XRRScreenConfiguration;
|
||||
|
||||
Bool XRRQueryExtension (Display *dpy, int *event_basep, int *error_basep);
|
||||
Status XRRQueryVersion (Display *dpy,
|
||||
int *major_versionp,
|
||||
int *minor_versionp);
|
||||
|
||||
XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy,
|
||||
Drawable draw);
|
||||
|
||||
void XRRFreeScreenConfigInfo (XRRScreenConfiguration *config);
|
||||
|
||||
/*
|
||||
* Note that screen configuration changes are only permitted if the client can
|
||||
* prove it has up to date configuration information. We are trying to
|
||||
* insist that it become possible for screens to change dynamically, so
|
||||
* we want to ensure the client knows what it is talking about when requesting
|
||||
* changes.
|
||||
*/
|
||||
Status XRRSetScreenConfig (Display *dpy,
|
||||
XRRScreenConfiguration *config,
|
||||
Drawable draw,
|
||||
int size_index,
|
||||
Rotation rotation,
|
||||
Time timestamp);
|
||||
|
||||
/* added in v1.1, sorry for the lame name */
|
||||
Status XRRSetScreenConfigAndRate (Display *dpy,
|
||||
XRRScreenConfiguration *config,
|
||||
Drawable draw,
|
||||
int size_index,
|
||||
Rotation rotation,
|
||||
short rate,
|
||||
Time timestamp);
|
||||
|
||||
|
||||
Rotation XRRConfigRotations(XRRScreenConfiguration *config, Rotation *current_rotation);
|
||||
|
||||
Time XRRConfigTimes (XRRScreenConfiguration *config, Time *config_timestamp);
|
||||
|
||||
XRRScreenSize *XRRConfigSizes(XRRScreenConfiguration *config, int *nsizes);
|
||||
|
||||
short *XRRConfigRates (XRRScreenConfiguration *config, int sizeID, int *nrates);
|
||||
|
||||
SizeID XRRConfigCurrentConfiguration (XRRScreenConfiguration *config,
|
||||
Rotation *rotation);
|
||||
|
||||
short XRRConfigCurrentRate (XRRScreenConfiguration *config);
|
||||
|
||||
int XRRRootToScreen(Display *dpy, Window root);
|
||||
|
||||
/*
|
||||
* returns the screen configuration for the specified screen; does a lazy
|
||||
* evalution to delay getting the information, and caches the result.
|
||||
* These routines should be used in preference to XRRGetScreenInfo
|
||||
* to avoid unneeded round trips to the X server. These are new
|
||||
* in protocol version 0.1.
|
||||
*/
|
||||
|
||||
|
||||
XRRScreenConfiguration *XRRScreenConfig(Display *dpy, int screen);
|
||||
XRRScreenConfiguration *XRRConfig(Screen *screen);
|
||||
void XRRSelectInput(Display *dpy, Window window, int mask);
|
||||
|
||||
/*
|
||||
* the following are always safe to call, even if RandR is not implemented
|
||||
* on a screen
|
||||
*/
|
||||
|
||||
|
||||
Rotation XRRRotations(Display *dpy, int screen, Rotation *current_rotation);
|
||||
XRRScreenSize *XRRSizes(Display *dpy, int screen, int *nsizes);
|
||||
short *XRRRates (Display *dpy, int screen, int sizeID, int *nrates);
|
||||
Time XRRTimes (Display *dpy, int screen, Time *config_timestamp);
|
||||
|
||||
|
||||
/*
|
||||
* intended to take RRScreenChangeNotify, or
|
||||
* ConfigureNotify (on the root window)
|
||||
* returns 1 if it is an event type it understands, 0 if not
|
||||
*/
|
||||
int XRRUpdateConfiguration(XEvent *event);
|
||||
|
||||
_XFUNCPROTOEND
|
||||
|
||||
#endif /* _XRANDR_H_ */
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/*
|
||||
* Implements the native code for the java.awt.AWTEvent class
|
||||
* and all of the classes in the java.awt.event package.
|
||||
*
|
||||
* THIS FILE DOES NOT IMPLEMENT ANY OF THE OBSOLETE java.awt.Event
|
||||
* CLASS. SEE awt_Event.[ch] FOR THAT CLASS' IMPLEMENTATION.
|
||||
*/
|
||||
|
||||
#ifdef HEADLESS
|
||||
#error This file should not be included in headless library
|
||||
#endif
|
||||
|
||||
#include "awt_p.h"
|
||||
#include "java_awt_AWTEvent.h"
|
||||
#include "java_awt_event_InputEvent.h"
|
||||
#include "java_awt_event_KeyEvent.h"
|
||||
#include "jni_util.h"
|
||||
|
||||
#include "awt_AWTEvent.h"
|
||||
|
||||
struct AWTEventIDs awtEventIDs;
|
||||
struct InputEventIDs inputEventIDs;
|
||||
struct KeyEventIDs keyEventIDs;
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_awt_AWTEvent_initIDs(JNIEnv *env, jclass cls)
|
||||
{
|
||||
CHECK_NULL(awtEventIDs.bdata = (*env)->GetFieldID(env, cls, "bdata", "[B"));
|
||||
CHECK_NULL(awtEventIDs.consumed = (*env)->GetFieldID(env, cls, "consumed", "Z"));
|
||||
CHECK_NULL(awtEventIDs.id = (*env)->GetFieldID(env, cls, "id", "I"));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_awt_event_InputEvent_initIDs(JNIEnv *env, jclass cls)
|
||||
{
|
||||
CHECK_NULL(inputEventIDs.modifiers = (*env)->GetFieldID(env, cls, "modifiers", "I"));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_awt_event_KeyEvent_initIDs(JNIEnv *env, jclass cls)
|
||||
{
|
||||
CHECK_NULL(keyEventIDs.keyCode = (*env)->GetFieldID(env, cls, "keyCode", "I"));
|
||||
CHECK_NULL(keyEventIDs.keyChar = (*env)->GetFieldID(env, cls, "keyChar", "C"));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_awt_AWTEvent_nativeSetSource(JNIEnv *env, jobject self,
|
||||
jobject newSource)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/*
|
||||
* Implements the native code for the java.awt.AWTEvent class
|
||||
* and all of the classes in the java.awt.event package.
|
||||
*
|
||||
* THIS FILE DOES NOT IMPLEMENT ANY OF THE OBSOLETE java.awt.Event
|
||||
* CLASS. SEE awt_Event.[ch] FOR THAT CLASS' IMPLEMENTATION.
|
||||
*/
|
||||
#ifndef _AWT_AWTEVENT_H_
|
||||
#define _AWT_AWTEVENT_H_
|
||||
|
||||
#include "jni_util.h"
|
||||
|
||||
struct AWTEventIDs {
|
||||
jfieldID bdata;
|
||||
jfieldID consumed;
|
||||
jfieldID id;
|
||||
};
|
||||
|
||||
struct InputEventIDs {
|
||||
jfieldID modifiers;
|
||||
};
|
||||
|
||||
struct KeyEventIDs {
|
||||
jfieldID keyCode;
|
||||
jfieldID keyChar;
|
||||
};
|
||||
|
||||
extern struct AWTEventIDs awtEventIDs;
|
||||
extern struct InputEventIDs inputEventIDs;
|
||||
extern struct KeyEventIDs keyEventIDs;
|
||||
|
||||
#endif /* _AWT_AWTEVENT_H_ */
|
||||
|
|
@ -1,430 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#ifdef HEADLESS
|
||||
#error This file should not be included in headless library
|
||||
#endif
|
||||
|
||||
#include "awt_p.h"
|
||||
#include "java_awt_Component.h"
|
||||
|
||||
#include "awt_Component.h"
|
||||
|
||||
#include <jni.h>
|
||||
#include <jni_util.h>
|
||||
#include <jawt_md.h>
|
||||
|
||||
extern struct ComponentIDs componentIDs;
|
||||
|
||||
#include "awt_GraphicsEnv.h"
|
||||
extern jfieldID windowID;
|
||||
extern jfieldID targetID;
|
||||
extern jfieldID graphicsConfigID;
|
||||
extern jfieldID drawStateID;
|
||||
extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
|
||||
|
||||
/*
|
||||
* Lock the surface of the target component for native rendering.
|
||||
* When finished drawing, the surface must be unlocked with
|
||||
* Unlock(). This function returns a bitmask with one or more of the
|
||||
* following values:
|
||||
*
|
||||
* JAWT_LOCK_ERROR - When an error has occurred and the surface could not
|
||||
* be locked.
|
||||
*
|
||||
* JAWT_LOCK_CLIP_CHANGED - When the clip region has changed.
|
||||
*
|
||||
* JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed.
|
||||
*
|
||||
* JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed
|
||||
*/
|
||||
JNIEXPORT jint JNICALL awt_DrawingSurface_Lock(JAWT_DrawingSurface* ds)
|
||||
{
|
||||
JNIEnv* env;
|
||||
jobject target, peer;
|
||||
jclass componentClass;
|
||||
jint drawState;
|
||||
|
||||
if (ds == NULL) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Drawing Surface is NULL\n");
|
||||
#endif
|
||||
return (jint)JAWT_LOCK_ERROR;
|
||||
}
|
||||
env = ds->env;
|
||||
target = ds->target;
|
||||
|
||||
/* Make sure the target is a java.awt.Component */
|
||||
componentClass = (*env)->FindClass(env, "java/awt/Component");
|
||||
CHECK_NULL_RETURN(componentClass, (jint)JAWT_LOCK_ERROR);
|
||||
|
||||
if (!(*env)->IsInstanceOf(env, target, componentClass)) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Target is not a component\n");
|
||||
#endif
|
||||
return (jint)JAWT_LOCK_ERROR;
|
||||
}
|
||||
|
||||
if (!awtLockInited) {
|
||||
return (jint)JAWT_LOCK_ERROR;
|
||||
}
|
||||
AWT_LOCK();
|
||||
|
||||
/* Get the peer of the target component */
|
||||
peer = (*env)->GetObjectField(env, target, componentIDs.peer);
|
||||
if (JNU_IsNull(env, peer)) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Component peer is NULL\n");
|
||||
#endif
|
||||
AWT_FLUSH_UNLOCK();
|
||||
return (jint)JAWT_LOCK_ERROR;
|
||||
}
|
||||
|
||||
drawState = (*env)->GetIntField(env, peer, drawStateID);
|
||||
(*env)->SetIntField(env, peer, drawStateID, 0);
|
||||
return drawState;
|
||||
}
|
||||
|
||||
JNIEXPORT int32_t JNICALL
|
||||
awt_GetColor(JAWT_DrawingSurface* ds, int32_t r, int32_t g, int32_t b)
|
||||
{
|
||||
JNIEnv* env;
|
||||
jobject target, peer;
|
||||
jclass componentClass;
|
||||
AwtGraphicsConfigDataPtr adata;
|
||||
int32_t result;
|
||||
jobject gc_object;
|
||||
if (ds == NULL) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Drawing Surface is NULL\n");
|
||||
#endif
|
||||
return (int32_t) 0;
|
||||
}
|
||||
|
||||
env = ds->env;
|
||||
target = ds->target;
|
||||
|
||||
/* Make sure the target is a java.awt.Component */
|
||||
componentClass = (*env)->FindClass(env, "java/awt/Component");
|
||||
CHECK_NULL_RETURN(componentClass, (int32_t) 0);
|
||||
|
||||
if (!(*env)->IsInstanceOf(env, target, componentClass)) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "DrawingSurface target must be a component\n");
|
||||
#endif
|
||||
return (int32_t) 0;
|
||||
}
|
||||
|
||||
if (!awtLockInited) {
|
||||
return (int32_t) 0;
|
||||
}
|
||||
|
||||
AWT_LOCK();
|
||||
|
||||
/* Get the peer of the target component */
|
||||
peer = (*env)->GetObjectField(env, target, componentIDs.peer);
|
||||
if (JNU_IsNull(env, peer)) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Component peer is NULL\n");
|
||||
#endif
|
||||
AWT_UNLOCK();
|
||||
return (int32_t) 0;
|
||||
}
|
||||
/* GraphicsConfiguration object of MComponentPeer */
|
||||
gc_object = (*env)->GetObjectField(env, peer, graphicsConfigID);
|
||||
|
||||
if (gc_object != NULL) {
|
||||
adata = (AwtGraphicsConfigDataPtr)
|
||||
JNU_GetLongFieldAsPtr(env, gc_object,
|
||||
x11GraphicsConfigIDs.aData);
|
||||
} else {
|
||||
adata = getDefaultConfig(DefaultScreen(awt_display));
|
||||
}
|
||||
|
||||
result = adata->AwtColorMatch(r, g, b, adata);
|
||||
AWT_UNLOCK();
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the drawing surface info.
|
||||
* The value returned may be cached, but the values may change if
|
||||
* additional calls to Lock() or Unlock() are made.
|
||||
* Lock() must be called before this can return a valid value.
|
||||
* Returns NULL if an error has occurred.
|
||||
* When finished with the returned value, FreeDrawingSurfaceInfo must be
|
||||
* called.
|
||||
*/
|
||||
JNIEXPORT JAWT_DrawingSurfaceInfo* JNICALL
|
||||
awt_DrawingSurface_GetDrawingSurfaceInfo(JAWT_DrawingSurface* ds)
|
||||
{
|
||||
JNIEnv* env;
|
||||
jobject target, peer;
|
||||
jclass componentClass;
|
||||
JAWT_X11DrawingSurfaceInfo* px;
|
||||
JAWT_DrawingSurfaceInfo* p;
|
||||
XWindowAttributes attrs;
|
||||
|
||||
if (ds == NULL) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Drawing Surface is NULL\n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
env = ds->env;
|
||||
target = ds->target;
|
||||
|
||||
/* Make sure the target is a java.awt.Component */
|
||||
componentClass = (*env)->FindClass(env, "java/awt/Component");
|
||||
CHECK_NULL_RETURN(componentClass, NULL);
|
||||
|
||||
if (!(*env)->IsInstanceOf(env, target, componentClass)) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "DrawingSurface target must be a component\n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!awtLockInited) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AWT_LOCK();
|
||||
|
||||
/* Get the peer of the target component */
|
||||
peer = (*env)->GetObjectField(env, target, componentIDs.peer);
|
||||
if (JNU_IsNull(env, peer)) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Component peer is NULL\n");
|
||||
#endif
|
||||
AWT_UNLOCK();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AWT_UNLOCK();
|
||||
|
||||
/* Allocate platform-specific data */
|
||||
px = (JAWT_X11DrawingSurfaceInfo*)
|
||||
malloc(sizeof(JAWT_X11DrawingSurfaceInfo));
|
||||
|
||||
/* Set drawable and display */
|
||||
px->drawable = (*env)->GetLongField(env, peer, windowID);
|
||||
px->display = awt_display;
|
||||
|
||||
/* Get window attributes to set other values */
|
||||
XGetWindowAttributes(awt_display, (Window)(px->drawable), &attrs);
|
||||
|
||||
/* Set the other values */
|
||||
px->visualID = XVisualIDFromVisual(attrs.visual);
|
||||
px->colormapID = attrs.colormap;
|
||||
px->depth = attrs.depth;
|
||||
px->GetAWTColor = awt_GetColor;
|
||||
|
||||
/* Allocate and initialize platform-independent data */
|
||||
p = (JAWT_DrawingSurfaceInfo*)malloc(sizeof(JAWT_DrawingSurfaceInfo));
|
||||
p->platformInfo = px;
|
||||
p->ds = ds;
|
||||
p->bounds.x = (*env)->GetIntField(env, target, componentIDs.x);
|
||||
p->bounds.y = (*env)->GetIntField(env, target, componentIDs.y);
|
||||
p->bounds.width = (*env)->GetIntField(env, target, componentIDs.width);
|
||||
p->bounds.height = (*env)->GetIntField(env, target, componentIDs.height);
|
||||
p->clipSize = 1;
|
||||
p->clip = &(p->bounds);
|
||||
|
||||
/* Return our new structure */
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the drawing surface info.
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
awt_DrawingSurface_FreeDrawingSurfaceInfo(JAWT_DrawingSurfaceInfo* dsi)
|
||||
{
|
||||
if (dsi == NULL ) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Drawing Surface Info is NULL\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
free(dsi->platformInfo);
|
||||
free(dsi);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unlock the drawing surface of the target component for native rendering.
|
||||
*/
|
||||
JNIEXPORT void JNICALL awt_DrawingSurface_Unlock(JAWT_DrawingSurface* ds)
|
||||
{
|
||||
JNIEnv* env;
|
||||
if (ds == NULL) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Drawing Surface is NULL\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
env = ds->env;
|
||||
AWT_FLUSH_UNLOCK();
|
||||
}
|
||||
|
||||
JNIEXPORT JAWT_DrawingSurface* JNICALL
|
||||
awt_GetDrawingSurface(JNIEnv* env, jobject target)
|
||||
{
|
||||
jclass componentClass;
|
||||
JAWT_DrawingSurface* p;
|
||||
|
||||
/* Make sure the target component is a java.awt.Component */
|
||||
componentClass = (*env)->FindClass(env, "java/awt/Component");
|
||||
CHECK_NULL_RETURN(componentClass, NULL);
|
||||
|
||||
if (!(*env)->IsInstanceOf(env, target, componentClass)) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,
|
||||
"GetDrawingSurface target must be a java.awt.Component\n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p = (JAWT_DrawingSurface*)malloc(sizeof(JAWT_DrawingSurface));
|
||||
p->env = env;
|
||||
p->target = (*env)->NewGlobalRef(env, target);
|
||||
p->Lock = awt_DrawingSurface_Lock;
|
||||
p->GetDrawingSurfaceInfo = awt_DrawingSurface_GetDrawingSurfaceInfo;
|
||||
p->FreeDrawingSurfaceInfo = awt_DrawingSurface_FreeDrawingSurfaceInfo;
|
||||
p->Unlock = awt_DrawingSurface_Unlock;
|
||||
return p;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
awt_FreeDrawingSurface(JAWT_DrawingSurface* ds)
|
||||
{
|
||||
JNIEnv* env;
|
||||
|
||||
if (ds == NULL ) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Drawing Surface is NULL\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
env = ds->env;
|
||||
(*env)->DeleteGlobalRef(env, ds->target);
|
||||
free(ds);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
awt_Lock(JNIEnv* env)
|
||||
{
|
||||
if (awtLockInited) {
|
||||
AWT_LOCK();
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
awt_Unlock(JNIEnv* env)
|
||||
{
|
||||
if (awtLockInited) {
|
||||
AWT_FLUSH_UNLOCK();
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
awt_GetComponent(JNIEnv* env, void* platformInfo)
|
||||
{
|
||||
Window window = (Window)platformInfo;
|
||||
jobject peer = NULL;
|
||||
jobject target = NULL;
|
||||
|
||||
AWT_LOCK();
|
||||
|
||||
if (window != None) {
|
||||
peer = JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XToolkit",
|
||||
"windowToXWindow", "(J)Lsun/awt/X11/XBaseWindow;", (jlong)window).l;
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
AWT_UNLOCK();
|
||||
return (jobject)NULL;
|
||||
}
|
||||
}
|
||||
if ((peer != NULL) &&
|
||||
(JNU_IsInstanceOfByName(env, peer, "sun/awt/X11/XWindow") == 1)) {
|
||||
target = (*env)->GetObjectField(env, peer, targetID);
|
||||
}
|
||||
|
||||
if (target == NULL) {
|
||||
(*env)->ExceptionClear(env);
|
||||
JNU_ThrowNullPointerException(env, "NullPointerException");
|
||||
AWT_UNLOCK();
|
||||
return (jobject)NULL;
|
||||
}
|
||||
|
||||
AWT_UNLOCK();
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
// EmbeddedFrame support
|
||||
|
||||
static char *const embeddedClassName = "sun/awt/X11/XEmbeddedFrame";
|
||||
|
||||
JNIEXPORT jobject JNICALL awt_CreateEmbeddedFrame
|
||||
(JNIEnv* env, void* platformInfo)
|
||||
{
|
||||
static jmethodID mid = NULL;
|
||||
static jclass cls;
|
||||
if (mid == NULL) {
|
||||
cls = (*env)->FindClass(env, embeddedClassName);
|
||||
CHECK_NULL_RETURN(cls, NULL);
|
||||
mid = (*env)->GetMethodID(env, cls, "<init>", "(JZ)V");
|
||||
CHECK_NULL_RETURN(mid, NULL);
|
||||
}
|
||||
return (*env)->NewObject(env, cls, mid, platformInfo, JNI_TRUE);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL awt_SetBounds
|
||||
(JNIEnv *env, jobject embeddedFrame, jint x, jint y, jint w, jint h)
|
||||
{
|
||||
static jmethodID mid = NULL;
|
||||
if (mid == NULL) {
|
||||
jclass cls = (*env)->FindClass(env, embeddedClassName);
|
||||
CHECK_NULL(cls);
|
||||
mid = (*env)->GetMethodID(env, cls, "setBoundsPrivate", "(IIII)V");
|
||||
CHECK_NULL(mid);
|
||||
}
|
||||
(*env)->CallVoidMethod(env, embeddedFrame, mid, x, y, w, h);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL awt_SynthesizeWindowActivation
|
||||
(JNIEnv *env, jobject embeddedFrame, jboolean doActivate)
|
||||
{
|
||||
static jmethodID mid = NULL;
|
||||
if (mid == NULL) {
|
||||
jclass cls = (*env)->FindClass(env, embeddedClassName);
|
||||
CHECK_NULL(cls);
|
||||
mid = (*env)->GetMethodID(env, cls, "synthesizeWindowActivation", "(Z)V");
|
||||
CHECK_NULL(mid);
|
||||
}
|
||||
(*env)->CallVoidMethod(env, embeddedFrame, mid, doActivate);
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/***
|
||||
*** THIS IMPLEMENTS ONLY THE OBSOLETE java.awt.Event CLASS! SEE
|
||||
*** awt_AWTEvent.[ch] FOR THE NEWER EVENT CLASSES.
|
||||
***
|
||||
***/
|
||||
#ifdef HEADLESS
|
||||
#error This file should not be included in headless library
|
||||
#endif
|
||||
|
||||
#include "java_awt_Event.h"
|
||||
#include "jni_util.h"
|
||||
|
||||
#include "awt_Event.h"
|
||||
|
||||
struct EventIDs eventIDs;
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_awt_Event_initIDs(JNIEnv *env, jclass cls)
|
||||
{
|
||||
CHECK_NULL(eventIDs.data = (*env)->GetFieldID(env, cls, "data", "J"));
|
||||
CHECK_NULL(eventIDs.consumed = (*env)->GetFieldID(env, cls, "consumed", "Z"));
|
||||
CHECK_NULL(eventIDs.id = (*env)->GetFieldID(env, cls, "id", "I"));
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/***
|
||||
*** THIS IMPLEMENTS ONLY THE OBSOLETE java.awt.Event CLASS! SEE
|
||||
*** awt_AWTEvent.[ch] FOR THE NEWER EVENT CLASSES.
|
||||
***
|
||||
***/
|
||||
#ifndef _AWT_EVENT_H_
|
||||
#define _AWT_EVENT_H_
|
||||
|
||||
#include "jni_util.h"
|
||||
|
||||
struct EventIDs {
|
||||
jfieldID data;
|
||||
jfieldID consumed;
|
||||
jfieldID id;
|
||||
};
|
||||
|
||||
extern struct EventIDs eventIDs;
|
||||
|
||||
#endif /* _AWT_EVENT_H_ */
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include "java_awt_Insets.h"
|
||||
#include "jni_util.h"
|
||||
|
||||
#include "awt_Insets.h"
|
||||
|
||||
struct InsetsIDs insetsIDs;
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_awt_Insets_initIDs(JNIEnv *env, jclass cls)
|
||||
{
|
||||
CHECK_NULL(insetsIDs.top = (*env)->GetFieldID(env, cls, "top", "I"));
|
||||
CHECK_NULL(insetsIDs.bottom = (*env)->GetFieldID(env, cls, "bottom", "I"));
|
||||
CHECK_NULL(insetsIDs.left = (*env)->GetFieldID(env, cls, "left", "I"));
|
||||
CHECK_NULL(insetsIDs.right = (*env)->GetFieldID(env, cls, "right", "I"));
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include "jni_util.h"
|
||||
|
||||
struct InsetsIDs {
|
||||
jfieldID top;
|
||||
jfieldID bottom;
|
||||
jfieldID left;
|
||||
jfieldID right;
|
||||
};
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include "jni_util.h"
|
||||
|
||||
struct MenuComponentIDs {
|
||||
jfieldID font;
|
||||
jfieldID appContext;
|
||||
jmethodID getParent;
|
||||
};
|
||||
|
|
@ -1,524 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#ifdef HEADLESS
|
||||
#error This file should not be included in headless library
|
||||
#endif
|
||||
|
||||
#include "jvm_md.h"
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "awt_p.h"
|
||||
#include "awt_GraphicsEnv.h"
|
||||
#define XK_MISCELLANY
|
||||
#include <X11/keysymdef.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xmd.h>
|
||||
#include <X11/extensions/xtestext1.h>
|
||||
#include <X11/extensions/XTest.h>
|
||||
#include <X11/extensions/XInput.h>
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <jni.h>
|
||||
#include <sizecalc.h>
|
||||
#include "robot_common.h"
|
||||
#include "canvas.h"
|
||||
#include "wsutils.h"
|
||||
#include "list.h"
|
||||
#include "multiVis.h"
|
||||
#include "gtk_interface.h"
|
||||
|
||||
#if defined(__linux__) || defined(MACOSX)
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
static Bool (*compositeQueryExtension) (Display*, int*, int*);
|
||||
static Status (*compositeQueryVersion) (Display*, int*, int*);
|
||||
static Window (*compositeGetOverlayWindow) (Display *, Window);
|
||||
|
||||
extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
|
||||
|
||||
static jint * masks;
|
||||
static jint num_buttons;
|
||||
|
||||
static void *xCompositeHandle;
|
||||
|
||||
static const char* XCOMPOSITE = JNI_LIB_NAME("Xcomposite");
|
||||
static const char* XCOMPOSITE_VERSIONED = VERSIONED_JNI_LIB_NAME("Xcomposite", "1");
|
||||
|
||||
static Bool checkXCompositeFunctions(void) {
|
||||
return (compositeQueryExtension != NULL &&
|
||||
compositeQueryVersion != NULL &&
|
||||
compositeGetOverlayWindow != NULL);
|
||||
}
|
||||
|
||||
static void initXCompositeFunctions(void) {
|
||||
|
||||
if (xCompositeHandle == NULL) {
|
||||
xCompositeHandle = dlopen(XCOMPOSITE, RTLD_LAZY | RTLD_GLOBAL);
|
||||
if (xCompositeHandle == NULL) {
|
||||
xCompositeHandle = dlopen(XCOMPOSITE_VERSIONED, RTLD_LAZY | RTLD_GLOBAL);
|
||||
}
|
||||
}
|
||||
//*(void **)(&asyncGetCallTraceFunction)
|
||||
if (xCompositeHandle != NULL) {
|
||||
*(void **)(&compositeQueryExtension) = dlsym(xCompositeHandle, "XCompositeQueryExtension");
|
||||
*(void **)(&compositeQueryVersion) = dlsym(xCompositeHandle, "XCompositeQueryVersion");
|
||||
*(void **)(&compositeGetOverlayWindow) = dlsym(xCompositeHandle, "XCompositeGetOverlayWindow");
|
||||
}
|
||||
|
||||
if (xCompositeHandle && !checkXCompositeFunctions()) {
|
||||
dlclose(xCompositeHandle);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t isXTestAvailable() {
|
||||
int32_t major_opcode, first_event, first_error;
|
||||
int32_t event_basep, error_basep, majorp, minorp;
|
||||
int32_t isXTestAvailable;
|
||||
|
||||
/* check if XTest is available */
|
||||
isXTestAvailable = XQueryExtension(awt_display, XTestExtensionName, &major_opcode, &first_event, &first_error);
|
||||
if (isXTestAvailable) {
|
||||
DTRACE_PRINTLN3("RobotPeer: XQueryExtension(XTEST) returns major_opcode = %d, first_event = %d, first_error = %d",
|
||||
major_opcode, first_event, first_error);
|
||||
/* check if XTest version is OK */
|
||||
XTestQueryExtension(awt_display, &event_basep, &error_basep, &majorp, &minorp);
|
||||
DTRACE_PRINTLN4("RobotPeer: XTestQueryExtension returns event_basep = %d, error_basep = %d, majorp = %d, minorp = %d",
|
||||
event_basep, error_basep, majorp, minorp);
|
||||
if (majorp < 2 || (majorp == 2 && minorp < 2)) {
|
||||
/* bad version*/
|
||||
DTRACE_PRINTLN2("XRobotPeer: XTEST version is %d.%d \n", majorp, minorp);
|
||||
if (majorp == 2 && minorp == 1) {
|
||||
DTRACE_PRINTLN("XRobotPeer: XTEST is 2.1 - no grab is available\n");
|
||||
} else {
|
||||
isXTestAvailable = False;
|
||||
}
|
||||
} else {
|
||||
/* allow XTest calls even if someone else has the grab; e.g. during
|
||||
* a window resize operation. Works only with XTEST2.2*/
|
||||
XTestGrabControl(awt_display, True);
|
||||
}
|
||||
} else {
|
||||
DTRACE_PRINTLN("RobotPeer: XTEST extension is unavailable");
|
||||
}
|
||||
|
||||
return isXTestAvailable;
|
||||
}
|
||||
|
||||
static Bool hasXCompositeOverlayExtension(Display *display) {
|
||||
|
||||
int xoverlay = False;
|
||||
int eventBase, errorBase;
|
||||
if (checkXCompositeFunctions() &&
|
||||
compositeQueryExtension(display, &eventBase, &errorBase))
|
||||
{
|
||||
int major = 0;
|
||||
int minor = 0;
|
||||
|
||||
compositeQueryVersion(display, &major, &minor);
|
||||
if (major > 0 || minor >= 3) {
|
||||
xoverlay = True;
|
||||
}
|
||||
}
|
||||
|
||||
return xoverlay;
|
||||
}
|
||||
|
||||
static jboolean isXCompositeDisplay(Display *display, int screenNumber) {
|
||||
|
||||
char NET_WM_CM_Sn[25];
|
||||
snprintf(NET_WM_CM_Sn, sizeof(NET_WM_CM_Sn), "_NET_WM_CM_S%d\0", screenNumber);
|
||||
|
||||
Atom managerSelection = XInternAtom(display, NET_WM_CM_Sn, 0);
|
||||
Window owner = XGetSelectionOwner(display, managerSelection);
|
||||
|
||||
return owner != 0;
|
||||
}
|
||||
|
||||
static XImage *getWindowImage(Display * display, Window window,
|
||||
int32_t x, int32_t y,
|
||||
int32_t w, int32_t h) {
|
||||
XImage *image;
|
||||
int32_t transparentOverlays;
|
||||
int32_t numVisuals;
|
||||
XVisualInfo *pVisuals;
|
||||
int32_t numOverlayVisuals;
|
||||
OverlayInfo *pOverlayVisuals;
|
||||
int32_t numImageVisuals;
|
||||
XVisualInfo **pImageVisuals;
|
||||
list_ptr vis_regions; /* list of regions to read from */
|
||||
list_ptr vis_image_regions ;
|
||||
int32_t allImage = 0 ;
|
||||
int32_t format = ZPixmap;
|
||||
|
||||
/* prevent user from moving stuff around during the capture */
|
||||
XGrabServer(display);
|
||||
|
||||
/*
|
||||
* The following two functions live in multiVis.c-- they are pretty
|
||||
* much verbatim taken from the source to the xwd utility from the
|
||||
* X11 source. This version of the xwd source was somewhat better written
|
||||
* for reuse compared to Sun's version.
|
||||
*
|
||||
* ftp.x.org/pub/R6.3/xc/programs/xwd
|
||||
*
|
||||
* We use these functions since they do the very tough job of capturing
|
||||
* the screen correctly when it contains multiple visuals. They take into
|
||||
* account the depth/colormap of each visual and produce a capture as a
|
||||
* 24-bit RGB image so we don't have to fool around with colormaps etc.
|
||||
*/
|
||||
|
||||
GetMultiVisualRegions(
|
||||
display,
|
||||
window,
|
||||
x, y, w, h,
|
||||
&transparentOverlays,
|
||||
&numVisuals,
|
||||
&pVisuals,
|
||||
&numOverlayVisuals,
|
||||
&pOverlayVisuals,
|
||||
&numImageVisuals,
|
||||
&pImageVisuals,
|
||||
&vis_regions,
|
||||
&vis_image_regions,
|
||||
&allImage );
|
||||
|
||||
image = ReadAreaToImage(
|
||||
display,
|
||||
window,
|
||||
x, y, w, h,
|
||||
numVisuals,
|
||||
pVisuals,
|
||||
numOverlayVisuals,
|
||||
pOverlayVisuals,
|
||||
numImageVisuals,
|
||||
pImageVisuals,
|
||||
vis_regions,
|
||||
vis_image_regions,
|
||||
format,
|
||||
allImage );
|
||||
|
||||
/* allow user to do stuff again */
|
||||
XUngrabServer(display);
|
||||
|
||||
/* make sure the grab/ungrab is flushed */
|
||||
XSync(display, False);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
/*********************************************************************************************/
|
||||
|
||||
// this should be called from XRobotPeer constructor
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButtons, jintArray buttonDownMasks)
|
||||
{
|
||||
int32_t xtestAvailable;
|
||||
jint *tmp;
|
||||
int i;
|
||||
|
||||
DTRACE_PRINTLN("RobotPeer: setup()");
|
||||
|
||||
num_buttons = numberOfButtons;
|
||||
tmp = (*env)->GetIntArrayElements(env, buttonDownMasks, JNI_FALSE);
|
||||
CHECK_NULL(tmp);
|
||||
|
||||
masks = (jint *)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(jint), num_buttons);
|
||||
if (masks == (jint *) NULL) {
|
||||
(*env)->ExceptionClear(env);
|
||||
(*env)->ReleaseIntArrayElements(env, buttonDownMasks, tmp, 0);
|
||||
JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2), NULL);
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < num_buttons; i++) {
|
||||
masks[i] = tmp[i];
|
||||
}
|
||||
(*env)->ReleaseIntArrayElements(env, buttonDownMasks, tmp, 0);
|
||||
|
||||
AWT_LOCK();
|
||||
xtestAvailable = isXTestAvailable();
|
||||
DTRACE_PRINTLN1("RobotPeer: XTest available = %d", xtestAvailable);
|
||||
if (!xtestAvailable) {
|
||||
JNU_ThrowByName(env, "java/awt/AWTException", "java.awt.Robot requires your X server support the XTEST extension version 2.2");
|
||||
}
|
||||
|
||||
AWT_UNLOCK();
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
|
||||
jclass cls,
|
||||
jobject xgc,
|
||||
jint jx,
|
||||
jint jy,
|
||||
jint jwidth,
|
||||
jint jheight,
|
||||
jintArray pixelArray,
|
||||
jboolean useGtk) {
|
||||
XImage *image;
|
||||
jint *ary; /* Array of jints for sending pixel values back
|
||||
* to parent process.
|
||||
*/
|
||||
Window rootWindow;
|
||||
XWindowAttributes attr;
|
||||
AwtGraphicsConfigDataPtr adata;
|
||||
|
||||
DTRACE_PRINTLN6("RobotPeer: getRGBPixelsImpl(%lx, %d, %d, %d, %d, %x)", xgc, jx, jy, jwidth, jheight, pixelArray);
|
||||
|
||||
if (jwidth <= 0 || jheight <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
adata = (AwtGraphicsConfigDataPtr) JNU_GetLongFieldAsPtr(env, xgc, x11GraphicsConfigIDs.aData);
|
||||
DASSERT(adata != NULL);
|
||||
|
||||
AWT_LOCK();
|
||||
|
||||
rootWindow = XRootWindow(awt_display, adata->awt_visInfo.screen);
|
||||
|
||||
if (!useGtk) {
|
||||
if (hasXCompositeOverlayExtension(awt_display) &&
|
||||
isXCompositeDisplay(awt_display, adata->awt_visInfo.screen))
|
||||
{
|
||||
rootWindow = compositeGetOverlayWindow(awt_display, rootWindow);
|
||||
}
|
||||
}
|
||||
|
||||
if (!XGetWindowAttributes(awt_display, rootWindow, &attr)
|
||||
|| jx + jwidth <= attr.x
|
||||
|| attr.x + attr.width <= jx
|
||||
|| jy + jheight <= attr.y
|
||||
|| attr.y + attr.height <= jy) {
|
||||
|
||||
AWT_UNLOCK();
|
||||
return; // Does not intersect with root window
|
||||
}
|
||||
|
||||
gboolean gtk_failed = TRUE;
|
||||
jint _x, _y;
|
||||
|
||||
jint x = MAX(jx, attr.x);
|
||||
jint y = MAX(jy, attr.y);
|
||||
jint width = MIN(jx + jwidth, attr.x + attr.width) - x;
|
||||
jint height = MIN(jy + jheight, attr.y + attr.height) - y;
|
||||
|
||||
int dx = attr.x > jx ? attr.x - jx : 0;
|
||||
int dy = attr.y > jy ? attr.y - jy : 0;
|
||||
|
||||
int index;
|
||||
|
||||
if (useGtk) {
|
||||
gtk->gdk_threads_enter();
|
||||
gtk_failed = gtk->get_drawable_data(env, pixelArray, x, y, width,
|
||||
height, jwidth, dx, dy, 1);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
if (gtk_failed) {
|
||||
image = getWindowImage(awt_display, rootWindow, x, y, width, height);
|
||||
|
||||
ary = (*env)->GetPrimitiveArrayCritical(env, pixelArray, NULL);
|
||||
|
||||
if (!ary) {
|
||||
XDestroyImage(image);
|
||||
AWT_UNLOCK();
|
||||
return;
|
||||
}
|
||||
|
||||
/* convert to Java ARGB pixels */
|
||||
for (_y = 0; _y < height; _y++) {
|
||||
for (_x = 0; _x < width; _x++) {
|
||||
jint pixel = (jint) XGetPixel(image, _x, _y);
|
||||
/* Note ignore upper
|
||||
* 32-bits on 64-bit
|
||||
* OSes.
|
||||
*/
|
||||
pixel |= 0xff000000; /* alpha - full opacity */
|
||||
|
||||
index = (_y + dy) * jwidth + (_x + dx);
|
||||
ary[index] = pixel;
|
||||
}
|
||||
}
|
||||
|
||||
XDestroyImage(image);
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, pixelArray, ary, 0);
|
||||
}
|
||||
AWT_UNLOCK();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XRobotPeer_keyPressImpl (JNIEnv *env,
|
||||
jclass cls,
|
||||
jint keycode) {
|
||||
|
||||
AWT_LOCK();
|
||||
|
||||
DTRACE_PRINTLN1("RobotPeer: keyPressImpl(%i)", keycode);
|
||||
|
||||
XTestFakeKeyEvent(awt_display,
|
||||
XKeysymToKeycode(awt_display, awt_getX11KeySym(keycode)),
|
||||
True,
|
||||
CurrentTime);
|
||||
|
||||
XSync(awt_display, False);
|
||||
|
||||
AWT_UNLOCK();
|
||||
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XRobotPeer_keyReleaseImpl (JNIEnv *env,
|
||||
jclass cls,
|
||||
jint keycode) {
|
||||
AWT_LOCK();
|
||||
|
||||
DTRACE_PRINTLN1("RobotPeer: keyReleaseImpl(%i)", keycode);
|
||||
|
||||
XTestFakeKeyEvent(awt_display,
|
||||
XKeysymToKeycode(awt_display, awt_getX11KeySym(keycode)),
|
||||
False,
|
||||
CurrentTime);
|
||||
|
||||
XSync(awt_display, False);
|
||||
|
||||
AWT_UNLOCK();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XRobotPeer_mouseMoveImpl (JNIEnv *env,
|
||||
jclass cls,
|
||||
jobject xgc,
|
||||
jint root_x,
|
||||
jint root_y) {
|
||||
|
||||
AwtGraphicsConfigDataPtr adata;
|
||||
|
||||
AWT_LOCK();
|
||||
|
||||
DTRACE_PRINTLN3("RobotPeer: mouseMoveImpl(%lx, %i, %i)", xgc, root_x, root_y);
|
||||
|
||||
adata = (AwtGraphicsConfigDataPtr) JNU_GetLongFieldAsPtr(env, xgc, x11GraphicsConfigIDs.aData);
|
||||
DASSERT(adata != NULL);
|
||||
|
||||
XWarpPointer(awt_display, None, XRootWindow(awt_display, adata->awt_visInfo.screen), 0, 0, 0, 0, root_x, root_y);
|
||||
XSync(awt_display, False);
|
||||
|
||||
AWT_UNLOCK();
|
||||
}
|
||||
|
||||
/*
|
||||
* Function joining the code of mousePressImpl and mouseReleaseImpl
|
||||
*/
|
||||
void mouseAction(JNIEnv *env,
|
||||
jclass cls,
|
||||
jint buttonMask,
|
||||
Bool isMousePress)
|
||||
{
|
||||
AWT_LOCK();
|
||||
|
||||
DTRACE_PRINTLN1("RobotPeer: mouseAction(%i)", buttonMask);
|
||||
DTRACE_PRINTLN1("RobotPeer: mouseAction, press = %d", isMousePress);
|
||||
|
||||
if (buttonMask & java_awt_event_InputEvent_BUTTON1_MASK ||
|
||||
buttonMask & java_awt_event_InputEvent_BUTTON1_DOWN_MASK )
|
||||
{
|
||||
XTestFakeButtonEvent(awt_display, 1, isMousePress, CurrentTime);
|
||||
}
|
||||
if ((buttonMask & java_awt_event_InputEvent_BUTTON2_MASK ||
|
||||
buttonMask & java_awt_event_InputEvent_BUTTON2_DOWN_MASK) &&
|
||||
(num_buttons >= 2)) {
|
||||
XTestFakeButtonEvent(awt_display, 2, isMousePress, CurrentTime);
|
||||
}
|
||||
if ((buttonMask & java_awt_event_InputEvent_BUTTON3_MASK ||
|
||||
buttonMask & java_awt_event_InputEvent_BUTTON3_DOWN_MASK) &&
|
||||
(num_buttons >= 3)) {
|
||||
XTestFakeButtonEvent(awt_display, 3, isMousePress, CurrentTime);
|
||||
}
|
||||
|
||||
if (num_buttons > 3){
|
||||
int32_t i;
|
||||
int32_t button = 0;
|
||||
for (i = 3; i<num_buttons; i++){
|
||||
if ((buttonMask & masks[i])) {
|
||||
// arrays starts from zero index => +1
|
||||
// users wants to affect 4 or 5 button but they are assigned
|
||||
// to the wheel so => we have to shift it to the right by 2.
|
||||
button = i + 3;
|
||||
XTestFakeButtonEvent(awt_display, button, isMousePress, CurrentTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XSync(awt_display, False);
|
||||
AWT_UNLOCK();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XRobotPeer_mousePressImpl (JNIEnv *env,
|
||||
jclass cls,
|
||||
jint buttonMask) {
|
||||
mouseAction(env, cls, buttonMask, True);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XRobotPeer_mouseReleaseImpl (JNIEnv *env,
|
||||
jclass cls,
|
||||
jint buttonMask) {
|
||||
mouseAction(env, cls, buttonMask, False);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XRobotPeer_mouseWheelImpl (JNIEnv *env,
|
||||
jclass cls,
|
||||
jint wheelAmt) {
|
||||
/* Mouse wheel is implemented as a button press of button 4 and 5, so it */
|
||||
/* probably could have been hacked into robot_mouseButtonEvent, but it's */
|
||||
/* cleaner to give it its own command type, in case the implementation */
|
||||
/* needs to be changed later. -bchristi, 6/20/01 */
|
||||
|
||||
int32_t repeat = abs(wheelAmt);
|
||||
int32_t button = wheelAmt < 0 ? 4 : 5; /* wheel up: button 4 */
|
||||
/* wheel down: button 5 */
|
||||
int32_t loopIdx;
|
||||
|
||||
AWT_LOCK();
|
||||
|
||||
DTRACE_PRINTLN1("RobotPeer: mouseWheelImpl(%i)", wheelAmt);
|
||||
|
||||
for (loopIdx = 0; loopIdx < repeat; loopIdx++) { /* do nothing for */
|
||||
/* wheelAmt == 0 */
|
||||
XTestFakeButtonEvent(awt_display, button, True, CurrentTime);
|
||||
XTestFakeButtonEvent(awt_display, button, False, CurrentTime);
|
||||
}
|
||||
XSync(awt_display, False);
|
||||
|
||||
AWT_UNLOCK();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XRobotPeer_loadNativeLibraries (JNIEnv *env, jclass cls) {
|
||||
initXCompositeFunctions();
|
||||
}
|
||||
|
|
@ -1,280 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <jni.h>
|
||||
#include <sizecalc.h>
|
||||
#include "sun_awt_UNIXToolkit.h"
|
||||
|
||||
#ifndef HEADLESS
|
||||
#include "awt.h"
|
||||
#include "gtk_interface.h"
|
||||
#endif /* !HEADLESS */
|
||||
|
||||
|
||||
static jclass this_class = NULL;
|
||||
static jmethodID icon_upcall_method = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_UNIXToolkit
|
||||
* Method: check_gtk
|
||||
* Signature: (I)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_UNIXToolkit_check_1gtk(JNIEnv *env, jclass klass, jint version) {
|
||||
#ifndef HEADLESS
|
||||
return (jboolean)gtk_check_version(version);
|
||||
#else
|
||||
return JNI_FALSE;
|
||||
#endif /* !HEADLESS */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_UNIXToolkit
|
||||
* Method: load_gtk
|
||||
* Signature: (I)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_UNIXToolkit_load_1gtk(JNIEnv *env, jclass klass, jint version,
|
||||
jboolean verbose) {
|
||||
#ifndef HEADLESS
|
||||
return (jboolean)gtk_load(env, version, verbose);
|
||||
#else
|
||||
return JNI_FALSE;
|
||||
#endif /* !HEADLESS */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_UNIXToolkit
|
||||
* Method: unload_gtk
|
||||
* Signature: ()Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_UNIXToolkit_unload_1gtk(JNIEnv *env, jclass klass)
|
||||
{
|
||||
#ifndef HEADLESS
|
||||
return (jboolean)gtk->unload();
|
||||
#else
|
||||
return JNI_FALSE;
|
||||
#endif /* !HEADLESS */
|
||||
}
|
||||
|
||||
jboolean init_method(JNIEnv *env, jobject this)
|
||||
{
|
||||
if (this_class == NULL) {
|
||||
this_class = (*env)->NewGlobalRef(env,
|
||||
(*env)->GetObjectClass(env, this));
|
||||
icon_upcall_method = (*env)->GetMethodID(env, this_class,
|
||||
"loadIconCallback", "([BIIIIIZ)V");
|
||||
CHECK_NULL_RETURN(icon_upcall_method, JNI_FALSE);
|
||||
}
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_UNIXToolkit
|
||||
* Method: load_gtk_icon
|
||||
* Signature: (Ljava/lang/String)Z
|
||||
*
|
||||
* This method assumes that GTK libs are present.
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_UNIXToolkit_load_1gtk_1icon(JNIEnv *env, jobject this,
|
||||
jstring filename)
|
||||
{
|
||||
#ifndef HEADLESS
|
||||
int len;
|
||||
char *filename_str = NULL;
|
||||
GError **error = NULL;
|
||||
|
||||
if (filename == NULL)
|
||||
{
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
len = (*env)->GetStringUTFLength(env, filename);
|
||||
filename_str = (char *)SAFE_SIZE_ARRAY_ALLOC(malloc,
|
||||
sizeof(char), len + 1);
|
||||
if (filename_str == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
if (!init_method(env, this) ) {
|
||||
free(filename_str);
|
||||
return JNI_FALSE;
|
||||
}
|
||||
(*env)->GetStringUTFRegion(env, filename, 0, len, filename_str);
|
||||
jboolean result = gtk->get_file_icon_data(env, filename_str, error,
|
||||
icon_upcall_method, this);
|
||||
|
||||
/* Release the strings we've allocated. */
|
||||
free(filename_str);
|
||||
|
||||
return result;
|
||||
#else /* HEADLESS */
|
||||
return JNI_FALSE;
|
||||
#endif /* !HEADLESS */
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_UNIXToolkit
|
||||
* Method: load_stock_icon
|
||||
* Signature: (ILjava/lang/String;IILjava/lang/String;)Z
|
||||
*
|
||||
* This method assumes that GTK libs are present.
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_UNIXToolkit_load_1stock_1icon(JNIEnv *env, jobject this,
|
||||
jint widget_type, jstring stock_id, jint icon_size,
|
||||
jint text_direction, jstring detail)
|
||||
{
|
||||
#ifndef HEADLESS
|
||||
int len;
|
||||
char *stock_id_str = NULL;
|
||||
char *detail_str = NULL;
|
||||
|
||||
if (stock_id == NULL)
|
||||
{
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
len = (*env)->GetStringUTFLength(env, stock_id);
|
||||
stock_id_str = (char *)SAFE_SIZE_ARRAY_ALLOC(malloc,
|
||||
sizeof(char), len + 1);
|
||||
if (stock_id_str == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
(*env)->GetStringUTFRegion(env, stock_id, 0, len, stock_id_str);
|
||||
|
||||
/* Detail isn't required so check for NULL. */
|
||||
if (detail != NULL)
|
||||
{
|
||||
len = (*env)->GetStringUTFLength(env, detail);
|
||||
detail_str = (char *)SAFE_SIZE_ARRAY_ALLOC(malloc,
|
||||
sizeof(char), len + 1);
|
||||
if (detail_str == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
(*env)->GetStringUTFRegion(env, detail, 0, len, detail_str);
|
||||
}
|
||||
|
||||
if (!init_method(env, this) ) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
jboolean result = gtk->get_icon_data(env, widget_type, stock_id_str,
|
||||
icon_size, text_direction, detail_str,
|
||||
icon_upcall_method, this);
|
||||
|
||||
/* Release the strings we've allocated. */
|
||||
free(stock_id_str);
|
||||
if (detail_str != NULL)
|
||||
{
|
||||
free(detail_str);
|
||||
}
|
||||
return result;
|
||||
#else /* HEADLESS */
|
||||
return JNI_FALSE;
|
||||
#endif /* !HEADLESS */
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_UNIXToolkit
|
||||
* Method: nativeSync
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_UNIXToolkit_nativeSync(JNIEnv *env, jobject this)
|
||||
{
|
||||
#ifndef HEADLESS
|
||||
AWT_LOCK();
|
||||
XSync(awt_display, False);
|
||||
AWT_UNLOCK();
|
||||
#endif /* !HEADLESS */
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_SunToolkit
|
||||
* Method: closeSplashScreen
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_SunToolkit_closeSplashScreen(JNIEnv *env, jclass cls)
|
||||
{
|
||||
typedef void (*SplashClose_t)();
|
||||
SplashClose_t splashClose;
|
||||
void* hSplashLib = dlopen(0, RTLD_LAZY);
|
||||
if (!hSplashLib) {
|
||||
return;
|
||||
}
|
||||
splashClose = (SplashClose_t)dlsym(hSplashLib,
|
||||
"SplashClose");
|
||||
if (splashClose) {
|
||||
splashClose();
|
||||
}
|
||||
dlclose(hSplashLib);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_UNIXToolkit
|
||||
* Method: gtkCheckVersionImpl
|
||||
* Signature: (III)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_UNIXToolkit_gtkCheckVersionImpl(JNIEnv *env, jobject this,
|
||||
jint major, jint minor, jint micro)
|
||||
{
|
||||
char *ret;
|
||||
|
||||
ret = gtk->gtk_check_version(major, minor, micro);
|
||||
if (ret == NULL) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_UNIXToolkit
|
||||
* Method: get_gtk_version
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_sun_awt_UNIXToolkit_get_1gtk_1version(JNIEnv *env, jclass klass)
|
||||
{
|
||||
#ifndef HEADLESS
|
||||
return gtk ? gtk->version : GTK_ANY;
|
||||
#else
|
||||
return GTK_ANY;
|
||||
#endif /* !HEADLESS */
|
||||
}
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#ifdef HEADLESS
|
||||
#error This file should not be included in headless library
|
||||
#endif
|
||||
|
||||
#include "awt_p.h"
|
||||
#include "color.h"
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xmd.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <jni.h>
|
||||
#include <jni_util.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
|
||||
#include "java_awt_event_MouseWheelEvent.h"
|
||||
|
||||
/*
|
||||
* Called by "ToolkitErrorHandler" function in "XlibWrapper.c" file.
|
||||
*/
|
||||
XErrorHandler current_native_xerror_handler = NULL;
|
||||
|
||||
extern jint getModifiers(uint32_t state, jint button, jint keyCode);
|
||||
extern jint getButton(uint32_t button);
|
||||
|
||||
static Atom OLDecorDelAtom = 0;
|
||||
static Atom MWMHints = 0;
|
||||
static Atom DTWMHints = 0;
|
||||
static Atom decor_list[9];
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
jboolean
|
||||
awtJNI_ThreadYield(JNIEnv *env) {
|
||||
|
||||
static jclass threadClass = NULL;
|
||||
static jmethodID yieldMethodID = NULL;
|
||||
|
||||
/* Initialize our java identifiers once. Checking before locking
|
||||
* is a huge performance win.
|
||||
*/
|
||||
if (threadClass == NULL) {
|
||||
// should enter a monitor here...
|
||||
Boolean err = FALSE;
|
||||
if (threadClass == NULL) {
|
||||
jclass tc = (*env)->FindClass(env, "java/lang/Thread");
|
||||
CHECK_NULL_RETURN(tc, JNI_FALSE);
|
||||
threadClass = (*env)->NewGlobalRef(env, tc);
|
||||
(*env)->DeleteLocalRef(env, tc);
|
||||
if (threadClass != NULL) {
|
||||
yieldMethodID = (*env)->GetStaticMethodID(env,
|
||||
threadClass,
|
||||
"yield",
|
||||
"()V"
|
||||
);
|
||||
}
|
||||
}
|
||||
if (yieldMethodID == NULL) {
|
||||
threadClass = NULL;
|
||||
err = TRUE;
|
||||
}
|
||||
if (err) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
} /* threadClass == NULL*/
|
||||
|
||||
(*env)->CallStaticVoidMethod(env, threadClass, yieldMethodID);
|
||||
DASSERT(!((*env)->ExceptionOccurred(env)));
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
return JNI_TRUE;
|
||||
} /* awtJNI_ThreadYield() */
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
#ifndef _CANVAS_H_
|
||||
#define _CANVAS_H_
|
||||
#ifndef HEADLESS
|
||||
|
||||
KeySym awt_getX11KeySym(jint awtKey);
|
||||
|
||||
#endif /* !HEADLESS */
|
||||
#endif /* _CANVAS_H_ */
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,452 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
#ifndef _GTK2_INTERFACE_H
|
||||
#define _GTK2_INTERFACE_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <jni.h>
|
||||
#include <X11/X.h>
|
||||
#include "gtk_interface.h"
|
||||
|
||||
#define GTK_HAS_FOCUS (1 << 12)
|
||||
#define GTK_HAS_DEFAULT (1 << 14)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_WINDOW_TOPLEVEL,
|
||||
GTK_WINDOW_POPUP
|
||||
} GtkWindowType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
G_PARAM_READABLE = 1 << 0,
|
||||
G_PARAM_WRITABLE = 1 << 1,
|
||||
G_PARAM_CONSTRUCT = 1 << 2,
|
||||
G_PARAM_CONSTRUCT_ONLY = 1 << 3,
|
||||
G_PARAM_LAX_VALIDATION = 1 << 4,
|
||||
G_PARAM_PRIVATE = 1 << 5
|
||||
} GParamFlags;
|
||||
|
||||
/* We define all structure pointers to be void* */
|
||||
typedef void GMainContext;
|
||||
typedef void GVfs;
|
||||
|
||||
typedef void GdkColormap;
|
||||
typedef void GdkDrawable;
|
||||
typedef void GdkGC;
|
||||
typedef void GdkPixbuf;
|
||||
typedef void GdkPixmap;
|
||||
|
||||
typedef void GtkFixed;
|
||||
typedef void GtkMenuItem;
|
||||
typedef void GtkMenuShell;
|
||||
typedef void GtkWidgetClass;
|
||||
typedef void PangoFontDescription;
|
||||
typedef void GtkSettings;
|
||||
|
||||
/* Some real structures */
|
||||
typedef struct
|
||||
{
|
||||
guint32 pixel;
|
||||
guint16 red;
|
||||
guint16 green;
|
||||
guint16 blue;
|
||||
} GdkColor;
|
||||
|
||||
typedef struct {
|
||||
gint fd;
|
||||
gushort events;
|
||||
gushort revents;
|
||||
} GPollFD;
|
||||
|
||||
typedef struct {
|
||||
gint x;
|
||||
gint y;
|
||||
gint width;
|
||||
gint height;
|
||||
} GdkRectangle;
|
||||
|
||||
typedef struct {
|
||||
gint x;
|
||||
gint y;
|
||||
gint width;
|
||||
gint height;
|
||||
} GtkAllocation;
|
||||
|
||||
typedef struct {
|
||||
gint width;
|
||||
gint height;
|
||||
} GtkRequisition;
|
||||
|
||||
typedef struct {
|
||||
GtkWidgetClass *g_class;
|
||||
} GTypeInstance;
|
||||
|
||||
typedef struct {
|
||||
gint left;
|
||||
gint right;
|
||||
gint top;
|
||||
gint bottom;
|
||||
} GtkBorder;
|
||||
|
||||
/******************************************************
|
||||
* FIXME: it is more safe to include gtk headers for
|
||||
* the precise type definition of GType and other
|
||||
* structures. This is a place where getting rid of gtk
|
||||
* headers may be dangerous.
|
||||
******************************************************/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GType g_type;
|
||||
|
||||
union {
|
||||
gint v_int;
|
||||
guint v_uint;
|
||||
glong v_long;
|
||||
gulong v_ulong;
|
||||
gint64 v_int64;
|
||||
guint64 v_uint64;
|
||||
gfloat v_float;
|
||||
gdouble v_double;
|
||||
gpointer v_pointer;
|
||||
} data[2];
|
||||
} GValue;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GTypeInstance g_type_instance;
|
||||
|
||||
gchar *name;
|
||||
GParamFlags flags;
|
||||
GType value_type;
|
||||
GType owner_type;
|
||||
} GParamSpec;
|
||||
|
||||
typedef struct {
|
||||
GTypeInstance g_type_instance;
|
||||
guint ref_count;
|
||||
void *qdata;
|
||||
} GObject;
|
||||
|
||||
typedef struct {
|
||||
GObject parent_instance;
|
||||
guint32 flags;
|
||||
} GtkObject;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GdkColor fg[5];
|
||||
GdkColor bg[5];
|
||||
GdkColor light[5];
|
||||
GdkColor dark[5];
|
||||
GdkColor mid[5];
|
||||
GdkColor text[5];
|
||||
GdkColor base[5];
|
||||
GdkColor text_aa[5]; /* Halfway between text/base */
|
||||
|
||||
GdkColor black;
|
||||
GdkColor white;
|
||||
PangoFontDescription *font_desc;
|
||||
|
||||
gint xthickness;
|
||||
gint ythickness;
|
||||
|
||||
GdkGC *fg_gc[5];
|
||||
GdkGC *bg_gc[5];
|
||||
GdkGC *light_gc[5];
|
||||
GdkGC *dark_gc[5];
|
||||
GdkGC *mid_gc[5];
|
||||
GdkGC *text_gc[5];
|
||||
GdkGC *base_gc[5];
|
||||
GdkGC *text_aa_gc[5];
|
||||
GdkGC *black_gc;
|
||||
GdkGC *white_gc;
|
||||
|
||||
GdkPixmap *bg_pixmap[5];
|
||||
} GtkStyle;
|
||||
|
||||
typedef struct _GtkWidget GtkWidget;
|
||||
struct _GtkWidget
|
||||
{
|
||||
GtkObject object;
|
||||
guint16 private_flags;
|
||||
guint8 state;
|
||||
guint8 saved_state;
|
||||
gchar *name;
|
||||
GtkStyle *style;
|
||||
GtkRequisition requisition;
|
||||
GtkAllocation allocation;
|
||||
GdkWindow *window;
|
||||
GtkWidget *parent;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget widget;
|
||||
|
||||
gfloat xalign;
|
||||
gfloat yalign;
|
||||
|
||||
guint16 xpad;
|
||||
guint16 ypad;
|
||||
} GtkMisc;
|
||||
|
||||
typedef struct {
|
||||
GtkWidget widget;
|
||||
GtkWidget *focus_child;
|
||||
guint border_width : 16;
|
||||
guint need_resize : 1;
|
||||
guint resize_mode : 2;
|
||||
guint reallocate_redraws : 1;
|
||||
guint has_focus_chain : 1;
|
||||
} GtkContainer;
|
||||
|
||||
typedef struct {
|
||||
GtkContainer container;
|
||||
GtkWidget *child;
|
||||
} GtkBin;
|
||||
|
||||
typedef struct {
|
||||
GtkBin bin;
|
||||
GdkWindow *event_window;
|
||||
gchar *label_text;
|
||||
guint activate_timeout;
|
||||
guint constructed : 1;
|
||||
guint in_button : 1;
|
||||
guint button_down : 1;
|
||||
guint relief : 2;
|
||||
guint use_underline : 1;
|
||||
guint use_stock : 1;
|
||||
guint depressed : 1;
|
||||
guint depress_on_activate : 1;
|
||||
guint focus_on_click : 1;
|
||||
} GtkButton;
|
||||
|
||||
typedef struct {
|
||||
GtkButton button;
|
||||
guint active : 1;
|
||||
guint draw_indicator : 1;
|
||||
guint inconsistent : 1;
|
||||
} GtkToggleButton;
|
||||
|
||||
typedef struct _GtkAdjustment GtkAdjustment;
|
||||
struct _GtkAdjustment
|
||||
{
|
||||
GtkObject parent_instance;
|
||||
|
||||
gdouble lower;
|
||||
gdouble upper;
|
||||
gdouble value;
|
||||
gdouble step_increment;
|
||||
gdouble page_increment;
|
||||
gdouble page_size;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_UPDATE_CONTINUOUS,
|
||||
GTK_UPDATE_DISCONTINUOUS,
|
||||
GTK_UPDATE_DELAYED
|
||||
} GtkUpdateType;
|
||||
|
||||
typedef struct _GtkRange GtkRange;
|
||||
struct _GtkRange
|
||||
{
|
||||
GtkWidget widget;
|
||||
GtkAdjustment *adjustment;
|
||||
GtkUpdateType update_policy;
|
||||
guint inverted : 1;
|
||||
/*< protected >*/
|
||||
guint flippable : 1;
|
||||
guint has_stepper_a : 1;
|
||||
guint has_stepper_b : 1;
|
||||
guint has_stepper_c : 1;
|
||||
guint has_stepper_d : 1;
|
||||
guint need_recalc : 1;
|
||||
guint slider_size_fixed : 1;
|
||||
gint min_slider_size;
|
||||
GtkOrientation orientation;
|
||||
GdkRectangle range_rect;
|
||||
gint slider_start, slider_end;
|
||||
gint round_digits;
|
||||
/*< private >*/
|
||||
guint trough_click_forward : 1;
|
||||
guint update_pending : 1;
|
||||
/*GtkRangeLayout * */ void *layout;
|
||||
/*GtkRangeStepTimer * */ void* timer;
|
||||
gint slide_initial_slider_position;
|
||||
gint slide_initial_coordinate;
|
||||
guint update_timeout_id;
|
||||
GdkWindow *event_window;
|
||||
};
|
||||
|
||||
typedef struct _GtkProgressBar GtkProgressBar;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_PROGRESS_CONTINUOUS,
|
||||
GTK_PROGRESS_DISCRETE
|
||||
} GtkProgressBarStyle;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_PROGRESS_LEFT_TO_RIGHT,
|
||||
GTK_PROGRESS_RIGHT_TO_LEFT,
|
||||
GTK_PROGRESS_BOTTOM_TO_TOP,
|
||||
GTK_PROGRESS_TOP_TO_BOTTOM
|
||||
} GtkProgressBarOrientation;
|
||||
|
||||
typedef struct _GtkProgress GtkProgress;
|
||||
|
||||
struct _GtkProgress
|
||||
{
|
||||
GtkWidget widget;
|
||||
GtkAdjustment *adjustment;
|
||||
GdkPixmap *offscreen_pixmap;
|
||||
gchar *format;
|
||||
gfloat x_align;
|
||||
gfloat y_align;
|
||||
guint show_text : 1;
|
||||
guint activity_mode : 1;
|
||||
guint use_text_format : 1;
|
||||
};
|
||||
|
||||
struct _GtkProgressBar
|
||||
{
|
||||
GtkProgress progress;
|
||||
GtkProgressBarStyle bar_style;
|
||||
GtkProgressBarOrientation orientation;
|
||||
guint blocks;
|
||||
gint in_block;
|
||||
gint activity_pos;
|
||||
guint activity_step;
|
||||
guint activity_blocks;
|
||||
gdouble pulse_fraction;
|
||||
guint activity_dir : 1;
|
||||
guint ellipsize : 3;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns :
|
||||
* NULL if the GLib library is compatible with the given version, or a string
|
||||
* describing the version mismatch.
|
||||
* Please note that the glib_check_version() is available since 2.6,
|
||||
* so you should use GLIB_CHECK_VERSION macro instead.
|
||||
*/
|
||||
static gchar* (*fp_glib_check_version)(guint required_major, guint required_minor,
|
||||
guint required_micro);
|
||||
|
||||
/**
|
||||
* Returns :
|
||||
* TRUE if the GLib library is compatible with the given version
|
||||
*/
|
||||
#define GLIB_CHECK_VERSION(major, minor, micro) \
|
||||
(fp_glib_check_version && fp_glib_check_version(major, minor, micro) == NULL)
|
||||
|
||||
/**
|
||||
* Returns :
|
||||
* NULL if the GTK+ library is compatible with the given version, or a string
|
||||
* describing the version mismatch.
|
||||
*/
|
||||
static gchar* (*fp_gtk_check_version)(guint required_major, guint required_minor,
|
||||
guint required_micro);
|
||||
|
||||
static void gtk2_init(GtkApi* gtk);
|
||||
|
||||
static void (*fp_g_free)(gpointer mem);
|
||||
static void (*fp_g_object_unref)(gpointer object);
|
||||
static GdkWindow *(*fp_gdk_get_default_root_window) (void);
|
||||
|
||||
static int (*fp_gdk_pixbuf_get_bits_per_sample)(const GdkPixbuf *pixbuf);
|
||||
static guchar *(*fp_gdk_pixbuf_get_pixels)(const GdkPixbuf *pixbuf);
|
||||
static gboolean (*fp_gdk_pixbuf_get_has_alpha)(const GdkPixbuf *pixbuf);
|
||||
static int (*fp_gdk_pixbuf_get_height)(const GdkPixbuf *pixbuf);
|
||||
static int (*fp_gdk_pixbuf_get_n_channels)(const GdkPixbuf *pixbuf);
|
||||
static int (*fp_gdk_pixbuf_get_rowstride)(const GdkPixbuf *pixbuf);
|
||||
static int (*fp_gdk_pixbuf_get_width)(const GdkPixbuf *pixbuf);
|
||||
static GdkPixbuf *(*fp_gdk_pixbuf_new_from_file)(const char *filename, GError **error);
|
||||
static GdkColorspace (*fp_gdk_pixbuf_get_colorspace)(const GdkPixbuf *pixbuf);
|
||||
|
||||
static GdkPixbuf *(*fp_gdk_pixbuf_get_from_drawable)(GdkPixbuf *dest,
|
||||
GdkDrawable *src, GdkColormap *cmap, int src_x, int src_y,
|
||||
int dest_x, int dest_y, int width, int height);
|
||||
static GdkPixbuf *(*fp_gdk_pixbuf_scale_simple)(GdkPixbuf *src,
|
||||
int dest_width, int dest_heigh, GdkInterpType interp_type);
|
||||
|
||||
|
||||
static void (*fp_gtk_widget_destroy)(void *widget);
|
||||
static void (*fp_gtk_window_present)(GtkWindow *window);
|
||||
static void (*fp_gtk_window_move)(GtkWindow *window, gint x, gint y);
|
||||
static void (*fp_gtk_window_resize)(GtkWindow *window, gint width, gint height);
|
||||
|
||||
/**
|
||||
* Function Pointers for GtkFileChooser
|
||||
*/
|
||||
static gchar* (*fp_gtk_file_chooser_get_filename)(GtkFileChooser *chooser);
|
||||
static void (*fp_gtk_widget_hide)(void *widget);
|
||||
static void (*fp_gtk_main_quit)(void);
|
||||
static void* (*fp_gtk_file_chooser_dialog_new)(const gchar *title,
|
||||
GtkWindow *parent, GtkFileChooserAction action,
|
||||
const gchar *first_button_text, ...);
|
||||
static gboolean (*fp_gtk_file_chooser_set_current_folder)(GtkFileChooser *chooser,
|
||||
const gchar *filename);
|
||||
static gboolean (*fp_gtk_file_chooser_set_filename)(GtkFileChooser *chooser,
|
||||
const char *filename);
|
||||
static void (*fp_gtk_file_chooser_set_current_name)(GtkFileChooser *chooser,
|
||||
const gchar *name);
|
||||
static void (*fp_gtk_file_filter_add_custom)(GtkFileFilter *filter,
|
||||
GtkFileFilterFlags needed, GtkFileFilterFunc func, gpointer data,
|
||||
GDestroyNotify notify);
|
||||
static void (*fp_gtk_file_chooser_set_filter)(GtkFileChooser *chooser,
|
||||
GtkFileFilter *filter);
|
||||
static GType (*fp_gtk_file_chooser_get_type)(void);
|
||||
static GtkFileFilter* (*fp_gtk_file_filter_new)(void);
|
||||
static void (*fp_gtk_file_chooser_set_do_overwrite_confirmation)(
|
||||
GtkFileChooser *chooser, gboolean do_overwrite_confirmation);
|
||||
static void (*fp_gtk_file_chooser_set_select_multiple)(
|
||||
GtkFileChooser *chooser, gboolean select_multiple);
|
||||
static gchar* (*fp_gtk_file_chooser_get_current_folder)(GtkFileChooser *chooser);
|
||||
static GSList* (*fp_gtk_file_chooser_get_filenames)(GtkFileChooser *chooser);
|
||||
static guint (*fp_gtk_g_slist_length)(GSList *list);
|
||||
static gulong (*fp_g_signal_connect_data)(gpointer instance,
|
||||
const gchar *detailed_signal, GCallback c_handler, gpointer data,
|
||||
GClosureNotify destroy_data, GConnectFlags connect_flags);
|
||||
static void (*fp_gtk_widget_show)(void *widget);
|
||||
static void (*fp_gtk_main)(void);
|
||||
static guint (*fp_gtk_main_level)(void);
|
||||
static gchar* (*fp_g_path_get_dirname) (const gchar *file_name);
|
||||
static XID (*fp_gdk_x11_drawable_get_xid) (GdkWindow *drawable);
|
||||
|
||||
static GList* (*fp_g_list_append) (GList *list, gpointer data);
|
||||
static void (*fp_g_list_free) (GList *list);
|
||||
static void (*fp_g_list_free_full) (GList *list, GDestroyNotify free_func);
|
||||
|
||||
static gboolean (*fp_gtk_show_uri)(GdkScreen *screen, const gchar *uri,
|
||||
guint32 timestamp, GError **error);
|
||||
|
||||
#endif /* !_GTK2_INTERFACE_H */
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,577 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
#ifndef _GTK3_INTERFACE_H
|
||||
#define _GTK3_INTERFACE_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <jni.h>
|
||||
#include <X11/X.h>
|
||||
#include "gtk_interface.h"
|
||||
|
||||
#define LIGHTNESS_MULT 1.3
|
||||
#define DARKNESS_MULT 0.7
|
||||
|
||||
#define G_PI 3.1415926535897932384626433832795028841971693993751
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_STATE_FLAG_NORMAL = 0,
|
||||
GTK_STATE_FLAG_ACTIVE = 1 << 0,
|
||||
GTK_STATE_FLAG_PRELIGHT = 1 << 1,
|
||||
GTK_STATE_FLAG_SELECTED = 1 << 2,
|
||||
GTK_STATE_FLAG_INSENSITIVE = 1 << 3,
|
||||
GTK_STATE_FLAG_INCONSISTENT = 1 << 4,
|
||||
GTK_STATE_FLAG_FOCUSED = 1 << 5,
|
||||
GTK_STATE_FLAG_BACKDROP = 1 << 6,
|
||||
GTK_STATE_FLAG_DIR_LTR = 1 << 7,
|
||||
GTK_STATE_FLAG_DIR_RTL = 1 << 8,
|
||||
GTK_STATE_FLAG_LINK = 1 << 9,
|
||||
GTK_STATE_FLAG_VISITED = 1 << 10,
|
||||
GTK_STATE_FLAG_CHECKED = 1 << 11
|
||||
} GtkStateFlags;
|
||||
|
||||
typedef enum {
|
||||
GTK_JUNCTION_NONE = 0,
|
||||
GTK_JUNCTION_CORNER_TOPLEFT = 1 << 0,
|
||||
GTK_JUNCTION_CORNER_TOPRIGHT = 1 << 1,
|
||||
GTK_JUNCTION_CORNER_BOTTOMLEFT = 1 << 2,
|
||||
GTK_JUNCTION_CORNER_BOTTOMRIGHT = 1 << 3,
|
||||
GTK_JUNCTION_TOP =
|
||||
(GTK_JUNCTION_CORNER_TOPLEFT | GTK_JUNCTION_CORNER_TOPRIGHT),
|
||||
GTK_JUNCTION_BOTTOM =
|
||||
(GTK_JUNCTION_CORNER_BOTTOMLEFT | GTK_JUNCTION_CORNER_BOTTOMRIGHT),
|
||||
GTK_JUNCTION_LEFT =
|
||||
(GTK_JUNCTION_CORNER_TOPLEFT | GTK_JUNCTION_CORNER_BOTTOMLEFT),
|
||||
GTK_JUNCTION_RIGHT =
|
||||
(GTK_JUNCTION_CORNER_TOPRIGHT | GTK_JUNCTION_CORNER_BOTTOMRIGHT)
|
||||
} GtkJunctionSides;
|
||||
|
||||
typedef enum {
|
||||
GTK_REGION_EVEN = 1 << 0,
|
||||
GTK_REGION_ODD = 1 << 1,
|
||||
GTK_REGION_FIRST = 1 << 2,
|
||||
GTK_REGION_LAST = 1 << 3,
|
||||
GTK_REGION_ONLY = 1 << 4,
|
||||
GTK_REGION_SORTED = 1 << 5
|
||||
} GtkRegionFlags;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_WINDOW_TOPLEVEL,
|
||||
GTK_WINDOW_POPUP
|
||||
} GtkWindowType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
G_PARAM_READABLE = 1 << 0,
|
||||
G_PARAM_WRITABLE = 1 << 1,
|
||||
G_PARAM_CONSTRUCT = 1 << 2,
|
||||
G_PARAM_CONSTRUCT_ONLY = 1 << 3,
|
||||
G_PARAM_LAX_VALIDATION = 1 << 4,
|
||||
G_PARAM_STATIC_NAME = 1 << 5
|
||||
} GParamFlags;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_ICON_LOOKUP_NO_SVG = 1 << 0,
|
||||
GTK_ICON_LOOKUP_FORCE_SVG = 1 << 1,
|
||||
GTK_ICON_LOOKUP_USE_BUILTIN = 1 << 2,
|
||||
GTK_ICON_LOOKUP_GENERIC_FALLBACK = 1 << 3,
|
||||
GTK_ICON_LOOKUP_FORCE_SIZE = 1 << 4
|
||||
} GtkIconLookupFlags;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_UPDATE_CONTINUOUS,
|
||||
GTK_UPDATE_DISCONTINUOUS,
|
||||
GTK_UPDATE_DELAYED
|
||||
} GtkUpdateType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_PROGRESS_CONTINUOUS,
|
||||
GTK_PROGRESS_DISCRETE
|
||||
} GtkProgressBarStyle;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_PROGRESS_LEFT_TO_RIGHT,
|
||||
GTK_PROGRESS_RIGHT_TO_LEFT,
|
||||
GTK_PROGRESS_BOTTOM_TO_TOP,
|
||||
GTK_PROGRESS_TOP_TO_BOTTOM
|
||||
} GtkProgressBarOrientation;
|
||||
|
||||
typedef enum {
|
||||
CAIRO_FORMAT_INVALID = -1,
|
||||
CAIRO_FORMAT_ARGB32 = 0,
|
||||
CAIRO_FORMAT_RGB24 = 1,
|
||||
CAIRO_FORMAT_A8 = 2,
|
||||
CAIRO_FORMAT_A1 = 3,
|
||||
CAIRO_FORMAT_RGB16_565 = 4
|
||||
} cairo_format_t;
|
||||
|
||||
/* We define all structure pointers to be void* */
|
||||
typedef void GdkPixbuf;
|
||||
typedef void GMainContext;
|
||||
typedef void GVfs;
|
||||
|
||||
typedef void GdkColormap;
|
||||
typedef void GdkDrawable;
|
||||
typedef void GdkGC;
|
||||
typedef void GdkPixmap;
|
||||
typedef void GtkStyleContext;
|
||||
typedef void GtkFixed;
|
||||
typedef void GtkMenuItem;
|
||||
typedef void GtkMenuShell;
|
||||
typedef void GtkWidgetClass;
|
||||
typedef void PangoFontDescription;
|
||||
typedef void GtkSettings;
|
||||
typedef void GtkStyleProvider;
|
||||
typedef void cairo_pattern_t;
|
||||
typedef void cairo_t;
|
||||
typedef void cairo_surface_t;
|
||||
typedef void GtkScrolledWindow;
|
||||
typedef void GtkIconTheme;
|
||||
typedef void GtkWidget;
|
||||
typedef void GtkMisc;
|
||||
typedef void GtkContainer;
|
||||
typedef void GtkBin;
|
||||
typedef void GtkAdjustment;
|
||||
typedef void GtkRange;
|
||||
typedef void GtkProgressBar;
|
||||
typedef void GtkProgress;
|
||||
|
||||
/* Some real structures */
|
||||
typedef struct
|
||||
{
|
||||
guint32 pixel;
|
||||
guint16 red;
|
||||
guint16 green;
|
||||
guint16 blue;
|
||||
} GdkColor;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gdouble red;
|
||||
gdouble green;
|
||||
gdouble blue;
|
||||
gdouble alpha;
|
||||
} GdkRGBA;
|
||||
|
||||
typedef struct {
|
||||
gint fd;
|
||||
gushort events;
|
||||
gushort revents;
|
||||
} GPollFD;
|
||||
|
||||
typedef struct {
|
||||
gint x;
|
||||
gint y;
|
||||
gint width;
|
||||
gint height;
|
||||
} GdkRectangle;
|
||||
|
||||
typedef struct {
|
||||
int x, y;
|
||||
int width, height;
|
||||
} GtkAllocation;
|
||||
|
||||
typedef struct {
|
||||
gint width;
|
||||
gint height;
|
||||
} GtkRequisition;
|
||||
|
||||
typedef struct {
|
||||
GtkWidgetClass *g_class;
|
||||
} GTypeInstance;
|
||||
|
||||
typedef struct {
|
||||
gint16 left;
|
||||
gint16 right;
|
||||
gint16 top;
|
||||
gint16 bottom;
|
||||
} GtkBorder;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GType g_type;
|
||||
union {
|
||||
gint v_int;
|
||||
guint v_uint;
|
||||
glong v_long;
|
||||
gulong v_ulong;
|
||||
gint64 v_int64;
|
||||
guint64 v_uint64;
|
||||
gfloat v_float;
|
||||
gdouble v_double;
|
||||
gpointer v_pointer;
|
||||
} data[2];
|
||||
} GValue;
|
||||
|
||||
typedef struct {
|
||||
GTypeInstance g_type_instance;
|
||||
const gchar *name;
|
||||
GParamFlags flags;
|
||||
GType value_type;
|
||||
GType owner_type;
|
||||
} GParamSpec;
|
||||
|
||||
|
||||
static gchar* (*fp_glib_check_version)(guint required_major,
|
||||
guint required_minor, guint required_micro);
|
||||
|
||||
/**
|
||||
* Returns :
|
||||
* NULL if the GTK+ library is compatible with the given version, or a string
|
||||
* describing the version mismatch.
|
||||
*/
|
||||
static gchar* (*fp_gtk_check_version)(guint required_major, guint
|
||||
required_minor, guint required_micro);
|
||||
|
||||
static void (*fp_g_free)(gpointer mem);
|
||||
static void (*fp_g_object_unref)(gpointer object);
|
||||
static GdkWindow *(*fp_gdk_get_default_root_window) (void);
|
||||
|
||||
static int (*fp_gdk_pixbuf_get_bits_per_sample)(const GdkPixbuf *pixbuf);
|
||||
static guchar *(*fp_gdk_pixbuf_get_pixels)(const GdkPixbuf *pixbuf);
|
||||
static gboolean (*fp_gdk_pixbuf_get_has_alpha)(const GdkPixbuf *pixbuf);
|
||||
static int (*fp_gdk_pixbuf_get_height)(const GdkPixbuf *pixbuf);
|
||||
static int (*fp_gdk_pixbuf_get_n_channels)(const GdkPixbuf *pixbuf);
|
||||
static int (*fp_gdk_pixbuf_get_rowstride)(const GdkPixbuf *pixbuf);
|
||||
static int (*fp_gdk_pixbuf_get_width)(const GdkPixbuf *pixbuf);
|
||||
static GdkPixbuf *(*fp_gdk_pixbuf_new_from_file)(const char *filename,
|
||||
GError **error);
|
||||
static GdkColorspace (*fp_gdk_pixbuf_get_colorspace)(const GdkPixbuf *pixbuf);
|
||||
|
||||
static GdkPixbuf *(*fp_gdk_pixbuf_get_from_drawable)(GdkWindow *window,
|
||||
int src_x, int src_y, int width, int height);
|
||||
static GdkPixbuf *(*fp_gdk_pixbuf_scale_simple)(GdkPixbuf *src,
|
||||
int dest_width, int dest_heigh, GdkInterpType interp_type);
|
||||
|
||||
|
||||
static void (*fp_gtk_widget_destroy)(void *widget);
|
||||
static void (*fp_gtk_window_present)(GtkWindow *window);
|
||||
static void (*fp_gtk_window_move)(GtkWindow *window, gint x, gint y);
|
||||
static void (*fp_gtk_window_resize)(GtkWindow *window, gint width, gint height);
|
||||
|
||||
/**
|
||||
* Function Pointers for GtkFileChooser
|
||||
*/
|
||||
static gchar* (*fp_gtk_file_chooser_get_filename)(GtkFileChooser *chooser);
|
||||
static void (*fp_gtk_widget_hide)(void *widget);
|
||||
static void (*fp_gtk_main_quit)(void);
|
||||
static void* (*fp_gtk_file_chooser_dialog_new)(const gchar *title,
|
||||
GtkWindow *parent, GtkFileChooserAction action,
|
||||
const gchar *first_button_text, ...);
|
||||
static gboolean (*fp_gtk_file_chooser_set_current_folder)
|
||||
(GtkFileChooser *chooser, const gchar *filename);
|
||||
static gboolean (*fp_gtk_file_chooser_set_filename)(GtkFileChooser *chooser,
|
||||
const char *filename);
|
||||
static void (*fp_gtk_file_chooser_set_current_name)(GtkFileChooser *chooser,
|
||||
const gchar *name);
|
||||
static void (*fp_gtk_file_filter_add_custom)(GtkFileFilter *filter,
|
||||
GtkFileFilterFlags needed, GtkFileFilterFunc func, gpointer data,
|
||||
GDestroyNotify notify);
|
||||
static void (*fp_gtk_file_chooser_set_filter)(GtkFileChooser *chooser,
|
||||
GtkFileFilter *filter);
|
||||
static GType (*fp_gtk_file_chooser_get_type)(void);
|
||||
static GtkFileFilter* (*fp_gtk_file_filter_new)(void);
|
||||
static void (*fp_gtk_file_chooser_set_do_overwrite_confirmation)(
|
||||
GtkFileChooser *chooser, gboolean do_overwrite_confirmation);
|
||||
static void (*fp_gtk_file_chooser_set_select_multiple)(
|
||||
GtkFileChooser *chooser, gboolean select_multiple);
|
||||
static gchar* (*fp_gtk_file_chooser_get_current_folder)
|
||||
(GtkFileChooser *chooser);
|
||||
static GSList* (*fp_gtk_file_chooser_get_filenames)(GtkFileChooser *chooser);
|
||||
static guint (*fp_gtk_g_slist_length)(GSList *list);
|
||||
static gulong (*fp_g_signal_connect_data)(gpointer instance,
|
||||
const gchar *detailed_signal, GCallback c_handler, gpointer data,
|
||||
GClosureNotify destroy_data, GConnectFlags connect_flags);
|
||||
static void (*fp_gtk_widget_show)(void *widget);
|
||||
static void (*fp_gtk_main)(void);
|
||||
static guint (*fp_gtk_main_level)(void);
|
||||
static gchar* (*fp_g_path_get_dirname) (const gchar *file_name);
|
||||
static XID (*fp_gdk_x11_drawable_get_xid) (GdkWindow *drawable);
|
||||
|
||||
static GList* (*fp_g_list_append) (GList *list, gpointer data);
|
||||
static void (*fp_g_list_free) (GList *list);
|
||||
static void (*fp_g_list_free_full) (GList *list, GDestroyNotify free_func);
|
||||
|
||||
static void (*fp_gdk_threads_enter)(void);
|
||||
static void (*fp_gdk_threads_leave)(void);
|
||||
|
||||
static gboolean (*fp_gtk_show_uri)(GdkScreen *screen, const gchar *uri,
|
||||
guint32 timestamp, GError **error);
|
||||
|
||||
// Implementation functions prototypes
|
||||
static void gtk3_init(GtkApi* gtk);
|
||||
static GValue* (*fp_g_value_init)(GValue *value, GType g_type);
|
||||
static gboolean (*fp_g_type_is_a)(GType type, GType is_a_type);
|
||||
static gboolean (*fp_g_value_get_boolean)(const GValue *value);
|
||||
static gchar (*fp_g_value_get_char)(const GValue *value);
|
||||
static guchar (*fp_g_value_get_uchar)(const GValue *value);
|
||||
static gint (*fp_g_value_get_int)(const GValue *value);
|
||||
static guint (*fp_g_value_get_uint)(const GValue *value);
|
||||
static glong (*fp_g_value_get_long)(const GValue *value);
|
||||
static gulong (*fp_g_value_get_ulong)(const GValue *value);
|
||||
static gint64 (*fp_g_value_get_int64)(const GValue *value);
|
||||
static guint64 (*fp_g_value_get_uint64)(const GValue *value);
|
||||
static gfloat (*fp_g_value_get_float)(const GValue *value);
|
||||
static gdouble (*fp_g_value_get_double)(const GValue *value);
|
||||
static const gchar* (*fp_g_value_get_string)(const GValue *value);
|
||||
static gint (*fp_g_value_get_enum)(const GValue *value);
|
||||
static guint (*fp_g_value_get_flags)(const GValue *value);
|
||||
static GParamSpec* (*fp_g_value_get_param)(const GValue *value);
|
||||
static gpointer* (*fp_g_value_get_boxed)(const GValue *value);
|
||||
static gpointer* (*fp_g_value_get_pointer)(const GValue *value);
|
||||
static void (*fp_g_object_get)(gpointer object,
|
||||
const gchar* fpn, ...);
|
||||
static void (*fp_g_object_set)(gpointer object,
|
||||
const gchar *first_property_name,
|
||||
...);
|
||||
|
||||
static gboolean (*fp_g_main_context_iteration)(GMainContext *context);
|
||||
static gboolean (*fp_g_str_has_prefix)(const gchar *str, const gchar *prefix);
|
||||
static gchar** (*fp_g_strsplit)(const gchar *string, const gchar *delimiter,
|
||||
gint max_tokens);
|
||||
static void (*fp_g_strfreev)(gchar **str_array);
|
||||
|
||||
|
||||
static cairo_surface_t* (*fp_cairo_image_surface_create)(cairo_format_t format,
|
||||
int width, int height);
|
||||
static void (*fp_cairo_surface_destroy)(cairo_surface_t *surface);
|
||||
static cairo_t* (*fp_cairo_create)(cairo_surface_t *target);
|
||||
static void (*fp_cairo_destroy)(cairo_t *cr);
|
||||
static void (*fp_cairo_fill)(cairo_t *cr);
|
||||
static void (*fp_cairo_surface_flush)(cairo_surface_t *surface);
|
||||
static void (*fp_cairo_rectangle)(cairo_t *cr, double x, double y, double width,
|
||||
double height);
|
||||
static void (*fp_cairo_set_source_rgb)(cairo_t *cr, double red, double green,
|
||||
double blue);
|
||||
static void (*fp_cairo_set_source_rgba)(cairo_t *cr, double red, double green,
|
||||
double blue, double alpha);
|
||||
static void (*fp_cairo_paint)(cairo_t *cr);
|
||||
static void (*fp_cairo_clip)(cairo_t *cr);
|
||||
static unsigned char* (*fp_cairo_image_surface_get_data)(
|
||||
cairo_surface_t *surface);
|
||||
static int (*fp_cairo_image_surface_get_stride) (cairo_surface_t *surface);
|
||||
static GdkPixbuf* (*fp_gdk_pixbuf_get_from_surface)(cairo_surface_t *surface,
|
||||
gint src_x, gint src_y, gint width, gint height);
|
||||
static GtkStateType (*fp_gtk_widget_get_state)(GtkWidget *widget);
|
||||
static void (*fp_gtk_widget_set_state)(GtkWidget *widget, GtkStateType state);
|
||||
static gboolean (*fp_gtk_widget_is_focus)(GtkWidget *widget);
|
||||
static void (*fp_gtk_widget_set_allocation)(GtkWidget *widget,
|
||||
const GtkAllocation *allocation);
|
||||
static GtkWidget* (*fp_gtk_widget_get_parent)(GtkWidget *widget);
|
||||
static GtkStyleContext* (*fp_gtk_widget_get_style_context)(GtkWidget *widget);
|
||||
static void (*fp_gtk_style_context_get_color)(GtkStyleContext *context,
|
||||
GtkStateFlags state, GdkRGBA *color);
|
||||
static void (*fp_gtk_style_context_get_background_color)
|
||||
(GtkStyleContext *context, GtkStateFlags state, GdkRGBA *color);
|
||||
static void (*fp_gtk_style_context_get)(GtkStyleContext *context,
|
||||
GtkStateFlags state, ...);
|
||||
static GtkStateFlags (*fp_gtk_widget_get_state_flags)(GtkWidget* widget);
|
||||
static void (*fp_gtk_style_context_set_state)(GtkStyleContext* style,
|
||||
GtkStateFlags flags);
|
||||
static void (*fp_gtk_style_context_add_class)(GtkStyleContext *context,
|
||||
const gchar *class_name);
|
||||
static void (*fp_gtk_style_context_save)(GtkStyleContext *context);
|
||||
static void (*fp_gtk_style_context_restore)(GtkStyleContext *context);
|
||||
static void (*fp_gtk_render_check)(GtkStyleContext *context, cairo_t *cr,
|
||||
gdouble x, gdouble y, gdouble width, gdouble height);
|
||||
static void (*fp_gtk_render_option)(GtkStyleContext *context, cairo_t *cr,
|
||||
gdouble x, gdouble y, gdouble width, gdouble height);
|
||||
static void (*fp_gtk_render_extension)(GtkStyleContext *context, cairo_t *cr,
|
||||
gdouble x, gdouble y, gdouble width, gdouble height,
|
||||
GtkPositionType gap_side);
|
||||
static void (*fp_gtk_render_expander)(GtkStyleContext *context, cairo_t *cr,
|
||||
gdouble x, gdouble y, gdouble width, gdouble height);
|
||||
static void (*fp_gtk_render_frame_gap)(GtkStyleContext *context, cairo_t *cr,
|
||||
gdouble x, gdouble y, gdouble width, gdouble height,
|
||||
GtkPositionType gap_side, gdouble xy0_gap,
|
||||
gdouble xy1_gap);
|
||||
static void (*fp_gtk_render_line)(GtkStyleContext *context, cairo_t *cr,
|
||||
gdouble x0, gdouble y0, gdouble x1, gdouble y1);
|
||||
static GdkPixbuf* (*fp_gtk_widget_render_icon_pixbuf)(GtkWidget *widget,
|
||||
const gchar *stock_id, GtkIconSize size);
|
||||
static cairo_surface_t* (*fp_gdk_window_create_similar_image_surface)(
|
||||
GdkWindow *window, cairo_format_t format, int width,
|
||||
int height, int scale);
|
||||
static cairo_surface_t* (*fp_gdk_window_create_similar_surface)(
|
||||
GdkWindow *window, cairo_format_t format,
|
||||
int width, int height);
|
||||
static GdkWindow* (*fp_gtk_widget_get_window)(GtkWidget *widget);
|
||||
static GtkSettings *(*fp_gtk_settings_get_for_screen)(GdkScreen *screen);
|
||||
static GdkScreen *(*fp_gtk_widget_get_screen)(GtkWidget *widget);
|
||||
static GtkStyleProvider* (*fp_gtk_css_provider_get_named)(const gchar *name,
|
||||
const gchar *variant);
|
||||
static void (*fp_gtk_style_context_add_provider)(GtkStyleContext *context,
|
||||
GtkStyleProvider *provider, guint priority);
|
||||
static void (*fp_gtk_render_frame)(GtkStyleContext *context,cairo_t *cr,
|
||||
gdouble x, gdouble y, gdouble width, gdouble height);
|
||||
static void (*fp_gtk_render_focus)(GtkStyleContext *context,cairo_t *cr,
|
||||
gdouble x, gdouble y, gdouble width, gdouble height);
|
||||
static void (*fp_gtk_render_handle)(GtkStyleContext *context,cairo_t *cr,
|
||||
gdouble x, gdouble y, gdouble width, gdouble height);
|
||||
static void (*fp_gtk_style_context_get_property)(GtkStyleContext *context,
|
||||
const gchar *property, GtkStateFlags state, GValue *value);
|
||||
static void (*fp_gtk_render_activity)(GtkStyleContext *context, cairo_t *cr,
|
||||
gdouble x, gdouble y, gdouble width, gdouble height);
|
||||
static void (*fp_gtk_render_background)(GtkStyleContext *context, cairo_t *cr,
|
||||
gdouble x, gdouble y, gdouble width, gdouble height);
|
||||
static gboolean (*fp_gtk_style_context_has_class)(GtkStyleContext *context,
|
||||
const gchar *class_name);
|
||||
static void transform_detail_string (const gchar *detail,
|
||||
GtkStyleContext *context);
|
||||
void (*fp_gtk_style_context_set_junction_sides)(GtkStyleContext *context,
|
||||
GtkJunctionSides sides);
|
||||
void (*fp_gtk_style_context_add_region)(GtkStyleContext *context,
|
||||
const gchar *region_name, GtkRegionFlags flags);
|
||||
void (*fp_gtk_render_arrow)(GtkStyleContext *context, cairo_t *cr,
|
||||
gdouble angle, gdouble x, gdouble y, gdouble size);
|
||||
void (*fp_gtk_bin_set_child)(GtkBin *bin, GtkWidget *widget);
|
||||
void (*fp_gtk_scrolled_window_set_shadow_type)(
|
||||
GtkScrolledWindow *scrolled_window, GtkShadowType type);
|
||||
static void (*fp_gtk_render_slider)(GtkStyleContext *context, cairo_t *cr,
|
||||
gdouble x, gdouble y, gdouble width, gdouble height,
|
||||
GtkOrientation orientation);
|
||||
static void (*fp_gtk_style_context_get_padding)(GtkStyleContext *self,
|
||||
GtkStateFlags state, GtkBorder* padding);
|
||||
static void (*fp_gtk_range_set_inverted)(GtkRange *range, gboolean setting);
|
||||
static PangoFontDescription* (*fp_gtk_style_context_get_font)(
|
||||
GtkStyleContext *context, GtkStateFlags state);
|
||||
static int (*fp_gtk_widget_get_allocated_width)(GtkWidget *widget);
|
||||
static int (*fp_gtk_widget_get_allocated_height)(GtkWidget *widget);
|
||||
static GtkIconTheme* (*fp_gtk_icon_theme_get_default)(void);
|
||||
static GdkPixbuf* (*fp_gtk_icon_theme_load_icon)(GtkIconTheme *icon_theme,
|
||||
const gchar *icon_name, gint size,
|
||||
GtkIconLookupFlags flags, GError **error);
|
||||
static void (*fp_gtk_adjustment_set_lower)(GtkAdjustment *adjustment,
|
||||
gdouble lower);
|
||||
static void (*fp_gtk_adjustment_set_page_increment)(GtkAdjustment *adjustment,
|
||||
gdouble page_increment);
|
||||
static void (*fp_gtk_adjustment_set_page_size)(GtkAdjustment *adjustment,
|
||||
gdouble page_size);
|
||||
static void (*fp_gtk_adjustment_set_step_increment)(GtkAdjustment *adjustment,
|
||||
gdouble step_increment);
|
||||
static void (*fp_gtk_adjustment_set_upper)(GtkAdjustment *adjustment,
|
||||
gdouble upper);
|
||||
static void (*fp_gtk_adjustment_set_value)(GtkAdjustment *adjustment,
|
||||
gdouble value);
|
||||
static GdkGC *(*fp_gdk_gc_new)(GdkDrawable*);
|
||||
static void (*fp_gdk_rgb_gc_set_foreground)(GdkGC*, guint32);
|
||||
static void (*fp_gdk_draw_rectangle)(GdkDrawable*, GdkGC*, gboolean,
|
||||
gint, gint, gint, gint);
|
||||
static GdkPixbuf *(*fp_gdk_pixbuf_new)(GdkColorspace colorspace,
|
||||
gboolean has_alpha, int bits_per_sample, int width, int height);
|
||||
static void (*fp_gdk_drawable_get_size)(GdkDrawable *drawable,
|
||||
gint* width, gint* height);
|
||||
static gboolean (*fp_gtk_init_check)(int* argc, char** argv);
|
||||
|
||||
/* Widget creation */
|
||||
static GtkWidget* (*fp_gtk_arrow_new)(GtkArrowType arrow_type,
|
||||
GtkShadowType shadow_type);
|
||||
static GtkWidget* (*fp_gtk_button_new)();
|
||||
static GtkWidget* (*fp_gtk_check_button_new)();
|
||||
static GtkWidget* (*fp_gtk_check_menu_item_new)();
|
||||
static GtkWidget* (*fp_gtk_color_selection_dialog_new)(const gchar* title);
|
||||
static GtkWidget* (*fp_gtk_combo_box_new)();
|
||||
static GtkWidget* (*fp_gtk_combo_box_entry_new)();
|
||||
static GtkWidget* (*fp_gtk_entry_new)();
|
||||
static GtkWidget* (*fp_gtk_fixed_new)();
|
||||
static GtkWidget* (*fp_gtk_handle_box_new)();
|
||||
static GtkWidget* (*fp_gtk_hpaned_new)();
|
||||
static GtkWidget* (*fp_gtk_vpaned_new)();
|
||||
static GtkWidget* (*fp_gtk_scale_new)(GtkOrientation orientation,
|
||||
GtkAdjustment* adjustment);
|
||||
static GtkWidget* (*fp_gtk_hscrollbar_new)(GtkAdjustment* adjustment);
|
||||
static GtkWidget* (*fp_gtk_vscrollbar_new)(GtkAdjustment* adjustment);
|
||||
static GtkWidget* (*fp_gtk_hseparator_new)();
|
||||
static GtkWidget* (*fp_gtk_vseparator_new)();
|
||||
static GtkWidget* (*fp_gtk_image_new)();
|
||||
static GtkWidget* (*fp_gtk_label_new)(const gchar* str);
|
||||
static GtkWidget* (*fp_gtk_menu_new)();
|
||||
static GtkWidget* (*fp_gtk_menu_bar_new)();
|
||||
static GtkWidget* (*fp_gtk_menu_item_new)();
|
||||
static GtkWidget* (*fp_gtk_notebook_new)();
|
||||
static GtkWidget* (*fp_gtk_progress_bar_new)();
|
||||
static GtkWidget* (*fp_gtk_progress_bar_set_orientation)(
|
||||
GtkProgressBar *pbar,
|
||||
GtkProgressBarOrientation orientation);
|
||||
static GtkWidget* (*fp_gtk_radio_button_new)(GSList *group);
|
||||
static GtkWidget* (*fp_gtk_radio_menu_item_new)(GSList *group);
|
||||
static GtkWidget* (*fp_gtk_scrolled_window_new)(GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment);
|
||||
static GtkWidget* (*fp_gtk_separator_menu_item_new)();
|
||||
static GtkWidget* (*fp_gtk_separator_tool_item_new)();
|
||||
static GtkWidget* (*fp_gtk_text_view_new)();
|
||||
static GtkWidget* (*fp_gtk_toggle_button_new)();
|
||||
static GtkWidget* (*fp_gtk_toolbar_new)();
|
||||
static GtkWidget* (*fp_gtk_tree_view_new)();
|
||||
static GtkWidget* (*fp_gtk_viewport_new)(GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment);
|
||||
static GtkWidget* (*fp_gtk_window_new)(GtkWindowType type);
|
||||
static GtkWidget* (*fp_gtk_dialog_new)();
|
||||
static GtkWidget* (*fp_gtk_spin_button_new)(GtkAdjustment *adjustment,
|
||||
gdouble climb_rate, guint digits);
|
||||
static GtkWidget* (*fp_gtk_frame_new)(const gchar *label);
|
||||
|
||||
/* Other widget operations */
|
||||
static GtkAdjustment* (*fp_gtk_adjustment_new)(gdouble value,
|
||||
gdouble lower, gdouble upper, gdouble step_increment,
|
||||
gdouble page_increment, gdouble page_size);
|
||||
static void (*fp_gtk_container_add)(GtkContainer *window, GtkWidget *widget);
|
||||
static void (*fp_gtk_menu_shell_append)(GtkMenuShell *menu_shell,
|
||||
GtkWidget *child);
|
||||
static void (*fp_gtk_menu_item_set_submenu)(GtkMenuItem *menu_item,
|
||||
GtkWidget *submenu);
|
||||
static void (*fp_gtk_widget_realize)(GtkWidget *widget);
|
||||
static GdkPixbuf* (*fp_gtk_widget_render_icon)(GtkWidget *widget,
|
||||
const gchar *stock_id, GtkIconSize size, const gchar *detail);
|
||||
static void (*fp_gtk_widget_set_name)(GtkWidget *widget, const gchar *name);
|
||||
static void (*fp_gtk_widget_set_parent)(GtkWidget *widget, GtkWidget *parent);
|
||||
static void (*fp_gtk_widget_set_direction)(GtkWidget *widget,
|
||||
GtkTextDirection direction);
|
||||
static void (*fp_gtk_widget_style_get)(GtkWidget *widget,
|
||||
const gchar *first_property_name, ...);
|
||||
static void (*fp_gtk_widget_class_install_style_property)(
|
||||
GtkWidgetClass* class, GParamSpec *pspec);
|
||||
static GParamSpec* (*fp_gtk_widget_class_find_style_property)(
|
||||
GtkWidgetClass* class, const gchar* property_name);
|
||||
static void (*fp_gtk_widget_style_get_property)(GtkWidget* widget,
|
||||
const gchar* property_name, GValue* value);
|
||||
static char* (*fp_pango_font_description_to_string)(
|
||||
const PangoFontDescription* fd);
|
||||
static GtkSettings* (*fp_gtk_settings_get_default)();
|
||||
static GtkSettings* (*fp_gtk_widget_get_settings)(GtkWidget *widget);
|
||||
static GType (*fp_gtk_border_get_type)();
|
||||
static void (*fp_gtk_arrow_set)(GtkWidget* arrow,
|
||||
GtkArrowType arrow_type,
|
||||
GtkShadowType shadow_type);
|
||||
static void (*fp_gtk_widget_size_request)(GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static GtkAdjustment* (*fp_gtk_range_get_adjustment)(GtkRange* range);
|
||||
|
||||
#endif /* !_GTK3_INTERFACE_H */
|
||||
|
|
@ -1,162 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
#include <dlfcn.h>
|
||||
#include <stdlib.h>
|
||||
#include "jvm_md.h"
|
||||
#include "gtk_interface.h"
|
||||
|
||||
GtkApi* gtk2_load(JNIEnv *env, const char* lib_name);
|
||||
GtkApi* gtk3_load(JNIEnv *env, const char* lib_name);
|
||||
|
||||
gboolean gtk2_check(const char* lib_name, gboolean load);
|
||||
gboolean gtk3_check(const char* lib_name, gboolean load);
|
||||
|
||||
GtkApi *gtk;
|
||||
|
||||
typedef struct {
|
||||
GtkVersion version;
|
||||
const char* name;
|
||||
const char* vname;
|
||||
GtkApi* (*load)(JNIEnv *env, const char* lib_name);
|
||||
gboolean (*check)(const char* lib_name, gboolean load);
|
||||
} GtkLib;
|
||||
|
||||
static GtkLib gtk_libs[] = {
|
||||
{
|
||||
GTK_3,
|
||||
JNI_LIB_NAME("gtk-3"),
|
||||
VERSIONED_JNI_LIB_NAME("gtk-3", "0"),
|
||||
>k3_load,
|
||||
>k3_check
|
||||
},
|
||||
{
|
||||
GTK_2,
|
||||
JNI_LIB_NAME("gtk-x11-2.0"),
|
||||
VERSIONED_JNI_LIB_NAME("gtk-x11-2.0", "0"),
|
||||
>k2_load,
|
||||
>k2_check
|
||||
}
|
||||
};
|
||||
|
||||
static GtkLib** get_libs_order(GtkVersion version) {
|
||||
static GtkLib** load_order;
|
||||
static int n_libs = 0;
|
||||
if (!n_libs) {
|
||||
n_libs = sizeof(gtk_libs) / sizeof(GtkLib);
|
||||
load_order = calloc(n_libs + 1, sizeof(GtkLib *));
|
||||
}
|
||||
int i, first = 0;
|
||||
for (i = 0; i < n_libs; i++) {
|
||||
load_order[i] = >k_libs[i];
|
||||
if (load_order[i]->version == version) {
|
||||
first = i;
|
||||
}
|
||||
}
|
||||
if (first) {
|
||||
for (i = first; i > 0; i--) {
|
||||
load_order[i] = load_order[i - 1];
|
||||
}
|
||||
load_order[0] = >k_libs[first];
|
||||
}
|
||||
return load_order;
|
||||
}
|
||||
|
||||
static GtkLib* get_loaded() {
|
||||
GtkLib** libs = get_libs_order(GTK_ANY);
|
||||
while(!gtk && *libs) {
|
||||
GtkLib* lib = *libs++;
|
||||
if (lib->check(lib->vname, /* load = */FALSE)) {
|
||||
return lib;
|
||||
}
|
||||
if (lib->check(lib->name, /* load = */FALSE)) {
|
||||
return lib;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean gtk_load(JNIEnv *env, GtkVersion version, gboolean verbose) {
|
||||
if (gtk == NULL) {
|
||||
GtkLib* lib = get_loaded();
|
||||
if (lib) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "Looking for GTK%d library...\n",
|
||||
lib->version);
|
||||
}
|
||||
gtk = lib->load(env, lib->vname);
|
||||
if (!gtk) {
|
||||
gtk = lib->load(env, lib->name);
|
||||
}
|
||||
} else {
|
||||
GtkLib** libs = get_libs_order(version);
|
||||
while (!gtk && *libs) {
|
||||
lib = *libs++;
|
||||
if (version == GTK_ANY || lib->version == version) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "Looking for GTK%d library...\n",
|
||||
lib->version);
|
||||
}
|
||||
gtk = lib->load(env, lib->vname);
|
||||
if (!gtk) {
|
||||
gtk = lib->load(env, lib->name);
|
||||
}
|
||||
if (verbose && !gtk) {
|
||||
fprintf(stderr, "Not found.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (verbose) {
|
||||
if (gtk) {
|
||||
fprintf(stderr, "GTK%d library loaded.\n", lib->version);
|
||||
} else {
|
||||
fprintf(stderr, "Failed to load GTK library.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
return gtk != NULL;
|
||||
}
|
||||
|
||||
static gboolean check_version(GtkVersion version) {
|
||||
GtkLib** libs = get_libs_order(version);
|
||||
while (*libs) {
|
||||
GtkLib* lib = *libs++;
|
||||
if (lib->check(lib->vname, /* load = */TRUE)) {
|
||||
return TRUE;
|
||||
}
|
||||
if (lib->check(lib->name, /* load = */TRUE)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean gtk_check_version(GtkVersion version) {
|
||||
if (gtk || get_loaded()) {
|
||||
return TRUE;
|
||||
}
|
||||
return check_version(version);
|
||||
}
|
||||
|
||||
|
|
@ -1,570 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
#ifndef _GTK_INTERFACE_H
|
||||
#define _GTK_INTERFACE_H
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <jni.h>
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE (0)
|
||||
#define TRUE (!FALSE)
|
||||
#endif
|
||||
|
||||
#define GTHREAD_LIB_VERSIONED VERSIONED_JNI_LIB_NAME("gthread-2.0", "0")
|
||||
#define GTHREAD_LIB JNI_LIB_NAME("gthread-2.0")
|
||||
|
||||
#define _G_TYPE_CIC(ip, gt, ct) ((ct*) ip)
|
||||
#define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) \
|
||||
(_G_TYPE_CIC ((instance), (g_type), c_type))
|
||||
#define GTK_TYPE_FILE_CHOOSER (fp_gtk_file_chooser_get_type ())
|
||||
#define GTK_FILE_CHOOSER(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FILE_CHOOSER, GtkFileChooser))
|
||||
#define G_CALLBACK(f) ((GCallback) (f))
|
||||
#define G_TYPE_FUNDAMENTAL_SHIFT (2)
|
||||
#define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
|
||||
#define G_TYPE_OBJECT G_TYPE_MAKE_FUNDAMENTAL (20)
|
||||
#define GTK_STOCK_CANCEL "gtk-cancel"
|
||||
#define GTK_STOCK_SAVE "gtk-save"
|
||||
#define GTK_STOCK_OPEN "gtk-open"
|
||||
#define GDK_CURRENT_TIME 0L
|
||||
|
||||
#define G_TYPE_INVALID G_TYPE_MAKE_FUNDAMENTAL (0)
|
||||
#define G_TYPE_NONE G_TYPE_MAKE_FUNDAMENTAL (1)
|
||||
#define G_TYPE_INTERFACE G_TYPE_MAKE_FUNDAMENTAL (2)
|
||||
#define G_TYPE_CHAR G_TYPE_MAKE_FUNDAMENTAL (3)
|
||||
#define G_TYPE_UCHAR G_TYPE_MAKE_FUNDAMENTAL (4)
|
||||
#define G_TYPE_BOOLEAN G_TYPE_MAKE_FUNDAMENTAL (5)
|
||||
#define G_TYPE_INT G_TYPE_MAKE_FUNDAMENTAL (6)
|
||||
#define G_TYPE_UINT G_TYPE_MAKE_FUNDAMENTAL (7)
|
||||
#define G_TYPE_LONG G_TYPE_MAKE_FUNDAMENTAL (8)
|
||||
#define G_TYPE_ULONG G_TYPE_MAKE_FUNDAMENTAL (9)
|
||||
#define G_TYPE_INT64 G_TYPE_MAKE_FUNDAMENTAL (10)
|
||||
#define G_TYPE_UINT64 G_TYPE_MAKE_FUNDAMENTAL (11)
|
||||
#define G_TYPE_ENUM G_TYPE_MAKE_FUNDAMENTAL (12)
|
||||
#define G_TYPE_FLAGS G_TYPE_MAKE_FUNDAMENTAL (13)
|
||||
#define G_TYPE_FLOAT G_TYPE_MAKE_FUNDAMENTAL (14)
|
||||
#define G_TYPE_DOUBLE G_TYPE_MAKE_FUNDAMENTAL (15)
|
||||
#define G_TYPE_STRING G_TYPE_MAKE_FUNDAMENTAL (16)
|
||||
#define G_TYPE_POINTER G_TYPE_MAKE_FUNDAMENTAL (17)
|
||||
#define G_TYPE_BOXED G_TYPE_MAKE_FUNDAMENTAL (18)
|
||||
#define G_TYPE_PARAM G_TYPE_MAKE_FUNDAMENTAL (19)
|
||||
#define G_TYPE_OBJECT G_TYPE_MAKE_FUNDAMENTAL (20)
|
||||
|
||||
#define GTK_TYPE_BORDER ((*fp_gtk_border_get_type)())
|
||||
|
||||
#define G_TYPE_FUNDAMENTAL_SHIFT (2)
|
||||
#define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#define CONV_BUFFER_SIZE 128
|
||||
#define NO_SYMBOL_EXCEPTION 1
|
||||
|
||||
/* basic types */
|
||||
typedef char gchar;
|
||||
typedef short gshort;
|
||||
typedef int gint;
|
||||
typedef long glong;
|
||||
typedef float gfloat;
|
||||
typedef double gdouble;
|
||||
typedef void* gpointer;
|
||||
typedef gint gboolean;
|
||||
typedef signed char gint8;
|
||||
typedef signed short gint16;
|
||||
typedef signed int gint32;
|
||||
typedef unsigned char guchar;
|
||||
typedef unsigned char guint8;
|
||||
typedef unsigned short gushort;
|
||||
typedef unsigned short guint16;
|
||||
typedef unsigned int guint;
|
||||
typedef unsigned int guint32;
|
||||
typedef unsigned int gsize;
|
||||
typedef unsigned long gulong;
|
||||
typedef signed long long gint64;
|
||||
typedef unsigned long long guint64;
|
||||
typedef gulong GType;
|
||||
|
||||
typedef struct _GList GList;
|
||||
struct _GList
|
||||
{
|
||||
gpointer data;
|
||||
GList *next;
|
||||
GList *prev;
|
||||
};
|
||||
|
||||
typedef struct _GSList GSList;
|
||||
struct _GSList {
|
||||
gpointer data;
|
||||
GSList *next;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
BUTTON, /* GtkButton */
|
||||
CHECK_BOX, /* GtkCheckButton */
|
||||
CHECK_BOX_MENU_ITEM, /* GtkCheckMenuItem */
|
||||
COLOR_CHOOSER, /* GtkColorSelectionDialog */
|
||||
COMBO_BOX, /* GtkComboBox */
|
||||
COMBO_BOX_ARROW_BUTTON, /* GtkComboBoxEntry */
|
||||
COMBO_BOX_TEXT_FIELD, /* GtkComboBoxEntry */
|
||||
DESKTOP_ICON, /* GtkLabel */
|
||||
DESKTOP_PANE, /* GtkContainer */
|
||||
EDITOR_PANE, /* GtkTextView */
|
||||
FORMATTED_TEXT_FIELD, /* GtkEntry */
|
||||
HANDLE_BOX, /* GtkHandleBox */
|
||||
HPROGRESS_BAR, /* GtkProgressBar */
|
||||
HSCROLL_BAR, /* GtkHScrollbar */
|
||||
HSCROLL_BAR_BUTTON_LEFT, /* GtkHScrollbar */
|
||||
HSCROLL_BAR_BUTTON_RIGHT, /* GtkHScrollbar */
|
||||
HSCROLL_BAR_TRACK, /* GtkHScrollbar */
|
||||
HSCROLL_BAR_THUMB, /* GtkHScrollbar */
|
||||
HSEPARATOR, /* GtkHSeparator */
|
||||
HSLIDER, /* GtkHScale */
|
||||
HSLIDER_TRACK, /* GtkHScale */
|
||||
HSLIDER_THUMB, /* GtkHScale */
|
||||
HSPLIT_PANE_DIVIDER, /* GtkHPaned */
|
||||
INTERNAL_FRAME, /* GtkWindow */
|
||||
INTERNAL_FRAME_TITLE_PANE, /* GtkLabel */
|
||||
IMAGE, /* GtkImage */
|
||||
LABEL, /* GtkLabel */
|
||||
LIST, /* GtkTreeView */
|
||||
MENU, /* GtkMenu */
|
||||
MENU_BAR, /* GtkMenuBar */
|
||||
MENU_ITEM, /* GtkMenuItem */
|
||||
MENU_ITEM_ACCELERATOR, /* GtkLabel */
|
||||
OPTION_PANE, /* GtkMessageDialog */
|
||||
PANEL, /* GtkContainer */
|
||||
PASSWORD_FIELD, /* GtkEntry */
|
||||
POPUP_MENU, /* GtkMenu */
|
||||
POPUP_MENU_SEPARATOR, /* GtkSeparatorMenuItem */
|
||||
RADIO_BUTTON, /* GtkRadioButton */
|
||||
RADIO_BUTTON_MENU_ITEM, /* GtkRadioMenuItem */
|
||||
ROOT_PANE, /* GtkContainer */
|
||||
SCROLL_PANE, /* GtkScrolledWindow */
|
||||
SPINNER, /* GtkSpinButton */
|
||||
SPINNER_ARROW_BUTTON, /* GtkSpinButton */
|
||||
SPINNER_TEXT_FIELD, /* GtkSpinButton */
|
||||
SPLIT_PANE, /* GtkPaned */
|
||||
TABBED_PANE, /* GtkNotebook */
|
||||
TABBED_PANE_TAB_AREA, /* GtkNotebook */
|
||||
TABBED_PANE_CONTENT, /* GtkNotebook */
|
||||
TABBED_PANE_TAB, /* GtkNotebook */
|
||||
TABLE, /* GtkTreeView */
|
||||
TABLE_HEADER, /* GtkButton */
|
||||
TEXT_AREA, /* GtkTextView */
|
||||
TEXT_FIELD, /* GtkEntry */
|
||||
TEXT_PANE, /* GtkTextView */
|
||||
TITLED_BORDER, /* GtkFrame */
|
||||
TOGGLE_BUTTON, /* GtkToggleButton */
|
||||
TOOL_BAR, /* GtkToolbar */
|
||||
TOOL_BAR_DRAG_WINDOW, /* GtkToolbar */
|
||||
TOOL_BAR_SEPARATOR, /* GtkSeparatorToolItem */
|
||||
TOOL_TIP, /* GtkWindow */
|
||||
TREE, /* GtkTreeView */
|
||||
TREE_CELL, /* GtkTreeView */
|
||||
VIEWPORT, /* GtkViewport */
|
||||
VPROGRESS_BAR, /* GtkProgressBar */
|
||||
VSCROLL_BAR, /* GtkVScrollbar */
|
||||
VSCROLL_BAR_BUTTON_UP, /* GtkVScrollbar */
|
||||
VSCROLL_BAR_BUTTON_DOWN, /* GtkVScrollbar */
|
||||
VSCROLL_BAR_TRACK, /* GtkVScrollbar */
|
||||
VSCROLL_BAR_THUMB, /* GtkVScrollbar */
|
||||
VSEPARATOR, /* GtkVSeparator */
|
||||
VSLIDER, /* GtkVScale */
|
||||
VSLIDER_TRACK, /* GtkVScale */
|
||||
VSLIDER_THUMB, /* GtkVScale */
|
||||
VSPLIT_PANE_DIVIDER, /* GtkVPaned */
|
||||
WIDGET_TYPE_SIZE
|
||||
} WidgetType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
_GTK_ARROW_TYPE,
|
||||
_GTK_BUTTON_TYPE,
|
||||
_GTK_CHECK_BUTTON_TYPE,
|
||||
_GTK_CHECK_MENU_ITEM_TYPE,
|
||||
_GTK_COLOR_SELECTION_DIALOG_TYPE,
|
||||
_GTK_COMBO_BOX_TYPE,
|
||||
_GTK_COMBO_BOX_ARROW_BUTTON_TYPE,
|
||||
_GTK_COMBO_BOX_TEXT_FIELD_TYPE,
|
||||
_GTK_CONTAINER_TYPE,
|
||||
_GTK_ENTRY_TYPE,
|
||||
_GTK_FRAME_TYPE,
|
||||
_GTK_HANDLE_BOX_TYPE,
|
||||
_GTK_HPANED_TYPE,
|
||||
_GTK_HPROGRESS_BAR_TYPE,
|
||||
_GTK_HSCALE_TYPE,
|
||||
_GTK_HSCROLLBAR_TYPE,
|
||||
_GTK_HSEPARATOR_TYPE,
|
||||
_GTK_IMAGE_TYPE,
|
||||
_GTK_MENU_TYPE,
|
||||
_GTK_MENU_BAR_TYPE,
|
||||
_GTK_MENU_ITEM_TYPE,
|
||||
_GTK_NOTEBOOK_TYPE,
|
||||
_GTK_LABEL_TYPE,
|
||||
_GTK_RADIO_BUTTON_TYPE,
|
||||
_GTK_RADIO_MENU_ITEM_TYPE,
|
||||
_GTK_SCROLLED_WINDOW_TYPE,
|
||||
_GTK_SEPARATOR_MENU_ITEM_TYPE,
|
||||
_GTK_SEPARATOR_TOOL_ITEM_TYPE,
|
||||
_GTK_SPIN_BUTTON_TYPE,
|
||||
_GTK_TEXT_VIEW_TYPE,
|
||||
_GTK_TOGGLE_BUTTON_TYPE,
|
||||
_GTK_TOOLBAR_TYPE,
|
||||
_GTK_TOOLTIP_TYPE,
|
||||
_GTK_TREE_VIEW_TYPE,
|
||||
_GTK_VIEWPORT_TYPE,
|
||||
_GTK_VPANED_TYPE,
|
||||
_GTK_VPROGRESS_BAR_TYPE,
|
||||
_GTK_VSCALE_TYPE,
|
||||
_GTK_VSCROLLBAR_TYPE,
|
||||
_GTK_VSEPARATOR_TYPE,
|
||||
_GTK_WINDOW_TYPE,
|
||||
_GTK_DIALOG_TYPE,
|
||||
_GTK_WIDGET_TYPE_SIZE
|
||||
} GtkWidgetType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_STATE_NORMAL,
|
||||
GTK_STATE_ACTIVE,
|
||||
GTK_STATE_PRELIGHT,
|
||||
GTK_STATE_SELECTED,
|
||||
GTK_STATE_INSENSITIVE,
|
||||
GTK_STATE_INCONSISTENT,
|
||||
GTK_STATE_FOCUSED
|
||||
} GtkStateType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_SHADOW_NONE,
|
||||
GTK_SHADOW_IN,
|
||||
GTK_SHADOW_OUT,
|
||||
GTK_SHADOW_ETCHED_IN,
|
||||
GTK_SHADOW_ETCHED_OUT
|
||||
} GtkShadowType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_EXPANDER_COLLAPSED,
|
||||
GTK_EXPANDER_SEMI_COLLAPSED,
|
||||
GTK_EXPANDER_SEMI_EXPANDED,
|
||||
GTK_EXPANDER_EXPANDED
|
||||
} GtkExpanderStyle;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_ICON_SIZE_INVALID,
|
||||
GTK_ICON_SIZE_MENU,
|
||||
GTK_ICON_SIZE_SMALL_TOOLBAR,
|
||||
GTK_ICON_SIZE_LARGE_TOOLBAR,
|
||||
GTK_ICON_SIZE_BUTTON,
|
||||
GTK_ICON_SIZE_DND,
|
||||
GTK_ICON_SIZE_DIALOG
|
||||
} GtkIconSize;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_ORIENTATION_HORIZONTAL,
|
||||
GTK_ORIENTATION_VERTICAL
|
||||
} GtkOrientation;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FOREGROUND,
|
||||
BACKGROUND,
|
||||
TEXT_FOREGROUND,
|
||||
TEXT_BACKGROUND,
|
||||
FOCUS,
|
||||
LIGHT,
|
||||
DARK,
|
||||
MID,
|
||||
BLACK,
|
||||
WHITE
|
||||
} ColorType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_FONT_NAME,
|
||||
GTK_ICON_SIZES,
|
||||
GTK_CURSOR_BLINK,
|
||||
GTK_CURSOR_BLINK_TIME
|
||||
} Setting;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_ARROW_UP,
|
||||
GTK_ARROW_DOWN,
|
||||
GTK_ARROW_LEFT,
|
||||
GTK_ARROW_RIGHT,
|
||||
GTK_ARROW_NONE
|
||||
} GtkArrowType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_TEXT_DIR_NONE,
|
||||
GTK_TEXT_DIR_LTR,
|
||||
GTK_TEXT_DIR_RTL
|
||||
} GtkTextDirection;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_POS_LEFT,
|
||||
GTK_POS_RIGHT,
|
||||
GTK_POS_TOP,
|
||||
GTK_POS_BOTTOM
|
||||
} GtkPositionType;
|
||||
|
||||
/* SynthConstants */
|
||||
static const gint ENABLED = 1 << 0;
|
||||
static const gint MOUSE_OVER = 1 << 1;
|
||||
static const gint PRESSED = 1 << 2;
|
||||
static const gint DISABLED = 1 << 3;
|
||||
static const gint FOCUSED = 1 << 8;
|
||||
static const gint SELECTED = 1 << 9;
|
||||
static const gint DEFAULT = 1 << 10;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_ANY,
|
||||
GTK_1,
|
||||
GTK_2,
|
||||
GTK_3
|
||||
} GtkVersion;
|
||||
|
||||
//------------------------------
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
GTK_RESPONSE_NONE = -1,
|
||||
GTK_RESPONSE_REJECT = -2,
|
||||
GTK_RESPONSE_ACCEPT = -3,
|
||||
GTK_RESPONSE_DELETE_EVENT = -4,
|
||||
GTK_RESPONSE_OK = -5,
|
||||
GTK_RESPONSE_CANCEL = -6,
|
||||
GTK_RESPONSE_CLOSE = -7,
|
||||
GTK_RESPONSE_YES = -8,
|
||||
GTK_RESPONSE_NO = -9,
|
||||
GTK_RESPONSE_APPLY = -10,
|
||||
GTK_RESPONSE_HELP = -11
|
||||
} GtkResponseType;
|
||||
|
||||
typedef enum {
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
|
||||
GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
|
||||
} GtkFileChooserAction;
|
||||
|
||||
typedef enum {
|
||||
GTK_FILE_FILTER_FILENAME = 1 << 0,
|
||||
GTK_FILE_FILTER_URI = 1 << 1,
|
||||
GTK_FILE_FILTER_DISPLAY_NAME = 1 << 2,
|
||||
GTK_FILE_FILTER_MIME_TYPE = 1 << 3
|
||||
} GtkFileFilterFlags;
|
||||
|
||||
typedef enum {
|
||||
GDK_COLORSPACE_RGB
|
||||
} GdkColorspace;
|
||||
|
||||
typedef enum {
|
||||
GDK_INTERP_NEAREST,
|
||||
GDK_INTERP_TILES,
|
||||
GDK_INTERP_BILINEAR,
|
||||
GDK_INTERP_HYPER
|
||||
} GdkInterpType;
|
||||
|
||||
typedef enum {
|
||||
G_CONNECT_AFTER = 1 << 0, G_CONNECT_SWAPPED = 1 << 1
|
||||
} GConnectFlags;
|
||||
//------------------------------
|
||||
|
||||
|
||||
typedef void GError;
|
||||
typedef void GdkScreen;
|
||||
typedef void GtkWindow;
|
||||
typedef void GdkWindow;
|
||||
typedef void GClosure;
|
||||
typedef void GtkFileChooser;
|
||||
typedef void GtkFileFilter;
|
||||
typedef struct {
|
||||
GtkFileFilterFlags contains;
|
||||
const gchar *filename;
|
||||
const gchar *uri;
|
||||
const gchar *display_name;
|
||||
const gchar *mime_type;
|
||||
} GtkFileFilterInfo;
|
||||
typedef gboolean (*GtkFileFilterFunc)(const GtkFileFilterInfo *filter_info,
|
||||
gpointer data);
|
||||
typedef void (*GClosureNotify)(gpointer data, GClosure *closure);
|
||||
typedef void (*GDestroyNotify)(gpointer data);
|
||||
typedef void (*GCallback)(void);
|
||||
|
||||
|
||||
typedef struct GtkApi {
|
||||
int version;
|
||||
gboolean (*show_uri_load)(JNIEnv *env);
|
||||
gboolean (*unload)();
|
||||
void (*flush_event_loop)();
|
||||
gchar* (*gtk_check_version)(guint required_major, guint required_minor,
|
||||
guint required_micro);
|
||||
jobject (*get_setting)(JNIEnv *env, Setting property);
|
||||
|
||||
void (*paint_arrow)(WidgetType widget_type, GtkStateType state_type,
|
||||
GtkShadowType shadow_type, const gchar *detail,
|
||||
gint x, gint y, gint width, gint height,
|
||||
GtkArrowType arrow_type, gboolean fill);
|
||||
void (*paint_box)(WidgetType widget_type, GtkStateType state_type,
|
||||
GtkShadowType shadow_type, const gchar *detail,
|
||||
gint x, gint y, gint width, gint height,
|
||||
gint synth_state, GtkTextDirection dir);
|
||||
void (*paint_box_gap)(WidgetType widget_type, GtkStateType state_type,
|
||||
GtkShadowType shadow_type, const gchar *detail,
|
||||
gint x, gint y, gint width, gint height,
|
||||
GtkPositionType gap_side, gint gap_x, gint gap_width);
|
||||
void (*paint_expander)(WidgetType widget_type, GtkStateType state_type,
|
||||
const gchar *detail, gint x, gint y, gint width, gint height,
|
||||
GtkExpanderStyle expander_style);
|
||||
void (*paint_extension)(WidgetType widget_type, GtkStateType state_type,
|
||||
GtkShadowType shadow_type, const gchar *detail,
|
||||
gint x, gint y, gint width, gint height, GtkPositionType gap_side);
|
||||
void (*paint_flat_box)(WidgetType widget_type, GtkStateType state_type,
|
||||
GtkShadowType shadow_type, const gchar *detail,
|
||||
gint x, gint y, gint width, gint height, gboolean has_focus);
|
||||
void (*paint_focus)(WidgetType widget_type, GtkStateType state_type,
|
||||
const char *detail, gint x, gint y, gint width, gint height);
|
||||
void (*paint_handle)(WidgetType widget_type, GtkStateType state_type,
|
||||
GtkShadowType shadow_type, const gchar *detail,
|
||||
gint x, gint y, gint width, gint height, GtkOrientation orientation);
|
||||
void (*paint_hline)(WidgetType widget_type, GtkStateType state_type,
|
||||
const gchar *detail, gint x, gint y, gint width, gint height);
|
||||
void (*paint_vline)(WidgetType widget_type, GtkStateType state_type,
|
||||
const gchar *detail, gint x, gint y, gint width, gint height);
|
||||
void (*paint_option)(WidgetType widget_type, gint synth_state,
|
||||
const gchar *detail, gint x, gint y, gint width, gint height);
|
||||
void (*paint_shadow)(WidgetType widget_type, GtkStateType state_type,
|
||||
GtkShadowType shadow_type, const gchar *detail,
|
||||
gint x, gint y, gint width, gint height,
|
||||
gint synth_state, GtkTextDirection dir);
|
||||
void (*paint_slider)(WidgetType widget_type, GtkStateType state_type,
|
||||
GtkShadowType shadow_type, const gchar *detail,
|
||||
gint x, gint y, gint width, gint height, GtkOrientation orientation,
|
||||
gboolean has_focus);
|
||||
void (*paint_background)(WidgetType widget_type, GtkStateType state_type,
|
||||
gint x, gint y, gint width, gint height);
|
||||
void (*paint_check)(WidgetType widget_type, gint synth_state,
|
||||
const gchar *detail, gint x, gint y, gint width, gint height);
|
||||
void (*set_range_value)(WidgetType widget_type, jdouble value,
|
||||
jdouble min, jdouble max, jdouble visible);
|
||||
|
||||
void (*init_painting)(JNIEnv *env, gint w, gint h);
|
||||
gint (*copy_image)(gint *dest, gint width, gint height);
|
||||
|
||||
gint (*get_xthickness)(JNIEnv *env, WidgetType widget_type);
|
||||
gint (*get_ythickness)(JNIEnv *env, WidgetType widget_type);
|
||||
gint (*get_color_for_state)(JNIEnv *env, WidgetType widget_type,
|
||||
GtkStateType state_type, ColorType color_type);
|
||||
jobject (*get_class_value)(JNIEnv *env, WidgetType widget_type,
|
||||
const char* key);
|
||||
|
||||
jstring (*get_pango_font_name)(JNIEnv *env, WidgetType widget_type);
|
||||
jboolean (*get_icon_data)(JNIEnv *env, gint widget_type,
|
||||
const gchar *stock_id, GtkIconSize size,
|
||||
GtkTextDirection direction, const char *detail,
|
||||
jmethodID icon_upcall_method, jobject this);
|
||||
jboolean (*get_file_icon_data)(JNIEnv *env, const char *filename,
|
||||
GError **error, jmethodID icon_upcall_method, jobject this);
|
||||
void (*gdk_threads_enter)(void);
|
||||
void (*gdk_threads_leave)(void);
|
||||
gboolean (*gtk_show_uri)(GdkScreen *screen, const gchar *uri,
|
||||
guint32 timestamp, GError **error);
|
||||
gboolean (*get_drawable_data)(JNIEnv *env, jintArray pixelArray,
|
||||
jint x, jint y, jint width, jint height,
|
||||
jint jwidth, int dx, int dy, jint scale);
|
||||
void (*g_free)(gpointer mem);
|
||||
|
||||
|
||||
gchar* (*gtk_file_chooser_get_filename)(GtkFileChooser *chooser);
|
||||
void (*gtk_widget_hide)(void* widget);
|
||||
void (*gtk_main_quit)(void);
|
||||
void* (*gtk_file_chooser_dialog_new)(const gchar *title,
|
||||
GtkWindow *parent, GtkFileChooserAction action,
|
||||
const gchar *first_button_text, ...);
|
||||
gboolean (*gtk_file_chooser_set_current_folder)(GtkFileChooser *chooser,
|
||||
const gchar *filename);
|
||||
gboolean (*gtk_file_chooser_set_filename)(GtkFileChooser *chooser,
|
||||
const char *filename);
|
||||
void (*gtk_file_chooser_set_current_name)(GtkFileChooser *chooser,
|
||||
const gchar *name);
|
||||
void (*gtk_file_filter_add_custom)(GtkFileFilter *filter,
|
||||
GtkFileFilterFlags needed, GtkFileFilterFunc func, gpointer data,
|
||||
GDestroyNotify notify);
|
||||
void (*gtk_file_chooser_set_filter)(GtkFileChooser *chooser,
|
||||
GtkFileFilter *filter);
|
||||
GType (*gtk_file_chooser_get_type)(void);
|
||||
GtkFileFilter* (*gtk_file_filter_new)(void);
|
||||
void (*gtk_file_chooser_set_do_overwrite_confirmation)(
|
||||
GtkFileChooser *chooser, gboolean do_overwrite_confirmation);
|
||||
void (*gtk_file_chooser_set_select_multiple)(
|
||||
GtkFileChooser *chooser, gboolean select_multiple);
|
||||
gchar* (*gtk_file_chooser_get_current_folder)(GtkFileChooser *chooser);
|
||||
GSList* (*gtk_file_chooser_get_filenames)(GtkFileChooser *chooser);
|
||||
guint (*gtk_g_slist_length)(GSList *list);
|
||||
gulong (*g_signal_connect_data)(gpointer instance,
|
||||
const gchar *detailed_signal, GCallback c_handler, gpointer data,
|
||||
GClosureNotify destroy_data, GConnectFlags connect_flags);
|
||||
void (*gtk_widget_show)(void *widget);
|
||||
void (*gtk_main)(void);
|
||||
guint (*gtk_main_level)(void);
|
||||
gchar* (*g_path_get_dirname) (const gchar *file_name);
|
||||
XID (*gdk_x11_drawable_get_xid) (void *drawable);
|
||||
void (*gtk_widget_destroy)(void *widget);
|
||||
void (*gtk_window_present)(void *window);
|
||||
void (*gtk_window_move)(void *window, gint x, gint y);
|
||||
void (*gtk_window_resize)(void *window, gint width, gint height);
|
||||
GdkWindow *(*get_window)(void *widget);
|
||||
|
||||
void (*g_object_unref)(gpointer object);
|
||||
GList* (*g_list_append) (GList *list, gpointer data);
|
||||
void (*g_list_free) (GList *list);
|
||||
void (*g_list_free_full) (GList *list, GDestroyNotify free_func);
|
||||
} GtkApi;
|
||||
|
||||
gboolean gtk_load(JNIEnv *env, GtkVersion version, gboolean verbose);
|
||||
gboolean gtk_check_version(GtkVersion version);
|
||||
|
||||
typedef struct _GThreadFunctions GThreadFunctions;
|
||||
static gboolean (*fp_g_thread_get_initialized)(void);
|
||||
static void (*fp_g_thread_init)(GThreadFunctions *vtable);
|
||||
static void (*fp_gdk_threads_init)(void);
|
||||
static void (*fp_gdk_threads_enter)(void);
|
||||
static void (*fp_gdk_threads_leave)(void);
|
||||
|
||||
extern GtkApi* gtk;
|
||||
|
||||
#endif /* !_GTK_INTERFACE_H */
|
||||
|
|
@ -1,323 +0,0 @@
|
|||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/* $XConsortium: list.c /main/4 1996/10/14 15:03:56 swick $ */
|
||||
/** ------------------------------------------------------------------------
|
||||
This file contains routines for manipulating generic lists.
|
||||
Lists are implemented with a "harness". In other words, each
|
||||
node in the list consists of two pointers, one to the data item
|
||||
and one to the next node in the list. The head of the list is
|
||||
the same struct as each node, but the "item" ptr is used to point
|
||||
to the current member of the list (used by the first_in_list and
|
||||
next_in_list functions).
|
||||
|
||||
This file is available under and governed by the GNU General Public
|
||||
License version 2 only, as published by the Free Software Foundation.
|
||||
However, the following notice accompanied the original version of this
|
||||
file:
|
||||
|
||||
Copyright (c) 1994 Hewlett-Packard Co.
|
||||
Copyright (c) 1996 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall
|
||||
not be used in advertising or otherwise to promote the sale, use or
|
||||
other dealings in this Software without prior written authorization
|
||||
from the X Consortium.
|
||||
|
||||
----------------------------------------------------------------------- **/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "list.h"
|
||||
|
||||
|
||||
/** ------------------------------------------------------------------------
|
||||
Sets the pointers of the specified list to NULL.
|
||||
--------------------------------------------------------------------- **/
|
||||
#if NeedFunctionPrototypes
|
||||
void zero_list(list_ptr lp)
|
||||
#else
|
||||
void zero_list(lp)
|
||||
list_ptr lp;
|
||||
#endif
|
||||
{
|
||||
lp->next = NULL;
|
||||
lp->ptr.item = NULL;
|
||||
}
|
||||
|
||||
|
||||
/** ------------------------------------------------------------------------
|
||||
Adds item to the list pointed to by lp. Finds the end of the
|
||||
list, then mallocs a new list node onto the end of the list.
|
||||
The item pointer in the new node is set to "item" passed in,
|
||||
and the next pointer in the new node is set to NULL.
|
||||
Returns 1 if successful, 0 if the malloc failed.
|
||||
-------------------------------------------------------------------- **/
|
||||
#if NeedFunctionPrototypes
|
||||
int32_t add_to_list(list_ptr lp, void *item)
|
||||
#else
|
||||
int32_t add_to_list(lp, item)
|
||||
list_ptr lp;
|
||||
void *item;
|
||||
#endif
|
||||
{
|
||||
while (lp->next) {
|
||||
lp = lp->next;
|
||||
}
|
||||
if ((lp->next = (list_ptr) malloc( sizeof( list_item))) == NULL) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
lp->next->ptr.item = item;
|
||||
lp->next->next = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/** ------------------------------------------------------------------------
|
||||
Creates a new list and sets its pointers to NULL.
|
||||
Returns a pointer to the new list.
|
||||
-------------------------------------------------------------------- **/
|
||||
list_ptr new_list ()
|
||||
{
|
||||
list_ptr lp;
|
||||
|
||||
if (lp = (list_ptr) malloc( sizeof( list_item))) {
|
||||
lp->next = NULL;
|
||||
lp->ptr.item = NULL;
|
||||
}
|
||||
|
||||
return lp;
|
||||
}
|
||||
|
||||
|
||||
/** ------------------------------------------------------------------------
|
||||
Creates a new list head, pointing to the same list as the one
|
||||
passed in. If start_at_curr is TRUE, the new list's first item
|
||||
is the "current" item (as set by calls to first/next_in_list()).
|
||||
If start_at_curr is FALSE, the first item in the new list is the
|
||||
same as the first item in the old list. In either case, the
|
||||
curr pointer in the new list is the same as in the old list.
|
||||
Returns a pointer to the new list head.
|
||||
-------------------------------------------------------------------- **/
|
||||
#if NeedFunctionPrototypes
|
||||
list_ptr dup_list_head(list_ptr lp, int32_t start_at_curr)
|
||||
#else
|
||||
list_ptr dup_list_head(lp, start_at_curr)
|
||||
list_ptr lp;
|
||||
int32_t start_at_curr;
|
||||
#endif
|
||||
{
|
||||
list_ptr new_list;
|
||||
|
||||
if ((new_list = (list_ptr) malloc( sizeof( list_item))) == NULL) {
|
||||
|
||||
return (list_ptr)NULL;
|
||||
}
|
||||
new_list->next = start_at_curr ? lp->ptr.curr : lp->next;
|
||||
new_list->ptr.curr = lp->ptr.curr;
|
||||
|
||||
return new_list;
|
||||
}
|
||||
|
||||
|
||||
/** ------------------------------------------------------------------------
|
||||
Returns the number of items in the list.
|
||||
-------------------------------------------------------------------- **/
|
||||
#if NeedFunctionPrototypes
|
||||
uint32_t list_length(list_ptr lp)
|
||||
#else
|
||||
uint32_t list_length(lp)
|
||||
list_ptr lp;
|
||||
#endif
|
||||
{
|
||||
uint32_t count = 0;
|
||||
|
||||
while (lp->next) {
|
||||
count++;
|
||||
lp = lp->next;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
/** ------------------------------------------------------------------------
|
||||
Scans thru list, looking for a node whose ptr.item is equal to
|
||||
the "item" passed in. "Equal" here means the same address - no
|
||||
attempt is made to match equivalent values stored in different
|
||||
locations. If a match is found, that node is deleted from the
|
||||
list. Storage for the node is freed, but not for the item itself.
|
||||
Returns a pointer to the item, so the caller can free it if it
|
||||
so desires. If a match is not found, returns NULL.
|
||||
-------------------------------------------------------------------- **/
|
||||
#if NeedFunctionPrototypes
|
||||
void *delete_from_list(list_ptr lp, void *item)
|
||||
#else
|
||||
void *delete_from_list(lp, item)
|
||||
list_ptr lp;
|
||||
void *item;
|
||||
#endif
|
||||
{
|
||||
list_ptr new_next;
|
||||
|
||||
while (lp->next) {
|
||||
if (lp->next->ptr.item == item) {
|
||||
new_next = lp->next->next;
|
||||
free (lp->next);
|
||||
lp->next = new_next;
|
||||
|
||||
return item;
|
||||
}
|
||||
lp = lp->next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/** ------------------------------------------------------------------------
|
||||
Deletes each node in the list *except the head*. This allows
|
||||
the deletion of lists where the head is not malloced or created
|
||||
with new_list(). If free_items is true, each item pointed to
|
||||
from the node is freed, in addition to the node itself.
|
||||
-------------------------------------------------------------------- **/
|
||||
#if NeedFunctionPrototypes
|
||||
void delete_list(list_ptr lp, int32_t free_items)
|
||||
#else
|
||||
void delete_list(lp, free_items)
|
||||
list_ptr lp;
|
||||
int32_t free_items;
|
||||
#endif
|
||||
{
|
||||
list_ptr del_node;
|
||||
void *item;
|
||||
|
||||
while (lp->next) {
|
||||
del_node = lp->next;
|
||||
item = del_node->ptr.item;
|
||||
lp->next = del_node->next;
|
||||
free (del_node);
|
||||
if (free_items) {
|
||||
free( item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if NeedFunctionPrototypes
|
||||
void delete_list_destroying(list_ptr lp, void destructor(void *item))
|
||||
#else
|
||||
void delete_list_destroying(lp, destructor)
|
||||
list_ptr lp;
|
||||
void (*destructor)();
|
||||
#endif
|
||||
{
|
||||
list_ptr del_node;
|
||||
void *item;
|
||||
|
||||
while (lp->next) {
|
||||
del_node = lp->next;
|
||||
item = del_node->ptr.item;
|
||||
lp->next = del_node->next;
|
||||
free( del_node);
|
||||
if (destructor) {
|
||||
destructor( item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** ------------------------------------------------------------------------
|
||||
Returns a ptr to the first *item* (not list node) in the list.
|
||||
Sets the list head node's curr ptr to the first node in the list.
|
||||
Returns NULL if the list is empty.
|
||||
-------------------------------------------------------------------- **/
|
||||
#if NeedFunctionPrototypes
|
||||
void * first_in_list(list_ptr lp)
|
||||
#else
|
||||
void * first_in_list(lp)
|
||||
list_ptr lp;
|
||||
#endif
|
||||
{
|
||||
if (! lp) {
|
||||
|
||||
return NULL;
|
||||
}
|
||||
lp->ptr.curr = lp->next;
|
||||
|
||||
return lp->ptr.curr ? lp->ptr.curr->ptr.item : NULL;
|
||||
}
|
||||
|
||||
/** ------------------------------------------------------------------------
|
||||
Returns a ptr to the next *item* (not list node) in the list.
|
||||
Sets the list head node's curr ptr to the next node in the list.
|
||||
first_in_list must have been called prior.
|
||||
Returns NULL if no next item.
|
||||
-------------------------------------------------------------------- **/
|
||||
#if NeedFunctionPrototypes
|
||||
void * next_in_list(list_ptr lp)
|
||||
#else
|
||||
void * next_in_list(lp)
|
||||
list_ptr lp;
|
||||
#endif
|
||||
{
|
||||
if (! lp) {
|
||||
|
||||
return NULL;
|
||||
}
|
||||
if (lp->ptr.curr) {
|
||||
lp->ptr.curr = lp->ptr.curr->next;
|
||||
}
|
||||
|
||||
return lp->ptr.curr ? lp->ptr.curr->ptr.item : NULL;
|
||||
}
|
||||
|
||||
#if NeedFunctionPrototypes
|
||||
int32_t list_is_empty(list_ptr lp)
|
||||
#else
|
||||
int32_t list_is_empty(lp)
|
||||
list_ptr lp;
|
||||
#endif
|
||||
{
|
||||
return (lp == NULL || lp->next == NULL);
|
||||
}
|
||||
|
|
@ -1,149 +0,0 @@
|
|||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/* $XConsortium: list.h /main/4 1996/10/14 15:04:04 swick $ */
|
||||
/** ------------------------------------------------------------------------
|
||||
This file contains routines for manipulating generic lists.
|
||||
Lists are implemented with a "harness". In other words, each
|
||||
node in the list consists of two pointers, one to the data item
|
||||
and one to the next node in the list. The head of the list is
|
||||
the same struct as each node, but the "item" ptr is used to point
|
||||
to the current member of the list (used by the first_in_list and
|
||||
next_in_list functions).
|
||||
|
||||
This file is available under and governed by the GNU General Public
|
||||
License version 2 only, as published by the Free Software Foundation.
|
||||
However, the following notice accompanied the original version of this
|
||||
file:
|
||||
|
||||
Copyright (c) 1994 Hewlett-Packard Co.
|
||||
Copyright (c) 1996 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall
|
||||
not be used in advertising or otherwise to promote the sale, use or
|
||||
other dealings in this Software without prior written authorization
|
||||
from the X Consortium.
|
||||
|
||||
-------------------------------------------------------------------- **/
|
||||
|
||||
#include "gdefs.h"
|
||||
|
||||
#ifndef LIST_DEF
|
||||
#define LIST_DEF
|
||||
|
||||
#define LESS -1
|
||||
#define EQUAL 0
|
||||
#define GREATER 1
|
||||
#define DUP_WHOLE_LIST 0
|
||||
#define START_AT_CURR 1
|
||||
|
||||
typedef struct _list_item {
|
||||
struct _list_item *next;
|
||||
union {
|
||||
void *item; /* in normal list node, pts to data */
|
||||
struct _list_item *curr; /* in list head, pts to curr for 1st, next */
|
||||
} ptr;
|
||||
} list, list_item, *list_ptr;
|
||||
|
||||
typedef void (*DESTRUCT_FUNC_PTR)(
|
||||
#if NeedFunctionPrototypes
|
||||
void *
|
||||
#endif
|
||||
);
|
||||
|
||||
void zero_list(
|
||||
#if NeedFunctionPrototypes
|
||||
list_ptr
|
||||
#endif
|
||||
);
|
||||
int32_t add_to_list (
|
||||
#if NeedFunctionPrototypes
|
||||
list_ptr , void *
|
||||
#endif
|
||||
);
|
||||
list_ptr new_list (
|
||||
#if NeedFunctionPrototypes
|
||||
void
|
||||
#endif
|
||||
);
|
||||
list_ptr dup_list_head (
|
||||
#if NeedFunctionPrototypes
|
||||
list_ptr , int32_t
|
||||
#endif
|
||||
);
|
||||
uint32_t list_length(
|
||||
#if NeedFunctionPrototypes
|
||||
list_ptr
|
||||
#endif
|
||||
);
|
||||
void *delete_from_list (
|
||||
#if NeedFunctionPrototypes
|
||||
list_ptr , void *
|
||||
#endif
|
||||
);
|
||||
void delete_list(
|
||||
#if NeedFunctionPrototypes
|
||||
list_ptr , int32_t
|
||||
#endif
|
||||
);
|
||||
void delete_list_destroying (
|
||||
#if NeedFunctionPrototypes
|
||||
list_ptr , DESTRUCT_FUNC_PTR
|
||||
#endif
|
||||
);
|
||||
void *first_in_list (
|
||||
#if NeedFunctionPrototypes
|
||||
list_ptr
|
||||
#endif
|
||||
);
|
||||
void *next_in_list (
|
||||
#if NeedFunctionPrototypes
|
||||
list_ptr
|
||||
#endif
|
||||
);
|
||||
int32_t list_is_empty (
|
||||
#if NeedFunctionPrototypes
|
||||
list_ptr
|
||||
#endif
|
||||
);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/* $XConsortium: multiVis.h /main/4 1996/10/14 15:04:12 swick $ */
|
||||
/** ------------------------------------------------------------------------
|
||||
This file contains routines for manipulating generic lists.
|
||||
Lists are implemented with a "harness". In other words, each
|
||||
node in the list consists of two pointers, one to the data item
|
||||
and one to the next node in the list. The head of the list is
|
||||
the same struct as each node, but the "item" ptr is used to point
|
||||
to the current member of the list (used by the first_in_list and
|
||||
next_in_list functions).
|
||||
|
||||
This file is available under and governed by the GNU General Public
|
||||
License version 2 only, as published by the Free Software Foundation.
|
||||
However, the following notice accompanied the original version of this
|
||||
file:
|
||||
|
||||
Copyright (c) 1994 Hewlett-Packard Co.
|
||||
Copyright (c) 1996 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall
|
||||
not be used in advertising or otherwise to promote the sale, use or
|
||||
other dealings in this Software without prior written authorization
|
||||
from the X Consortium.
|
||||
|
||||
------------------------------------------------------------------------ **/
|
||||
|
||||
extern int32_t GetMultiVisualRegions(
|
||||
#if NeedFunctionPrototypes
|
||||
Display *, Window, int32_t, int32_t, uint32_t,
|
||||
uint32_t, int32_t *, int32_t *, XVisualInfo **, int32_t *,
|
||||
OverlayInfo **, int32_t *, XVisualInfo ***, list_ptr *,
|
||||
list_ptr *, int32_t *
|
||||
#endif
|
||||
);
|
||||
|
||||
extern XImage *ReadAreaToImage(
|
||||
#if NeedFunctionPrototypes
|
||||
Display *, Window, int32_t, int32_t, uint32_t,
|
||||
uint32_t, int32_t, XVisualInfo *, int32_t,
|
||||
OverlayInfo *, int32_t, XVisualInfo **, list_ptr,
|
||||
list_ptr, int32_t, int32_t
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void initFakeVisual(
|
||||
#if NeedFunctionPrototypes
|
||||
Visual *
|
||||
#endif
|
||||
);
|
||||
|
|
@ -1,393 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* These routines are used for display string with multi font.
|
||||
*/
|
||||
|
||||
#ifdef HEADLESS
|
||||
#error This file should not be included in headless library
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <ctype.h>
|
||||
#include <jni.h>
|
||||
#include <jni_util.h>
|
||||
#include <jvm.h>
|
||||
#include "awt_Font.h"
|
||||
#include "awt_p.h"
|
||||
#include "multi_font.h"
|
||||
|
||||
extern XFontStruct *loadFont(Display *, char *, int32_t);
|
||||
|
||||
extern struct FontIDs fontIDs;
|
||||
extern struct PlatformFontIDs platformFontIDs;
|
||||
extern struct XFontPeerIDs xFontPeerIDs;
|
||||
|
||||
/*
|
||||
* make string with str + string representation of num
|
||||
* This string is used as tag string of Motif Compound String and FontList.
|
||||
*/
|
||||
static void
|
||||
makeTag(char *str, int32_t num, char *buf)
|
||||
{
|
||||
int32_t len = strlen(str);
|
||||
|
||||
strcpy(buf, str);
|
||||
buf[len] = '0' + num % 100;
|
||||
buf[len + 1] = '\0';
|
||||
}
|
||||
|
||||
static int32_t
|
||||
awtJNI_GetFontDescriptorNumber(JNIEnv * env
|
||||
,jobject font
|
||||
,jobject fd)
|
||||
{
|
||||
int32_t i = 0, num;
|
||||
/* initialize to NULL so that DeleteLocalRef will work. */
|
||||
jobjectArray componentFonts = NULL;
|
||||
jobject peer = NULL;
|
||||
jobject temp = NULL;
|
||||
jboolean validRet = JNI_FALSE;
|
||||
|
||||
if ((*env)->EnsureLocalCapacity(env, 2) < 0 || (*env)->ExceptionCheck(env))
|
||||
goto done;
|
||||
|
||||
peer = (*env)->CallObjectMethod(env,font,fontIDs.getPeer);
|
||||
if (peer == NULL)
|
||||
goto done;
|
||||
|
||||
componentFonts = (jobjectArray)
|
||||
(*env)->GetObjectField(env,peer,platformFontIDs.componentFonts);
|
||||
|
||||
if (componentFonts == NULL)
|
||||
goto done;
|
||||
|
||||
num = (*env)->GetArrayLength(env, componentFonts);
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
temp = (*env)->GetObjectArrayElement(env, componentFonts, i);
|
||||
|
||||
if ((*env)->IsSameObject(env, fd, temp)) {
|
||||
validRet = JNI_TRUE;
|
||||
break;
|
||||
}
|
||||
(*env)->DeleteLocalRef(env, temp);
|
||||
}
|
||||
|
||||
done:
|
||||
(*env)->DeleteLocalRef(env, peer);
|
||||
(*env)->DeleteLocalRef(env, componentFonts);
|
||||
|
||||
if (validRet)
|
||||
return i;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
jobject
|
||||
awtJNI_GetFMFont(JNIEnv * env, jobject this)
|
||||
{
|
||||
return JNU_CallMethodByName(env, NULL, this, "getFont_NoClientCode",
|
||||
"()Ljava/awt/Font;").l;
|
||||
}
|
||||
|
||||
jboolean
|
||||
awtJNI_IsMultiFont(JNIEnv * env, jobject this)
|
||||
{
|
||||
jobject peer = NULL;
|
||||
jobject fontConfig = NULL;
|
||||
|
||||
if (this == NULL) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
if ((*env)->EnsureLocalCapacity(env, 2) < 0) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
peer = (*env)->CallObjectMethod(env,this,fontIDs.getPeer);
|
||||
if (peer == NULL) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
fontConfig = (*env)->GetObjectField(env,peer,platformFontIDs.fontConfig);
|
||||
(*env)->DeleteLocalRef(env, peer);
|
||||
|
||||
if (fontConfig == NULL) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
(*env)->DeleteLocalRef(env, fontConfig);
|
||||
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
jboolean
|
||||
awtJNI_IsMultiFontMetrics(JNIEnv * env, jobject this)
|
||||
{
|
||||
jobject peer = NULL;
|
||||
jobject fontConfig = NULL;
|
||||
jobject font = NULL;
|
||||
|
||||
if (JNU_IsNull(env, this)) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
if ((*env)->EnsureLocalCapacity(env, 3) < 0) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
font = JNU_CallMethodByName(env, NULL, this, "getFont_NoClientCode",
|
||||
"()Ljava/awt/Font;").l;
|
||||
if (JNU_IsNull(env, font) || (*env)->ExceptionCheck(env)) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
peer = (*env)->CallObjectMethod(env,font,fontIDs.getPeer);
|
||||
(*env)->DeleteLocalRef(env, font);
|
||||
|
||||
if (peer == NULL) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
fontConfig = (*env)->GetObjectField(env,peer,platformFontIDs.fontConfig);
|
||||
(*env)->DeleteLocalRef(env, peer);
|
||||
if (fontConfig == NULL) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
(*env)->DeleteLocalRef(env, fontConfig);
|
||||
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
/* #define FONT_DEBUG 2 */
|
||||
|
||||
XFontSet
|
||||
awtJNI_MakeFontSet(JNIEnv * env, jobject font)
|
||||
{
|
||||
jstring xlfd = NULL;
|
||||
char *xfontset = NULL;
|
||||
int32_t size;
|
||||
int32_t length = 0;
|
||||
char *realxlfd = NULL, *ptr = NULL, *prev = NULL;
|
||||
char **missing_list = NULL;
|
||||
int32_t missing_count;
|
||||
char *def_string = NULL;
|
||||
XFontSet xfs;
|
||||
jobject peer = NULL;
|
||||
jstring xfsname = NULL;
|
||||
#ifdef FONT_DEBUG
|
||||
char xx[1024];
|
||||
#endif
|
||||
|
||||
if ((*env)->EnsureLocalCapacity(env, 2) < 0)
|
||||
return 0;
|
||||
|
||||
size = (*env)->GetIntField(env, font, fontIDs.size) * 10;
|
||||
|
||||
peer = (*env)->CallObjectMethod(env,font,fontIDs.getPeer);
|
||||
xfsname = (*env)->GetObjectField(env, peer, xFontPeerIDs.xfsname);
|
||||
|
||||
if (JNU_IsNull(env, xfsname))
|
||||
xfontset = "";
|
||||
else
|
||||
xfontset = (char *)JNU_GetStringPlatformChars(env, xfsname, NULL);
|
||||
|
||||
realxlfd = malloc(strlen(xfontset) + 50);
|
||||
|
||||
prev = ptr = xfontset;
|
||||
while ((ptr = strstr(ptr, "%d"))) {
|
||||
char save = *(ptr + 2);
|
||||
|
||||
*(ptr + 2) = '\0';
|
||||
jio_snprintf(realxlfd + length, strlen(xfontset) + 50 - length,
|
||||
prev, size);
|
||||
length = strlen(realxlfd);
|
||||
*(ptr + 2) = save;
|
||||
|
||||
prev = ptr + 2;
|
||||
ptr += 2;
|
||||
}
|
||||
strcpy(realxlfd + length, prev);
|
||||
|
||||
#ifdef FONT_DEBUG
|
||||
strcpy(xx, realxlfd);
|
||||
#endif
|
||||
xfs = XCreateFontSet(awt_display, realxlfd, &missing_list,
|
||||
&missing_count, &def_string);
|
||||
#if FONT_DEBUG >= 2
|
||||
fprintf(stderr, "XCreateFontSet(%s)->0x%x\n", xx, xfs);
|
||||
#endif
|
||||
|
||||
#if FONT_DEBUG
|
||||
if (missing_count != 0) {
|
||||
int32_t i;
|
||||
fprintf(stderr, "XCreateFontSet missing %d fonts:\n", missing_count);
|
||||
for (i = 0; i < missing_count; ++i) {
|
||||
fprintf(stderr, "\t\"%s\"\n", missing_list[i]);
|
||||
}
|
||||
fprintf(stderr, " requested \"%s\"\n", xx);
|
||||
#if FONT_DEBUG >= 3
|
||||
exit(-1);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
free((void *)realxlfd);
|
||||
|
||||
if (xfontset && !JNU_IsNull(env, xfsname))
|
||||
JNU_ReleaseStringPlatformChars(env, xfsname, (const char *) xfontset);
|
||||
|
||||
(*env)->DeleteLocalRef(env, peer);
|
||||
(*env)->DeleteLocalRef(env, xfsname);
|
||||
return xfs;
|
||||
}
|
||||
|
||||
/*
|
||||
* get multi font string width with multiple X11 font
|
||||
*
|
||||
* ASSUMES: We are not running on a privileged thread
|
||||
*/
|
||||
int32_t
|
||||
awtJNI_GetMFStringWidth(JNIEnv * env, jcharArray s, int offset, int sLength, jobject font)
|
||||
{
|
||||
char *err = NULL;
|
||||
unsigned char *stringData = NULL;
|
||||
char *offsetStringData = NULL;
|
||||
int32_t stringCount, i;
|
||||
int32_t size;
|
||||
struct FontData *fdata = NULL;
|
||||
jobject fontDescriptor = NULL;
|
||||
jbyteArray data = NULL;
|
||||
int32_t j;
|
||||
int32_t width = 0;
|
||||
int32_t length;
|
||||
XFontStruct *xf = NULL;
|
||||
jobjectArray dataArray = NULL;
|
||||
if ((*env)->EnsureLocalCapacity(env, 3) < 0)
|
||||
return 0;
|
||||
|
||||
if (!JNU_IsNull(env, s) && !JNU_IsNull(env, font))
|
||||
{
|
||||
jobject peer;
|
||||
peer = (*env)->CallObjectMethod(env,font,fontIDs.getPeer);
|
||||
|
||||
dataArray = (*env)->CallObjectMethod(
|
||||
env,
|
||||
peer,
|
||||
platformFontIDs.makeConvertedMultiFontChars,
|
||||
s, offset, sLength);
|
||||
|
||||
if ((*env)->ExceptionOccurred(env))
|
||||
{
|
||||
(*env)->ExceptionDescribe(env);
|
||||
(*env)->ExceptionClear(env);
|
||||
}
|
||||
|
||||
(*env)->DeleteLocalRef(env, peer);
|
||||
|
||||
if(dataArray == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
fdata = awtJNI_GetFontData(env, font, &err);
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
(*env)->DeleteLocalRef(env, dataArray);
|
||||
return 0;
|
||||
}
|
||||
|
||||
stringCount = (*env)->GetArrayLength(env, dataArray);
|
||||
|
||||
size = (*env)->GetIntField(env, font, fontIDs.size);
|
||||
|
||||
for (i = 0; i < stringCount; i+=2)
|
||||
{
|
||||
fontDescriptor = (*env)->GetObjectArrayElement(env, dataArray, i);
|
||||
data = (*env)->GetObjectArrayElement(env, dataArray, i + 1);
|
||||
|
||||
/* Bail if we've finished */
|
||||
if (fontDescriptor == NULL || data == NULL) {
|
||||
(*env)->DeleteLocalRef(env, fontDescriptor);
|
||||
(*env)->DeleteLocalRef(env, data);
|
||||
break;
|
||||
}
|
||||
|
||||
j = awtJNI_GetFontDescriptorNumber(env, font, fontDescriptor);
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
(*env)->DeleteLocalRef(env, fontDescriptor);
|
||||
(*env)->DeleteLocalRef(env, data);
|
||||
break;
|
||||
}
|
||||
|
||||
if (fdata->flist[j].load == 0) {
|
||||
xf = loadFont(awt_display,
|
||||
fdata->flist[j].xlfd, size * 10);
|
||||
if (xf == NULL) {
|
||||
(*env)->DeleteLocalRef(env, fontDescriptor);
|
||||
(*env)->DeleteLocalRef(env, data);
|
||||
continue;
|
||||
}
|
||||
fdata->flist[j].load = 1;
|
||||
fdata->flist[j].xfont = xf;
|
||||
if (xf->min_byte1 == 0 && xf->max_byte1 == 0)
|
||||
fdata->flist[j].index_length = 1;
|
||||
else
|
||||
fdata->flist[j].index_length = 2;
|
||||
}
|
||||
xf = fdata->flist[j].xfont;
|
||||
|
||||
stringData =
|
||||
(unsigned char *)(*env)->GetPrimitiveArrayCritical(env, data,NULL);
|
||||
if (stringData == NULL) {
|
||||
(*env)->DeleteLocalRef(env, fontDescriptor);
|
||||
(*env)->DeleteLocalRef(env, data);
|
||||
(*env)->ExceptionClear(env);
|
||||
JNU_ThrowOutOfMemoryError(env, "Could not get string data");
|
||||
break;
|
||||
}
|
||||
|
||||
length = (stringData[0] << 24) | (stringData[1] << 16) |
|
||||
(stringData[2] << 8) | stringData[3];
|
||||
offsetStringData = (char *)(stringData + (4 * sizeof(char)));
|
||||
|
||||
if (fdata->flist[j].index_length == 2) {
|
||||
width += XTextWidth16(xf, (XChar2b *)offsetStringData, length/2);
|
||||
} else {
|
||||
width += XTextWidth(xf, offsetStringData, length);
|
||||
}
|
||||
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, data, stringData, JNI_ABORT);
|
||||
(*env)->DeleteLocalRef(env, fontDescriptor);
|
||||
(*env)->DeleteLocalRef(env, data);
|
||||
}
|
||||
(*env)->DeleteLocalRef(env, dataArray);
|
||||
|
||||
return width;
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/*
|
||||
* header for Multi Font String
|
||||
*/
|
||||
#ifndef _MULTI_FONT_H_
|
||||
#define _MULTI_FONT_H_
|
||||
|
||||
#ifndef HEADLESS
|
||||
jboolean awtJNI_IsMultiFont(JNIEnv *env,jobject this);
|
||||
jboolean awtJNI_IsMultiFontMetrics(JNIEnv *env,jobject this);
|
||||
XFontSet awtJNI_MakeFontSet(JNIEnv *env,jobject font);
|
||||
struct FontData *awtJNI_GetFontData(JNIEnv *env,jobject font, char **errmsg);
|
||||
int32_t awtJNI_GetMFStringWidth(JNIEnv * env, jcharArray s, int32_t offset,
|
||||
int32_t length, jobject font);
|
||||
#endif /* !HEADLESS */
|
||||
|
||||
#endif /* _MULTI_FONT_H_ */
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* $XFree86: xc/include/extensions/randr.h,v 1.4 2001/11/24 07:24:58 keithp Exp $
|
||||
*
|
||||
* Copyright © 2000, Compaq Computer Corporation,
|
||||
* Copyright © 2002, Hewlett Packard, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Compaq or HP not be used in advertising
|
||||
* or publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. HP makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HP
|
||||
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _RANDR_H_
|
||||
#define _RANDR_H_
|
||||
|
||||
typedef unsigned short Connection;
|
||||
typedef unsigned short Rotation;
|
||||
typedef unsigned short SizeID;
|
||||
typedef unsigned short SubpixelOrder;
|
||||
|
||||
#define RANDR_NAME "RANDR"
|
||||
#define RANDR_MAJOR 1
|
||||
#define RANDR_MINOR 1
|
||||
|
||||
#define RRNumberErrors 0
|
||||
#define RRNumberEvents 1
|
||||
|
||||
#define X_RRQueryVersion 0
|
||||
/* we skip 1 to make old clients fail pretty immediately */
|
||||
#define X_RROldGetScreenInfo 1
|
||||
#define X_RR1_0SetScreenConfig 2
|
||||
/* V1.0 apps share the same set screen config request id */
|
||||
#define X_RRSetScreenConfig 2
|
||||
#define X_RROldScreenChangeSelectInput 3
|
||||
/* 3 used to be ScreenChangeSelectInput; deprecated */
|
||||
#define X_RRSelectInput 4
|
||||
#define X_RRGetScreenInfo 5
|
||||
|
||||
/* used in XRRSelectInput */
|
||||
|
||||
#define RRScreenChangeNotifyMask (1L << 0)
|
||||
|
||||
#define RRScreenChangeNotify 0
|
||||
|
||||
/* used in the rotation field; rotation and reflection in 0.1 proto. */
|
||||
#define RR_Rotate_0 1
|
||||
#define RR_Rotate_90 2
|
||||
#define RR_Rotate_180 4
|
||||
#define RR_Rotate_270 8
|
||||
|
||||
/* new in 1.0 protocol, to allow reflection of screen */
|
||||
|
||||
#define RR_Reflect_X 16
|
||||
#define RR_Reflect_Y 32
|
||||
|
||||
#define RRSetConfigSuccess 0
|
||||
#define RRSetConfigInvalidConfigTime 1
|
||||
#define RRSetConfigInvalidTime 2
|
||||
#define RRSetConfigFailed 3
|
||||
|
||||
#endif /* _RANDR_H_ */
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#ifdef HEADLESS
|
||||
#error This file should not be included in headless library
|
||||
#endif
|
||||
|
||||
#ifdef MACOSX
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include "robot_common.h"
|
||||
|
||||
/*
|
||||
* QueryColorMap is taken from multiVis.c, part of the xwd distribution from
|
||||
* X.org. It was moved here so it can be shared with awt_DataTransferer.c
|
||||
*/
|
||||
int32_t
|
||||
QueryColorMap(Display *disp,
|
||||
Colormap src_cmap,
|
||||
Visual *src_vis,
|
||||
XColor **src_colors,
|
||||
int32_t *rShift, int32_t *gShift, int32_t *bShift)
|
||||
|
||||
{
|
||||
int32_t ncolors, i;
|
||||
unsigned long redMask, greenMask, blueMask;
|
||||
int32_t redShift, greenShift, blueShift;
|
||||
XColor *colors ;
|
||||
|
||||
ncolors = src_vis->map_entries ;
|
||||
*src_colors = colors = (XColor *)calloc(ncolors,sizeof(XColor) ) ;
|
||||
|
||||
if(src_vis->class != TrueColor && src_vis->class != DirectColor)
|
||||
{
|
||||
for(i=0 ; i < ncolors ; i++)
|
||||
{
|
||||
colors[i].pixel = i ;
|
||||
colors[i].pad = 0;
|
||||
colors[i].flags = DoRed|DoGreen|DoBlue;
|
||||
}
|
||||
}
|
||||
else /** src is decomposed rgb ***/
|
||||
{
|
||||
/* Get the X colormap */
|
||||
redMask = src_vis->red_mask;
|
||||
greenMask = src_vis->green_mask;
|
||||
blueMask = src_vis->blue_mask;
|
||||
redShift = 0; while (!(redMask&0x1)) {
|
||||
redShift++;
|
||||
redMask = redMask>>1;
|
||||
}
|
||||
greenShift = 0; while (!(greenMask&0x1)) {
|
||||
greenShift++;
|
||||
greenMask = greenMask>>1;
|
||||
}
|
||||
blueShift = 0; while (!(blueMask&0x1)) {
|
||||
blueShift++;
|
||||
blueMask = blueMask>>1;
|
||||
}
|
||||
*rShift = redShift ;
|
||||
*gShift = greenShift ;
|
||||
*bShift = blueShift ;
|
||||
for (i=0; i<ncolors; i++) {
|
||||
if( (uint32_t)i <= redMask) colors[i].pixel = (i<<redShift) ;
|
||||
if( (uint32_t)i <= greenMask) colors[i].pixel |= (i<<greenShift) ;
|
||||
if( (uint32_t)i <= blueMask) colors[i].pixel |= (i<<blueShift) ;
|
||||
/***** example :for gecko's 3-3-2 map, blue index should be <= 3
|
||||
.
|
||||
colors[i].pixel = (i<<redShift)|(i<<greenShift)|(i<<blueShift);
|
||||
*****/
|
||||
colors[i].pad = 0;
|
||||
colors[i].flags = DoRed|DoGreen|DoBlue;
|
||||
}
|
||||
}
|
||||
|
||||
XQueryColors(disp, src_cmap, colors, ncolors);
|
||||
return ncolors ;
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
#ifndef _ROBOT_COMMON_H
|
||||
#define _ROBOT_COMMON_H
|
||||
|
||||
#include "java_awt_event_InputEvent.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include "gdefs.h"
|
||||
|
||||
int QueryColorMap(Display *disp,
|
||||
Colormap src_cmap,
|
||||
Visual *src_vis,
|
||||
XColor **src_colors,
|
||||
int *rShift, int *gShift, int *bShift);
|
||||
|
||||
#endif /* _ROBOT_COMMON_H */
|
||||
|
|
@ -1,419 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
#include <stdio.h>
|
||||
#include <jni_util.h>
|
||||
#include <string.h>
|
||||
#include <X11/X.h>
|
||||
#include "gtk_interface.h"
|
||||
#include "sun_awt_X11_GtkFileDialogPeer.h"
|
||||
#include "java_awt_FileDialog.h"
|
||||
#include "debug_assert.h"
|
||||
|
||||
typedef void GtkWidget;
|
||||
static JavaVM *jvm;
|
||||
|
||||
/* To cache some method IDs */
|
||||
static jmethodID filenameFilterCallbackMethodID = NULL;
|
||||
static jmethodID setFileInternalMethodID = NULL;
|
||||
static jfieldID widgetFieldID = NULL;
|
||||
static jmethodID setWindowMethodID = NULL;
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_initIDs
|
||||
(JNIEnv *env, jclass cx)
|
||||
{
|
||||
filenameFilterCallbackMethodID = (*env)->GetMethodID(env, cx,
|
||||
"filenameFilterCallback", "(Ljava/lang/String;)Z");
|
||||
DASSERT(filenameFilterCallbackMethodID != NULL);
|
||||
CHECK_NULL(filenameFilterCallbackMethodID);
|
||||
|
||||
setFileInternalMethodID = (*env)->GetMethodID(env, cx,
|
||||
"setFileInternal", "(Ljava/lang/String;[Ljava/lang/String;)V");
|
||||
DASSERT(setFileInternalMethodID != NULL);
|
||||
CHECK_NULL(setFileInternalMethodID);
|
||||
|
||||
widgetFieldID = (*env)->GetFieldID(env, cx, "widget", "J");
|
||||
DASSERT(widgetFieldID != NULL);
|
||||
CHECK_NULL(widgetFieldID);
|
||||
|
||||
setWindowMethodID = (*env)->GetMethodID(env, cx, "setWindow", "(J)Z");
|
||||
DASSERT(setWindowMethodID != NULL);
|
||||
}
|
||||
|
||||
static gboolean filenameFilterCallback(const GtkFileFilterInfo * filter_info, gpointer obj)
|
||||
{
|
||||
JNIEnv *env;
|
||||
jstring filename;
|
||||
|
||||
env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
filename = (*env)->NewStringUTF(env, filter_info->filename);
|
||||
JNU_CHECK_EXCEPTION_RETURN(env, FALSE);
|
||||
|
||||
return (*env)->CallBooleanMethod(env, obj, filenameFilterCallbackMethodID,
|
||||
filename);
|
||||
}
|
||||
|
||||
static void quit(JNIEnv * env, jobject jpeer, gboolean isSignalHandler)
|
||||
{
|
||||
jthrowable pendingException;
|
||||
if (pendingException = (*env)->ExceptionOccurred(env)) {
|
||||
(*env)->ExceptionClear(env);
|
||||
}
|
||||
|
||||
GtkWidget * dialog = (GtkWidget*)jlong_to_ptr(
|
||||
(*env)->GetLongField(env, jpeer, widgetFieldID));
|
||||
|
||||
if (dialog != NULL)
|
||||
{
|
||||
// Callbacks from GTK signals are made within the GTK lock
|
||||
// So, within a signal handler there is no need to call
|
||||
// gdk_threads_enter() / gtk->gdk_threads_leave()
|
||||
if (!isSignalHandler) {
|
||||
gtk->gdk_threads_enter();
|
||||
}
|
||||
|
||||
gtk->gtk_widget_hide (dialog);
|
||||
gtk->gtk_widget_destroy (dialog);
|
||||
|
||||
gtk->gtk_main_quit ();
|
||||
|
||||
(*env)->SetLongField(env, jpeer, widgetFieldID, 0);
|
||||
|
||||
if (!isSignalHandler) {
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
}
|
||||
|
||||
if (pendingException) {
|
||||
(*env)->Throw(env, pendingException);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_GtkFileDialogPeer
|
||||
* Method: quit
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_quit
|
||||
(JNIEnv * env, jobject jpeer)
|
||||
{
|
||||
quit(env, jpeer, FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_GtkFileDialogPeer
|
||||
* Method: toFront
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_toFront
|
||||
(JNIEnv * env, jobject jpeer)
|
||||
{
|
||||
GtkWidget * dialog;
|
||||
|
||||
gtk->gdk_threads_enter();
|
||||
|
||||
dialog = (GtkWidget*)jlong_to_ptr(
|
||||
(*env)->GetLongField(env, jpeer, widgetFieldID));
|
||||
|
||||
if (dialog != NULL) {
|
||||
gtk->gtk_window_present((GtkWindow*)dialog);
|
||||
}
|
||||
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_GtkFileDialogPeer
|
||||
* Method: setBounds
|
||||
* Signature: (IIIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_setBounds
|
||||
(JNIEnv * env, jobject jpeer, jint x, jint y, jint width, jint height, jint op)
|
||||
{
|
||||
GtkWindow* dialog;
|
||||
|
||||
gtk->gdk_threads_enter();
|
||||
|
||||
dialog = (GtkWindow*)jlong_to_ptr(
|
||||
(*env)->GetLongField(env, jpeer, widgetFieldID));
|
||||
|
||||
if (dialog != NULL) {
|
||||
if (x >= 0 && y >= 0) {
|
||||
gtk->gtk_window_move(dialog, (gint)x, (gint)y);
|
||||
}
|
||||
if (width > 0 && height > 0) {
|
||||
gtk->gtk_window_resize(dialog, (gint)width, (gint)height);
|
||||
}
|
||||
}
|
||||
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* baseDir should be freed by user.
|
||||
*/
|
||||
static gboolean isFromSameDirectory(GSList* list, gchar** baseDir) {
|
||||
|
||||
GSList *it = list;
|
||||
gchar* prevDir = NULL;
|
||||
gboolean isAllDirsSame = TRUE;
|
||||
|
||||
while (it) {
|
||||
gchar* dir = gtk->g_path_get_dirname((gchar*) it->data);
|
||||
|
||||
if (prevDir && strcmp(prevDir, dir) != 0) {
|
||||
isAllDirsSame = FALSE;
|
||||
gtk->g_free(dir);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!prevDir) {
|
||||
prevDir = strdup(dir);
|
||||
}
|
||||
gtk->g_free(dir);
|
||||
|
||||
it = it->next;
|
||||
}
|
||||
|
||||
if (isAllDirsSame) {
|
||||
*baseDir = prevDir;
|
||||
} else {
|
||||
free(prevDir);
|
||||
*baseDir = strdup("/");
|
||||
}
|
||||
|
||||
return isAllDirsSame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a GSList to an array of filenames
|
||||
*/
|
||||
static jobjectArray toFilenamesArray(JNIEnv *env, GSList* list, jstring* jcurrent_folder)
|
||||
{
|
||||
jstring str;
|
||||
jclass stringCls;
|
||||
GSList *iterator;
|
||||
jobjectArray array;
|
||||
int i;
|
||||
gchar* entry;
|
||||
gchar * baseDir;
|
||||
gboolean isFromSameDir;
|
||||
|
||||
if (list == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
stringCls = (*env)->FindClass(env, "java/lang/String");
|
||||
if (stringCls == NULL) {
|
||||
(*env)->ExceptionClear(env);
|
||||
JNU_ThrowInternalError(env, "Could not get java.lang.String class");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
array = (*env)->NewObjectArray(env, gtk->gtk_g_slist_length(list), stringCls, NULL);
|
||||
if (array == NULL) {
|
||||
(*env)->ExceptionClear(env);
|
||||
JNU_ThrowInternalError(env, "Could not instantiate array files array");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
isFromSameDir = isFromSameDirectory(list, &baseDir);
|
||||
|
||||
*jcurrent_folder = (*env)->NewStringUTF(env, baseDir);
|
||||
if (*jcurrent_folder == NULL) {
|
||||
free(baseDir);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (iterator = list, i=0;
|
||||
iterator;
|
||||
iterator = iterator->next, i++) {
|
||||
|
||||
entry = (gchar*) iterator->data;
|
||||
|
||||
if (isFromSameDir) {
|
||||
entry = strrchr(entry, '/') + 1;
|
||||
} else if (entry[0] == '/') {
|
||||
entry++;
|
||||
}
|
||||
|
||||
str = (*env)->NewStringUTF(env, entry);
|
||||
if((*env)->ExceptionCheck(env)){
|
||||
break;
|
||||
}
|
||||
if (str) {
|
||||
(*env)->SetObjectArrayElement(env, array, i, str);
|
||||
if((*env)->ExceptionCheck(env)){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(baseDir);
|
||||
return array;
|
||||
}
|
||||
|
||||
static void handle_response(GtkWidget* aDialog, gint responseId, gpointer obj)
|
||||
{
|
||||
JNIEnv *env;
|
||||
GSList *filenames;
|
||||
jstring jcurrent_folder = NULL;
|
||||
jobjectArray jfilenames;
|
||||
|
||||
env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
filenames = NULL;
|
||||
|
||||
if (responseId == GTK_RESPONSE_ACCEPT) {
|
||||
filenames = gtk->gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(aDialog));
|
||||
}
|
||||
|
||||
jfilenames = toFilenamesArray(env, filenames, &jcurrent_folder);
|
||||
|
||||
if (!(*env)->ExceptionCheck(env)) {
|
||||
(*env)->CallVoidMethod(env, obj, setFileInternalMethodID,
|
||||
jcurrent_folder, jfilenames);
|
||||
}
|
||||
|
||||
quit(env, (jobject)obj, TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_GtkFileDialogPeer
|
||||
* Method: run
|
||||
* Signature: (Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/io/FilenameFilter;ZII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_GtkFileDialogPeer_run(JNIEnv * env, jobject jpeer,
|
||||
jstring jtitle, jint mode, jstring jdir, jstring jfile,
|
||||
jobject jfilter, jboolean multiple, int x, int y)
|
||||
{
|
||||
GtkWidget *dialog = NULL;
|
||||
GtkFileFilter *filter;
|
||||
|
||||
if (jvm == NULL) {
|
||||
(*env)->GetJavaVM(env, &jvm);
|
||||
JNU_CHECK_EXCEPTION(env);
|
||||
}
|
||||
|
||||
gtk->gdk_threads_enter();
|
||||
|
||||
const char *title = jtitle == NULL? "": (*env)->GetStringUTFChars(env, jtitle, 0);
|
||||
if (title == NULL) {
|
||||
(*env)->ExceptionClear(env);
|
||||
JNU_ThrowOutOfMemoryError(env, "Could not get title");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode == java_awt_FileDialog_SAVE) {
|
||||
/* Save action */
|
||||
dialog = gtk->gtk_file_chooser_dialog_new(title, NULL,
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL,
|
||||
GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL);
|
||||
}
|
||||
else {
|
||||
/* Default action OPEN */
|
||||
dialog = gtk->gtk_file_chooser_dialog_new(title, NULL,
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL,
|
||||
GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
|
||||
|
||||
/* Set multiple selection mode, that is allowed only in OPEN action */
|
||||
if (multiple) {
|
||||
gtk->gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog),
|
||||
multiple);
|
||||
}
|
||||
}
|
||||
|
||||
if (jtitle != NULL) {
|
||||
(*env)->ReleaseStringUTFChars(env, jtitle, title);
|
||||
}
|
||||
|
||||
/* Set the directory */
|
||||
if (jdir != NULL) {
|
||||
const char *dir = (*env)->GetStringUTFChars(env, jdir, 0);
|
||||
if (dir == NULL) {
|
||||
(*env)->ExceptionClear(env);
|
||||
JNU_ThrowOutOfMemoryError(env, "Could not get dir");
|
||||
return;
|
||||
}
|
||||
gtk->gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), dir);
|
||||
(*env)->ReleaseStringUTFChars(env, jdir, dir);
|
||||
}
|
||||
|
||||
/* Set the filename */
|
||||
if (jfile != NULL) {
|
||||
const char *filename = (*env)->GetStringUTFChars(env, jfile, 0);
|
||||
if (filename == NULL) {
|
||||
(*env)->ExceptionClear(env);
|
||||
JNU_ThrowOutOfMemoryError(env, "Could not get filename");
|
||||
return;
|
||||
}
|
||||
if (mode == java_awt_FileDialog_SAVE) {
|
||||
gtk->gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), filename);
|
||||
} else {
|
||||
gtk->gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), filename);
|
||||
}
|
||||
(*env)->ReleaseStringUTFChars(env, jfile, filename);
|
||||
}
|
||||
|
||||
/* Set the file filter */
|
||||
if (jfilter != NULL) {
|
||||
filter = gtk->gtk_file_filter_new();
|
||||
gtk->gtk_file_filter_add_custom(filter, GTK_FILE_FILTER_FILENAME,
|
||||
filenameFilterCallback, jpeer, NULL);
|
||||
gtk->gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);
|
||||
}
|
||||
|
||||
/* Other Properties */
|
||||
if (gtk->gtk_check_version(2, 8, 0) == NULL ||
|
||||
gtk->gtk_check_version(3, 0, 0) == NULL) {
|
||||
gtk->gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(
|
||||
dialog), TRUE);
|
||||
}
|
||||
|
||||
/* Set the initial location */
|
||||
if (x >= 0 && y >= 0) {
|
||||
gtk->gtk_window_move((GtkWindow*)dialog, (gint)x, (gint)y);
|
||||
|
||||
// NOTE: it doesn't set the initial size for the file chooser
|
||||
// as it seems like the file chooser overrides the size internally
|
||||
}
|
||||
|
||||
gtk->g_signal_connect_data(dialog, "response", G_CALLBACK(
|
||||
handle_response), jpeer, 0, 0);
|
||||
|
||||
(*env)->SetLongField(env, jpeer, widgetFieldID, ptr_to_jlong(dialog));
|
||||
|
||||
gtk->gtk_widget_show(dialog);
|
||||
|
||||
XID xid = gtk->gdk_x11_drawable_get_xid(gtk->get_window(dialog));
|
||||
if( (*env)->CallBooleanMethod(env, jpeer, setWindowMethodID, xid) ) {
|
||||
gtk->gtk_main();
|
||||
}
|
||||
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
|
|
@ -1,375 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "gtk_interface.h"
|
||||
#include "com_sun_java_swing_plaf_gtk_GTKEngine.h"
|
||||
|
||||
/* Static buffer for conversion from java.lang.String to UTF-8 */
|
||||
static char conversionBuffer[CONV_BUFFER_SIZE];
|
||||
|
||||
const char *getStrFor(JNIEnv *env, jstring val)
|
||||
{
|
||||
int length = (*env)->GetStringLength(env, val);
|
||||
if (length > CONV_BUFFER_SIZE-1)
|
||||
{
|
||||
length = CONV_BUFFER_SIZE-1;
|
||||
}
|
||||
|
||||
(*env)->GetStringUTFRegion(env, val, 0, length, conversionBuffer);
|
||||
return conversionBuffer;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: native_paint_arrow
|
||||
* Signature: (IIILjava/lang/String;IIIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1arrow(
|
||||
JNIEnv *env, jobject this,
|
||||
jint widget_type, jint state, jint shadow_type, jstring detail,
|
||||
jint x, jint y, jint w, jint h, jint arrow_type)
|
||||
{
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->paint_arrow(widget_type, state, shadow_type, getStrFor(env, detail),
|
||||
x, y, w, h, arrow_type, TRUE);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: native_paint_box
|
||||
* Signature: (IIILjava/lang/String;IIIIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box(
|
||||
JNIEnv *env, jobject this,
|
||||
jint widget_type, jint state, jint shadow_type, jstring detail,
|
||||
jint x, jint y, jint w, jint h,
|
||||
jint synth_state, jint dir)
|
||||
{
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->paint_box(widget_type, state, shadow_type, getStrFor(env, detail),
|
||||
x, y, w, h, synth_state, dir);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: native_paint_box_gap
|
||||
* Signature: (IIILjava/lang/String;IIIIIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box_1gap(
|
||||
JNIEnv *env, jobject this,
|
||||
jint widget_type, jint state, jint shadow_type, jstring detail,
|
||||
jint x, jint y, jint w, jint h,
|
||||
jint gap_side, jint gap_x, jint gap_w)
|
||||
{
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->paint_box_gap(widget_type, state, shadow_type, getStrFor(env, detail),
|
||||
x, y, w, h, gap_side, gap_x, gap_w);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: native_paint_check
|
||||
* Signature: (IILjava/lang/String;IIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1check(
|
||||
JNIEnv *env, jobject this,
|
||||
jint widget_type, jint synth_state, jstring detail,
|
||||
jint x, jint y, jint w, jint h)
|
||||
{
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->paint_check(widget_type, synth_state, getStrFor(env, detail),
|
||||
x, y, w, h);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: native_paint_expander
|
||||
* Signature: (IILjava/lang/String;IIIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1expander(
|
||||
JNIEnv *env, jobject this,
|
||||
jint widget_type, jint state, jstring detail,
|
||||
jint x, jint y, jint w, jint h, jint expander_style)
|
||||
{
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->paint_expander(widget_type, state, getStrFor(env, detail),
|
||||
x, y, w, h, expander_style);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: native_paint_extension
|
||||
* Signature: (IIILjava/lang/String;IIIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1extension(
|
||||
JNIEnv *env, jobject this,
|
||||
jint widget_type, jint state, jint shadow_type, jstring detail,
|
||||
jint x, jint y, jint w, jint h, jint placement)
|
||||
{
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->paint_extension(widget_type, state, shadow_type,
|
||||
getStrFor(env, detail), x, y, w, h, placement);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: native_paint_flat_box
|
||||
* Signature: (IIILjava/lang/String;IIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1flat_1box(
|
||||
JNIEnv *env, jobject this,
|
||||
jint widget_type, jint state, jint shadow_type, jstring detail,
|
||||
jint x, jint y, jint w, jint h, jboolean has_focus)
|
||||
{
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->paint_flat_box(widget_type, state, shadow_type,
|
||||
getStrFor(env, detail), x, y, w, h, has_focus);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: native_paint_focus
|
||||
* Signature: (IILjava/lang/String;IIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1focus(
|
||||
JNIEnv *env, jobject this,
|
||||
jint widget_type, jint state, jstring detail,
|
||||
jint x, jint y, jint w, jint h)
|
||||
{
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->paint_focus(widget_type, state, getStrFor(env, detail),
|
||||
x, y, w, h);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: native_paint_handle
|
||||
* Signature: (IIILjava/lang/String;IIIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1handle(
|
||||
JNIEnv *env, jobject this,
|
||||
jint widget_type, jint state, jint shadow_type, jstring detail,
|
||||
jint x, jint y, jint w, jint h, jint orientation)
|
||||
{
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->paint_handle(widget_type, state, shadow_type, getStrFor(env, detail),
|
||||
x, y, w, h, orientation);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: native_paint_hline
|
||||
* Signature: (IILjava/lang/String;IIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1hline(
|
||||
JNIEnv *env, jobject this,
|
||||
jint widget_type, jint state, jstring detail,
|
||||
jint x, jint y, jint w, jint h)
|
||||
{
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->paint_hline(widget_type, state, getStrFor(env, detail),
|
||||
x, y, w, h);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: native_paint_option
|
||||
* Signature: (IILjava/lang/String;IIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1option(
|
||||
JNIEnv *env, jobject this,
|
||||
jint widget_type, jint synth_state, jstring detail,
|
||||
jint x, jint y, jint w, jint h)
|
||||
{
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->paint_option(widget_type, synth_state, getStrFor(env, detail),
|
||||
x, y, w, h);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: native_paint_shadow
|
||||
* Signature: (IIILjava/lang/String;IIIIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1shadow(
|
||||
JNIEnv *env, jobject this,
|
||||
jint widget_type, jint state, jint shadow_type, jstring detail,
|
||||
jint x, jint y, jint w, jint h,
|
||||
jint synth_state, jint dir)
|
||||
{
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->paint_shadow(widget_type, state, shadow_type, getStrFor(env, detail),
|
||||
x, y, w, h, synth_state, dir);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: native_paint_slider
|
||||
* Signature: (IIILjava/lang/String;IIIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1slider(
|
||||
JNIEnv *env, jobject this,
|
||||
jint widget_type, jint state, jint shadow_type, jstring detail,
|
||||
jint x, jint y, jint w, jint h, jint orientation, jboolean has_focus)
|
||||
{
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->paint_slider(widget_type, state, shadow_type, getStrFor(env, detail),
|
||||
x, y, w, h, orientation, has_focus);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: native_paint_vline
|
||||
* Signature: (IILjava/lang/String;IIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1vline(
|
||||
JNIEnv *env, jobject this,
|
||||
jint widget_type, jint state, jstring detail,
|
||||
jint x, jint y, jint w, jint h)
|
||||
{
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->paint_vline(widget_type, state, getStrFor(env, detail),
|
||||
x, y, w, h);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: native_paint_background
|
||||
* Signature: (IIIIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1background(
|
||||
JNIEnv *env, jobject this, jint widget_type, jint state,
|
||||
jint x, jint y, jint w, jint h)
|
||||
{
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->paint_background(widget_type, state, x, y, w, h);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: nativeStartPainting
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeStartPainting(
|
||||
JNIEnv *env, jobject this, jint w, jint h)
|
||||
{
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->init_painting(env, w, h);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: nativeFinishPainting
|
||||
* Signature: ([III)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeFinishPainting(
|
||||
JNIEnv *env, jobject this, jintArray dest, jint width, jint height)
|
||||
{
|
||||
jint transparency;
|
||||
gint *buffer = (gint*) (*env)->GetPrimitiveArrayCritical(env, dest, 0);
|
||||
gtk->gdk_threads_enter();
|
||||
transparency = gtk->copy_image(buffer, width, height);
|
||||
gtk->gdk_threads_leave();
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, dest, buffer, 0);
|
||||
return transparency;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: native_switch_theme
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1switch_1theme(
|
||||
JNIEnv *env, jobject this)
|
||||
{
|
||||
// Note that flush_gtk_event_loop takes care of locks (7053002)
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->flush_event_loop();
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: native_get_gtk_setting
|
||||
* Signature: (I)Ljava/lang/Object;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1get_1gtk_1setting(
|
||||
JNIEnv *env, jobject this, jint property)
|
||||
{
|
||||
jobject obj;
|
||||
gtk->gdk_threads_enter();
|
||||
obj = gtk->get_setting(env, property);
|
||||
gtk->gdk_threads_leave();
|
||||
return obj;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKEngine
|
||||
* Method: nativeSetRangeValue
|
||||
* Signature: (IDDDD)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeSetRangeValue(
|
||||
JNIEnv *env, jobject this, jint widget_type,
|
||||
jdouble value, jdouble min, jdouble max, jdouble visible)
|
||||
{
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->set_range_value(widget_type, value, min, max, visible);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "gtk_interface.h"
|
||||
#include "com_sun_java_swing_plaf_gtk_GTKStyle.h"
|
||||
|
||||
const char *getStrFor(JNIEnv *env, jstring val);
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKStyle
|
||||
* Method: nativeGetXThickness
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetXThickness(
|
||||
JNIEnv *env, jclass klass, jint widget_type)
|
||||
{
|
||||
jint ret;
|
||||
gtk->gdk_threads_enter();
|
||||
ret = gtk->get_xthickness(env, widget_type);
|
||||
gtk->gdk_threads_leave();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKStyle
|
||||
* Method: nativeGetYThickness
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetYThickness(
|
||||
JNIEnv *env, jclass klass, jint widget_type)
|
||||
{
|
||||
jint ret;
|
||||
gtk->gdk_threads_enter();
|
||||
ret = gtk->get_ythickness(env, widget_type);
|
||||
gtk->gdk_threads_leave();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKStyle
|
||||
* Method: nativeGetColorForState
|
||||
* Signature: (III)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetColorForState(
|
||||
JNIEnv *env, jclass klass, jint widget_type,
|
||||
jint state_type, jint type_id)
|
||||
{
|
||||
jint ret;
|
||||
gtk->gdk_threads_enter();
|
||||
ret = gtk->get_color_for_state(env, widget_type, state_type, type_id);
|
||||
gtk->gdk_threads_leave();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKStyle
|
||||
* Method: nativeGetClassValue
|
||||
* Signature: (ILjava/lang/String;)Ljava/lang/Object;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetClassValue(
|
||||
JNIEnv *env, jclass klass, jint widget_type, jstring key)
|
||||
{
|
||||
jobject ret;
|
||||
gtk->gdk_threads_enter();
|
||||
ret = gtk->get_class_value(env, widget_type, getStrFor(env, key));
|
||||
gtk->gdk_threads_leave();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_sun_java_swing_plaf_gtk_GTKStyle
|
||||
* Method: nativeGetPangoFontName
|
||||
* Signature: (I)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetPangoFontName(
|
||||
JNIEnv *env, jclass klass, jint widget_type)
|
||||
{
|
||||
jstring ret;
|
||||
gtk->gdk_threads_enter();
|
||||
ret = gtk->get_pango_font_name(env, widget_type);
|
||||
gtk->gdk_threads_leave();
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1,380 +0,0 @@
|
|||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/* $XConsortium: wsutils.h /main/3 1996/10/14 15:04:17 swick $ */
|
||||
/** ------------------------------------------------------------------------
|
||||
This file contains routines for manipulating generic lists.
|
||||
Lists are implemented with a "harness". In other words, each
|
||||
node in the list consists of two pointers, one to the data item
|
||||
and one to the next node in the list. The head of the list is
|
||||
the same struct as each node, but the "item" ptr is used to point
|
||||
to the current member of the list (used by the first_in_list and
|
||||
next_in_list functions).
|
||||
|
||||
This file is available under and governed by the GNU General Public
|
||||
License version 2 only, as published by the Free Software Foundation.
|
||||
However, the following notice accompanied the original version of this
|
||||
file:
|
||||
|
||||
Copyright (c) 1994 Hewlett-Packard Co.
|
||||
Copyright (c) 1996 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall
|
||||
not be used in advertising or otherwise to promote the sale, use or
|
||||
other dealings in this Software without prior written authorization
|
||||
from the X Consortium.
|
||||
|
||||
------------------------------------------------------------------------ **/
|
||||
/******************************************************************************
|
||||
*
|
||||
* This file contains various typedef's, macros and procedure declarations for
|
||||
* a set of example utility procedures contained in the file "wsutils.c".
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/* This is the actual structure returned by the X server describing the
|
||||
* SERVER_OVERLAY_VISUAL property.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
VisualID visualID; /* The VisualID of the overlay visual */
|
||||
long transparentType; /* Can be None, TransparentPixel or
|
||||
* TransparentMask */
|
||||
long value; /* Pixel value */
|
||||
long layer; /* Overlay planes will always be in
|
||||
* layer 1 */
|
||||
} OverlayVisualPropertyRec;
|
||||
|
||||
|
||||
/* This is structure also describes the SERVER_OVERLAY_VISUAL property, but
|
||||
* should be more useful than the one actually returned by the X server
|
||||
* because it actually points to the visual's XVisualInfo struct rather than
|
||||
* refering to the visual's ID.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
XVisualInfo *pOverlayVisualInfo; /* Pointer to the XVisualInfo struct */
|
||||
long transparentType; /* Can be None, TransparentPixel or
|
||||
* TransparentMask */
|
||||
long value; /* Pixel value */
|
||||
long layer; /* Overlay planes will always be in
|
||||
* layer 1 */
|
||||
} OverlayInfo;
|
||||
|
||||
|
||||
/* These macros are the values of the "transparentType" above: */
|
||||
#ifndef None
|
||||
#define None 0
|
||||
#endif
|
||||
#ifndef TransparentPixel
|
||||
#define TransparentPixel 1
|
||||
#endif
|
||||
|
||||
|
||||
/* These macros define how flexible a program is when it requests a window's
|
||||
* creation with either the CreateImagePlanesWindow() or
|
||||
* CreateOverlayPlanesWindow():
|
||||
*/
|
||||
#ifndef NOT_FLEXIBLE
|
||||
#define NOT_FLEXIBLE 0
|
||||
#define FLEXIBLE 1
|
||||
#endif
|
||||
|
||||
|
||||
/* These macros define the values of the "sbCmapHint" parameter of the
|
||||
* CreateImagePlanesWindow():
|
||||
*/
|
||||
#ifndef SB_CMAP_TYPE_NORMAL
|
||||
#define SB_CMAP_TYPE_NORMAL 1
|
||||
#endif
|
||||
|
||||
#ifndef SB_CMAP_TYPE_MONOTONIC
|
||||
#define SB_CMAP_TYPE_MONOTONIC 2
|
||||
#endif
|
||||
|
||||
#ifndef SB_CMAP_TYPE_FULL
|
||||
#define SB_CMAP_TYPE_FULL 4
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* GetXVisualInfo()
|
||||
*
|
||||
* This routine takes an X11 Display, screen number, and returns whether the
|
||||
* screen supports transparent overlays and three arrays:
|
||||
*
|
||||
* 1) All of the XVisualInfo struct's for the screen.
|
||||
* 2) All of the OverlayInfo struct's for the screen.
|
||||
* 3) An array of pointers to the screen's image plane XVisualInfo
|
||||
* structs.
|
||||
*
|
||||
* The code below obtains the array of all the screen's visuals, and obtains
|
||||
* the array of all the screen's overlay visual information. It then processes
|
||||
* the array of the screen's visuals, determining whether the visual is an
|
||||
* overlay or image visual.
|
||||
*
|
||||
* If the routine sucessfully obtained the visual information, it returns zero.
|
||||
* If the routine didn't obtain the visual information, it returns non-zero.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
extern int32_t GetXVisualInfo(
|
||||
#if NeedFunctionPrototypes
|
||||
Display *display, /* Which X server (aka "display"). */
|
||||
int32_t screen, /* Which screen of the "display". */
|
||||
int32_t *transparentOverlays, /* Non-zero if there's at least one
|
||||
* overlay visual and if at least one
|
||||
* of those supports a transparent
|
||||
* pixel. */
|
||||
int32_t *numVisuals, /* Number of XVisualInfo struct's
|
||||
* pointed to by pVisuals. */
|
||||
XVisualInfo **pVisuals, /* All of the device's visuals. */
|
||||
int32_t *numOverlayVisuals, /* Number of OverlayInfo's pointed
|
||||
* to by pOverlayVisuals. If this
|
||||
* number is zero, the device does
|
||||
* not have overlay planes. */
|
||||
OverlayInfo **pOverlayVisuals, /* The device's overlay plane visual
|
||||
* information. */
|
||||
int32_t *numImageVisuals, /* Number of XVisualInfo's pointed
|
||||
* to by pImageVisuals. */
|
||||
XVisualInfo ***pImageVisuals /* The device's image visuals. */
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FreeXVisualInfo()
|
||||
*
|
||||
* This routine frees the data that was allocated by GetXVisualInfo().
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
extern void FreeXVisualInfo(
|
||||
#if NeedFunctionPrototypes
|
||||
XVisualInfo *pVisuals,
|
||||
OverlayInfo *pOverlayVisuals,
|
||||
XVisualInfo **pImageVisuals
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FindImagePlanesVisual()
|
||||
*
|
||||
* This routine attempts to find a visual to use to create an image planes
|
||||
* window based upon the information passed in.
|
||||
*
|
||||
* The "Hint" values give guides to the routine as to what the program wants.
|
||||
* The "depthFlexibility" value tells the routine how much the program wants
|
||||
* the actual "depthHint" specified. If the program can't live with the
|
||||
* screen's image planes visuals, the routine returns non-zero, and the
|
||||
* "depthObtained" and "pImageVisualToUse" return parameters are NOT valid.
|
||||
* Otherwise, the "depthObtained" and "pImageVisualToUse" return parameters
|
||||
* are valid and the routine returns zero.
|
||||
*
|
||||
* NOTE: This is just an example of what can be done. It may or may not be
|
||||
* useful for any specific application.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
extern int32_t FindImagePlanesVisual(
|
||||
#if NeedFunctionPrototypes
|
||||
Display *display, /* Which X server (aka "display"). */
|
||||
int32_t screen, /* Which screen of the "display". */
|
||||
int32_t numImageVisuals, /* Number of XVisualInfo's pointed
|
||||
* to by pImageVisuals. */
|
||||
XVisualInfo **pImageVisuals, /* The device's image visuals. */
|
||||
int32_t sbCmapHint, /* What Starbase cmap modes will be
|
||||
* used with the visual. NOTE: This
|
||||
* is a mask of the possible values. */
|
||||
int32_t depthHint, /* Desired depth. */
|
||||
int32_t depthFlexibility, /* How much the actual value in
|
||||
* "depthHint" is desired. */
|
||||
Visual **pImageVisualToUse, /* The screen's image visual to use. */
|
||||
int32_t *depthObtained /* Actual depth of the visual. */
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FindOverlayPlanesVisual()
|
||||
*
|
||||
* This routine attempts to find a visual to use to create an overlay planes
|
||||
* window based upon the information passed in.
|
||||
*
|
||||
* While the CreateImagePlanesWindow() routine took a sbCmapHint, this
|
||||
* routine doesn't. Starbase's CMAP_FULL shouldn't be used in overlay planes
|
||||
* windows. This is partially because this functionality is better suited in
|
||||
* the image planes where there are generally more planes, and partially
|
||||
* because the overlay planes generally have PseudoColor visuals with one
|
||||
* color being transparent (the transparent normally being the "white" color
|
||||
* for CMAP_FULL).
|
||||
*
|
||||
* The "depthHint" values give guides to the routine as to what depth the
|
||||
* program wants the window to be. The "depthFlexibility" value tells the
|
||||
* routine how much the program wants the actual "depthHint" specified. If
|
||||
* the program can't live with the screen's overlay planes visuals, the
|
||||
* routine returns non-zero, and the "depthObtained" and "pOverlayVisualToUse"
|
||||
* return parameters are NOT valid. Otherwise, the "depthObtained" and
|
||||
* "pOverlayVisualToUse" return parameters are valid and the routine returns
|
||||
* zero.
|
||||
*
|
||||
* NOTE: This is just an example of what can be done. It may or may not be
|
||||
* useful for any specific application.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
extern int32_t FindOverlayPlanesVisual(
|
||||
#if NeedFunctionPrototypes
|
||||
Display *display, /* Which X server (aka "display"). */
|
||||
int32_t screen, /* Which screen of the "display". */
|
||||
int32_t numOverlayVisuals, /* Number of OverlayInfo's pointed
|
||||
* to by pOverlayVisuals. */
|
||||
OverlayInfo *pOverlayVisuals, /* The device's overlay plane visual
|
||||
* information. */
|
||||
int32_t depthHint, /* Desired depth. */
|
||||
int32_t depthFlexibility, /* How much the actual value in
|
||||
* "depthHint" is desired. */
|
||||
int32_t transparentBackground, /* Non-zero if the visual must have
|
||||
* a transparent color. */
|
||||
Visual **pOverlayVisualToUse, /* The screen's overlay visual to
|
||||
* use. */
|
||||
int32_t *depthObtained, /* Actual depth of the visual. */
|
||||
int32_t *transparentColor /* The transparent color the program
|
||||
* can use with the visual. */
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* CreateImagePlanesWindow()
|
||||
*
|
||||
* This routine creates an image planes window, potentially creates a colormap
|
||||
* for the window to use, and sets the window's standard properties, based
|
||||
* upon the information passed in to the routine. While "created," the window
|
||||
* has not been mapped.
|
||||
*
|
||||
* If the routine suceeds, it returns zero and the return parameters
|
||||
* "imageWindow", "imageColormap" and "mustFreeImageColormap" are valid.
|
||||
* Otherwise, the routine returns non-zero and the return parameters are
|
||||
* NOT valid.
|
||||
*
|
||||
* NOTE: This is just an example of what can be done. It may or may not be
|
||||
* useful for any specific application.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
extern int32_t CreateImagePlanesWindow(
|
||||
#if NeedFunctionPrototypes
|
||||
Display *display, /* Which X server (aka "display"). */
|
||||
int32_t screen, /* Which screen of the "display". */
|
||||
Window parentWindow, /* Window ID of the parent window for
|
||||
* the created window. */
|
||||
int32_t windowX, /* Desired X coord. of the window. */
|
||||
int32_t windowY, /* Desired Y coord of the window. */
|
||||
int32_t windowWidth, /* Desired width of the window. */
|
||||
int32_t windowHeight, /* Desired height of the window. */
|
||||
int32_t windowDepth, /* Desired depth of the window. */
|
||||
Visual *pImageVisualToUse, /* The window's image planes visual. */
|
||||
int32_t argc, /* Program's argc parameter. */
|
||||
char *argv[], /* Program's argv parameter. */
|
||||
char *windowName, /* Name to put on window's border. */
|
||||
char *iconName, /* Name to put on window's icon. */
|
||||
Window *imageWindow, /* Window ID of the created window. */
|
||||
Colormap *imageColormap, /* The window's colormap. */
|
||||
int32_t *mustFreeImageColormap /* Non-zero if the program must call
|
||||
* XFreeColormap() for imageColormap. */
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* CreateOverlayPlanesWindow()
|
||||
*
|
||||
* This routine creates an overlay planes window, potentially creates a colormap
|
||||
* for the window to use, and sets the window's standard properties, based
|
||||
* upon the information passed in to the routine. While "created," the window
|
||||
* has not been mapped.
|
||||
*
|
||||
* If the routine suceeds, it returns zero and the return parameters
|
||||
* "overlayWindow", "overlayColormap" and "mustFreeOverlayColormap" are valid.
|
||||
* Otherwise, the routine returns non-zero and the return parameters are
|
||||
* NOT valid.
|
||||
*
|
||||
* NOTE: This is just an example of what can be done. It may or may not be
|
||||
* useful for any specific application.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
int32_t CreateOverlayPlanesWindow(
|
||||
#if NeedFunctionPrototypes
|
||||
Display *display, /* Which X server (aka "display"). */
|
||||
int32_t screen, /* Which screen of the "display". */
|
||||
Window parentWindow, /* Window ID of the parent window for
|
||||
* the created window. */
|
||||
int32_t windowX, /* Desired X coord. of the window. */
|
||||
int32_t windowY, /* Desired Y coord of the window. */
|
||||
int32_t windowWidth, /* Desired width of the window. */
|
||||
int32_t windowHeight, /* Desired height of the window. */
|
||||
int32_t windowDepth, /* Desired depth of the window. */
|
||||
Visual *pOverlayVisualToUse, /* The window's overlay planes visual.*/
|
||||
int32_t argc, /* Program's argc parameter. */
|
||||
char *argv[], /* Program's argv parameter. */
|
||||
char *windowName, /* Name to put on window's border. */
|
||||
char *iconName, /* Name to put on window's icon. */
|
||||
int32_t transparentBackground, /* Non-zero if the window's background
|
||||
* should be a transparent color. */
|
||||
int32_t *transparentColor, /* The transparent color to use as the
|
||||
* window's background. */
|
||||
Window *overlayWindow, /* Window ID of the created window. */
|
||||
Colormap *overlayColormap, /* The window's colormap. */
|
||||
int32_t *mustFreeOverlayColormap/* Non-zero if the program must call
|
||||
* XFreeColormap() for
|
||||
* overlayColormap. */
|
||||
#endif
|
||||
);
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,145 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include "GraphicsPrimitiveMgr.h"
|
||||
#include "Region.h"
|
||||
#include "Trace.h"
|
||||
#include "X11SurfaceData.h"
|
||||
|
||||
/*#include <xcb/xcb.h>*/
|
||||
#include <X11/extensions/Xrender.h>
|
||||
|
||||
#ifndef RepeatNone /* added in 0.10 */
|
||||
#define RepeatNone 0
|
||||
#define RepeatNormal 1
|
||||
#define RepeatPad 2
|
||||
#define RepeatReflect 3
|
||||
#endif
|
||||
|
||||
|
||||
#include <sys/uio.h>
|
||||
#include <dlfcn.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#ifndef HEADLESS
|
||||
jfieldID pictID;
|
||||
jfieldID xidID;
|
||||
jfieldID blitMaskPMID;
|
||||
jfieldID blitMaskPictID;
|
||||
#endif /* !HEADLESS */
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_java2d_xr_XRSurfaceData_initXRPicture(JNIEnv *env, jobject xsd,
|
||||
jlong pXSData,
|
||||
jint pictFormat)
|
||||
{
|
||||
#ifndef HEADLESS
|
||||
|
||||
X11SDOps *xsdo;
|
||||
XRenderPictFormat *fmt;
|
||||
|
||||
J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_initXRender");
|
||||
|
||||
xsdo = (X11SDOps *) jlong_to_ptr(pXSData);
|
||||
if (xsdo == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (xsdo->xrPic == None) {
|
||||
XRenderPictureAttributes pict_attr;
|
||||
pict_attr.repeat = RepeatNone;
|
||||
fmt = XRenderFindStandardFormat(awt_display, pictFormat);
|
||||
xsdo->xrPic =
|
||||
XRenderCreatePicture(awt_display, xsdo->drawable, fmt,
|
||||
CPRepeat, &pict_attr);
|
||||
}
|
||||
|
||||
(*env)->SetIntField (env, xsd, pictID, xsdo->xrPic);
|
||||
(*env)->SetIntField (env, xsd, xidID, xsdo->drawable);
|
||||
#endif /* !HEADLESS */
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_java2d_xr_XRSurfaceData_initIDs(JNIEnv *env, jclass xsd)
|
||||
{
|
||||
#ifndef HEADLESS
|
||||
J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_initIDs");
|
||||
|
||||
pictID = (*env)->GetFieldID(env, xsd, "picture", "I");
|
||||
if (pictID == NULL) {
|
||||
return;
|
||||
}
|
||||
xidID = (*env)->GetFieldID(env, xsd, "xid", "I");
|
||||
if (xidID == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
XShared_initIDs(env, JNI_FALSE);
|
||||
#endif /* !HEADLESS */
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_java2d_xr_XRSurfaceData_XRInitSurface(JNIEnv *env, jclass xsd,
|
||||
jint depth,
|
||||
jint width, jint height,
|
||||
jlong drawable, jint pictFormat)
|
||||
{
|
||||
#ifndef HEADLESS
|
||||
X11SDOps *xsdo;
|
||||
|
||||
J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_initSurface");
|
||||
|
||||
xsdo = X11SurfaceData_GetOps(env, xsd);
|
||||
if (xsdo == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
XShared_initSurface(env, xsdo, depth, width, height, drawable);
|
||||
#endif /* !HEADLESS */
|
||||
}
|
||||
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture(JNIEnv *env, jobject xsd,
|
||||
jlong pXSData)
|
||||
{
|
||||
#ifndef HEADLESS
|
||||
X11SDOps *xsdo;
|
||||
|
||||
J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_freeXSDOPicture");
|
||||
|
||||
xsdo = X11SurfaceData_GetOps(env, xsd);
|
||||
if (xsdo == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(xsdo->xrPic != None) {
|
||||
XRenderFreePicture(awt_display, xsdo->xrPic);
|
||||
xsdo->xrPic = None;
|
||||
}
|
||||
#endif /* !HEADLESS */
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include "jni_util.h"
|
||||
#include "gtk_interface.h"
|
||||
#include "gnome_interface.h"
|
||||
|
||||
static gboolean gtk_has_been_loaded = FALSE;
|
||||
static gboolean gnome_has_been_loaded = FALSE;
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XDesktopPeer
|
||||
* Method: init
|
||||
* Signature: ()Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XDesktopPeer_init
|
||||
(JNIEnv *env, jclass cls, jint version, jboolean verbose)
|
||||
{
|
||||
|
||||
if (gtk_has_been_loaded || gnome_has_been_loaded) {
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
if (gtk_load(env, version, verbose) && gtk->show_uri_load(env)) {
|
||||
gtk_has_been_loaded = TRUE;
|
||||
return JNI_TRUE;
|
||||
} else if (gnome_load()) {
|
||||
gnome_has_been_loaded = TRUE;
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XDesktopPeer
|
||||
* Method: gnome_url_show
|
||||
* Signature: (Ljava/lang/[B;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XDesktopPeer_gnome_1url_1show
|
||||
(JNIEnv *env, jobject obj, jbyteArray url_j)
|
||||
{
|
||||
gboolean success = FALSE;
|
||||
const gchar* url_c;
|
||||
|
||||
url_c = (char*)(*env)->GetByteArrayElements(env, url_j, NULL);
|
||||
if (url_c == NULL) {
|
||||
if (!(*env)->ExceptionCheck(env)) {
|
||||
JNU_ThrowOutOfMemoryError(env, 0);
|
||||
}
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
if (gtk_has_been_loaded) {
|
||||
gtk->gdk_threads_enter();
|
||||
success = gtk->gtk_show_uri(NULL, url_c, GDK_CURRENT_TIME, NULL);
|
||||
gtk->gdk_threads_leave();
|
||||
} else if (gnome_has_been_loaded) {
|
||||
success = (*gnome_url_show)(url_c, NULL);
|
||||
}
|
||||
|
||||
(*env)->ReleaseByteArrayElements(env, url_j, (signed char*)url_c, 0);
|
||||
|
||||
return success ? JNI_TRUE : JNI_FALSE;
|
||||
}
|
||||
|
|
@ -1,257 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include "jvm_md.h"
|
||||
#include <setjmp.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "jni_util.h"
|
||||
#include "awt_Taskbar.h"
|
||||
|
||||
|
||||
extern JavaVM *jvm;
|
||||
|
||||
#define NO_SYMBOL_EXCEPTION 1
|
||||
|
||||
#define UNITY_LIB_VERSIONED VERSIONED_JNI_LIB_NAME("unity", "9")
|
||||
#define UNITY_LIB JNI_LIB_NAME("unity")
|
||||
|
||||
static jmp_buf j;
|
||||
|
||||
static void *unity_libhandle = NULL;
|
||||
|
||||
static DbusmenuMenuitem* menu = NULL;
|
||||
UnityLauncherEntry* entry = NULL;
|
||||
|
||||
static jclass jTaskbarCls = NULL;
|
||||
static jmethodID jTaskbarCallback = NULL;
|
||||
static jmethodID jMenuItemGetLabel = NULL;
|
||||
|
||||
GList* globalRefs = NULL;
|
||||
|
||||
static void* dl_symbol(const char* name) {
|
||||
void* result = dlsym(unity_libhandle, name);
|
||||
if (!result)
|
||||
longjmp(j, NO_SYMBOL_EXCEPTION);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static gboolean unity_load() {
|
||||
unity_libhandle = dlopen(UNITY_LIB_VERSIONED, RTLD_LAZY | RTLD_LOCAL);
|
||||
if (unity_libhandle == NULL) {
|
||||
unity_libhandle = dlopen(UNITY_LIB, RTLD_LAZY | RTLD_LOCAL);
|
||||
if (unity_libhandle == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
if (setjmp(j) == 0) {
|
||||
fp_unity_launcher_entry_get_for_desktop_file = dl_symbol("unity_launcher_entry_get_for_desktop_file");
|
||||
fp_unity_launcher_entry_set_count = dl_symbol("unity_launcher_entry_set_count");
|
||||
fp_unity_launcher_entry_set_count_visible = dl_symbol("unity_launcher_entry_set_count_visible");
|
||||
fp_unity_launcher_entry_set_urgent = dl_symbol("unity_launcher_entry_set_urgent");
|
||||
fp_unity_launcher_entry_set_progress = dl_symbol("unity_launcher_entry_set_progress");
|
||||
fp_unity_launcher_entry_set_progress_visible = dl_symbol("unity_launcher_entry_set_progress_visible");
|
||||
|
||||
fp_dbusmenu_menuitem_new = dl_symbol("dbusmenu_menuitem_new");
|
||||
fp_dbusmenu_menuitem_property_set = dl_symbol("dbusmenu_menuitem_property_set");
|
||||
fp_dbusmenu_menuitem_property_set_int = dl_symbol("dbusmenu_menuitem_property_set_int");
|
||||
fp_dbusmenu_menuitem_property_get_int = dl_symbol("dbusmenu_menuitem_property_get_int");
|
||||
fp_dbusmenu_menuitem_property_set = dl_symbol("dbusmenu_menuitem_property_set");
|
||||
fp_dbusmenu_menuitem_child_append = dl_symbol("dbusmenu_menuitem_child_append");
|
||||
fp_dbusmenu_menuitem_child_delete = dl_symbol("dbusmenu_menuitem_child_delete");
|
||||
fp_dbusmenu_menuitem_take_children = dl_symbol("dbusmenu_menuitem_take_children");
|
||||
fp_dbusmenu_menuitem_foreach = dl_symbol("dbusmenu_menuitem_foreach");
|
||||
fp_unity_launcher_entry_set_quicklist = dl_symbol("unity_launcher_entry_set_quicklist");
|
||||
fp_unity_launcher_entry_get_quicklist = dl_symbol("unity_launcher_entry_get_quicklist");
|
||||
} else {
|
||||
dlclose(unity_libhandle);
|
||||
unity_libhandle = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void callback(DbusmenuMenuitem* mi, guint ts, jobject data) {
|
||||
JNIEnv* env = (JNIEnv*) JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
(*env)->CallStaticVoidMethod(env, jTaskbarCls, jTaskbarCallback, data);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XTaskbarPeer
|
||||
* Method: init
|
||||
* Signature: (Ljava/lang/String;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XTaskbarPeer_init
|
||||
(JNIEnv *env, jclass cls, jstring jname, jint version, jboolean verbose) {
|
||||
jclass clazz;
|
||||
|
||||
jTaskbarCls = (*env)->NewGlobalRef(env, cls);
|
||||
|
||||
CHECK_NULL_RETURN(jTaskbarCallback =
|
||||
(*env)->GetStaticMethodID(env, cls, "menuItemCallback", "(Ljava/awt/MenuItem;)V"), JNI_FALSE);
|
||||
CHECK_NULL_RETURN(
|
||||
clazz = (*env)->FindClass(env, "java/awt/MenuItem"), JNI_FALSE);
|
||||
CHECK_NULL_RETURN(
|
||||
jMenuItemGetLabel = (*env)->GetMethodID(env, clazz, "getLabel", "()Ljava/lang/String;"), JNI_FALSE);
|
||||
|
||||
if (gtk_load(env, version, verbose) && unity_load()) {
|
||||
const gchar* name = (*env)->GetStringUTFChars(env, jname, NULL);
|
||||
if (name) {
|
||||
entry = fp_unity_launcher_entry_get_for_desktop_file(name);
|
||||
(*env)->ReleaseStringUTFChars(env, jname, name);
|
||||
return JNI_TRUE;
|
||||
}
|
||||
}
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XTaskbarPeer
|
||||
* Method: runloop
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XTaskbarPeer_runloop
|
||||
(JNIEnv *env, jclass cls) {
|
||||
gtk->gdk_threads_enter();
|
||||
gtk->gtk_main();
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XTaskbarPeer
|
||||
* Method: setBadge
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XTaskbarPeer_setBadge
|
||||
(JNIEnv *env, jobject obj, jlong value, jboolean visible) {
|
||||
gtk->gdk_threads_enter();
|
||||
fp_unity_launcher_entry_set_count(entry, value);
|
||||
fp_unity_launcher_entry_set_count_visible(entry, visible);
|
||||
DbusmenuMenuitem* m;
|
||||
if (m = fp_unity_launcher_entry_get_quicklist(entry)) {
|
||||
fp_unity_launcher_entry_set_quicklist(entry, m);
|
||||
}
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XTaskbarPeer
|
||||
* Method: setUrgent
|
||||
* Signature: (Z)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XTaskbarPeer_setUrgent
|
||||
(JNIEnv *env, jobject obj, jboolean urgent) {
|
||||
gtk->gdk_threads_enter();
|
||||
fp_unity_launcher_entry_set_urgent(entry, urgent);
|
||||
DbusmenuMenuitem* m;
|
||||
if (m = fp_unity_launcher_entry_get_quicklist(entry)) {
|
||||
fp_unity_launcher_entry_set_quicklist(entry, m);
|
||||
}
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XTaskbarPeer
|
||||
* Method: updateProgress
|
||||
* Signature: (DZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XTaskbarPeer_updateProgress
|
||||
(JNIEnv *env, jobject obj, jdouble value, jboolean visible) {
|
||||
gtk->gdk_threads_enter();
|
||||
fp_unity_launcher_entry_set_progress(entry, value);
|
||||
fp_unity_launcher_entry_set_progress_visible(entry, visible);
|
||||
DbusmenuMenuitem* m;
|
||||
if (m = fp_unity_launcher_entry_get_quicklist(entry)) {
|
||||
fp_unity_launcher_entry_set_quicklist(entry, m);
|
||||
}
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
void deleteGlobalRef(gpointer data) {
|
||||
JNIEnv* env = (JNIEnv*) JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
(*env)->DeleteGlobalRef(env, data);
|
||||
}
|
||||
|
||||
void fill_menu(JNIEnv *env, jobjectArray items) {
|
||||
int index;
|
||||
jsize length = (*env)->GetArrayLength(env, items);
|
||||
for (index = 0; index < length; index++) {
|
||||
jobject elem = (*env)->GetObjectArrayElement(env, items, index);
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
break;
|
||||
}
|
||||
elem = (*env)->NewGlobalRef(env, elem);
|
||||
|
||||
globalRefs = gtk->g_list_append(globalRefs, elem);
|
||||
|
||||
jstring jlabel = (jstring) (*env)->CallObjectMethod(env, elem, jMenuItemGetLabel);
|
||||
if (!(*env)->ExceptionCheck(env) && jlabel) {
|
||||
const gchar* label = (*env)->GetStringUTFChars(env, jlabel, NULL);
|
||||
if (label) {
|
||||
DbusmenuMenuitem* mi = fp_dbusmenu_menuitem_new();
|
||||
if (!strcmp(label, "-")) {
|
||||
fp_dbusmenu_menuitem_property_set(mi, "type", "separator");
|
||||
} else {
|
||||
fp_dbusmenu_menuitem_property_set(mi, "label", label);
|
||||
}
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, jlabel, label);
|
||||
fp_dbusmenu_menuitem_child_append(menu, mi);
|
||||
gtk->g_signal_connect_data(mi, "item_activated",
|
||||
G_CALLBACK(callback), elem, NULL, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XTaskbarPeer
|
||||
* Method: setNativeMenu
|
||||
* Signature: ([Ljava/awt/MenuItem;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XTaskbarPeer_setNativeMenu
|
||||
(JNIEnv *env, jobject obj, jobjectArray items) {
|
||||
|
||||
gtk->gdk_threads_enter();
|
||||
|
||||
if (!menu) {
|
||||
menu = fp_dbusmenu_menuitem_new();
|
||||
fp_unity_launcher_entry_set_quicklist(entry, menu);
|
||||
}
|
||||
|
||||
GList* list = fp_dbusmenu_menuitem_take_children(menu);
|
||||
gtk->g_list_free_full(list, gtk->g_object_unref);
|
||||
|
||||
gtk->g_list_free_full(globalRefs, deleteGlobalRef);
|
||||
globalRefs = NULL;
|
||||
|
||||
if (items) {
|
||||
fill_menu(env, items);
|
||||
}
|
||||
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#ifndef AWT_TASKBAR_H
|
||||
#define AWT_TASKBAR_H
|
||||
|
||||
#include "gtk_interface.h"
|
||||
|
||||
typedef void UnityLauncherEntry;
|
||||
typedef void DbusmenuMenuitem;
|
||||
|
||||
static UnityLauncherEntry* (*fp_unity_launcher_entry_get_for_desktop_file) (const gchar* desktop_file);
|
||||
|
||||
static void (*fp_unity_launcher_entry_set_count) (UnityLauncherEntry* self, gint64 value);
|
||||
static void (*fp_unity_launcher_entry_set_count_visible) (UnityLauncherEntry* self, gboolean value);
|
||||
|
||||
static void (*fp_unity_launcher_entry_set_urgent) (UnityLauncherEntry* self, gboolean value);
|
||||
|
||||
static void (*fp_unity_launcher_entry_set_progress) (UnityLauncherEntry* self, gdouble value);
|
||||
static void (*fp_unity_launcher_entry_set_progress_visible) (UnityLauncherEntry* self, gboolean value);
|
||||
|
||||
|
||||
static DbusmenuMenuitem* (*fp_dbusmenu_menuitem_new) (void);
|
||||
static gboolean (*fp_dbusmenu_menuitem_property_set) (DbusmenuMenuitem* mi, const gchar* property, const gchar* value);
|
||||
static gboolean (*fp_dbusmenu_menuitem_property_set_int) (DbusmenuMenuitem * mi, const gchar * property, const gint value);
|
||||
static gint (*fp_dbusmenu_menuitem_property_get_int) (const DbusmenuMenuitem * mi, const gchar * property);
|
||||
static gboolean (*fp_dbusmenu_menuitem_child_append) (DbusmenuMenuitem* mi, DbusmenuMenuitem* child);
|
||||
static gboolean (*fp_dbusmenu_menuitem_child_delete) (DbusmenuMenuitem * mi, DbusmenuMenuitem * child);
|
||||
static GList * (*fp_dbusmenu_menuitem_take_children) (DbusmenuMenuitem * mi);
|
||||
static void (*fp_dbusmenu_menuitem_foreach) (DbusmenuMenuitem * mi, void (*func) (DbusmenuMenuitem * mi, gpointer data), gpointer data);
|
||||
static void (*fp_unity_launcher_entry_set_quicklist) (UnityLauncherEntry* self, DbusmenuMenuitem* value);
|
||||
static DbusmenuMenuitem* (*fp_unity_launcher_entry_get_quicklist) (UnityLauncherEntry* self);
|
||||
|
||||
|
||||
#endif /* AWT_TASKBAR_H */
|
||||
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include "gnome_interface.h"
|
||||
|
||||
GNOME_URL_SHOW_TYPE *gnome_url_show = NULL;
|
||||
|
||||
gboolean gnome_load() {
|
||||
void *vfs_handle;
|
||||
void *gnome_handle;
|
||||
const char *errmsg;
|
||||
GNOME_VFS_INIT_TYPE *gnome_vfs_init;
|
||||
|
||||
// trying to open the gnomevfs. VERSIONED_JNI_LIB_NAME
|
||||
// macros formats the library name in a system specific manner
|
||||
// see jdk/src/solaris/javavm/export/jvm_md.h for more details
|
||||
vfs_handle = dlopen(VERSIONED_JNI_LIB_NAME("gnomevfs-2", "0"), RTLD_LAZY);
|
||||
if (vfs_handle == NULL) {
|
||||
// if we cannot load the library using a version assumed by JNI
|
||||
// we are trying to load the library without a version suffix
|
||||
vfs_handle = dlopen(JNI_LIB_NAME("gnomevfs-2"), RTLD_LAZY);
|
||||
if (vfs_handle == NULL) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "can not load libgnomevfs-2.so\n");
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
dlerror(); /* Clear errors */
|
||||
gnome_vfs_init = (GNOME_VFS_INIT_TYPE*)dlsym(vfs_handle, "gnome_vfs_init");
|
||||
if (gnome_vfs_init == NULL){
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "dlsym( gnome_vfs_init) returned NULL\n");
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
if ((errmsg = dlerror()) != NULL) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "can not find symbol gnome_vfs_init %s \n", errmsg);
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
// call gonme_vfs_init()
|
||||
(*gnome_vfs_init)();
|
||||
|
||||
gnome_handle = dlopen(VERSIONED_JNI_LIB_NAME("gnome-2", "0"), RTLD_LAZY);
|
||||
if (gnome_handle == NULL) {
|
||||
gnome_handle = dlopen(JNI_LIB_NAME("gnome-2"), RTLD_LAZY);
|
||||
if (gnome_handle == NULL) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "can not load libgnome-2.so\n");
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
dlerror(); /* Clear errors */
|
||||
gnome_url_show = (GNOME_URL_SHOW_TYPE*)dlsym(gnome_handle, "gnome_url_show");
|
||||
if ((errmsg = dlerror()) != NULL) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "can not find symble gnome_url_show\n");
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#ifndef _GNOME_INTERFACE_H
|
||||
#define _GNOME_INTERFACE_H
|
||||
#include "gtk_interface.h"
|
||||
#include <dlfcn.h>
|
||||
#include <jvm_md.h>
|
||||
#include <jni.h>
|
||||
|
||||
typedef gboolean (GNOME_URL_SHOW_TYPE)(const char *, void **);
|
||||
typedef gboolean (GNOME_VFS_INIT_TYPE)(void);
|
||||
|
||||
extern GNOME_URL_SHOW_TYPE *gnome_url_show;
|
||||
gboolean gnome_load();
|
||||
|
||||
#endif /* !_GNOME_INTERFACE_H */
|
||||
|
|
@ -19,9 +19,9 @@ struct PotatoBridge {
|
|||
ANativeWindow* androidWindow;
|
||||
void* androidDisplay;
|
||||
|
||||
void* eglContext;
|
||||
void* eglDisplay;
|
||||
void* eglSurface;
|
||||
EGLContext* eglContext;
|
||||
EGLDisplay eglDisplay;
|
||||
EGLSurface eglSurface;
|
||||
/*
|
||||
void* eglSurfaceRead;
|
||||
void* eglSurfaceDraw;
|
||||
|
|
@ -98,7 +98,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv*
|
|||
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
|
||||
potatoBridge.eglContext = eglCreateContext(potatoBridge.eglDisplay, config, EGL_NO_CONTEXT, ctx_attribs);
|
||||
potatoBridge.eglContext = &eglCreateContext(potatoBridge.eglDisplay, config, EGL_NO_CONTEXT, ctx_attribs);
|
||||
if (!potatoBridge.eglContext) {
|
||||
printf("Error: eglCreateContext failed\n");
|
||||
return JNI_FALSE;
|
||||
|
|
@ -107,7 +107,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv*
|
|||
// test eglQueryContext()
|
||||
{
|
||||
EGLint val;
|
||||
eglQueryContext(potatoBridge.eglDisplay, potatoBridge.eglContext, EGL_CONTEXT_CLIENT_VERSION, &val);
|
||||
eglQueryContext(potatoBridge.eglDisplay, *potatoBridge.eglContext, EGL_CONTEXT_CLIENT_VERSION, &val);
|
||||
assert(val == 2);
|
||||
}
|
||||
|
||||
|
|
@ -133,12 +133,12 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv*
|
|||
*/
|
||||
printf("EGLBridge: Making current\n");
|
||||
printf("EGLContext=%p, EGLDisplay=%p, EGLSurface=%p\n",
|
||||
potatoBridge.eglContext,
|
||||
*potatoBridge.eglContext,
|
||||
potatoBridge.eglDisplay,
|
||||
potatoBridge.eglSurface
|
||||
);
|
||||
|
||||
EGLBoolean success = eglMakeCurrent(potatoBridge.eglDisplay, potatoBridge.eglSurface, potatoBridge.eglSurface, potatoBridge.eglContext);
|
||||
EGLBoolean success = eglMakeCurrent(potatoBridge.eglDisplay, potatoBridge.eglSurface, potatoBridge.eglSurface, *potatoBridge.eglContext);
|
||||
if (success == EGL_FALSE) {
|
||||
printf("Error: eglMakeCurrent() failed: %p\n", eglGetError());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue