本文整理汇总了C++中JAWT_DrawingSurface类的典型用法代码示例。如果您正苦于以下问题:C++ JAWT_DrawingSurface类的具体用法?C++ JAWT_DrawingSurface怎么用?C++ JAWT_DrawingSurface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JAWT_DrawingSurface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_AWTSurfaceLock_lockAndInitHandle
(JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject canvas) {
JAWT awt;
JAWT_DrawingSurface* ds;
JAWT_DrawingSurfaceInfo *dsi;
AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle);
awt.version = JAWT_VERSION_1_4;
if (JAWT_GetAWT(env, &awt) == JNI_FALSE) {
throwException(env, "Could not get the JAWT interface");
return JNI_FALSE;
}
ds = awt.GetDrawingSurface(env, canvas);
if (ds == NULL) {
throwException(env, "Could not get the drawing surface");
return JNI_FALSE;
}
if((ds->Lock(ds) & JAWT_LOCK_ERROR) != 0) {
awt.FreeDrawingSurface(ds);
throwException(env, "Could not lock the drawing surface");
return JNI_FALSE;
}
dsi = ds->GetDrawingSurfaceInfo(ds);
if (dsi != NULL) {
awt_lock->awt = awt;
awt_lock->ds = ds;
awt_lock->dsi = dsi;
return JNI_TRUE;
}
ds->Unlock(ds);
awt.FreeDrawingSurface(ds);
return JNI_FALSE;
}
示例2: SWT_AWT_NATIVE
JNIEXPORT void JNICALL SWT_AWT_NATIVE(setDebug)
(JNIEnv *env, jclass that, jobject frame, jboolean debug)
{
JAWT awt;
JAWT_DrawingSurface* ds;
JAWT_DrawingSurfaceInfo* dsi;
JAWT_X11DrawingSurfaceInfo* dsi_x11;
jint lock;
awt.version = JAWT_VERSION_1_3;
if (JAWT_GetAWT(env, &awt) != 0) {
ds = awt.GetDrawingSurface(env, frame);
if (ds != NULL) {
lock = ds->Lock(ds);
if ((lock & JAWT_LOCK_ERROR) == 0) {
dsi = ds->GetDrawingSurfaceInfo(ds);
dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo;
XSynchronize(dsi_x11->display, debug);
ds->FreeDrawingSurfaceInfo(dsi);
ds->Unlock(ds);
}
}
awt.FreeDrawingSurface(ds);
}
}
示例3: SWT_AWT_NATIVE
JNIEXPORT jintLong JNICALL SWT_AWT_NATIVE(getAWTHandle)
(JNIEnv *env, jclass that, jobject canvas)
{
JAWT awt;
JAWT_DrawingSurface* ds;
JAWT_DrawingSurfaceInfo* dsi;
JAWT_Win32DrawingSurfaceInfo* dsi_win;
jintLong result = 0;
jint lock;
awt.version = JAWT_VERSION_1_3;
if (JAWT_GetAWT(env, &awt) != 0) {
ds = awt.GetDrawingSurface(env, canvas);
if (ds != NULL) {
lock = ds->Lock(ds);
if ((lock & JAWT_LOCK_ERROR) == 0) {
dsi = ds->GetDrawingSurfaceInfo(ds);
dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
result = (jintLong)dsi_win->hwnd;
ds->FreeDrawingSurfaceInfo(dsi);
ds->Unlock(ds);
}
}
awt.FreeDrawingSurface(ds);
}
return result;
}
示例4: printf
static inline jboolean wrapped_Java_bor_util_JAWT_getRectangle0
(JNIEnv* env, jclass clazz, jlong dsHandle, jintArray obj_val, int* val) {
//@line:515
#ifndef VK_USE_PLATFORM_ANDROID_KHR
JAWT_DrawingSurface *ds;
JAWT_DrawingSurfaceInfo* dsi;
jint lock;
ds = reinterpret_cast<JAWT_DrawingSurface *>(dsHandle);
ds->env = env;
lock = ds->Lock(ds);
if ( (lock & JAWT_LOCK_ERROR) != 0 ) {
printf("Error locking surface \n");
return JNI_FALSE;
}
// update dsi
dsi = ds->GetDrawingSurfaceInfo(ds);
val[0] = dsi->bounds.x;
val[1] = dsi->bounds.y;
val[2] = dsi->bounds.width;
val[3] = dsi->bounds.height;
// Free the drawing surface info
ds->FreeDrawingSurfaceInfo(dsi);
// unlock the drawing surface
ds->Unlock(ds);
return JNI_TRUE;
#elif
return JNI_FALSE;
#endif
}
示例5: MOZILLA_NATIVE
extern "C" NS_EXPORT jlong JNICALL
MOZILLA_NATIVE(getNativeHandleFromAWT) (JNIEnv* env, jobject clazz,
jobject widget)
{
PRUint64 handle = 0;
#ifdef XP_MACOSX
JAWT awt;
awt.version = JAWT_VERSION_1_4;
jboolean result = JAWT_GetAWT(env, &awt);
if (result == JNI_FALSE)
return 0;
JAWT_DrawingSurface* ds = awt.GetDrawingSurface(env, widget);
if (ds != nullptr) {
jint lock = ds->Lock(ds);
if (!(lock & JAWT_LOCK_ERROR)) {
JAWT_DrawingSurfaceInfo* dsi = ds->GetDrawingSurfaceInfo(ds);
if (dsi) {
handle = GetPlatformHandle(dsi);
ds->FreeDrawingSurfaceInfo(dsi);
}
ds->Unlock(ds);
}
awt.FreeDrawingSurface(ds);
}
#else
NS_WARNING("getNativeHandleFromAWT JNI method not implemented");
#endif
return handle;
}
示例6: Java_bor_util_JAWT_getDrawingSurfaceWindowIdAWT
JNIEXPORT jlong JNICALL Java_bor_util_JAWT_getDrawingSurfaceWindowIdAWT(JNIEnv* env, jclass clazz, jobject canvas, jlong dsHandle, jlong dsiHandle, jlong display, jint screen) {
//@line:233
#ifndef VK_USE_PLATFORM_ANDROID_KHR
JAWT_DrawingSurface *ds = reinterpret_cast<JAWT_DrawingSurface*>(dsHandle);
JAWT_DrawingSurfaceInfo *dsi = reinterpret_cast<JAWT_DrawingSurfaceInfo *>(dsiHandle);
jint lock;
jlong window;
ds->env = env;
lock = ds->Lock(ds);
if ( (lock & JAWT_LOCK_ERROR) != 0 ) {
printf("Error locking surface \n");
ds->Unlock(ds);
lock = ds->Lock(ds);
}
#ifdef VK_USE_PLATFORM_WIN32_KHR
JAWT_Win32DrawingSurfaceInfo *dsi_win = (JAWT_Win32DrawingSurfaceInfo*) dsi->platformInfo;
window = (jlong)dsi_win->hwnd;
#else
JAWT_X11DrawingSurfaceInfo *dsi_x11 = (JAWT_X11DrawingSurfaceInfo*) dsi->platformInfo;
window = (jint)dsi_x11->drawable;
#endif
ds->Unlock(ds);
return reinterpret_cast<jlong>(window);
#elif
return (jlong)0;
#endif
}
示例7: SetWindowLong
/*****************************************************************************
*
* Class : NativeView
* Method : getNativeWindow
* Signature : ()J
* Description: returns the native systemw window handle of this object
*/
JNIEXPORT jlong JNICALL Java_NativeView_getNativeWindow
(JNIEnv * env, jobject obj_this)
{
jboolean result ;
jint lock ;
JAWT awt ;
JAWT_DrawingSurface* ds ;
JAWT_DrawingSurfaceInfo* dsi ;
JAWT_Win32DrawingSurfaceInfo* dsi_win ;
HDC hdc ;
HWND hWnd ;
LONG hFuncPtr;
/* Get the AWT */
awt.version = JAWT_VERSION_1_3;
result = JAWT_GetAWT(env, &awt);
MY_ASSERT(result!=JNI_FALSE,"wrong jawt version");
/* Get the drawing surface */
if ((ds = awt.GetDrawingSurface(env, obj_this)) == NULL)
return 0L;
/* Lock the drawing surface */
lock = ds->Lock(ds);
MY_ASSERT((lock & JAWT_LOCK_ERROR)==0,"can't lock the drawing surface");
/* Get the drawing surface info */
dsi = ds->GetDrawingSurfaceInfo(ds);
/* Get the platform-specific drawing info */
dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
hdc = dsi_win->hdc;
hWnd = dsi_win->hwnd;
/* Free the drawing surface info */
ds->FreeDrawingSurfaceInfo(dsi);
/* Unlock the drawing surface */
ds->Unlock(ds);
/* Free the drawing surface */
awt.FreeDrawingSurface(ds);
/* Register own window procedure
Do it one times only! Otherwhise
multiple instances will be registered
and calls on such construct produce
a stack overflow.
*/
if (GetProp( hWnd, OLD_PROC_KEY )==0)
{
hFuncPtr = SetWindowLong( hWnd, GWL_WNDPROC, (DWORD)NativeViewWndProc );
SetProp( hWnd, OLD_PROC_KEY, (HANDLE)hFuncPtr );
}
return ((jlong)hWnd);
}
示例8: printf
JNIEXPORT jint JNICALL Java_vnmr_ui_VNMRFrame_syncXwin
(JNIEnv *env, jobject obj, jobject source)
{
JAWT awt;
JAWT_DrawingSurface *ds;
JAWT_DrawingSurfaceInfo *dsi;
JAWT_X11DrawingSurfaceInfo *dsi_win;
Display* dpy;
Drawable xwin;
GC gc;
jint ret;
jint lock;
ret = 0;
awt.version = JAWT_VERSION_1_4;
if (JAWT_GetAWT(env, &awt) == JNI_FALSE) {
printf(" JAVA AWT not found \n");
return (ret);
}
ds = awt.GetDrawingSurface(env, source);
if (ds == NULL) {
printf(" JAVA Window not found \n");
return (ret);
}
lock = ds->Lock(ds);
if ((lock & JAWT_LOCK_ERROR) != 0) {
printf(" JAVA Error on locking window \n");
awt.FreeDrawingSurface(ds);
return (ret);
}
dsi = ds->GetDrawingSurfaceInfo(ds);
if (dsi != NULL) {
dsi_win = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo;
if (dsi_win != NULL) {
xwin = dsi_win->drawable;
dpy = dsi_win->display;
XSynchronize(dpy, 1);
gc = XCreateGC(dpy, xwin, 0, 0);
XSetForeground(dpy, gc, 2);
XFreeGC(dpy, gc);
XSynchronize(dpy, 0);
ret = 1;
}
ds->FreeDrawingSurfaceInfo(dsi);
}
ds->Unlock(ds);
awt.FreeDrawingSurface(ds);
return (ret);
}
示例9: XSync
JNIEXPORT void JNICALL Java_com_turbovnc_vncviewer_Viewport_x11FullScreen
(JNIEnv *env, jobject obj, jboolean on)
{
JAWT awt;
JAWT_DrawingSurface *ds = NULL;
JAWT_DrawingSurfaceInfo *dsi = NULL;
JAWT_X11DrawingSurfaceInfo *x11dsi = NULL;
jfieldID fid;
jclass cls;
awt.version = JAWT_VERSION_1_3;
if (!handle) {
if ((handle = dlopen("libjawt.so", RTLD_LAZY)) == NULL)
_throw(dlerror());
if ((__JAWT_GetAWT =
(__JAWT_GetAWT_type)dlsym(handle, "JAWT_GetAWT")) == NULL)
_throw(dlerror());
}
if (__JAWT_GetAWT(env, &awt) == JNI_FALSE)
_throw("Could not initialize AWT native interface");
if ((ds = awt.GetDrawingSurface(env, obj)) == NULL)
_throw("Could not get drawing surface");
if ((ds->Lock(ds) & JAWT_LOCK_ERROR) != 0)
_throw("Could not lock surface");
if ((dsi = ds->GetDrawingSurfaceInfo(ds)) == NULL)
_throw("Could not get drawing surface info");
if ((x11dsi = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo) == NULL)
_throw("Could not get X11 drawing surface info");
netwm_fullscreen(x11dsi->display, x11dsi->drawable, on);
XSync(x11dsi->display, False);
if ((cls = (*env)->GetObjectClass(env, obj)) == NULL ||
(fid = (*env)->GetFieldID(env, cls, "x11win", "J")) == 0)
_throw("Could not store X window handle");
(*env)->SetLongField(env, obj, fid, x11dsi->drawable);
printf("TurboVNC Helper: %s X11 full-screen mode for window 0x%.8lx\n",
on ? "Enabling" : "Disabling", x11dsi->drawable);
bailout:
if (ds) {
if (dsi) ds->FreeDrawingSurfaceInfo(dsi);
ds->Unlock(ds);
awt.FreeDrawingSurface(ds);
}
}
示例10:
/*****************************************************************************
*
* Class : NativeView
* Method : getNativeWindow
* Signature : ()J
* Description: returns the native systemw window handle of this object
*/
JNIEXPORT jlong JNICALL Java_embeddedobj_test_NativeView_getNativeWindow
(JNIEnv * env, jobject obj_this)
{
jboolean result ;
jint lock ;
JAWT awt ;
JAWT_DrawingSurface* ds ;
JAWT_DrawingSurfaceInfo* dsi ;
#ifdef WNT
JAWT_Win32DrawingSurfaceInfo* dsi_win ;
#else
// FIXME: Where is dsi_x11 defined?
// Added below because I'm guessing this test breaks
// JAWT_X11DrawingSurfaceInfo*dsi_x11 ;
#endif
jlong drawable;
/* Get the AWT */
awt.version = JAWT_VERSION_1_3;
result = JAWT_GetAWT(env, &awt);
MY_ASSERT(result!=JNI_FALSE,"wrong jawt version");
/* Get the drawing surface */
if ((ds = awt.GetDrawingSurface(env, obj_this)) == NULL)
return 0L;
/* Lock the drawing surface */
lock = ds->Lock(ds);
MY_ASSERT((lock & JAWT_LOCK_ERROR)==0,"can't lock the drawing surface");
/* Get the drawing surface info */
dsi = ds->GetDrawingSurfaceInfo(ds);
/* Get the platform-specific drawing info */
#ifdef WNT
dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
drawable = (jlong)dsi_win->hwnd;
#else
dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo;
drawable = (jlong)dsi_x11->drawable;
#endif
/* Free the drawing surface info */
ds->FreeDrawingSurfaceInfo(dsi);
/* Unlock the drawing surface */
ds->Unlock(ds);
/* Free the drawing surface */
awt.FreeDrawingSurface(ds);
return drawable;
}
示例11: printf
JNIEXPORT void JNICALL Java_com_turbovnc_vncviewer_Viewport_grabKeyboard
(JNIEnv *env, jobject obj, jboolean on, jboolean pointer)
{
JAWT awt;
JAWT_DrawingSurface *ds = NULL;
JAWT_DrawingSurfaceInfo *dsi = NULL;
JAWT_Win32DrawingSurfaceInfo *w32dsi = NULL;
if (on) {
awt.version = JAWT_VERSION_1_3;
if (!handle) {
if ((handle = LoadLibrary("jawt")) == NULL)
_throww32();
if ((__JAWT_GetAWT =
(__JAWT_GetAWT_type)GetProcAddress(handle, "JAWT_GetAWT")) == NULL)
_throww32();
}
if (__JAWT_GetAWT(env, &awt) == JNI_FALSE)
_throw("Could not initialize AWT native interface");
if ((ds = awt.GetDrawingSurface(env, obj)) == NULL)
_throw("Could not get drawing surface");
if ((ds->Lock(ds) & JAWT_LOCK_ERROR) != 0)
_throw("Could not lock surface");
if ((dsi = ds->GetDrawingSurfaceInfo(ds)) == NULL)
_throw("Could not get drawing surface info");
if ((w32dsi = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo) == NULL)
_throw("Could not get Win32 drawing surface info");
LowLevelHook::Activate(w32dsi->hwnd);
printf("TurboVNC Helper: Grabbed keyboard for window 0x%.8llx\n",
(unsigned long long)w32dsi->hwnd);
} else {
LowLevelHook::Deactivate();
printf("TurboVNC Helper: Ungrabbed keyboard\n");
}
bailout:
if (ds) {
if (dsi) ds->FreeDrawingSurfaceInfo(dsi);
ds->Unlock(ds);
awt.FreeDrawingSurface(ds);
}
}
示例12: Java_bor_util_JAWT_unlock0
JNIEXPORT jboolean JNICALL Java_bor_util_JAWT_unlock0(JNIEnv* env, jclass clazz, jlong drawingSurface) {
//@line:448
#ifndef VK_USE_PLATFORM_ANDROID_KHR
JAWT_DrawingSurface *ds = reinterpret_cast<JAWT_DrawingSurface*>(drawingSurface);
ds->env = env;
ds->Unlock(ds);
return JNI_TRUE;
#elif
return JNI_FALSE;
#endif
}
示例13:
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_AWTSurfaceLock_lockAndInitHandle
(JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject canvas) {
JAWT awt;
JAWT_DrawingSurface* ds;
JAWT_DrawingSurfaceInfo *dsi;
AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle);
jboolean result = JNI_FALSE;
#ifdef __MACH__
// try get JAWT with JAWT_MACOSX_USE_CALAYER Opt In
awt.version = JAWT_VERSION_1_4 | 0x80000000;//JAWT_MACOSX_USE_CALAYER;
result = JAWT_GetAWT(env, &awt);
#endif
if (result == JNI_FALSE) {
// now try without CALAYER
awt.version = JAWT_VERSION_1_4;
if (JAWT_GetAWT(env, &awt) == JNI_FALSE) {
throwException(env, "Could not get the JAWT interface");
return JNI_FALSE;
}
}
ds = awt.GetDrawingSurface(env, canvas);
if (ds == NULL) {
throwException(env, "Could not get the drawing surface");
return JNI_FALSE;
}
if((ds->Lock(ds) & JAWT_LOCK_ERROR) != 0) {
awt.FreeDrawingSurface(ds);
throwException(env, "Could not lock the drawing surface");
return JNI_FALSE;
}
dsi = ds->GetDrawingSurfaceInfo(ds);
if (dsi != NULL) {
awt_lock->awt = awt;
awt_lock->ds = ds;
awt_lock->dsi = dsi;
return JNI_TRUE;
}
ds->Unlock(ds);
awt.FreeDrawingSurface(ds);
return JNI_FALSE;
}
示例14: ThrowException
/*
* Class: com_sun_star_beans_LocalOfficeWindow
* Method: getNativeWindow
* Signature: ()J
*/
SAL_DLLPUBLIC_EXPORT jlong JNICALL Java_com_sun_star_comp_beans_LocalOfficeWindow_getNativeWindow
(JNIEnv * env, jobject obj_this)
{
jboolean result;
jint lock;
JAWT awt;
JAWT_DrawingSurface* ds;
JAWT_DrawingSurfaceInfo* dsi;
JAWT_X11DrawingSurfaceInfo* dsi_x11;
Drawable drawable;
/* Get the AWT */
awt.version = JAWT_VERSION_1_3;
result = JAWT_GetAWT(env, &awt);
if (result == JNI_FALSE)
ThrowException(env, "java/lang/RuntimeException", "JAWT_GetAWT failed");
/* Get the drawing surface */
if ((ds = awt.GetDrawingSurface(env, obj_this)) == NULL)
return 0L;
/* Lock the drawing surface */
lock = ds->Lock(ds);
if ( (lock & JAWT_LOCK_ERROR) != 0)
ThrowException(env, "java/lang/RuntimeException",
"Could not get AWT drawing surface.");
/* Get the drawing surface info */
dsi = ds->GetDrawingSurfaceInfo(ds);
/* Get the platform-specific drawing info */
dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo;
drawable = dsi_x11->drawable;
/* Free the drawing surface info */
ds->FreeDrawingSurfaceInfo(dsi);
/* Unlock the drawing surface */
ds->Unlock(ds);
/* Free the drawing surface */
awt.FreeDrawingSurface(ds);
return ((jlong)drawable);
}
示例15: Java_org_jclutter_awt_JClutterCanvas_paint
JNIEXPORT void JNICALL Java_org_jclutter_awt_JClutterCanvas_paint(JNIEnv *env, jobject canvas, jobject graphics){
JAWT awt;
JAWT_DrawingSurface* ds;
JAWT_DrawingSurfaceInfo* dsi;
JAWT_Win32DrawingSurfaceInfo* dsi_win;
jboolean result;
jint lock;
// Get the AWT
awt.version = JAWT_VERSION_1_3;
result = JAWT_GetAWT(env, &awt);
assert(result != JNI_FALSE);
// Get the drawing surface
ds = awt.GetDrawingSurface(env, canvas);
assert(ds != NULL);
// Lock the drawing surface
lock = ds->Lock(ds);
assert((lock & JAWT_LOCK_ERROR) == 0);
// Get the drawing surface info
dsi = ds->GetDrawingSurfaceInfo(ds);
// Get the platform-specific drawing info
dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
// TODO : What to do next ?
HWND hWnd = dsi_win->hwnd;
clutter_win32_set_stage_foreign( clutter_stage_get_default(), hWnd);
// Free the drawing surface info
ds->FreeDrawingSurfaceInfo(dsi);
// Unlock the drawing surface
ds->Unlock(ds);
// Free the drawing surface
awt.FreeDrawingSurface(ds);
}