privatise data structs for evas... much cleaner. all structs are now internal

so you cant look into them. all defines now become enums too - cleaner. no
more bypassing the api is possible :)

also added better checks and --with- stuff for imlib2, gl and ttf


SVN revision: 3548
This commit is contained in:
Carsten Haitzler 2000-09-26 19:16:48 +00:00
parent faa90fe44b
commit 289117a952
19 changed files with 294 additions and 229 deletions

View File

@ -12,10 +12,24 @@ if test X"$enable_shared" = Xyes; then
DLLDFLAGS=-export-dynamic
AC_SUBST(DLLDFLAGS)
fi
AM_WITH_DMALLOC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
IMLIB2_CONFIG="imlib2-config"
AC_ARG_WITH(imlib2,
[ --with-imlib2=DIR use DIR where imlib2 was installed (eg /usr/local)],
[CPPFLAGS="$CPPFLAGS -I$withval/include"
IMLIB2_CONFIG=$withval"/bin/imlib2-config"])
AC_ARG_WITH(ttf,
[ --with-ttf=DIR use DIR where freetype was installed (eg /opt/freetype)],
[CPPFLAGS="$CPPFLAGS -I$withval/include"
LIBS_TTF="-L"$withval"/lib"])
AC_ARG_WITH(gl,
[ --with-gl=DIR use DIR where opengl was installed (eg /usr/X11R6)],
[CPPFLAGS="$CPPFLAGS -I$withval/include"
LIBS_GL="-L"$withval"/lib"])
#### Find out about X
AC_PATH_X
AC_PATH_XTRA
@ -56,10 +70,11 @@ AC_CHECK_LIB(Imlib2, imlib_context_set_image, ,[
echo ""
echo "ERROR: Imlib 2 needed"
echo ""
AC_MSG_ERROR([Fatal Error: no Imlib2 detected.]); exit], -L/usr/X11R6/lib -L/usr/local/lib -lm -ldl -lttf -lX11 -lXext)
AC_MSG_ERROR([Fatal Error: no Imlib2 detected.]); exit],
`$IMLIB2_CONFIG --libs` `$IMLIB2_CONFIG --cflags`)
)
AC_CHECK_LIB(ttf, TT_Init_FreeType, TTF_LIBS=-lttf, [
AC_CHECK_LIB(ttf, TT_Init_FreeType, TTF_LIBS=-lttf $LIBS_TTF, [
echo ""
echo "ERROR: Evas needs a system with libttf.so (TrueType Font Library)"
echo "You can obtain it from:"
@ -69,7 +84,7 @@ echo "http://www.freetype.org/"
echo "You can obtain some truetype fonts from:"
echo "http://voyager.cns.ohiou.edu/~sadkins/web_library/fonts/font_archive/"
echo ""
AC_MSG_ERROR([Fatal Error: no FreeType detected.])], -lm)
AC_MSG_ERROR([Fatal Error: no FreeType detected.])], $LIBS_TTF -lm)
AC_CHECK_HEADERS(freetype.h freetype/freetype.h,[ break] , )
@ -97,6 +112,8 @@ AC_MSG_ERROR([Fatal Error: no FreeType header files detected.])
fi
fi
ttf_includes="$CPPFLAGS"
ttf_libs="$LIBS_TTF -lm -lttf"
gl_includes=""
#### Find out about OpenGL
@ -104,24 +121,22 @@ PREV_CPPFLAGS=$CPPFLAGS
CPPFLAGS=$CPPFLAGS" -I/usr/include -I/usr/local/include "$x_cflags
AC_TRY_CPP(GL/gl.h,
echo "checking for GL/gl.h... yes"
gl_includes="-I/usr/include -I/usr/local/include "$x_cflags
gl_includes=$CPPFLAGS" -I/usr/include -I/usr/local/include "$x_cflags
AC_CHECK_LIB(GL, glBindTexture, have_gl=yes,[
], -L/usr/local/lib -lGL $X_LDFLAGS $X_EXTRA_LIBS $X_LIBS)
], -L/usr/local/lib -lGL $X_LDFLAGS $X_EXTRA_LIBS $X_LIBS $LIBS_GL)
)
if test "x$have_gl" = "xyes"; then
gl_includes=$gl_includes" -I/usr/include -I/usr/local/include"
gl_ldflags=$gl_ldflags" -L/usr/local/lib"
gl_includes=$gl_includes
gl_ldflags=$gl_ldflags" -L/usr/local/lib "$X_LDFLAGS" "$X_EXTRA_LIBS" "$X_LIBS" "$LIBS_GL
gl_libs=$gl_libs" -lGL"
AC_DEFINE(HAVE_GL)
AC_TRY_CPP(GL/glu.h,
echo "checking for GL/glu.h... yes"
gl_includes="-I/usr/include -I/usr/local/include "$x_cflags
AC_CHECK_LIB(GLU, gluBuild2DMipmaps, have_glu=yes,[
], -L/usr/local/lib -lGL -lGLU $X_LDFLAGS $X_EXTRA_LIBS $X_LIBS)
], $gl_ldflags -lGL -lGLU)
)
if test "x$have_glu" = "xyes"; then
gl_includes=$gl_includes" -I/usr/include -I/usr/local/include"
gl_ldflags=$gl_ldflags" -L/usr/local/lib"
gl_libs=$gl_libs" -lGLU"
AC_DEFINE(HAVE_GLU)
else
@ -140,8 +155,8 @@ else
fi
CPPFLAGS=$PREV_CPPFLAGS
imlib2_inlcudes=`imlib2-config --cflags`
imlib2_libs=`imlib2-config --libs`
imlib2_inlcudes=`$IMLIB2_CONFIG --cflags`
imlib2_libs=`$IMLIB2_CONFIG --libs`
AC_SUBST(x_cflags)
AC_SUBST(x_includes)
@ -152,6 +167,8 @@ AC_SUBST(gl_ldflags)
AC_SUBST(gl_libs)
AC_SUBST(imlib2_includes)
AC_SUBST(imlib2_libs)
AC_SUBST(ttf_includes)
AC_SUBST(ttf_libs)
AC_OUTPUT([
Makefile src/Makefile test/Makefile evas-config

View File

@ -4,236 +4,55 @@
#include <X11/Xlib.h>
#include <Imlib2.h>
typedef struct _Evas * Evas;
typedef struct _Evas_Gradient * Evas_Gradient;
typedef struct _Evas_Object_Any * Evas_Object;
typedef struct _Evas_Object_Any * Evas_Object_Any;
typedef int Evas_Callback_Type;
typedef int Evas_Image_Format;
typedef int Evas_Render_Method;
typedef struct _Evas_Render_Data Evas_Render_Data;
/* types */
#ifndef _EVAS_PRIVATE_H
typedef void * Evas;
typedef void * Evas_Gradient;
typedef void * Evas_Object;
#endif
typedef struct _Evas_List * Evas_List;
typedef struct _Evas_Data * Evas_Data;
typedef struct _Evas_Layer * Evas_Layer;
typedef struct _Evas_Color_Point * Evas_Color_Point;
typedef struct _Evas_Callback * Evas_Callback;
typedef struct _Evas_Rectangle * Evas_Rectangle;
typedef struct _Evas_Object_Image * Evas_Object_Image;
typedef struct _Evas_Object_Text * Evas_Object_Text;
typedef struct _Evas_Object_Rectangle * Evas_Object_Rectangle;
typedef struct _Evas_Object_Line * Evas_Object_Line;
typedef struct _Evas_Object_Gradient_Box * Evas_Object_Gradient_Box;
#define RENDER_METHOD_ALPHA_SOFTWARE 0
#define RENDER_METHOD_BASIC_HARDWARE 1
#define RENDER_METHOD_3D_HARDWARE 2
#define RENDER_METHOD_ALPHA_HARDWARE 3
#define RENDER_METHOD_IMAGE 4
#define RENDER_METHOD_COUNT 5
typedef enum _Evas_Callback_Type Evas_Callback_Type;
typedef enum _Evas_Image_Format Evas_Image_Format;
typedef enum _Evas_Render_Method Evas_Render_Method;
#define CALLBACK_MOUSE_IN 0
#define CALLBACK_MOUSE_OUT 1
#define CALLBACK_MOUSE_DOWN 2
#define CALLBACK_MOUSE_UP 3
#define CALLBACK_MOUSE_MOVE 4
#define CALLBACK_FREE 5
#define IMAGE_FORMAT_BGRA 0
#define IMAGE_FORMAT_ARGB 1
#define IMAGE_FORMAT_RGB 2
#define IMAGE_FORMAT_GRAY 3
#define OBJECT_IMAGE 1230
#define OBJECT_TEXT 1231
#define OBJECT_RECTANGLE 1232
#define OBJECT_LINE 1233
#define OBJECT_GRADIENT_BOX 1234
#define IF_OBJ(_o, _t) if (((Evas_Object)_o)->type != _t)
struct _Evas_Render_Data
{
int *method[RENDER_METHOD_COUNT];
};
struct _Evas
{
struct {
Display *display;
Drawable drawable;
Visual *visual;
Colormap colormap;
int created_window;
int screen;
int colors;
Imlib_Image image;
int drawable_width, drawable_height;
struct {
double x, y, w, h;
} viewport;
Evas_Render_Method render_method;
Evas_Render_Data renderer_data;
} current, previous;
struct {
int in;
int x, y;
int buttons;
Evas_Object object, button_object;
} mouse;
void (*evas_renderer_data_free) (Evas _e);
int changed;
Evas_List layers;
Imlib_Updates updates;
};
struct _Evas_Color_Point
{
int r, g, b, a;
int distance;
};
struct _Evas_Gradient
{
Evas_List color_points;
};
struct _Evas_List
/* public structs */
struct _Evas_List
{
Evas_List prev, next;
void *data;
};
struct _Evas_Rectangle
/* enums */
#define RENDER_METHOD_COUNT 5
enum _Evas_Render_Method
{
int x, y, w, h;
RENDER_METHOD_ALPHA_SOFTWARE,
RENDER_METHOD_BASIC_HARDWARE,
RENDER_METHOD_3D_HARDWARE,
RENDER_METHOD_ALPHA_HARDWARE,
RENDER_METHOD_IMAGE
};
struct _Evas_Data
enum _Evas_Callback_Type
{
char *key;
void *data;
CALLBACK_MOUSE_IN,
CALLBACK_MOUSE_OUT,
CALLBACK_MOUSE_DOWN,
CALLBACK_MOUSE_UP,
CALLBACK_MOUSE_MOVE,
CALLBACK_FREE
};
struct _Evas_Layer
enum _Evas_Image_Format
{
int layer;
Evas_List objects;
struct {
int store;
} current, previous;
Evas_Render_Data renderer_data;
};
struct _Evas_Callback
{
Evas_Callback_Type type;
void *data;
void (*callback) (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
};
struct _Evas_Object_Any
{
int type;
struct {
double x, y, w, h;
int zoomscale;
int layer;
int visible;
int stacking;
} current, previous;
int changed;
int delete_me;
int pass_events;
void (*object_free) (Evas_Object _o);
void (*object_renderer_data_free) (Evas _e, Evas_Object _o);
Evas_List callbacks;
Evas_List data;
Evas_Render_Data renderer_data;
char *name;
};
struct _Evas_Object_Image
{
struct _Evas_Object_Any object;
struct {
char *file;
int new_data;
int scale;
struct {
int w, h;
} image;
struct {
double x, y, w, h;
} fill;
struct {
int l, r, t, b;
} border;
struct {
int r, g, b, a;
} color;
} current, previous;
};
struct _Evas_Object_Text
{
struct _Evas_Object_Any object;
struct {
char *text;
char *font;
int size;
struct {
int w, h;
} string;
int r, g, b, a;
} current, previous;
};
struct _Evas_Object_Rectangle
{
struct _Evas_Object_Any object;
struct {
int r, g, b, a;
} current, previous;
};
struct _Evas_Object_Line
{
struct _Evas_Object_Any object;
struct {
double x1, y1, x2, y2;
int r, g, b, a;
} current, previous;
};
struct _Evas_Object_Gradient_Box
{
struct _Evas_Object_Any object;
struct {
Evas_Gradient gradient;
int new_gradient;
double angle;
} current, previous;
IMAGE_FORMAT_BGRA,
IMAGE_FORMAT_ARGB,
IMAGE_FORMAT_RGB,
IMAGE_FORMAT_GRAY
};
/* functions */
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -0,0 +1,211 @@
#ifndef _EVAS_PRIVATE_H
#define _EVAS_PRIVATE_H 1
#include <X11/Xlib.h>
#include <Imlib2.h>
typedef struct _Evas * Evas;
typedef struct _Evas_Gradient * Evas_Gradient;
typedef struct _Evas_Object_Any * Evas_Object;
typedef struct _Evas_Object_Any * Evas_Object_Any;
typedef struct _Evas_Render_Data Evas_Render_Data;
typedef struct _Evas_Data * Evas_Data;
typedef struct _Evas_Layer * Evas_Layer;
typedef struct _Evas_Color_Point * Evas_Color_Point;
typedef struct _Evas_Callback * Evas_Callback;
typedef struct _Evas_Rectangle * Evas_Rectangle;
typedef struct _Evas_Object_Image * Evas_Object_Image;
typedef struct _Evas_Object_Text * Evas_Object_Text;
typedef struct _Evas_Object_Rectangle * Evas_Object_Rectangle;
typedef struct _Evas_Object_Line * Evas_Object_Line;
typedef struct _Evas_Object_Gradient_Box * Evas_Object_Gradient_Box;
#define OBJECT_IMAGE 1230
#define OBJECT_TEXT 1231
#define OBJECT_RECTANGLE 1232
#define OBJECT_LINE 1233
#define OBJECT_GRADIENT_BOX 1234
#define IF_OBJ(_o, _t) if (((Evas_Object)_o)->type != _t)
#include "Evas.h"
struct _Evas_Render_Data
{
int *method[RENDER_METHOD_COUNT];
};
struct _Evas
{
struct {
Display *display;
Drawable drawable;
Visual *visual;
Colormap colormap;
int created_window;
int screen;
int colors;
Imlib_Image image;
int drawable_width, drawable_height;
struct {
double x, y, w, h;
} viewport;
Evas_Render_Method render_method;
Evas_Render_Data renderer_data;
} current, previous;
struct {
int in;
int x, y;
int buttons;
Evas_Object object, button_object;
} mouse;
void (*evas_renderer_data_free) (Evas _e);
int changed;
Evas_List layers;
Imlib_Updates updates;
};
struct _Evas_Color_Point
{
int r, g, b, a;
int distance;
};
struct _Evas_Gradient
{
Evas_List color_points;
};
struct _Evas_Rectangle
{
int x, y, w, h;
};
struct _Evas_Data
{
char *key;
void *data;
};
struct _Evas_Layer
{
int layer;
Evas_List objects;
struct {
int store;
} current, previous;
Evas_Render_Data renderer_data;
};
struct _Evas_Callback
{
Evas_Callback_Type type;
void *data;
void (*callback) (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
};
struct _Evas_Object_Any
{
int type;
struct {
double x, y, w, h;
int zoomscale;
int layer;
int visible;
int stacking;
} current, previous;
int changed;
int delete_me;
int pass_events;
void (*object_free) (Evas_Object _o);
void (*object_renderer_data_free) (Evas _e, Evas_Object _o);
Evas_List callbacks;
Evas_List data;
Evas_Render_Data renderer_data;
char *name;
};
struct _Evas_Object_Image
{
struct _Evas_Object_Any object;
struct {
char *file;
int new_data;
int scale;
struct {
int w, h;
} image;
struct {
double x, y, w, h;
} fill;
struct {
int l, r, t, b;
} border;
struct {
int r, g, b, a;
} color;
} current, previous;
};
struct _Evas_Object_Text
{
struct _Evas_Object_Any object;
struct {
char *text;
char *font;
int size;
struct {
int w, h;
} string;
int r, g, b, a;
} current, previous;
};
struct _Evas_Object_Rectangle
{
struct _Evas_Object_Any object;
struct {
int r, g, b, a;
} current, previous;
};
struct _Evas_Object_Line
{
struct _Evas_Object_Any object;
struct {
double x1, y1, x2, y2;
int r, g, b, a;
} current, previous;
};
struct _Evas_Object_Gradient_Box
{
struct _Evas_Object_Any object;
struct {
Evas_Gradient gradient;
int new_gradient;
double angle;
} current, previous;
};
#endif

View File

@ -9,16 +9,18 @@ LIBS_X = @x_ldflags@ @x_libs@
LIBS_IMLIB2 = @imlib2_libs@
#LIBS_DB = -ledb
LIBS_GL = @gl_ldflags@ @gl_libs@
LIBS_TTF = @ttf_libs@
LIBS_EXTRA = -L/usr/local/lib
CFLAGS_X = @x_cflags@
CFLAGS_IMLIB2 = @imlib2_includes@
#CFLAGS_DB =
CFLAGS_GL = @gl_includes@
CFLAGS_TTF = @ttf_includes@
CFLAGS_EXTRA = -I$(includedir) -I$(top_srcdir) -I/usr/local/include
LIBS_ALL = $(LIBS_X) $(LIBS_IMLIB2) $(LIBS_GL) $(LIBS_EXTRA)
CFLGAS_ALL = $(CFLAGS_X) $(CFLAGS_IMLIB2) $(CFLAGS_GL) $(CFLAGS_EXTRA)
LIBS_ALL = $(LIBS_X) $(LIBS_IMLIB2) $(LIBS_GL) $(LIBS_TTF) $(LIBS_EXTRA)
CFLGAS_ALL = $(CFLAGS_X) $(CFLAGS_IMLIB2) $(CFLAGS_GL) $(CFLAGS_TTF) $(CFLAGS_EXTRA)
INCLUDES = $(CFLGAS_ALL) \
-DLIBDIR=\"$(libdir)\" \
@ -49,7 +51,8 @@ evas_x11_routines.c \
evas_image_routines.h \
evas_imlib_routines.h \
evas_x11_routines.h \
Evas.h
Evas.h \
Evas_private.h
libevas_la_LIBADD = $(LIBS_ALL)
libevas_la_DEPENDENCIES = $(top_builddir)/config.h

View File

@ -1,3 +1,4 @@
#include "Evas_private.h"
#include "Evas.h"
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,3 +1,4 @@
#include "Evas_private.h"
#include "Evas.h"
#include <stdio.h>
#include <stdlib.h>

View File

@ -29,6 +29,7 @@ typedef int GLuint;
#include <freetype.h>
#endif
#include "Evas_private.h"
#include "Evas.h"
typedef struct _evas_gl_image Evas_GL_Image;

View File

@ -1,3 +1,4 @@
#include "Evas_private.h"
#include "Evas.h"
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,3 +1,4 @@
#include "Evas_private.h"
#include "Evas.h"
#include <stdio.h>
#include <stdlib.h>

View File

@ -12,6 +12,7 @@
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include "Evas_private.h"
#include "Evas.h"
#include <Imlib2.h>

View File

@ -12,6 +12,7 @@
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include "Evas_private.h"
#include "Evas.h"
#include <Imlib2.h>

View File

@ -1,3 +1,4 @@
#include "Evas_private.h"
#include "Evas.h"
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,3 +1,4 @@
#include "Evas_private.h"
#include "Evas.h"
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,3 +1,4 @@
#include "Evas_private.h"
#include "Evas.h"
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,3 +1,4 @@
#include "Evas_private.h"
#include "Evas.h"
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,3 +1,4 @@
#include "Evas_private.h"
#include "Evas.h"
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,3 +1,4 @@
#include "Evas_private.h"
#include "Evas.h"
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,3 +1,4 @@
#include "Evas_private.h"
#include "Evas.h"
#include <stdio.h>
#include <stdlib.h>

View File

@ -12,6 +12,7 @@
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include "Evas_private.h"
#include "Evas.h"
#include <Imlib2.h>