From http://www.jwz.org/xscreensaver/xscreensaver-5.39.tar.gz
[xscreensaver] / jwxyz / jwxyz-android.h
index 14bfc7feaf29fe7970ded19cff60f9931c0c61d0..1f5ae5220b071ee5fa673b66eca7d797968e4a01 100644 (file)
 #include <GLES/glext.h>
 #include <jni.h>
 
-/* Keep synchronized with check-configs.pl and jwxyz.java. */
-#define API_XLIB 0
-#define API_GL   1
+/* From utils/visual.c. */
+#define DEFAULT_VISUAL -1
+#define GL_VISUAL      -6
 
 struct jwxyz_Drawable {
   enum { WINDOW, PIXMAP } type;
   XRectangle frame;
   union {
+    /* JWXYZ_GL */
     EGLSurface egl_surface;
     GLuint texture; /* If this is 0, it's the default framebuffer. */
+
+    /* JWXYZ_IMAGE */
+    void *image_data;
   };
   union {
     struct {
@@ -45,7 +49,6 @@ struct jwxyz_Drawable {
 
 struct running_hack {
   struct xscreensaver_function_table *xsft;
-  jint api;
   Display *dpy;
   Window window;
   fps_state *fpst;
@@ -53,7 +56,9 @@ struct running_hack {
   JNIEnv *jni_env;
   jobject jobject;
 
-  /* These are set up in Java by the GLSurfaceView. */
+  Bool jwxyz_gl_p, egl_p;
+
+  /* JWXYZ_GL */
   EGLContext egl_ctx;
   EGLSurface egl_surface;
   EGLDisplay egl_display;
@@ -61,15 +66,16 @@ struct running_hack {
 
   EGLConfig egl_config;
 
-  PFNGLBINDFRAMEBUFFEROESPROC glBindFramebufferOES;
-  PFNGLFRAMEBUFFERTEXTURE2DOESPROC glFramebufferTexture2DOES;
-
   struct jwxyz_Drawable frontbuffer;
   GC copy_gc;
   Bool gl_fbo_p, frontbuffer_p;
   GLuint fb_pixmap;
 
   Drawable current_drawable;
+
+  /* JWXYZ_IMAGE */
+  ANativeWindow *native_window;
+
   Bool ignore_rotation_p;
 
   jwzgles_state *gles_state;
@@ -80,16 +86,14 @@ struct running_hack {
 };
 
 
-extern void prepare_context (struct running_hack *rh);
-
-
 // Methods of the Java class org.jwz.jwxyz that are implemented in C.
 
 JNIEXPORT void JNICALL
 Java_org_jwz_xscreensaver_jwxyz_nativeInit (JNIEnv *, jobject thiz,
                                             jstring jhack,
                                             jobject defaults,
-                                            jint w, jint h);
+                                            jint w, jint h,
+                                            jobject jni_surface);
 
 JNIEXPORT void JNICALL
 Java_org_jwz_xscreensaver_jwxyz_nativeResize (JNIEnv *, jobject thiz,
@@ -101,19 +105,6 @@ Java_org_jwz_xscreensaver_jwxyz_nativeRender (JNIEnv *, jobject thiz);
 JNIEXPORT void JNICALL
 Java_org_jwz_xscreensaver_jwxyz_nativeDone (JNIEnv *, jobject thiz);
 
-JNIEXPORT void JNICALL
-Java_org_jwz_xscreensaver_jwxyz_allnativeSettings (JNIEnv *, jobject thiz,
-                                                   jstring jhack,
-                                                   jstring hackPref,
-                                                   jint draw, jstring key);
-
-JNIEXPORT jboolean JNICALL
-Java_org_jwz_xscreensaver_jwxyz_ignoreRotation (JNIEnv *, jobject thiz);
-
-JNIEXPORT jboolean JNICALL
-Java_org_jwz_xscreensaver_jwxyz_suppressRotationAnimation (JNIEnv *,
-                                                           jobject thiz);
-
 JNIEXPORT void JNICALL
 Java_org_jwz_xscreensaver_jwxyz_sendButtonEvent (JNIEnv *, jobject thiz,
                                                  int x, int y, jboolean down);