ecere: gfx/gui: support P/NaCl platform. add new Pepper interface driver for targetin...
authorRejean Loyer <redj@ecere.com>
Wed, 26 Nov 2014 20:58:36 +0000 (15:58 -0500)
committerRejean Loyer <redj@ecere.com>
Mon, 16 Mar 2015 05:31:50 +0000 (01:31 -0400)
18 files changed:
ecere/ecere.epj
ecere/src/com/instance.c
ecere/src/com/instance.ec
ecere/src/gfx/bitmaps/GIFFormat.ec
ecere/src/gfx/bitmaps/PNGFormat.ec
ecere/src/gfx/drivers/NCursesDisplayDriver.ec
ecere/src/gfx/drivers/OpenGLDisplayDriver.ec
ecere/src/gfx/drivers/PepperDisplayDriver.ec [new file with mode: 0644]
ecere/src/gfx/drivers/XDisplayDriver.ec
ecere/src/gui/GuiApplication.ec
ecere/src/gui/drivers/NCursesInterface.ec
ecere/src/gui/drivers/PepperInterface.ec [new file with mode: 0644]
ecere/src/gui/drivers/XInterface.ec
ecere/src/gui/skins/WindowsSkin.ec
ecere/src/sys/File.ec
ecere/src/sys/i18n.ec
ide/src/ide.ec
ide/src/project/Project.ec

index 4d34cdc..b498748 100644 (file)
@@ -456,6 +456,15 @@ from wherever you obtained them.
             "TargetType" : "StaticLibrary",
             "TargetFileName" : "ecereStatic"
          }
+      },
+      {
+         "Name" : "pnacl",
+         "Options" : {
+            "PreprocessorDefinitions" : [
+               "_DEBUG",
+               "ECERE_NOSSL"
+            ]
+         }
       }
    ],
    "Files" : [
@@ -1598,10 +1607,15 @@ from wherever you obtained them.
                            }
                         },
                         {
-                           "FileName" : "SDL2DisplayDriver.ec",
-                           "Options" : {
-                              "ExcludeFromBuild" : false
-                           }
+                           "FileName" : "PepperDisplayDriver.ec",
+                           "Configurations" : [
+                              {
+                                 "Name" : "pnacl",
+                                 "Options" : {
+                                    "ExcludeFromBuild" : false
+                                 }
+                              }
+                           ]
                         }
                      ],
                      "Options" : {
@@ -1961,10 +1975,15 @@ from wherever you obtained them.
                            }
                         },
                         {
-                           "FileName" : "SDL2Interface.ec",
-                           "Options" : {
-                              "ExcludeFromBuild" : false
-                           }
+                           "FileName" : "PepperInterface.ec",
+                           "Configurations" : [
+                              {
+                                 "Name" : "pnacl",
+                                 "Options" : {
+                                    "ExcludeFromBuild" : false
+                                 }
+                              }
+                           ]
                         }
                      ],
                      "Options" : {
index 3539e8d..7432ffc 100644 (file)
@@ -14,7 +14,9 @@
 #if defined(__unix__) || defined(__APPLE__)
 #define bool _bool
 #include <utime.h>
+#if !defined(__pnacl__)
 #include <dlfcn.h>
+#endif
 #if defined(__APPLE__)
 #include <mach-o/dyld.h>
 #endif
@@ -325,7 +327,7 @@ bool Instance_LocateModule(const char * name, char * fileName)
       }
       fclose(f);
    }
