1 /* xscreensaver, Copyright (c) 2016 Jamie Zawinski <jwz@jwz.org>
3 * Permission to use, copy, modify, distribute, and sell this software and its
4 * documentation for any purpose is hereby granted without fee, provided that
5 * the above copyright notice appear in all copies and that both that
6 * copyright notice and this permission notice appear in supporting
7 * documentation. No representations are made about the suitability of this
8 * software for any purpose. It is provided "as is" without express or
12 #ifndef __JWXYZ_ANDROID_H__
13 #define __JWXYZ_ANDROID_H__
16 #include "../hacks/fps.h"
18 #include <android/log.h>
22 /* Keep synchronized with check-configs.pl and jwxyz.java. */
27 struct xscreensaver_function_table *xsft;
36 EGLDisplay egl_display;
38 EGLContext egl_window_ctx, egl_xlib_ctx;
39 Drawable current_drawable;
40 Bool ignore_rotation_p;
42 unsigned long frame_count;
44 struct event_queue *event_queue;
47 struct jwxyz_Drawable {
48 enum { WINDOW, PIXMAP } type;
50 EGLSurface egl_surface;
53 struct running_hack *rh;
54 int last_mouse_x, last_mouse_y;
63 extern void prepare_context (struct running_hack *rh);
66 // Methods of the Java class org.jwz.jwxyz that are implemented in C.
68 JNIEXPORT void JNICALL
69 Java_org_jwz_xscreensaver_jwxyz_nativeInit (JNIEnv *, jobject thiz,
70 jstring jhack, jint api,
74 JNIEXPORT void JNICALL
75 Java_org_jwz_xscreensaver_jwxyz_nativeResize (JNIEnv *, jobject thiz,
76 jint w, jint h, jdouble rot);
78 JNIEXPORT jlong JNICALL
79 Java_org_jwz_xscreensaver_jwxyz_nativeRender (JNIEnv *, jobject thiz);
81 JNIEXPORT void JNICALL
82 Java_org_jwz_xscreensaver_jwxyz_nativeDone (JNIEnv *, jobject thiz);
84 JNIEXPORT void JNICALL
85 Java_org_jwz_xscreensaver_jwxyz_allnativeSettings (JNIEnv *, jobject thiz,
88 jint draw, jstring key);
90 JNIEXPORT jboolean JNICALL
91 Java_org_jwz_xscreensaver_jwxyz_ignoreRotation (JNIEnv *, jobject thiz);
93 JNIEXPORT jboolean JNICALL
94 Java_org_jwz_xscreensaver_jwxyz_suppressRotationAnimation (JNIEnv *,
97 JNIEXPORT void JNICALL
98 Java_org_jwz_xscreensaver_jwxyz_sendButtonEvent (JNIEnv *, jobject thiz,
99 int x, int y, jboolean down);
101 JNIEXPORT void JNICALL
102 Java_org_jwz_xscreensaver_jwxyz_sendMotionEvent (JNIEnv *, jobject thiz,
105 JNIEXPORT void JNICALL
106 Java_org_jwz_xscreensaver_jwxyz_sendKeyEvent (JNIEnv *, jobject thiz,
110 #endif // __JWXYZ_ANDROID_H__