summaryrefslogtreecommitdiff
path: root/src/drivers/PicoAndroid
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/PicoAndroid')
-rw-r--r--src/drivers/PicoAndroid/Fl_PicoAndroid_Copy_Surface.cxx1
-rw-r--r--src/drivers/PicoAndroid/Fl_PicoAndroid_Graphics_Driver.H119
-rw-r--r--src/drivers/PicoAndroid/Fl_PicoAndroid_Graphics_Driver.cxx97
-rw-r--r--src/drivers/PicoAndroid/Fl_PicoAndroid_Image_Surface.cxx1
-rw-r--r--src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.H73
-rw-r--r--src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx562
-rw-r--r--src/drivers/PicoAndroid/Fl_PicoAndroid_System_Driver.H1
-rw-r--r--src/drivers/PicoAndroid/Fl_PicoAndroid_System_Driver.cxx1
-rw-r--r--src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.H55
-rw-r--r--src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx122
10 files changed, 0 insertions, 1032 deletions
diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Copy_Surface.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_Copy_Surface.cxx
deleted file mode 100644
index 8b1378917..000000000
--- a/src/drivers/PicoAndroid/Fl_PicoAndroid_Copy_Surface.cxx
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Graphics_Driver.H b/src/drivers/PicoAndroid/Fl_PicoAndroid_Graphics_Driver.H
deleted file mode 100644
index 8c18fd3dd..000000000
--- a/src/drivers/PicoAndroid/Fl_PicoAndroid_Graphics_Driver.H
+++ /dev/null
@@ -1,119 +0,0 @@
-
-//
-// Definition of the Pico Android graphics driver
-// for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 2010-2016 by Bill Spitzak and others.
-//
-// This library is free software. Distribution and use rights are outlined in
-// the file "COPYING" which should have been included with this file. If this
-// file is missing or damaged, see the license at:
-//
-// https://www.fltk.org/COPYING.php
-//
-// Please see the following page on how to report bugs and issues:
-//
-// https://www.fltk.org/bugs.php
-//
-
-/**
- \file Fl_PicoAndroid_Graphics_Driver.H
- \brief Definition of Pico minimal graphics driver.
- */
-
-#ifndef FL_PICOANDROID_GRAPHICS_DRIVER_H
-#define FL_PICOANDROID_GRAPHICS_DRIVER_H
-
-#include "../Pico/Fl_Pico_Graphics_Driver.H"
-
-
-/**
- \brief The Pico minimal SDL graphics class.
-
- This class is implemented as a base class for minimal core SDL drivers.
- */
-class Fl_PicoAndroid_Graphics_Driver : public Fl_Pico_Graphics_Driver {
-protected:
- // CGContextRef gc_;
-public:
- // virtual int has_feature(driver_feature mask) { return mask & NATIVE; }
- // virtual void gc(void *ctxt) {if (ctxt != gc_) global_gc(); gc_ = (CGContextRef)ctxt; }
- // virtual void *gc() {return gc_;}
- // char can_do_alpha_blending();
- //
- // // --- bitmap stuff
- // Fl_Bitmask create_bitmask(int w, int h, const uchar *array);
- // void delete_bitmask(Fl_Bitmask bm);
- // void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
- // void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
- // void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
- // void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
- // void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
- // void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
- // void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
- // void cache(Fl_Pixmap *img);
- // void cache(Fl_Bitmap *img);
- // void cache(Fl_RGB_Image *img);
- // void uncache(Fl_RGB_Image *img, fl_uintptr_t &id_, fl_uintptr_t &mask_);
- // void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
- // void draw_CGImage(CGImageRef cgimg, int x, int y, int w, int h, int srcx, int srcy, int sw, int sh);
- //protected:
- // // --- implementation is in src/fl_rect.cxx which includes src/cfg_gfx/quartz_rect.cxx
- void point(int x, int y);
- // void rect(int x, int y, int w, int h);
- void rectf(int x, int y, int w, int h);
- void line(int x, int y, int x1, int y1);
- // void line(int x, int y, int x1, int y1, int x2, int y2);
- // void xyline(int x, int y, int x1);
- // void xyline(int x, int y, int x1, int y2);
- // void xyline(int x, int y, int x1, int y2, int x3);
- // void yxline(int x, int y, int y1);
- // void yxline(int x, int y, int y1, int x2);
- // void yxline(int x, int y, int y1, int x2, int y3);
- // void loop(int x0, int y0, int x1, int y1, int x2, int y2);
- // void loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
- // void polygon(int x0, int y0, int x1, int y1, int x2, int y2);
- // void polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
- // // --- clipping
- // void push_clip(int x, int y, int w, int h);
- // int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
- // int not_clipped(int x, int y, int w, int h);
- // void push_no_clip();
- // void pop_clip();
- // void restore_clip();
- // // --- implementation is in src/fl_vertex.cxx which includes src/cfg_gfx/xxx_rect.cxx
- // void begin_complex_polygon();
- // void transformed_vertex(double xf, double yf);
- // void vertex(double x, double y);
- // void end_points();
- // void end_line();
- // void end_loop();
- // void end_polygon();
- // void end_complex_polygon();
- // void gap();
- // void circle(double x, double y, double r);
- // // --- implementation is in src/fl_arc.cxx which includes src/cfg_gfx/xxx_arc.cxx if needed
- // // using void Fl_Graphics_Driver::arc(double x, double y, double r, double start, double end);
- // // --- implementation is in src/fl_arci.cxx which includes src/cfg_gfx/xxx_arci.cxx
- // void arc(int x, int y, int w, int h, double a1, double a2);
- // void pie(int x, int y, int w, int h, double a1, double a2);
- // // --- implementation is in src/fl_line_style.cxx which includes src/cfg_gfx/xxx_line_style.cxx
- // void line_style(int style, int width=0, char* dashes=0);
- // // --- implementation is in src/fl_color.cxx which includes src/cfg_gfx/xxx_color.cxx
- // void color(Fl_Color c);
- // Fl_Color color() { return color_; }
- // void color(uchar r, uchar g, uchar b);
- // // --- implementation is in src/fl_font.cxx which includes src/cfg_gfx/xxx_font.cxx
- // void draw(const char *str, int n, int x, int y);
- // void draw(const char *str, int n, float x, float y);
- // void draw(int angle, const char *str, int n, int x, int y);
- // void rtl_draw(const char *str, int n, int x, int y);
- // void font(Fl_Font face, Fl_Fontsize fsize);
- // double width(const char *str, int n);
- // double width(unsigned int c);
- // void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
- // int height();
- // int descent();
-};
-
-#endif // FL_PICOANDROID_GRAPHICS_DRIVER_H
diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Graphics_Driver.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_Graphics_Driver.cxx
deleted file mode 100644
index 856c89d6d..000000000
--- a/src/drivers/PicoAndroid/Fl_PicoAndroid_Graphics_Driver.cxx
+++ /dev/null
@@ -1,97 +0,0 @@
-//
-// Rectangle drawing routines for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2016 by Bill Spitzak and others.
-//
-// This library is free software. Distribution and use rights are outlined in
-// the file "COPYING" which should have been included with this file. If this
-// file is missing or damaged, see the license at:
-//
-// https://www.fltk.org/COPYING.php
-//
-// Please see the following page on how to report bugs and issues:
-//
-// https://www.fltk.org/bugs.php
-//
-
-
-#include <config.h>
-#include "Fl_PicoAndroid_Graphics_Driver.h"
-
-#include <jni.h>
-#include <errno.h>
-
-#include <EGL/egl.h>
-#include <GLES/gl.h>
-
-#include <android/log.h>
-#include <android_native_app_glue.h>
-
-#include <FL/Fl.H>
-
-#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "native-activity", __VA_ARGS__))
-
-
-/*
- By linking this module, the following static method will instantiate the
- PicoSDL Graphics driver as the main display driver.
- */
-Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver()
-{
- return new Fl_PicoAndroid_Graphics_Driver();
-}
-
-
-void Fl_PicoAndroid_Graphics_Driver::rectf(int x, int y, int w, int h)
-{
- GLfloat q3[] = {
- x, y,
- x, y+h-3,
- x+w-3, y+h-3,
- x+w-3, y
- };
-
- uchar r, g, b;
- Fl::get_color(Fl_Graphics_Driver::color(), r, g, b);
- glColor4ub(r, g, b, 255);
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, q3);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- glDisableClientState(GL_VERTEX_ARRAY);
-}
-
-
-void Fl_PicoAndroid_Graphics_Driver::line(int x, int y, int x1, int y1)
-{
- GLfloat q3[] = {
- x, y,
- x1, y1
- };
-
- uchar r, g, b;
- Fl::get_color(Fl_Graphics_Driver::color(), r, g, b);
- glColor4ub(r, g, b, 255);
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, q3);
- glDrawArrays(GL_LINES, 0, 2);
- glDisableClientState(GL_VERTEX_ARRAY);
-}
-
-
-void Fl_PicoAndroid_Graphics_Driver::point(int x, int y)
-{
- GLfloat q3[] = {
- x, y
- };
-
- uchar r, g, b;
- Fl::get_color(Fl_Graphics_Driver::color(), r, g, b);
- glColor4ub(r, g, b, 255);
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, q3);
- glDrawArrays(GL_POINTS, 0, 1);
- glDisableClientState(GL_VERTEX_ARRAY);
-}
diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Image_Surface.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_Image_Surface.cxx
deleted file mode 100644
index 8b1378917..000000000
--- a/src/drivers/PicoAndroid/Fl_PicoAndroid_Image_Surface.cxx
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.H b/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.H
deleted file mode 100644
index 1163296cf..000000000
--- a/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.H
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// Definition of Android Screen interface based on Pico
-// for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 2010-2016 by Bill Spitzak and others.
-//
-// This library is free software. Distribution and use rights are outlined in
-// the file "COPYING" which should have been included with this file. If this
-// file is missing or damaged, see the license at:
-//
-// https://www.fltk.org/COPYING.php
-//
-// Please see the following page on how to report bugs and issues:
-//
-// https://www.fltk.org/bugs.php
-//
-
-/**
- \file Fl_PicoAndroid_Screen_Driver.H
- \brief Definition of SDL Screen interface based on Pico.
- */
-
-#ifndef FL_PICOANDROID_SCREEN_DRIVER_H
-#define FL_PICOANDROID_SCREEN_DRIVER_H
-
-#include "../Pico/Fl_Pico_Screen_Driver.H"
-
-#include <jni.h>
-#include <errno.h>
-
-#include <EGL/egl.h>
-#include <GLES/gl.h>
-
-#include <android/sensor.h>
-#include <android/log.h>
-#include <android_native_app_glue.h>
-
-
-class Fl_PicoAndroid_Window_Driver;
-
-
-class FL_EXPORT Fl_PicoAndroid_Screen_Driver : public Fl_Pico_Screen_Driver
-{
- friend class Fl_PicoAndroid_Window_Driver;
-
- struct android_app* pApp;
- EGLDisplay pDisplay;
- EGLSurface pSurface;
- EGLContext pContext;
- int32_t pWidth;
- int32_t pHeight;
-
- static void handleAppCmdCB(struct android_app* app, int32_t cmd);
- void handleAppCmd(struct android_app* app, int32_t cmd);
- static int32_t handleInputEventCB(struct android_app* app, AInputEvent* event);
- int32_t handleInputEvent(struct android_app* app, AInputEvent* event);
- void initDisplay();
- void termDisplay();
-
-public:
- void drawFrame();
-
-public:
- Fl_PicoAndroid_Screen_Driver();
- virtual ~Fl_PicoAndroid_Screen_Driver();
- virtual double wait(double time_to_wait);
-
-public:
- void android_main(struct android_app* state);
-};
-
-
-#endif // FL_PICOANDROID_SCREEN_DRIVER_H
diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx
deleted file mode 100644
index 5e96125a4..000000000
--- a/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx
+++ /dev/null
@@ -1,562 +0,0 @@
-//
-// Definition of Android Screen interface based on Pico
-//
-// Copyright 1998-2018 by Bill Spitzak and others.
-//
-// This library is free software. Distribution and use rights are outlined in
-// the file "COPYING" which should have been included with this file. If this
-// file is missing or damaged, see the license at:
-//
-// https://www.fltk.org/COPYING.php
-//
-// Please see the following page on how to report bugs and issues:
-//
-// https://www.fltk.org/bugs.php
-//
-
-// http://developer.android.com/ndk/reference/group___native_activity.html
-
-
-#include <config.h>
-#include "Fl_PicoAndroid_Screen_Driver.H"
-
-#include <android/window.h>
-
-#include <FL/platform.H>
-#include <FL/Fl.H>
-#include <FL/Fl_Window.H>
-#include <FL/Fl_Double_Window.H>
-#include "../../Fl_Window_Driver.H"
-#include <FL/Fl_Image_Surface.H>
-#include <FL/Fl_Graphics_Driver.H>
-#include <FL/fl_draw.H>
-
-
-#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "native-activity", __VA_ARGS__))
-#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "native-activity", __VA_ARGS__))
-
-
-
-void Fl_PicoAndroid_Screen_Driver::initDisplay()
-{
- // initialize OpenGL ES and EGL
-
- /*
- * Here specify the attributes of the desired configuration.
- * Below, we select an EGLConfig with at least 8 bits per color
- * component compatible with on-screen windows
- */
- const EGLint attribs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_BLUE_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_RED_SIZE, 8,
- EGL_NONE
- };
- EGLint w, h, dummy, format;
- EGLint numConfigs;
- EGLConfig config;
- EGLSurface surface;
- EGLContext context;
-
- EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
-
- eglInitialize(display, 0, 0);
-
- /* Here, the application chooses the configuration it desires. In this
- * sample, we have a very simplified selection process, where we pick
- * the first EGLConfig that matches our criteria */
- eglChooseConfig(display, attribs, &config, 1, &numConfigs);
-
- /* EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is
- * guaranteed to be accepted by ANativeWindow_setBuffersGeometry().
- * As soon as we picked a EGLConfig, we can safely reconfigure the
- * ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID. */
- eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format);
-
- ANativeWindow_setBuffersGeometry(pApp->window, 0, 0, format);
-
- surface = eglCreateWindowSurface(display, config, pApp->window, NULL);
- context = eglCreateContext(display, config, NULL, NULL);
-
- if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) {
- LOGW("Unable to eglMakeCurrent");
- return;
- }
-
- eglQuerySurface(display, surface, EGL_WIDTH, &w);
- eglQuerySurface(display, surface, EGL_HEIGHT, &h);
-
- this->pDisplay = display;
- pContext = context;
- pSurface = surface;
- pWidth = w;
- pHeight = h;
-
- // Initialize GL state.
- glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
- glEnable(GL_CULL_FACE);
- glShadeModel(GL_SMOOTH);
- glDisable(GL_DEPTH_TEST);
-
- glViewport(0, 100, w, h-200);
-
- // make adjustments for screen ratio
- float ratio = 3.0 * (float) w / h;
- glMatrixMode(GL_PROJECTION); // set matrix to projection mode
- glLoadIdentity(); // reset the matrix to its default state
- // glFrustumf(-ratio, ratio, -3, 3, 3, 30); // apply the projection matrix
- glOrthof(0, w/3, h/3, 0, -30, 30); // apply the projection matrix
- glLineWidth(3);
-}
-
-
-void Fl_PicoAndroid_Screen_Driver::termDisplay()
-{
- if (pDisplay != EGL_NO_DISPLAY) {
- eglMakeCurrent(pDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
- if (pContext != EGL_NO_CONTEXT) {
- eglDestroyContext(pDisplay, pContext);
- }
- if (pSurface != EGL_NO_SURFACE) {
- eglDestroySurface(pDisplay, pSurface);
- }
- eglTerminate(pDisplay);
- }
- pDisplay = EGL_NO_DISPLAY;
- pContext = EGL_NO_CONTEXT;
- pSurface = EGL_NO_SURFACE;
-}
-
-
-void Fl_PicoAndroid_Screen_Driver::drawFrame()
-{
- if (pDisplay == NULL) {
- return;
- }
- eglSwapBuffers(pDisplay, pSurface);
-// LOGI("Swapping buffers");
-}
-
-
-void Fl_PicoAndroid_Screen_Driver::handleAppCmdCB(struct android_app* app, int32_t cmd)
-{
- Fl_PicoAndroid_Screen_Driver *This = (Fl_PicoAndroid_Screen_Driver*)(app->userData);
- This->handleAppCmd(app, cmd);
-}
-
-
-void Fl_PicoAndroid_Screen_Driver::handleAppCmd(struct android_app* app, int32_t cmd)
-{
- LOGI("CMD %d", cmd);
-// struct engine* engine = (struct engine*)app->userData;
- switch (cmd) {
- case APP_CMD_SAVE_STATE:
- // The system has asked us to save our current state. Do so.
-// engine->app->savedState = malloc(sizeof(struct saved_state));
-// *((struct saved_state*)engine->app->savedState) = engine->state;
-// engine->app->savedStateSize = sizeof(struct saved_state);
- break;
- case APP_CMD_INIT_WINDOW:
- // The window is being shown, get it ready.
- if (pApp->window != NULL) {
- // the flag below allow for easy development and should be removed when
- // distributing a final app
- ANativeActivity_setWindowFlags(pApp->activity, AWINDOW_FLAG_KEEP_SCREEN_ON, 0);
- initDisplay();
- drawFrame();
- }
- break;
- case APP_CMD_TERM_WINDOW:
- // The window is being hidden or closed, clean it up.
- termDisplay();
- break;
- case APP_CMD_GAINED_FOCUS:
- // When our app gains focus, we start monitoring the accelerometer.
-// if (engine->accelerometerSensor != NULL) {
-// ASensorEventQueue_enableSensor(engine->sensorEventQueue,
-// engine->accelerometerSensor);
-// // We'd like to get 60 events per second (in us).
-// ASensorEventQueue_setEventRate(engine->sensorEventQueue,
-// engine->accelerometerSensor, (1000L/60)*1000);
-// }
- break;
- case APP_CMD_LOST_FOCUS:
- // When our app loses focus, we stop monitoring the accelerometer.
- // This is to avoid consuming battery while not being used.
-// if (engine->accelerometerSensor != NULL) {
-// ASensorEventQueue_disableSensor(engine->sensorEventQueue,
-// engine->accelerometerSensor);
-// }
-// // Also stop animating.
-// engine->animating = 0;
-// engine_draw_frame(engine);
- break;
- }
-}
-
-
-int32_t Fl_PicoAndroid_Screen_Driver::handleInputEventCB(struct android_app* app, AInputEvent* event)
-{
- Fl_PicoAndroid_Screen_Driver *This = (Fl_PicoAndroid_Screen_Driver*)(app->userData);
- This->handleInputEvent(app, event);
-}
-
-
-int32_t Fl_PicoAndroid_Screen_Driver::handleInputEvent(struct android_app* app, AInputEvent* event)
-{
- if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_MOTION) {
-// fl_lock_function();
- int x = AMotionEvent_getX(event, 0);
- int y = AMotionEvent_getY(event, 0);
- int action = AKeyEvent_getAction(event);
- Fl_Window *window = Fl::first_window();
- switch (action) {
- case AMOTION_EVENT_ACTION_DOWN:
- Fl::e_is_click = 1;
- Fl::e_x = Fl::e_x_root = x/3;
- Fl::e_y = Fl::e_y_root = (y-100)/3;
- if (!window) break;
- Fl::e_keysym = FL_Button+FL_LEFT_MOUSE;
- Fl::e_state = FL_BUTTON1;
- Fl::handle(FL_PUSH, window);
- break;
- case AMOTION_EVENT_ACTION_MOVE:
- Fl::e_is_click = 1;
- Fl::e_x = Fl::e_x_root = x/3;
- Fl::e_y = Fl::e_y_root = (y-100)/3;
- if (!window) break;
- Fl::e_keysym = FL_Button+FL_LEFT_MOUSE;
- Fl::e_state = FL_BUTTON1;
- Fl::handle(FL_DRAG, window);
- break;
- case AMOTION_EVENT_ACTION_UP:
- case AMOTION_EVENT_ACTION_CANCEL:
- Fl::e_is_click = 1;
- Fl::e_x = Fl::e_x_root = x/3;
- Fl::e_y = Fl::e_y_root = (y-100)/3;
- if (!window) break;
- Fl::e_keysym = FL_Button+FL_LEFT_MOUSE;
- Fl::e_state = 0;
- Fl::handle(FL_RELEASE, window);
- break;
-// case AMOTION_EVENT_ACTION_HOVER_MOVE:
-// Fl::e_is_click = 1;
-// Fl::e_x = Fl::e_x_root = x/3;
-// Fl::e_y = (y-100)/3;
-// if (!window) break;
-// Fl::e_keysym = 0;
-// Fl::e_state = 0;
-// Fl::handle(FL_MOVE, window);
-// break;
- }
-// AMOTION_EVENT_ACTION_MASK
-// LOGI("Motion at %d, %d", x, y);
-// fl_unlock_function();
- Fl_X::first->w->redraw();
- return 1;
- }
- return 0;
-}
-
-
-extern int main(int argc, const char **argv);
-
-void android_main(struct android_app* state)
-{
-// LOGI("Android Main call");
- Fl_PicoAndroid_Screen_Driver *This = (Fl_PicoAndroid_Screen_Driver*)Fl::screen_driver();
- This->android_main(state);
- static const char *argv[1] = { "native-activity" };
- main(1, argv);
-}
-
-/**
- This is the main entry point of a native application that is using
- android_native_app_glue. It runs in its own thread, with its own
- event loop for receiving input events and doing other things.
- */
-void Fl_PicoAndroid_Screen_Driver::android_main(struct android_app* state)
-{
- app_dummy();
-
- pApp = state;
- pApp->userData = this;
- pApp->onAppCmd = handleAppCmdCB;
- pApp->onInputEvent = handleInputEventCB;
-
-
-#if 0
- struct engine engine;
-
- // Make sure glue isn't stripped.
- app_dummy();
-
- memset(&engine, 0, sizeof(engine));
- state->userData = &engine;
- state->onAppCmd = engine_handle_cmd;
- state->onInputEvent = engine_handle_input;
- engine.app = state;
-
- // Prepare to monitor accelerometer
- engine.sensorManager = ASensorManager_getInstance();
- engine.accelerometerSensor = ASensorManager_getDefaultSensor(engine.sensorManager,
- ASENSOR_TYPE_ACCELEROMETER);
- engine.sensorEventQueue = ASensorManager_createEventQueue(engine.sensorManager,
- state->looper, LOOPER_ID_USER, NULL, NULL);
-
- if (state->savedState != NULL) {
- // We are starting with a previous saved state; restore from it.
- engine.state = *(struct saved_state*)state->savedState;
- }
-
- // loop waiting for stuff to do.
-
- while (1) {
- // Read all pending events.
- int ident;
- int events;
- struct android_poll_source* source;
-
- // If not animating, we will block forever waiting for events.
- // If animating, we loop until all events are read, then continue
- // to draw the next frame of animation.
- while ((ident=ALooper_pollAll(engine.animating ? 0 : -1, NULL, &events,
- (void**)&source)) >= 0) {
-
- // Process this event.
- if (source != NULL) {
- source->process(state, source);
- }
-
- // If a sensor has data, process it now.
- if (ident == LOOPER_ID_USER) {
- if (engine.accelerometerSensor != NULL) {
- ASensorEvent event;
- while (ASensorEventQueue_getEvents(engine.sensorEventQueue,
- &event, 1) > 0) {
- LOGI("accelerometer: x=%f y=%f z=%f",
- event.acceleration.x, event.acceleration.y,
- event.acceleration.z);
- }
- }
- }
-
- // Check if we are exiting.
- if (state->destroyRequested != 0) {
- engine_term_display(&engine);
- return;
- }
- }
-
- if (engine.animating) {
- // Done with events; draw next animation frame.
- engine.state.angle += .01f;
- if (engine.state.angle > 1) {
- engine.state.angle = 0;
- }
-
- // Drawing is throttled to the screen update rate, so there
- // is no need to do timing here.
- engine_draw_frame(&engine);
- }
- }
-#endif
-}
-
-
-Fl_Screen_Driver* Fl_Screen_Driver::newScreenDriver()
-{
- return new Fl_PicoAndroid_Screen_Driver();
-}
-
-
-Fl_PicoAndroid_Screen_Driver::Fl_PicoAndroid_Screen_Driver()
-{
- pDisplay = EGL_NO_DISPLAY;
- pContext = EGL_NO_CONTEXT;
- pSurface = EGL_NO_SURFACE;
-}
-
-Fl_PicoAndroid_Screen_Driver::~Fl_PicoAndroid_Screen_Driver()
-{
-}
-
-
-double Fl_PicoAndroid_Screen_Driver::wait(double time_to_wait)
-{
- Fl::flush();
- // Read all pending events.
- int ident;
- int events;
- struct android_poll_source* source;
-
- // If not animating, we will block forever waiting for events.
- // If animating, we loop until all events are read, then continue
- // to draw the next frame of animation.
- // int ALooper_pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outData)
- if ((ident=ALooper_pollAll(0, NULL, &events, (void**)&source)) >= 0) {
-
- // Process this event.
- if (source != NULL) {
- source->process(pApp, source);
- }
-
- // If a sensor has data, process it now.
-// if (ident == LOOPER_ID_USER) {
-// if (engine.accelerometerSensor != NULL) {
-// ASensorEvent event;
-// while (ASensorEventQueue_getEvents(engine.sensorEventQueue,
-// &event, 1) > 0) {
-// LOGI("accelerometer: x=%f y=%f z=%f",
-// event.acceleration.x, event.acceleration.y,
-// event.acceleration.z);
-// }
-// }
-// }
-
- // Check if we are exiting.
-// if (state->destroyRequested != 0) {
-// engine_term_display(&engine);
-// return;
-// }
- }
-
-// if (engine.animating) {
-// // Done with events; draw next animation frame.
-// engine.state.angle += .01f;
-// if (engine.state.angle > 1) {
-// engine.state.angle = 0;
-// }
-//
-// // Drawing is throttled to the screen update rate, so there
-// // is no need to do timing here.
-// engine_draw_frame(&engine);
-// }
-// }
- return 0.0;
-}
-
-
-
-
-/*
- The following code should not be here!
- All this must be refactored into the driver system!
- */
-
-Fl_Fontdesc* fl_fonts = NULL;
-
-/*
-
- The following symbols are not found if we naively compile the core modules and
- no specific platform implementations. This list is a hint at all the functions
- and methods that probably need to be refactored into the driver system.
-
- Undefined symbols for architecture x86_64:
- */
-
-#if !defined(FL_DOXYGEN) // *FIXME* silence Doxygen warnings
-
-void fl_set_spot(int, int, int, int, int, int, Fl_Window*) { }
-void fl_reset_spot() { }
-const char *fl_filename_name(char const*) { return 0; }
-
-//Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver() { return 0; }
-//Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver() { return 0; }
-//void Fl_Graphics_Driver::global_gc() { }
-int Fl::dnd() { return 0; }
-void Fl::copy(char const*, int, int, char const*) { }
-void Fl::paste(Fl_Widget&, int, char const*) { }
-void Fl::get_mouse(int&, int&) { }
-int Fl_X::set_cursor(Fl_Cursor) { return 0; }
-int Fl_X::set_cursor(Fl_RGB_Image const*, int, int) { return 0; }
-
-//void Fl_Window::size_range_() { }
-//void Fl_Window::fullscreen_x() { }
-
-void Fl_Window::make_current()
-{
- fl_window = i->xid;
- current_ = this;
-}
-
-//void Fl_Window::fullscreen_off_x(int, int, int, int) { }
-
-Window fl_xid(const Fl_Window* w)
-{
- Fl_X *temp = Fl_X::i(w);
- return temp ? temp->xid : 0;
-}
-
-void Fl_Window::show() {
- if (!shown()) {
- Fl_X::make(this);
- }
-}
-
-Fl_X* Fl_X::make(Fl_Window *w)
-{
- return w->driver()->makeWindow();
-}
-
-void Fl_Window::label(char const*, char const*) { }
-void Fl_Window::resize(int, int, int, int) { }
-Fl_Window *Fl_Window::current_;
-char fl_show_iconic;
-Window fl_window;
-//void Fl_Image_Surface::translate(int x, int y) { }
-//void Fl_Image_Surface::untranslate() { }
-
-void Fl::add_fd(int, int, Fl_FD_Handler, void*)
-{
-}
-
-void Fl::add_fd(int, Fl_FD_Handler, void*)
-{
-}
-
-void Fl::remove_fd(int)
-{
-}
-
-// these pointers are set by the Fl::lock() function:
-static void nothing() {}
-void (*fl_lock_function)() = nothing;
-void (*fl_unlock_function)() = nothing;
-
-Fl_Font_Descriptor::~Fl_Font_Descriptor()
-{
-}
-
-#endif // !defined(FL_DOXYGEN)
-
-#if 0
-
-ld: error: ./obj/local/armeabi-v7a/objs/native-activity/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.o: multiple definition of 'Fl_Window::make_current()'
-ld: ./obj/local/armeabi-v7a/objs/native-activity/src/Fl_Window.o: previous definition here
-
-ld: error: ./obj/local/armeabi-v7a/objs/native-activity/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.o: multiple definition of 'Fl_Window::current_'
-ld: ./obj/local/armeabi-v7a/objs/native-activity/src/Fl_Window.o: previous definition here
-
-ld: error: ./obj/local/armeabi-v7a/objs/native-activity/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.o: multiple definition of 'Fl_Window::show()'
-ld: ./obj/local/armeabi-v7a/objs/native-activity/src/Fl_Window.o: previous definition here
-
-ld: error: ./obj/local/armeabi-v7a/objs/native-activity/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.o: multiple definition of 'Fl_Window::label(char const*, char const*)'
-ld: ./obj/local/armeabi-v7a/objs/native-activity/src/Fl_Window.o: previous definition here
-
-ld: error: ./obj/local/armeabi-v7a/objs/native-activity/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.o: multiple definition of 'Fl_Window::resize(int, int, int, int)'
-ld: ./obj/local/armeabi-v7a/objs/native-activity/src/Fl_Window.o: previous definition here
-
-jni/../../src/Fl.cxx:1520: error: undefined reference to 'Fl_Graphics_Driver::add_rectangle_to_region(void*, int, int, int, int)'
-jni/../../src/Fl_Printer.cxx:115: error: undefined reference to 'Fl_Paged_Device::newPrinterDriver()'
-jni/../../src/Fl_Window.cxx:312: error: undefined reference to 'Fl_Window_Driver::default_icons(Fl_RGB_Image const**, int)'
-jni/../../src/fl_shortcut.cxx:330: error: undefined reference to 'fl_local_ctrl'
-jni/../../src/fl_shortcut.cxx:330: error: undefined reference to 'fl_local_alt'
-jni/../../src/fl_shortcut.cxx:330: error: undefined reference to 'fl_local_shift'
-jni/../../src/fl_shortcut.cxx:330: error: undefined reference to 'fl_local_meta'
-
-drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.o:Fl_PicoAndroid_Window_Driver.cxx:vtable for Fl_PicoAndroid_Window_Driver: error: undefined reference to 'Fl_PicoAndroid_Window_Driver::flush_double()'
-drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.o:Fl_PicoAndroid_Window_Driver.cxx:vtable for Fl_PicoAndroid_Window_Driver: error: undefined reference to 'Fl_PicoAndroid_Window_Driver::flush_overlay()'
-
-#endif
diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_System_Driver.H b/src/drivers/PicoAndroid/Fl_PicoAndroid_System_Driver.H
deleted file mode 100644
index 8b1378917..000000000
--- a/src/drivers/PicoAndroid/Fl_PicoAndroid_System_Driver.H
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_System_Driver.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_System_Driver.cxx
deleted file mode 100644
index 8b1378917..000000000
--- a/src/drivers/PicoAndroid/Fl_PicoAndroid_System_Driver.cxx
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.H b/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.H
deleted file mode 100644
index 813c2fb5b..000000000
--- a/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.H
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// Definition of Android Window interface
-// for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 2010-2016 by Bill Spitzak and others.
-//
-// This library is free software. Distribution and use rights are outlined in
-// the file "COPYING" which should have been included with this file. If this
-// file is missing or damaged, see the license at:
-//
-// https://www.fltk.org/COPYING.php
-//
-// Please see the following page on how to report bugs and issues:
-//
-// https://www.fltk.org/bugs.php
-//
-
-/**
- \file Fl_PicoAndroid_Window_Driver.H
- \brief Definition of SDL Window interface.
- */
-
-#ifndef FL_PICOANDROID_WINDOW_DRIVER_H
-#define FL_PICOANDROID_WINDOW_DRIVER_H
-
-#include "../Pico/Fl_Pico_Window_Driver.H"
-
-#include <jni.h>
-#include <android_native_app_glue.h>
-
-
-class FL_EXPORT Fl_PicoAndroid_Window_Driver : public Fl_Pico_Window_Driver
-{
- ANativeWindow *pNativeWindow;
-public:
- Fl_PicoAndroid_Window_Driver(Fl_Window *win);
- virtual ~Fl_PicoAndroid_Window_Driver();
-
- virtual Fl_X *makeWindow();
-
- // --- window data
-// virtual int decorated_w() = 0;
-// virtual int decorated_h() = 0;
-
- // --- window management
-// virtual void take_focus();
- virtual void flush();
- virtual void flush_double();
- virtual void flush_overlay();
-// virtual void draw_begin();
-// virtual void draw_end();
-};
-
-
-#endif // FL_PICOSDL_WINDOW_DRIVER_H
diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx
deleted file mode 100644
index 67b833434..000000000
--- a/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx
+++ /dev/null
@@ -1,122 +0,0 @@
-//
-// Definition of Android Window interface based on SDL
-//
-// Copyright 1998-2018 by Bill Spitzak and others.
-//
-// This library is free software. Distribution and use rights are outlined in
-// the file "COPYING" which should have been included with this file. If this
-// file is missing or damaged, see the license at:
-//
-// https://www.fltk.org/COPYING.php
-//
-// Please see the following page on how to report bugs and issues:
-//
-// https://www.fltk.org/bugs.php
-//
-
-
-#include <config.h>
-#include "Fl_PicoAndroid_Window_Driver.H"
-
-#include "Fl_PicoAndroid_Screen_Driver.H"
-
-#include <jni.h>
-#include <errno.h>
-
-#include <android/sensor.h>
-#include <android/log.h>
-#include <android_native_app_glue.h>
-
-#include <FL/platform.H>
-#include <FL/Fl.H>
-#include <FL/Fl_Window.H>
-#include "../../Fl_Window_Driver.H"
-#include <FL/fl_draw.H>
-
-
-Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *win)
-{
- return new Fl_PicoAndroid_Window_Driver(win);
-}
-
-
-Fl_PicoAndroid_Window_Driver::Fl_PicoAndroid_Window_Driver(Fl_Window *win)
-: Fl_Pico_Window_Driver(win)
-{
-}
-
-
-Fl_PicoAndroid_Window_Driver::~Fl_PicoAndroid_Window_Driver()
-{
-}
-
-
-Fl_X *Fl_PicoAndroid_Window_Driver::makeWindow()
-{
- Fl_PicoAndroid_Screen_Driver *scr = (Fl_PicoAndroid_Screen_Driver*)Fl::screen_driver();
-
- Fl_Group::current(0);
- if (parent() && !Fl_X::i(pWindow->window())) {
- pWindow->set_visible();
- return 0L;
- }
- Window parent;
- if (pWindow->parent()) {
- parent = fl_xid(pWindow->window());
- } else {
- parent = 0;
- }
- Fl_X *x = new Fl_X;
- other_xid = 0;
- x->w = pWindow;
- x->region = 0;
- if (!pWindow->force_position()) {
-// pNativeWindow = SDL_CreateWindow(pWindow->label(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w(), h(), 0);
- } else {
-// pNativeWindow = SDL_CreateWindow(pWindow->label(), x(), y(), w(), h(), 0);
- }
- pNativeWindow = scr->pApp->window;
-// x->xid = SDL_CreateRenderer(pNativeWindow, -1, SDL_RENDERER_ACCELERATED);
- x->next = Fl_X::first;
- wait_for_expose_value = 0;
- pWindow->i = x;
- Fl_X::first = x;
-
- pWindow->set_visible();
- pWindow->redraw();
- pWindow->flush();
- int old_event = Fl::e_number;
- pWindow->handle(Fl::e_number = FL_SHOW);
- Fl::e_number = old_event;
-
- return x;
-}
-
-
-void Fl_PicoAndroid_Window_Driver::flush()
-{
- glClearColor(0, 0, 0, 1);
- glClear(GL_COLOR_BUFFER_BIT);
- Fl_X *i = Fl_X::i(pWindow);
- if (!i) return;
- fl_clip_region(i->region);
- i->region = 0;
- pWindow->draw();
- Fl_PicoAndroid_Screen_Driver *scr = (Fl_PicoAndroid_Screen_Driver*)Fl::screen_driver();
- scr->drawFrame();
-}
-
-
-#if 0
-void Fl_PicoAndroid_Window_Driver::flush()
-{
- Fl_PicoAndroid_Screen_Driver *scr = (Fl_PicoAndroid_Screen_Driver*)Fl::screen_driver();
-// LOGI("Flush...");
- glClearColor(0, 0, 0, 1);
- glClear(GL_COLOR_BUFFER_BIT);
- pWindow->flush();
-// fl_color(FL_RED);
-// fl_rectf(10, 10, 300, 400);
- scr->drawFrame();
-}
-#endif