-#if !defined(ECERE_NOFILE) && !defined(__linux__) && !defined(__EMSCRIPTEN__)
+#if !defined(ECERE_NOFILE) && !defined(__linux__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
    if(name && name[0])
    {
       // Couldn't locate libraries with /proc/curmap/map, attempt with ldd
@@ -404,7 +406,7 @@ bool Instance_LocateModule(const char * name, char * fileName)
 
 void Instance_COM_Initialize(int argc, char ** argv, char ** parsedCommand, int * argcPtr, const char *** argvPtr)
 {
-#if !defined(__WIN32__) && !defined(__EMSCRIPTEN__) && !defined(ECERE_BOOTSTRAP)
+#if !defined(__WIN32__) && !defined(__EMSCRIPTEN__) && !defined(ECERE_BOOTSTRAP) && !defined(__pnacl__)
    // Disable stdout buffering on Unix
    setvbuf(stdout, null, _IONBF, 0);
 #endif
@@ -476,7 +478,7 @@ void * Instance_Module_Load(const char * libLocation, const char * name, void **
       strcat(fileName, ".so");
 #endif
 
-#if !defined(__EMSCRIPTEN__)
+#if !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
    library = dlopen(fileName, RTLD_LAZY);
 #endif
    while(!library && attempts < sizeof(paths)/sizeof(paths[0]))
@@ -501,7 +503,7 @@ void * Instance_Module_Load(const char * libLocation, const char * name, void **
 #else
          strcat(fileName, ".so");
 #endif
-#if !defined(__EMSCRIPTEN__)
+#if !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
       library = dlopen(fileName, RTLD_LAZY);
 #endif
    }
@@ -510,7 +512,7 @@ void * Instance_Module_Load(const char * libLocation, const char * name, void **
    {
       *Load = dlsym(library, "__ecereDll_Load");
       *Unload = dlsym(library, "__ecereDll_Unload");
-#if !defined(__EMSCRIPTEN__)
+#if !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
       if(!*Load)
          dlclose(library);
 #endif
@@ -559,7 +561,7 @@ void Instance_Module_Free(void * library)
 #if defined(__WIN32__) && !defined(__EMSCRIPTEN__)
    if(library)
       FreeLibrary(library);
-#elif (defined(__unix__) || defined(__APPLE__)) && !defined(__EMSCRIPTEN__)
+#elif (defined(__unix__) || defined(__APPLE__)) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
    if(library)
       dlclose(library);
 #endif
index 9ee3934..36f5531 100644 (file)
@@ -5900,7 +5900,7 @@ static int64 GetEnumSize(Class _class)
 #define strnicmp strncasecmp
 #endif
 
-#if defined(ECERE_BOOTSTRAP) || (defined(__GNUC__) && !defined(__DJGPP__) && !defined(__WIN32__) && !defined(__EMSCRIPTEN__))
+#if defined(ECERE_BOOTSTRAP) || (defined(__GNUC__) && !defined(__DJGPP__) && !defined(__WIN32__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__))
 #undef strlwr
 #undef strupr
 default dllexport char * strlwr(char *string)
index d584a4f..428947f 100644 (file)
@@ -2,7 +2,7 @@ namespace gfx::bitmaps;
 
 import "Display"
 
-#if !defined(__EMSCRIPTEN__)
+#if !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
 
 #include "gif_lib.h"
 
index 95e596e..17f2215 100644 (file)
@@ -2,7 +2,7 @@ namespace gfx::bitmaps;
 
 import "Display"
 
-#if !defined(__EMSCRIPTEN__)
+#if !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
 
 #define uint _uint
 #include "png.h"
index b15db41..5e54a37 100644 (file)
@@ -4,7 +4,7 @@ import "instance"
 
 #undef __BLOCKS__
 
-#if (defined(__unix__) || defined(__APPLE__)) && !defined(__DOS__) && !defined(__EMSCRIPTEN__)
+#if (defined(__unix__) || defined(__APPLE__)) && !defined(__DOS__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
 
 #include <curses.h>
 
index 047ce1f..11a39d3 100644 (file)
@@ -120,7 +120,7 @@ import "Display"
 
 #if defined(__unix__) || defined(__APPLE__)
 
-   #if !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
+   #if !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
    import "XInterface"
    #endif
 
@@ -1434,7 +1434,7 @@ class OGLDisplay : struct
    int imageBuffers[2];
    byte * pboMemory1, * pboMemory2;
    */
-#elif !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
+#elif !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
    GLXContext glContext;
 
    Pixmap pixmap;
@@ -1468,7 +1468,7 @@ class OGLSystem : struct
    HDC hdc;
    HGLRC glrc;
    HWND hwnd;
-#elif !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
+#elif !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
    XVisualInfo * visualInfo;
    GLXContext glContext;
    GLXDrawable glxDrawable;
@@ -1511,7 +1511,7 @@ class OpenGLDisplayDriver : DisplayDriver
 
    bool LockSystem(DisplaySystem displaySystem)
    {
-#if !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
+#if !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
       OGLSystem oglSystem = displaySystem.driverData;
       if(useSingleGLContext) return true;
    #if defined(__WIN32__)
@@ -1543,7 +1543,7 @@ class OpenGLDisplayDriver : DisplayDriver
 
    bool Lock(Display display)
    {
-#if !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
+#if !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
       OGLDisplay oglDisplay = display.driverData;
       if(useSingleGLContext) return true;
    #if defined(__WIN32__)
@@ -1877,7 +1877,7 @@ class OpenGLDisplayDriver : DisplayDriver
    {
       bool result = false;
       OGLDisplay oglDisplay = display.driverData;
-#if !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
+#if !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
       OGLSystem oglSystem = display.displaySystem.driverData;
 #endif
       if(!oglDisplay)
diff --git a/ecere/src/gfx/drivers/PepperDisplayDriver.ec b/ecere/src/gfx/drivers/PepperDisplayDriver.ec
new file mode 100644 (file)
index 0000000..1e5c308
--- /dev/null
@@ -0,0 +1,428 @@
+namespace gfx::drivers;
+
+#ifdef BUILDING_ECERE_COM
+import "instance"
+import "Display"
+#else
+#ifdef ECERE_STATIC
+public import static "ecere"
+#else
+public import "ecere"
+#endif
+#endif
+
+import "PepperInterface"
+
+#if !defined(ENABLE_PEPPER_DRIVER)
+#define NO_PEPPER_DRIVER
+#endif
+
+#if (defined(__nacl__) || defined(__pnacl__)) // && !defined(NO_PEPPER_DRIVER)
+
+#include <stdio.h>
+
+// source file line number printf (sflnprintf)
+#define sflnprintf(format,...) printf("%s:% 5d: " format, __FILE__, __LINE__, ##__VA_ARGS__)
+
+class PepperDisplayDriver : DisplayDriver
+{
+   class_property(name) = "Pepper";
+
+
+   // Constructor / Destructor
+
+   bool ::CreateDisplaySystem(DisplaySystem displaySystem)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::CreateDisplaySystem [STUB!]\n");
+      return false;
+   }
+
+   void ::DestroyDisplaySystem(DisplaySystem displaySystem)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::DestroyDisplaySystem [STUB!]\n");
+   }
+
+   bool ::CreateDisplay(Display display)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::CreateDisplay [STUB!]\n");
+      return false;
+   }
+
+   void ::DestroyDisplay(Display display)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::DestroyDisplay [STUB!]\n");
+   }
+
+
+   // Display Position and Size
+
+   bool ::DisplaySize(Display display, int width, int height)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::DisplaySize [STUB!]\n");
+      return false;
+   }
+
+   void ::DisplayPosition(Display display, int x, int y)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::DisplayPosition [STUB!]\n");
+   }
+
+
+   // Palettes
+
+   void ::SetPalette(Display display, ColorAlpha * palette, bool colorMatch)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::SetPalette [STUB!]\n");
+   }
+
+   void ::RestorePalette(Display display)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::RestorePalette [STUB!]\n");
+   }
+
+
+   // Display the back buffer content
+
+   void ::StartUpdate(Display display)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::StartUpdate [STUB!]\n");
+   }
+
+   void ::EndUpdate(Display display)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::EndUpdate [STUB!]\n");
+   }
+
+   void ::Scroll(Display display, Box scroll, int x, int y, Extent dirty)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Scroll [STUB!]\n");
+   }
+
+   void ::Update(Display display, Box updateBox)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Update [STUB!]\n");
+   }
+
+
+   // Allocate/free a bitmap
+
+   bool ::AllocateBitmap(DisplaySystem displaySystem, Bitmap bitmap, int width, int height, int stride, PixelFormat format, bool allocatePalette)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::AllocateBitmap [STUB!]\n");
+      return false;
+   }
+
+   void ::FreeBitmap(DisplaySystem displaySystem, Bitmap bitmap)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::FreeBitmap [STUB!]\n");
+   }
+
+
+   // Lock
+
+   bool ::LockSystem(DisplaySystem displaySystem)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::LockSystem [STUB!]\n");
+      return false;
+   }
+
+   void ::UnlockSystem(DisplaySystem displaySystem)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::UnlockSystem [STUB!]\n");
+   }
+
+   bool ::Lock(Display display)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Lock [STUB!]\n");
+      return false;
+   }
+
+   void ::Unlock(Display display)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Unlock [STUB!]\n");
+   }
+
+
+   // Get/release a surface
+
+   bool ::GetSurface(Display display, Surface surface, int x, int y, Box clip)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::GetSurface [STUB!]\n");
+      return false;
+   }
+
+   bool ::GetBitmapSurface(DisplaySystem displaySystem, Surface surface, Bitmap bitmap, int x, int y, Box clip)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::GetBitmapSurface [STUB!]\n");
+      return false;
+   }
+
+   void ::ReleaseSurface(Display display, Surface surface)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::ReleaseSurface [STUB!]\n");
+   }
+
+
+   // Clip a surface
+
+   void ::Clip(Display display, Surface surface, Box clip)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Clip [STUB!]\n");
+   }
+
+
+   // Grab from the screen
+
+   bool ::GrabScreen(Display display, Bitmap bitmap, int x, int y, unsigned int w, unsigned int h)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::GrabScreen [STUB!]\n");
+      return false;
+   }
+
+
+   // Converts a bitmap format
+
+   bool ::ConvertBitmap(DisplaySystem displaySystem, Bitmap src, PixelFormat format, ColorAlpha * palette)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::ConvertBitmap [STUB!]\n");
+      return false;
+   }
+
+
+   // Converts an LFB bitmap into an offscreen bitmap for this device
+
+   bool ::MakeDDBitmap(DisplaySystem displaySystem, Bitmap bitmap, bool mipMaps)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::MakeDDBitmap [STUB!]\n");
+      return false;
+   }
+
+
+   // Font loading
+
+   Font ::LoadFont(DisplaySystem displaySystem, const char * faceName, float size, FontFlags flags)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::LoadFont [STUB!]\n");
+      return null;
+   }
+
+   void ::UnloadFont(DisplaySystem displaySystem, Font font)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::UnloadFont [STUB!]\n");
+   }
+
+
+   // 2D Drawing
+
+   void ::SetForeground(Display display, Surface surface, ColorAlpha color)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::SetForeground [STUB!]\n");
+   }
+
+   void ::SetBackground(Display display, Surface surface, ColorAlpha color)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::SetBackground [STUB!]\n");
+   }
+
+   void ::LineStipple(Display display, Surface surface, uint stipple)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::LineStipple [STUB!]\n");
+   }
+
+   ColorAlpha ::GetPixel(Display display, Surface surface, int x, int y)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::GetPixel [STUB!]\n");
+      return 0;
+   }
+
+   void ::PutPixel(Display display, Surface surface, int x, int y)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::PutPixel [STUB!]\n");
+   }
+
+   void ::DrawLine(Display display, Surface surface, int x1, int y1, int x2, int y2)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::DrawLine [STUB!]\n");
+   }
+
+   void ::Rectangle(Display display, Surface surface, int x1, int y1, int x2, int y2)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Rectangle [STUB!]\n");
+   }
+
+   void ::Area(Display display, Surface surface, int x1, int y1, int x2, int y2)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Area [STUB!]\n");
+   }
+
+   void ::Clear(Display display, Surface surface, ClearType type)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Clear [STUB!]\n");
+   }
+
+   void ::Blit(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Blit [STUB!]\n");
+   }
+
+   void ::SetBlitTint(Display display, Surface surface, ColorAlpha tint)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::SetBlitTint [STUB!]\n");
+   }
+
+   void ::Stretch(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h, int sw, int sh)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Stretch [STUB!]\n");
+   }
+
+   void ::Filter(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h, int sw, int sh)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Filter [STUB!]\n");
+   }
+
+   void ::BlitDI(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::BlitDI [STUB!]\n");
+   }
+
+   void ::StretchDI(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h, int sw, int sh)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::StretchDI [STUB!]\n");
+   }
+
+   void ::FilterDI(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h, int sw, int sh)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::FilterDI [STUB!]\n");
+   }
+
+   void ::TextFont(Display display, Surface surface, Font font)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::TextFont [STUB!]\n");
+   }
+
+   void ::TextOpacity(Display display, Surface surface, bool opaque)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::TextOpacity [STUB!]\n");
+   }
+
+   void ::WriteText(Display display, Surface surface, int x, int y, const char * text, int len)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::WriteText [STUB!]\n");
+   }
+
+   void ::TextExtent(Display display, Surface surface, const char * text, int len, int * width, int * height)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::TextExtent [STUB!]\n");
+   }
+
+   void ::FontExtent(DisplaySystem displaySystem, Font font, const char * text, int len, int * width, int * height)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::FontExtent [STUB!]\n");
+   }
+
+   void ::DrawingChar(Display display, Surface surface, char character)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::DrawingChar [STUB!]\n");
+   }
+
+   void ::NextPage(Display display)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::NextPage [STUB!]\n");
+   }
+
+   // 3D Graphics
+
+#if !defined(ECERE_VANILLA) && !defined(ECERE_NO3D)
+   void ::SetRenderState(Display display, RenderState state, uint value)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::SetRenderState [STUB!]\n");
+   }
+
+   void ::SetLight(Display display, int id, Light light)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::SetLight [STUB!]\n");
+   }
+
+   void ::SetCamera(Display display, Surface surface, Camera camera)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::SetCamera [STUB!]\n");
+   }
+
+   bool ::AllocateMesh(DisplaySystem displaySystem, Mesh mesh, MeshFeatures flags, int nVertices)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::AllocateMesh [STUB!]\n");
+      return false;
+   }
+
+   void ::FreeMesh(DisplaySystem displaySystem, Mesh mesh)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::FreeMesh [STUB!]\n");
+   }
+
+   bool ::LockMesh(DisplaySystem displaySystem, Mesh mesh, MeshFeatures flags)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::LockMesh [STUB!]\n");
+      return false;
+   }
+
+   void ::UnlockMesh(DisplaySystem displaySystem, Mesh mesh, MeshFeatures flags)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::UnlockMesh [STUB!]\n");
+   }
+
+   void * ::AllocateIndices(DisplaySystem displaySystem, int nIndices, bool indices32bit)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::AllocateIndices [STUB!]\n");
+      return null;
+   }
+
+   void ::FreeIndices(DisplaySystem displaySystem, void * indices)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::FreeIndices [STUB!]\n");
+   }
+
+   uint16 * ::LockIndices(DisplaySystem displaySystem, void * indices)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::LockIndices [STUB!]\n");
+      return null;
+   }
+
+   void ::UnlockIndices(DisplaySystem displaySystem, void * indices, bool indices32bit, int nIndices)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::UnlockIndices [STUB!]\n");
+   }
+
+   void ::SelectMesh(Display display, Mesh mesh)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::SelectMesh [STUB!]\n");
+   }
+
+   void ::ApplyMaterial(Display display, Material material, Mesh mesh)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::ApplyMaterial [STUB!]\n");
+   }
+
+   void ::DrawPrimitives(Display display, PrimitiveSingle * primitive, Mesh mesh)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::DrawPrimitives [STUB!]\n");
+   }
+
+   void ::PushMatrix(Display display)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::PushMatrix [STUB!]\n");
+   }
+
+   void ::PopMatrix(Display display, bool setMatrix)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::PopMatrix [STUB!]\n");
+   }
+
+   void ::SetTransform(Display display, Matrix transMatrix, bool viewSpace, bool useCamera)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::SetTransform [STUB!]\n");
+   }
+#endif
+
+}
+
+#endif // !defined(NO_PEPPER_DRIVER)
index 81a6d8f..e4401ff 100644 (file)
@@ -2,7 +2,7 @@ namespace gfx::drivers;
 
 import "instance"
 
-#if (defined(__unix__) || defined(__APPLE__)) && !defined(ECERE_MINIGLX) && !defined(__EMSCRIPTEN__)
+#if (defined(__unix__) || defined(__APPLE__)) && !defined(ECERE_MINIGLX) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
 
 default:
 
@@ -21,7 +21,7 @@ default:
 
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
-#if !defined(__EMSCRIPTEN__)
+#if !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
 #include <X11/extensions/shape.h>
 #include <X11/extensions/Xrender.h>
 #endif
index e1731ad..a74e8d8 100644 (file)
@@ -8,7 +8,7 @@ namespace gui;
 #include <emscripten.h>
 #endif
 
-#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
+#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
 #define property _property
 #define new _new
 #define class _class
@@ -85,7 +85,7 @@ import "network"
 import "CocoaInterface"
 #endif
 
-#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
+#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
 import "XInterface"
 #endif
 
@@ -225,7 +225,7 @@ public class GuiApplication : Application
       delete desktop;
       customCursors.Clear();
 
-#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
+#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
       if(xGlobalDisplay)
          XUnlockDisplay(xGlobalDisplay);
 #endif
@@ -759,7 +759,7 @@ public:
                   Wait();
                else
                {
-#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
+#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
                   if(xGlobalDisplay)
                      XUnlockDisplay(xGlobalDisplay);
 #endif
@@ -769,7 +769,7 @@ public:
                   lockMutex.Wait();
 #endif
 
-#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
+#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
                   if(xGlobalDisplay)
                      XLockDisplay(xGlobalDisplay);
 #endif
@@ -788,7 +788,7 @@ public:
 
    void Wait(void)
    {
-#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
+#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
       if(xGlobalDisplay)
          XUnlockDisplay(xGlobalDisplay);
 #endif
@@ -808,7 +808,7 @@ public:
       lockMutex.Wait();
 #endif
 
-#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
+#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
       if(xGlobalDisplay)
          XLockDisplay(xGlobalDisplay);
 #endif
@@ -1414,7 +1414,7 @@ public:
    {
 #if !defined(__EMSCRIPTEN__)
       lockMutex.Wait();
-#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
+#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
       if(xGlobalDisplay)
          XLockDisplay(xGlobalDisplay);
 #endif
@@ -1424,7 +1424,7 @@ public:
    void Unlock(void)
    {
 #if !defined(__EMSCRIPTEN__)
-#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
+#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
       if(xGlobalDisplay)
          XUnlockDisplay(xGlobalDisplay);
 #endif
index a20a7cf..377c0f9 100644 (file)
@@ -2,7 +2,7 @@ namespace gui::drivers;
 
 import "instance"
 
-#if (defined(__unix__) || defined(__APPLE__)) && !defined(__DOS__) && !defined(__EMSCRIPTEN__)
+#if (defined(__unix__) || defined(__APPLE__)) && !defined(__DOS__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
 
 #undef __BLOCKS__
 #define DBLCLICK_DELAY  0.3  // seconds
diff --git a/ecere/src/gui/drivers/PepperInterface.ec b/ecere/src/gui/drivers/PepperInterface.ec
new file mode 100644 (file)
index 0000000..b6d314b
--- /dev/null
@@ -0,0 +1,289 @@
+namespace gui::drivers;
+
+#ifdef BUILDING_ECERE_COM
+import "Window"
+import "Interface"
+#else
+#ifdef ECERE_STATIC
+public import static "ecere"
+#else
+public import "ecere"
+#endif
+#endif
+
+/*#if !defined(ENABLE_PEPPER_DRIVER)
+#define NO_PEPPER_DRIVER
+#endif*/
+
+#if (defined(__nacl__) || defined(__pnacl__)) // && !defined(NO_PEPPER_DRIVER)
+
+#include <stdio.h>
+
+//#include "ppapi_simple/ps_main.h"
+
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_module.h"
+#include "ppapi/c/pp_var.h"
+
+
+// source file line number printf (sflnprintf)
+#define sflnprintf(format,...) printf("%s:% 5d: " format, __FILE__, __LINE__, ##__VA_ARGS__)
+
+#include <stddef.h>
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/pp_module.h"
+#include "ppapi/c/ppb.h"
+#include "ppapi/c/ppp.h"
+
+class PepperInterface : Interface
+{
+   class_property(name) = "Pepper";
+
+
+   // --- User Interface System ---
+
+   bool ::Initialize()
+   {
+      sflnprintf("class(PepperInterface) ::Initialize [STUB!]\n");
+      return false;
+   }
+
+   void ::Terminate()
+   {
+      sflnprintf("class(PepperInterface) ::Terminate [STUB!]\n");
+   }
+
+   bool ::ProcessInput(bool processAll)
+   {
+      sflnprintf("class(PepperInterface) ::ProcessInput [STUB!]\n");
+      return false;
+   }
+
+   void ::Wait()
+   {
+      sflnprintf("class(PepperInterface) ::Wait [STUB!]\n");
+   }
+
+   void ::Lock(Window window)
+   {
+      sflnprintf("class(PepperInterface) ::Lock [STUB!]\n");
+   }
+
+   void ::Unlock(Window window)
+   {
+      sflnprintf("class(PepperInterface) ::Unlock [STUB!]\n");
+   }
+
+   void ::SetTimerResolution(uint hertz)
+   {
+      sflnprintf("class(PepperInterface) ::SetTimerResolution [STUB!] Implement high resolution timer here\n");
+   }
+
+   const char ** ::GraphicsDrivers(int * numDrivers)
+   {
+      sflnprintf("class(PepperInterface) ::GraphicsDrivers [STUB!]\n");
+      return null;
+   }
+
+   void ::EnsureFullScreen(bool * fullScreen)
+   {
+      sflnprintf("class(PepperInterface) ::EnsureFullScreen [STUB!]\n");
+   }
+
+   void ::GetCurrentMode(bool * fullScreen, Resolution * resolution, PixelFormat * colorDepth, int * refreshRate)
+   {
+      sflnprintf("class(PepperInterface) ::GetCurrentMode [STUB!]\n");
+   }
+
+   bool ::ScreenMode(bool fullScreen, Resolution resolution, PixelFormat colorDepth, int refreshRate, bool * textMode)
+   {
+      sflnprintf("class(PepperInterface) ::ScreenMode [STUB!]\n");
+      return false;
+   }
+
+
+   // --- Window Creation ---
+
+   void * ::CreateRootWindow(Window window)
+   {
+      sflnprintf("class(PepperInterface) ::CreateRootWindow [STUB!]\n");
+      return null;
+   }
+
+   void ::DestroyRootWindow(Window window)
+   {
+      sflnprintf("class(PepperInterface) ::DestroyRootWindow [STUB!]\n");
+   }
+
+
+   // --- Window manipulation ---
+
+   void ::SetRootWindowCaption(Window window, const char * name)
+   {
+      sflnprintf("class(PepperInterface) ::SetRootWindowCaption [STUB!]\n");
+   }
+
+   void ::PositionRootWindow(Window window, int x, int y, int w, int h, bool move, bool resize)
+   {
+      sflnprintf("class(PepperInterface) ::PositionRootWindow [STUB!]\n");
+   }
+
+   void ::OffsetWindow(Window window, int * x, int * y)
+   {
+      sflnprintf("class(PepperInterface) ::OffsetWindow [STUB!]\n");
+   }
+
+   void ::UpdateRootWindow(Window window)
+   {
+      sflnprintf("class(PepperInterface) ::UpdateRootWindow [STUB!]\n");
+   }
+
+   void ::SetRootWindowState(Window window, WindowState state, bool visible)
+   {
+      sflnprintf("class(PepperInterface) ::SetRootWindowState [STUB!]\n");
+   }
+
+   void ::ActivateRootWindow(Window window)
+   {
+      sflnprintf("class(PepperInterface) ::ActivateRootWindow [STUB!]\n");
+   }
+
+   void ::OrderRootWindow(Window window, bool topMost)
+   {
+      sflnprintf("class(PepperInterface) ::OrderRootWindow [STUB!]\n");
+   }
+
+   void ::SetRootWindowColor(Window window)
+   {
+      sflnprintf("class(PepperInterface) ::SetRootWindowColor [STUB!]\n");
+   }
+
+   void ::FlashRootWindow(Window window)
+   {
+      sflnprintf("class(PepperInterface) ::FlashRootWindow [STUB!]\n");
+   }
+
+
+   // --- Mouse-based window movement ---
+
+   void ::StartMoving(Window window, int x, int y, bool fromKeyBoard)
+   {
+      sflnprintf("class(PepperInterface) ::StartMoving [STUB!]\n");
+   }
+
+   void ::StopMoving(Window window)
+   {
+      sflnprintf("class(PepperInterface) ::StopMoving [STUB!]\n");
+   }
+
+
+   // --- Mouse manipulation ---
+
+   void ::GetMousePosition(int *x, int *y)
+   {
+      sflnprintf("class(PepperInterface) ::GetMousePosition [STUB!]\n");
+   }
+
+   void ::SetMousePosition(int x, int y)
+   {
+      sflnprintf("class(PepperInterface) ::SetMousePosition [STUB!]\n");
+   }
+
+   void ::SetMouseRange(Window window, Box box)
+   {
+      sflnprintf("class(PepperInterface) ::SetMouseRange [STUB!]\n");
+   }
+
+   void ::SetMouseCapture(Window window)
+   {
+      sflnprintf("class(PepperInterface) ::SetMouseCapture [STUB!]\n");
+   }
+
+
+   // --- Mouse cursor ---
+
+   void ::SetMouseCursor(Window window, SystemCursor cursor)
+   {
+      sflnprintf("class(PepperInterface) ::SetMouseCursor [STUB!]\n");
+   }
+
+
+   // --- Caret manipulation ---
+
+   void ::SetCaret(int caretX, int caretY, int size)
+   {
+      sflnprintf("class(PepperInterface) ::SetCaret [STUB!]\n");
+   }
+
+
+   // --- Clipboard manipulation ---
+
+   void ::ClearClipboard()
+   {
+      sflnprintf("class(PepperInterface) ::ClearClipboard [STUB!]\n");
+   }
+
+   bool ::AllocateClipboard(ClipBoard clipBoard, uint size)
+   {
+      sflnprintf("class(PepperInterface) ::AllocateClipboard [STUB!]\n");
+      return false;
+   }
+
+   bool ::SaveClipboard(ClipBoard clipBoard)
+   {
+      sflnprintf("class(PepperInterface) ::SaveClipboard [STUB!]\n");
+      return false;
+   }
+
+   bool ::LoadClipboard(ClipBoard clipBoard)
+   {
+      sflnprintf("class(PepperInterface) ::LoadClipboard [STUB!]\n");
+      return false;
+   }
+
+   void ::UnloadClipboard(ClipBoard clipBoard)
+   {
+      sflnprintf("class(PepperInterface) ::UnloadClipboard [STUB!]\n");
+   }
+
+
+   // --- State based input ---
+
+   bool ::AcquireInput(Window window, bool state)
+   {
+      sflnprintf("class(PepperInterface) ::AcquireInput [STUB!]\n");
+      return false;
+   }
+
+   bool ::GetMouseState(MouseButtons * buttons, int * x, int * y)
+   {
+      sflnprintf("class(PepperInterface) ::GetMouseState [STUB!]\n");
+      return false;
+   }
+
+   bool ::GetJoystickState(int device, Joystick joystick)
+   {
+      sflnprintf("class(PepperInterface) ::GetJoystickState [STUB!]\n");
+      return false;
+   }
+
+   bool ::GetKeyState(Key key)
+   {
+      sflnprintf("class(PepperInterface) ::GetKeyState [STUB!]\n");
+      return false;
+   }
+
+   bool ::SetIcon(Window window, BitmapResource icon)
+   {
+      sflnprintf("class(PepperInterface) ::SetIcon [STUB!]\n");
+      return false;
+   }
+
+   void ::GetScreenArea(Window window, Box box)
+   {
+      sflnprintf("class(PepperInterface) ::GetScreenArea [STUB!]\n");
+   }
+}
+
+#endif // !defined(NO_PEPPER_DRIVER)
index 80d8fae..214185e 100644 (file)
@@ -5,7 +5,7 @@ import "instance"
 import "OpenGLDisplayDriver"
 #endif
 
-#if (defined(__unix__) || defined(__APPLE__)) && !defined(ECERE_MINIGLX) && !defined(__EMSCRIPTEN__)
+#if (defined(__unix__) || defined(__APPLE__)) && !defined(ECERE_MINIGLX) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
 
 #undef __BLOCKS__
 default:
@@ -50,7 +50,7 @@ typedef int X11Bool;
 
 #include <X11/Xatom.h>
 #include <X11/Xlib.h>
-#if !defined(__EMSCRIPTEN__)
+#if !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
 #include <X11/Xresource.h>
 #endif
 #include <X11/Xutil.h>
@@ -65,7 +65,7 @@ typedef int X11Bool;
 #include <GL/glx.h>
 #endif
 #endif
-#if !defined(__EMSCRIPTEN__)
+#if !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
 #include <X11/extensions/Xrender.h>
 #endif
 #include <X11/extensions/XShm.h>
index eab0746..5faac5b 100644 (file)
@@ -198,7 +198,7 @@ public class WindowsSkin_Window : Window
          // PrintLn(_class.name, " is at l = ", rcWindow.left, ", r = ", rcWindow.right);
 #else
          Box widths = { 0 };
-#if !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
+#if !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
          XGetBorderWidths(this, widths);
 #endif
          *w += widths.left + widths.right;
@@ -285,7 +285,7 @@ public class WindowsSkin_Window : Window
          *y += client00.y - rcWindow.top;
 #else
          Box widths = { 0 };
-#if !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
+#if !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
          XGetBorderWidths(this, widths);
 #endif
          *x += widths.left;
index 2a73e02..ad6e8f9 100644 (file)
@@ -1147,9 +1147,11 @@ public bool FileSetTime(const char * fileName, TimeStamp created, TimeStamp acce
       }
 #else
       struct utimbuf t = { (int)accessed, (int)modified };
+#if !defined(__pnacl__)
       if(!utime(fileName, &t))
          result = true;
 #endif
+#endif
    }
    return result;
 }
@@ -1427,11 +1429,13 @@ static FileDesc FileFind(const char * path, const char * extensions)
                strcat(file.path, file.name);
                if(!stat(file.path, &s))
                {
+#if !defined(__pnacl__)
                   file.stats.attribs = (s.st_mode&S_IFDIR) ? FileAttribs { isDirectory = true } : FileAttribs { isFile = true };
                   file.stats.size = (FileSize)s.st_size;
                   file.stats.accessed = s.st_atime;
                   file.stats.modified = s.st_mtime;
                   file.stats.created = s.st_ctime;
+#endif
                }
                strcpy(d.name, path);
 
@@ -1704,12 +1708,14 @@ private class FileDesc : struct
                strcat(path, name);
                if(!stat(path, &s))
                {
+#if !defined(__pnacl__)
                   stats.attribs = FileAttribs { };
                   stats.attribs = (s.st_mode&S_IFDIR) ? FileAttribs { isDirectory = true } : FileAttribs { isFile = true };
                   stats.size = (FileSize)s.st_size;
                   stats.accessed = s.st_atime;
                   stats.modified = s.st_mtime;
                   stats.created = s.st_ctime;
+#endif
                }
                result = this;
             }
index 004b3b7..3c0d1a6 100644 (file)
@@ -24,7 +24,7 @@ static Map<const String, Map<const String, const String>> moduleMaps { };
 
 public dllexport void LoadTranslatedStrings(const String moduleName, const char * name)
 {
-#if !defined(ECERE_NOFILE) && !defined(__EMSCRIPTEN__)
+#if !defined(ECERE_NOFILE) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
    File f;
    char fileName[MAX_LOCATION];
 
index c34cb54..1d63fbd 100755 (executable)
@@ -2814,7 +2814,8 @@ class IDEWorkSpace : Window
          if(binaryDocExt.Find(ext))
             ShellOpen(path);
          else if(!strcmp(ext, "a") || !strcmp(ext, "o") || !strcmp(ext, "bc") ||
-               !strcmp(ext, "lib") || !strcmp(ext, "dll") || !strcmp(ext, "exe"))
+               !strcmp(ext, "lib") || !strcmp(ext, "dll") ||
+               !strcmp(ext, "exe") || !strcmp(ext, "nexe") || !strcmp(ext, "pexe"))
          {
             char dirPath[MAX_LOCATION];
             StripLastDirectory(path, dirPath);
index b232d9a..c43125f 100644 (file)
@@ -2806,7 +2806,9 @@ private:
 
          // Important: We cannot use this ifdef anymore, EXECUTABLE_TARGET is not yet defined. It's embedded in the crossplatform.mk EXECUTABLE
          //f.Puts("ifdef EXECUTABLE_TARGET\n");
+         f.Puts("ifneq ($(COMPILER),pnacl)\n");
          f.Printf("CONSOLE = %s\n", GetConsole(config) ? "-mconsole" : "-mwindows");
+         f.Puts("endif\n");
          //f.Puts("endif\n");
          f.Puts("\n");