Move to Imlib2. Build for e16.8.

- This is a quick and dirty port to imlib2. It's posible to clean/speed up
  things considerably here and there.
- It's not unlikely that I missed some spots that require fixups.


SVN revision: 21639
This commit is contained in:
Kim Woelders 2006-03-31 22:56:17 +00:00
parent da95987958
commit 528b750a2c
22 changed files with 374 additions and 622 deletions

View File

@ -1,298 +0,0 @@
/* acconfig.h
This file is in the public domain.
Descriptive text for the C preprocessor macros that
the distributed Autoconf macros can define.
No software package will use all of them; autoheader copies the ones
your configure.in uses into your configuration header file templates.
The entries are in sort -df order: alphabetical, case insensitive,
ignoring punctuation (such as underscores). Although this order
can split up related entries, it makes it easier to check whether
a given entry is in the file.
Leave the following blank line there!! Autoheader needs it. */
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
#undef _ALL_SOURCE
#endif
/* Define if using alloca.c. */
#undef C_ALLOCA
/* Define if type char is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
#undef __CHAR_UNSIGNED__
#endif
/* Define if the closedir function returns void instead of int. */
#undef CLOSEDIR_VOID
/* Define to empty if the keyword does not work. */
#undef const
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
#undef CRAY_STACKSEG_END
/* Define for DGUX with <sys/dg_sys_info.h>. */
#undef DGUX
/* Define if you have <dirent.h>. */
#undef DIRENT
/* Define to the type of elements in the array set by `getgroups'.
Usually this is either `int' or `gid_t'. */
#undef GETGROUPS_T
/* Define if the `getloadavg' function needs to be run setuid or setgid. */
#undef GETLOADAVG_PRIVILEGED
/* Define if the `getpgrp' function takes no argument. */
#undef GETPGRP_VOID
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define if you have alloca, as a function or macro. */
#undef HAVE_ALLOCA
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H
/* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT
/* Define if your system has a working fnmatch function. */
#undef HAVE_FNMATCH
/* Define if your system has its own `getloadavg' function. */
#undef HAVE_GETLOADAVG
/* Define if you have the getmntent function. */
#undef HAVE_GETMNTENT
/* Define if the `long double' type works. */
#undef HAVE_LONG_DOUBLE
/* Define if you support file names longer than 14 characters. */
#undef HAVE_LONG_FILE_NAMES
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define if you have e >= 0.16.4 */
#undef NEW_REMEMBER
/* Define if system calls automatically restart after interruption
by a signal. */
#undef HAVE_RESTARTABLE_SYSCALLS
/* Define if your struct stat has st_blksize. */
#undef HAVE_ST_BLKSIZE
/* Define if your struct stat has st_blocks. */
#undef HAVE_ST_BLOCKS
/* Define if you have the strcoll function and it is properly defined. */
#undef HAVE_STRCOLL
/* Define if your struct stat has st_rdev. */
#undef HAVE_ST_RDEV
/* Define if you have the strftime function. */
#undef HAVE_STRFTIME
/* Define if you have the ANSI # stringizing operator in cpp. */
#undef HAVE_STRINGIZE
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define if your struct tm has tm_zone. */
#undef HAVE_TM_ZONE
/* Define if you don't have tm_zone but do have the external array
tzname. */
#undef HAVE_TZNAME
/* Define if you have <unistd.h>. */
#undef HAVE_UNISTD_H
/* Define if utime(file, NULL) sets file's timestamp to the present. */
#undef HAVE_UTIME_NULL
/* Define if you have <vfork.h>. */
#undef HAVE_VFORK_H
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* Define if you have the wait3 system call. */
#undef HAVE_WAIT3
/* Define as __inline if that's what the C compiler calls it. */
#undef inline
/* Define if int is 16 bits instead of 32. */
#undef INT_16_BITS
/* Define if long int is 64 bits. */
#undef LONG_64_BITS
/* Define if major, minor, and makedev are declared in <mkdev.h>. */
#undef MAJOR_IN_MKDEV
/* Define if major, minor, and makedev are declared in <sysmacros.h>. */
#undef MAJOR_IN_SYSMACROS
/* Define if on MINIX. */
#undef _MINIX
/* Define to `int' if <sys/types.h> doesn't define. */
#undef mode_t
/* Define if you don't have <dirent.h>, but have <ndir.h>. */
#undef NDIR
/* Define if you have <memory.h>, and <string.h> doesn't declare the
mem* functions. */
#undef NEED_MEMORY_H
/* Define if your struct nlist has an n_un member. */
#undef NLIST_NAME_UNION
/* Define if you have <nlist.h>. */
#undef NLIST_STRUCT
/* How gnome friendly do we feel? */
#undef NO_AUTO_RESPAWN
/* Define if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Define if your Fortran 77 compiler doesn't accept -c and -o together. */
#undef F77_NO_MINUS_C_MINUS_O
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef pid_t
/* Define if the system does not provide POSIX.1 features except
with this defined. */
#undef _POSIX_1_SOURCE
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
/* Define to the type of arg1 for select(). */
#undef SELECT_TYPE_ARG1
/* Define to the type of args 2, 3 and 4 for select(). */
#undef SELECT_TYPE_ARG234
/* Define to the type of arg5 for select(). */
#undef SELECT_TYPE_ARG5
/* Define if the `setpgrp' function takes no argument. */
#undef SETPGRP_VOID
/* Define if the setvbuf function takes the buffering type as its second
argument and the buffer pointer as the third, as on System V
before release 3. */
#undef SETVBUF_REVERSED
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
#undef STACK_DIRECTION
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
#undef STAT_MACROS_BROKEN
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you have stdarg.h */
#undef HAVE_STDARGS
/* Define on System V Release 4. */
#undef SVR4
/* Define if you don't have <dirent.h>, but have <sys/dir.h>. */
#undef SYSDIR
/* Define if you don't have <dirent.h>, but have <sys/ndir.h>. */
#undef SYSNDIR
/* Define if `sys_siglist' is declared by <signal.h>. */
#undef SYS_SIGLIST_DECLARED
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define if your <sys/time.h> declares struct tm. */
#undef TM_IN_SYS_TIME
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
/* Define for Encore UMAX. */
#undef UMAX
/* Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
instead of <sys/cpustats.h>. */
#undef UMAX4_3
/* Define if you do not have <strings.h>, index, bzero, etc.. */
#undef USG
/* Define vfork as fork if vfork does not work. */
#undef vfork
/* Define if the closedir function returns void instead of int. */
#undef VOID_CLOSEDIR
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
/* Define if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
/* Define if lex declares yytext as a char * by default, not a char[]. */
#undef YYTEXT_POINTER
/* Do we need libgtop? */
#undef HAVE_LIBGTOP
/* Do we have OpenGL? */
#undef HAVE_LIBGL
/* E-Mountbox stuff */
#undef EJECT
#undef MOUNT
#undef UMOUNT
#undef HAVE_EJECT
/* Leave that blank line there!! Autoheader needs it.
If you're adding to this file, keep in mind:
The entries are in sort -df order: alphabetical, case insensitive,
ignoring punctuation (such as underscores). */

View File

@ -5,7 +5,7 @@ lib_LTLIBRARIES = libepplet.la
include_HEADERS = epplet.h
libepplet_la_SOURCES = epplet.c snprintf.c
libepplet_la_DEPENDENCIES = $(top_builddir)/config.h epplet.h
libepplet_la_LDFLAGS = -version-info 1:0:1
libepplet_la_LDFLAGS = -version-info 1:0:0
INCLUDES = -I$(top_srcdir) $(X_CFLAGS)

View File

@ -5,7 +5,11 @@
#include <sys/utsname.h>
#include <signal.h>
#include <sys/wait.h>
#include <X11/Xatom.h>
#include <X11/keysym.h>
#include <X11/extensions/shape.h>
#define DEPTH() DefaultDepth(disp, DefaultScreen(disp))
#define SET_HINTS_OLD 1
#define SET_HINTS_EWM 1
@ -37,7 +41,6 @@ static Epplet_window mainwin; /* Always the main epplet window */
static Atom wmDeleteWindow;
static ImlibData *id = NULL;
static Display *dd = NULL;
static Window comms_win = 0;
static Window my_win = 0;
@ -182,12 +185,6 @@ static void Epplet_textbox_textsize(Epplet_gadget gadget, int *w,
int Epplet_textbox_spacesize(Epplet_gadget gadget);
static void Epplet_find_instance(char *name);
ImlibData *
Epplet_get_imlib_data(void)
{
return (id);
}
typedef struct gad_general
{
GadType type;
@ -430,21 +427,23 @@ Epplet_Init(char *name,
Atom atom_list[8];
int atom_count;
#endif
ImlibInitParams iip;
mainwin = malloc(sizeof(EppWindow));
mainwin->win_vert = vertical;
w *= 16;
h *= 16;
disp = XOpenDisplay(NULL);
iip.flags = PARAMS_VISUALID;
iip.visualid = XVisualIDFromVisual(DefaultVisual(disp, DefaultScreen(disp)));
id = Imlib_init_with_params(disp, &iip);
if (!disp)
{
fprintf(stderr, "Epplet Error: Cannot open display\n");
exit(1);
}
XSynchronize(disp, True);
imlib_context_set_display(disp);
imlib_context_set_visual(DefaultVisual(disp, DefaultScreen(disp)));
imlib_context_set_colormap(DefaultColormap(disp, DefaultScreen(disp)));
ECommsSetup(disp);
XSelectInput(disp, DefaultRootWindow(disp), PropertyChangeMask);
@ -454,7 +453,7 @@ Epplet_Init(char *name,
/* create a window with everythign set */
attr.backing_store = NotUseful;
attr.override_redirect = False;
attr.colormap = Imlib_get_colormap(id);
attr.colormap = imlib_context_get_colormap();
attr.border_pixel = 0;
attr.background_pixel = 0;
attr.save_under = False;
@ -464,8 +463,7 @@ Epplet_Init(char *name,
ExposureMask | FocusChangeMask | PropertyChangeMask |
VisibilityChangeMask;
mainwin->win = XCreateWindow(disp, DefaultRootWindow(disp), 0, 0, w, h, 0,
id->x.depth, InputOutput,
Imlib_get_visual(id),
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder |
CWBackingStore | CWColormap | CWBackPixel |
CWBorderPixel | CWEventMask, &attr);
@ -611,7 +609,7 @@ Epplet_internal_create_window(int w, int h, char *title, char vertical,
ret->win_vert = vertical;
attr.backing_store = NotUseful;
attr.override_redirect = False;
attr.colormap = Imlib_get_colormap(id);
attr.colormap = imlib_context_get_colormap();
attr.border_pixel = 0;
attr.background_pixel = 0;
attr.save_under = False;
@ -622,7 +620,7 @@ Epplet_internal_create_window(int w, int h, char *title, char vertical,
VisibilityChangeMask;
ret->win = XCreateWindow(disp, DefaultRootWindow(disp), 0, 0, w, h, 0,
id->x.depth, InputOutput, Imlib_get_visual(id),
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder | CWBackingStore
| CWColormap | CWBackPixel | CWBorderPixel |
CWEventMask, &attr);
@ -774,11 +772,23 @@ Epplet_window_hide(Window win)
void
Epplet_window_destroy_children(Epplet_window win)
{
int i;
int i, num;
Epplet_gadget *lst;
for (i = 0; i < gad_num; i++)
if (((GadGeneral *) gads[i])->parent == win)
Epplet_gadget_destroy(gads[i]);
if (!gads || gad_num <= 0)
return;
/* Create work copy of gadget list
* (gads is modified by Epplet_gadget_destroy) */
num = gad_num;
lst = malloc(num * sizeof(Epplet_gadget));
memcpy(lst, gads, num * sizeof(Epplet_gadget));
for (i = 0; i < num; i++)
if (((GadGeneral *) lst[i])->parent == win)
Epplet_gadget_destroy(lst[i]);
free(lst);
}
void
@ -791,9 +801,6 @@ Epplet_window_destroy(Window newwin)
if (win == NULL)
return;
XDestroyWindow(disp, win->win);
/* wait for the window to be destroyed */
XMaskEvent(disp, StructureNotifyMask, &ev);
Epplet_unregister_window(win);
Epplet_window_destroy_children(win);
if (win->bg_pmap)
@ -802,6 +809,11 @@ Epplet_window_destroy(Window newwin)
XFreePixmap(disp, win->bg_bg);
if (win->bg_mask)
XFreePixmap(disp, win->bg_mask);
XDestroyWindow(disp, win->win);
/* wait for the window to be destroyed */
XMaskEvent(disp, StructureNotifyMask, &ev);
free(win);
win = NULL;
}
@ -940,8 +952,11 @@ Epplet_cleanup(void)
{
char s[1024];
#if 0 /* No, I think this causes unintended e16 snaps/respawning */
printf("Epplet_cleanup remember=%d\n", need_remember);
if (need_remember)
Epplet_remember();
#endif
/* remove lock file */
Esnprintf(s, sizeof(s), "%s/.lock_%i", conf_dir, epplet_instance);
@ -1117,7 +1132,7 @@ Epplet_imageclass_get_pixmaps(char *iclass, char *state, Pixmap * p,
sscanf(msg, "%x %x", (unsigned int *)&pp, (unsigned int *)&mm);
free(msg);
if (pp)
*p = XCreatePixmap(disp, context_win->win, w, h, id->x.depth);
*p = XCreatePixmap(disp, context_win->win, w, h, DEPTH());
else
*p = 0;
if (mm)
@ -1949,12 +1964,13 @@ ECommsGet(XEvent * ev)
int
Epplet_get_color(int r, int g, int b)
{
int rr, gg, bb;
XColor xc;
rr = r;
gg = g;
bb = b;
return Imlib_best_color_match(id, &rr, &gg, &bb);
xc.red = (r << 8) | r;
xc.green = (g << 8) | g;
xc.blue = (b << 8) | b;
XAllocColor(disp, imlib_context_get_colormap(), &xc);
return xc.pixel;
}
static char *
@ -1974,26 +1990,30 @@ Estrdup(char *s)
void
Epplet_paste_image(char *image, Window ww, int x, int y)
{
ImlibImage *im;
Imlib_Image *im;
im = Imlib_load_image(id, image);
im = imlib_load_image(image);
if (im)
{
Imlib_paste_image(id, im, ww, x, y, im->rgb_width, im->rgb_height);
Imlib_destroy_image(id, im);
imlib_context_set_image(im);
imlib_context_set_drawable(ww);
imlib_render_image_on_drawable(x, y);
imlib_free_image();
}
}
void
Epplet_paste_image_size(char *image, Window ww, int x, int y, int w, int h)
{
ImlibImage *im;
Imlib_Image *im;
im = Imlib_load_image(id, image);
im = imlib_load_image(image);
if (im)
{
Imlib_paste_image(id, im, ww, x, y, w, h);
Imlib_destroy_image(id, im);
imlib_context_set_image(im);
imlib_context_set_drawable(ww);
imlib_render_image_on_drawable_at_size(x, y, w, h);
imlib_free_image();
}
}
@ -2112,7 +2132,7 @@ Epplet_create_textbox(char *image, char *contents, int x, int y,
attr.backing_store = NotUseful;
attr.override_redirect = False;
attr.colormap = Imlib_get_colormap(id);
attr.colormap = imlib_context_get_colormap();
attr.border_pixel = 0;
attr.background_pixel = 0;
attr.save_under = False;
@ -2121,7 +2141,7 @@ Epplet_create_textbox(char *image, char *contents, int x, int y,
KeyPressMask | KeyReleaseMask;
g->general.visible = 0;
g->win = XCreateWindow(disp, context_win->win, x, y, g->w, g->h, 0,
id->x.depth, InputOutput, Imlib_get_visual(id),
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder | CWBackingStore |
CWColormap | CWBackPixel | CWBorderPixel |
CWEventMask, &attr);
@ -2308,30 +2328,32 @@ Epplet_draw_textbox(Epplet_gadget eg)
&(g->pmap), &(g->mask), g->w, g->h);
if (g->image)
{
ImlibImage *im;
Imlib_Image *im;
ESYNC;
im = Imlib_load_image(id, g->image);
im = imlib_load_image(g->image);
if (im)
{
int x, y, w, h;
if (g->w > im->rgb_width) {
w = im->rgb_width;
x = (g->w - im->rgb_width) / 2;
imlib_context_set_image(im);
if (g->w > imlib_image_get_width()) {
w = imlib_image_get_width();
x = (g->w - imlib_image_get_width()) / 2;
} else {
w = g->w - 4;
x = 2;
}
if (g->h > im->rgb_height) {
h = im->rgb_height;
y = (g->h - im->rgb_height) / 2;
if (g->h > imlib_image_get_height()) {
h = imlib_image_get_height();
y = (g->h - imlib_image_get_height()) / 2;
} else {
h = g->h - 4;
y = 2;
}
Imlib_paste_image(id, im, g->pmap, x, y, w, h);
Imlib_destroy_image(id, im);
imlib_context_set_drawable(g->pmap);
imlib_render_image_on_drawable_at_size(x, y, w, h);
imlib_free_image();
}
}
@ -2350,7 +2372,8 @@ Epplet_draw_textbox(Epplet_gadget eg)
g->contents[g->cursor_pos] = temp;
/* Get the position in pixels to the cursor */
Epplet_textbox_textsize(eg, &(g->to_cursor), &h, s);
Epplet_textbox_textsize(eg, &x, &h, s);
g->to_cursor = x;
if (h == 0)
Epplet_textbox_textsize(eg, &x, &h, "X");
@ -2684,7 +2707,7 @@ Epplet_create_button(char *label, char *image, int x, int y,
g->pop_parent = pop_parent;
attr.backing_store = NotUseful;
attr.override_redirect = False;
attr.colormap = Imlib_get_colormap(id);
attr.colormap = imlib_context_get_colormap();
attr.border_pixel = 0;
attr.background_pixel = 0;
attr.save_under = False;
@ -2694,7 +2717,7 @@ Epplet_create_button(char *label, char *image, int x, int y,
if (parent)
{
g->win = XCreateWindow(disp, parent, x, y, g->w, g->h, 0,
id->x.depth, InputOutput, Imlib_get_visual(id),
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder |
CWBackingStore | CWColormap | CWBackPixel |
CWBorderPixel | CWEventMask, &attr);
@ -2702,7 +2725,7 @@ Epplet_create_button(char *label, char *image, int x, int y,
}
else
g->win = XCreateWindow(disp, context_win->win, x, y, g->w, g->h, 0,
id->x.depth, InputOutput, Imlib_get_visual(id),
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder | CWBackingStore
| CWColormap | CWBackPixel | CWBorderPixel |
CWEventMask, &attr);
@ -2779,30 +2802,32 @@ Epplet_draw_button(Epplet_gadget eg)
&(g->pmap), &(g->mask), g->w, g->h);
if (g->image)
{
ImlibImage *im;
Imlib_Image *im;
ESYNC;
im = Imlib_load_image(id, g->image);
im = imlib_load_image(g->image);
if (im)
{
int x, y, w, h;
if (g->w > im->rgb_width) {
w = im->rgb_width;
x = (g->w - im->rgb_width) / 2;
imlib_context_set_image(im);
if (g->w > imlib_image_get_width()) {
w = imlib_image_get_width();
x = (g->w - imlib_image_get_width()) / 2;
} else {
w = g->w - 4;
x = 2;
}
if (g->h > im->rgb_height) {
h = im->rgb_height;
y = (g->h - im->rgb_height) / 2;
if (g->h > imlib_image_get_height()) {
h = imlib_image_get_height();
y = (g->h - imlib_image_get_height()) / 2;
} else {
h = g->h - 4;
y = 2;
}
Imlib_paste_image(id, im, g->pmap, x, y, w, h);
Imlib_destroy_image(id, im);
imlib_context_set_drawable(g->pmap);
imlib_render_image_on_drawable_at_size(x, y, w, h);
imlib_free_image();
}
}
if (g->label)
@ -2822,30 +2847,32 @@ Epplet_draw_button(Epplet_gadget eg)
&(g->pmap), &(g->mask), g->w, g->h);
if (g->image)
{
ImlibImage *im;
Imlib_Image *im;
ESYNC;
im = Imlib_load_image(id, g->image);
im = imlib_load_image(g->image);
if (im)
{
int x, y, w, h;
if (g->w > im->rgb_width) {
w = im->rgb_width;
x = (g->w - im->rgb_width) / 2;
imlib_context_set_image(im);
if (g->w > imlib_image_get_width()) {
w = imlib_image_get_width();
x = (g->w - imlib_image_get_width()) / 2;
} else {
w = g->w - 4;
x = 2;
}
if (g->h > im->rgb_height) {
h = im->rgb_height;
y = (g->h - im->rgb_height) / 2;
if (g->h > imlib_image_get_height()) {
h = imlib_image_get_height();
y = (g->h - imlib_image_get_height()) / 2;
} else {
h = g->h - 4;
y = 2;
}
Imlib_paste_image(id, im, g->pmap, x, y, w, h);
Imlib_destroy_image(id, im);
imlib_context_set_drawable(g->pmap);
imlib_render_image_on_drawable_at_size(x, y, w, h);
imlib_free_image();
}
}
if (g->label)
@ -2891,7 +2918,7 @@ Epplet_create_togglebutton(char *label, char *image, int x,
g->clicked = 0;
attr.backing_store = NotUseful;
attr.override_redirect = False;
attr.colormap = Imlib_get_colormap(id);
attr.colormap = imlib_context_get_colormap();
attr.border_pixel = 0;
attr.background_pixel = 0;
attr.save_under = False;
@ -2899,7 +2926,7 @@ Epplet_create_togglebutton(char *label, char *image, int x,
EnterWindowMask | LeaveWindowMask;
g->general.visible = 0;
g->win = XCreateWindow(disp, context_win->win, x, y, w, h, 0,
id->x.depth, InputOutput, Imlib_get_visual(id),
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder | CWBackingStore |
CWColormap | CWBackPixel | CWBorderPixel |
CWEventMask, &attr);
@ -2943,30 +2970,32 @@ Epplet_draw_togglebutton(Epplet_gadget eg)
&(g->pmap), &(g->mask), g->w, g->h);
if (g->image)
{
ImlibImage *im;
Imlib_Image *im;
ESYNC;
im = Imlib_load_image(id, g->image);
im = imlib_load_image(g->image);
if (im)
{
int x, y, w, h;
if (g->w > im->rgb_width) {
w = im->rgb_width;
x = (g->w - im->rgb_width) / 2;
imlib_context_set_image(im);
if (g->w > imlib_image_get_width()) {
w = imlib_image_get_width();
x = (g->w - imlib_image_get_width()) / 2;
} else {
w = g->w - 4;
x = 2;
}
if (g->h > im->rgb_height) {
h = im->rgb_height;
y = (g->h - im->rgb_height) / 2;
if (g->h > imlib_image_get_height()) {
h = imlib_image_get_height();
y = (g->h - imlib_image_get_height()) / 2;
} else {
h = g->h - 4;
y = 2;
}
Imlib_paste_image(id, im, g->pmap, x, y, w, h);
Imlib_destroy_image(id, im);
imlib_context_set_drawable(g->pmap);
imlib_render_image_on_drawable_at_size(x, y, w, h);
imlib_free_image();
}
}
if (g->label)
@ -3013,14 +3042,14 @@ Epplet_create_drawingarea(int x, int y, int w, int h)
g->h = h;
attr.backing_store = NotUseful;
attr.override_redirect = False;
attr.colormap = Imlib_get_colormap(id);
attr.colormap = imlib_context_get_colormap();
attr.border_pixel = 0;
attr.background_pixel = 0;
attr.save_under = False;
attr.event_mask = 0;
g->general.visible = 0;
g->win = XCreateWindow(disp, context_win->win, x, y, w, h, 0,
id->x.depth, InputOutput, Imlib_get_visual(id),
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder | CWBackingStore |
CWColormap | CWBackPixel | CWBorderPixel |
CWEventMask, &attr);
@ -3029,7 +3058,7 @@ Epplet_create_drawingarea(int x, int y, int w, int h)
LeaveWindowMask | KeyPressMask | KeyReleaseMask | ButtonMotionMask |
ExposureMask;
g->win_in = XCreateWindow(disp, g->win, 2, 2, w - 4, h - 4, 0,
id->x.depth, InputOutput, Imlib_get_visual(id),
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder | CWBackingStore
| CWColormap | CWBackPixel | CWBorderPixel |
CWEventMask, &attr);
@ -3076,22 +3105,21 @@ Epplet_create_hslider(int x, int y, int len, int min, int max,
g->clicked = 0;
attr.backing_store = NotUseful;
attr.override_redirect = False;
attr.colormap = Imlib_get_colormap(id);
attr.colormap = imlib_context_get_colormap();
attr.border_pixel = 0;
attr.background_pixel = 0;
attr.save_under = False;
attr.event_mask = ButtonPressMask | ButtonReleaseMask;
g->general.visible = 0;
g->win = XCreateWindow(disp, context_win->win, x, y, len, 8, 0,
id->x.depth, InputOutput, Imlib_get_visual(id),
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder | CWBackingStore |
CWColormap | CWBackPixel | CWBorderPixel |
CWEventMask, &attr);
attr.event_mask = ButtonPressMask | ButtonReleaseMask |
PointerMotionMask | EnterWindowMask | LeaveWindowMask | ButtonMotionMask;
g->win_knob = XCreateWindow(disp, context_win->win, x, y, 8, 8, 0,
id->x.depth, InputOutput,
Imlib_get_visual(id),
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder |
CWBackingStore | CWColormap | CWBackPixel |
CWBorderPixel | CWEventMask, &attr);
@ -3156,22 +3184,21 @@ Epplet_create_vslider(int x, int y, int len, int min, int max,
g->clicked = 0;
attr.backing_store = NotUseful;
attr.override_redirect = False;
attr.colormap = Imlib_get_colormap(id);
attr.colormap = imlib_context_get_colormap();
attr.border_pixel = 0;
attr.background_pixel = 0;
attr.save_under = False;
attr.event_mask = ButtonPressMask | ButtonReleaseMask;
g->general.visible = 0;
g->win = XCreateWindow(disp, context_win->win, x, y, 8, len, 0,
id->x.depth, InputOutput, Imlib_get_visual(id),
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder | CWBackingStore |
CWColormap | CWBackPixel | CWBorderPixel |
CWEventMask, &attr);
attr.event_mask = ButtonPressMask | ButtonReleaseMask |
PointerMotionMask | EnterWindowMask | LeaveWindowMask | ButtonMotionMask;
g->win_knob = XCreateWindow(disp, context_win->win, x, y, 8, 8, 0,
id->x.depth, InputOutput,
Imlib_get_visual(id),
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder |
CWBackingStore | CWColormap | CWBackPixel |
CWBorderPixel | CWEventMask, &attr);
@ -3225,19 +3252,19 @@ Epplet_create_hbar(int x, int y, int w, int h, char dir, int *val)
g->val = val;
attr.backing_store = NotUseful;
attr.override_redirect = False;
attr.colormap = Imlib_get_colormap(id);
attr.colormap = imlib_context_get_colormap();
attr.border_pixel = 0;
attr.background_pixel = 0;
attr.save_under = False;
attr.event_mask = 0;
g->general.visible = 0;
g->win = XCreateWindow(disp, context_win->win, x, y, w, h, 0,
id->x.depth, InputOutput, Imlib_get_visual(id),
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder | CWBackingStore |
CWColormap | CWBackPixel | CWBorderPixel |
CWEventMask, &attr);
g->win_in = XCreateWindow(disp, g->win, 2, 2, w - 4, h - 4, 0,
id->x.depth, InputOutput, Imlib_get_visual(id),
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder | CWBackingStore
| CWColormap | CWBackPixel | CWBorderPixel |
CWEventMask, &attr);
@ -3284,19 +3311,19 @@ Epplet_create_vbar(int x, int y, int w, int h, char dir, int *val)
g->val = val;
attr.backing_store = NotUseful;
attr.override_redirect = False;
attr.colormap = Imlib_get_colormap(id);
attr.colormap = imlib_context_get_colormap();
attr.border_pixel = 0;
attr.background_pixel = 0;
attr.save_under = False;
attr.event_mask = 0;
g->general.visible = 0;
g->win = XCreateWindow(disp, context_win->win, x, y, w, h, 0,
id->x.depth, InputOutput, Imlib_get_visual(id),
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder | CWBackingStore |
CWColormap | CWBackPixel | CWBorderPixel |
CWEventMask, &attr);
g->win_in = XCreateWindow(disp, g->win, 2, 2, w - 4, h - 4, 0,
id->x.depth, InputOutput, Imlib_get_visual(id),
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder | CWBackingStore
| CWColormap | CWBackPixel | CWBorderPixel |
CWEventMask, &attr);
@ -3353,33 +3380,33 @@ Epplet_draw_image(Epplet_gadget eg, char un_only)
GadImage *g;
GC gc = 0;
XGCValues gcv;
ImlibImage *im;
Imlib_Image *im;
g = (GadImage *) eg;
gc = XCreateGC(disp, g->general.parent->bg_pmap, 0, &gcv);
if ((g->pw > 0) && (g->ph > 0))
XCopyArea(disp, g->general.parent->bg_bg, g->general.parent->bg_pmap, gc,
g->x, g->y, g->pw, g->ph, g->x, g->y);
if (!un_only)
if (g->image && !un_only)
{
im = Imlib_load_image(id, g->image);
im = imlib_load_image(g->image);
if (im)
{
imlib_context_set_image(im);
imlib_context_set_drawable(g->general.parent->bg_pmap);
if ((g->w > 0) && (g->h > 0))
{
Imlib_paste_image(id, im, g->general.parent->bg_pmap, g->x,
g->y, g->w, g->h);
imlib_render_image_on_drawable_at_size(g->x, g->y, g->w, g->h);
g->pw = g->w;
g->ph = g->h;
}
else
{
Imlib_paste_image(id, im, g->general.parent->bg_pmap, g->x,
g->y, im->rgb_width, im->rgb_height);
g->pw = im->rgb_width;
g->ph = im->rgb_height;
imlib_render_image_on_drawable(g->x, g->y);
g->pw = imlib_image_get_width();
g->ph = imlib_image_get_height();
}
Imlib_destroy_image(id, im);
imlib_free_image();
}
}
XSetWindowBackgroundPixmap(disp, g->general.parent->win,
@ -3532,14 +3559,14 @@ Epplet_create_popup(void)
g->changed = 1;
attr.backing_store = NotUseful;
attr.override_redirect = True;
attr.colormap = Imlib_get_colormap(id);
attr.colormap = imlib_context_get_colormap();
attr.border_pixel = 0;
attr.background_pixel = 0;
attr.save_under = False;
attr.event_mask = ButtonPressMask | ButtonReleaseMask |
PointerMotionMask | EnterWindowMask | LeaveWindowMask | ButtonMotionMask;
g->win = XCreateWindow(disp, root, 0, 0, 5, 5, 0,
id->x.depth, InputOutput, Imlib_get_visual(id),
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder | CWBackingStore |
CWColormap | CWBackPixel | CWBorderPixel |
CWEventMask, &attr);
@ -3575,12 +3602,13 @@ Epplet_add_sized_popup_entry(Epplet_gadget gadget, char *label, char *pixmap, in
g->entry[g->entry_num - 1].gadget = NULL;
if (g->entry[g->entry_num - 1].image)
{
ImlibImage *im;
Imlib_Image *im;
im = Imlib_load_image(id, g->entry[g->entry_num - 1].image);
g->entry[g->entry_num - 1].w = ((w == -1) ? im->rgb_width : w);
g->entry[g->entry_num - 1].h = ((h == -1) ? im->rgb_height : h);
Imlib_destroy_image(id, im);
im = imlib_load_image(g->entry[g->entry_num - 1].image);
imlib_context_set_image(im);
g->entry[g->entry_num - 1].w = ((w == -1) ? imlib_image_get_width() : w);
g->entry[g->entry_num - 1].h = ((h == -1) ? imlib_image_get_height() : h);
imlib_free_image();
}
else if (g->entry[g->entry_num - 1].label)
{
@ -3803,7 +3831,7 @@ Epplet_create_popupbutton(char *label, char *image, int x,
g->popup = popup;
attr.backing_store = NotUseful;
attr.override_redirect = False;
attr.colormap = Imlib_get_colormap(id);
attr.colormap = imlib_context_get_colormap();
attr.border_pixel = 0;
attr.background_pixel = 0;
attr.save_under = False;
@ -3811,7 +3839,7 @@ Epplet_create_popupbutton(char *label, char *image, int x,
EnterWindowMask | LeaveWindowMask;
g->general.visible = 0;
g->win = XCreateWindow(disp, context_win->win, x, y, g->w, g->h, 0,
id->x.depth, InputOutput, Imlib_get_visual(id),
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder | CWBackingStore |
CWColormap | CWBackPixel | CWBorderPixel |
CWEventMask, &attr);
@ -3864,30 +3892,32 @@ Epplet_draw_popupbutton(Epplet_gadget eg)
&(g->pmap), &(g->mask), g->w, g->h);
if (g->image)
{
ImlibImage *im;
Imlib_Image *im;
ESYNC;
im = Imlib_load_image(id, g->image);
im = imlib_load_image(g->image);
if (im)
{
int x, y, w, h;
if (g->w > im->rgb_width) {
w = im->rgb_width;
x = (g->w - im->rgb_width) / 2;
imlib_context_set_image(im);
if (g->w > imlib_image_get_width()) {
w = imlib_image_get_width();
x = (g->w - imlib_image_get_width()) / 2;
} else {
w = g->w - 4;
x = 2;
}
if (g->h > im->rgb_height) {
h = im->rgb_height;
y = (g->h - im->rgb_height) / 2;
if (g->h > imlib_image_get_height()) {
h = imlib_image_get_height();
y = (g->h - imlib_image_get_height()) / 2;
} else {
h = g->h - 4;
y = 2;
}
Imlib_paste_image(id, im, g->pmap, x, y, w, h);
Imlib_destroy_image(id, im);
imlib_context_set_drawable(g->pmap);
imlib_render_image_on_drawable_at_size(x, y, w, h);
imlib_free_image();
}
}
if (g->label)
@ -4592,7 +4622,7 @@ Epplet_background_properties(char vertical, Window newwin)
else
Epplet_imageclass_get_pixmaps("EPPLET_BACKGROUND_HORIZONTAL", "normal",
&win->bg_bg, &win->bg_mask, win->w, win->h);
win->bg_pmap = XCreatePixmap(disp, win->win, win->w, win->h, id->x.depth);
win->bg_pmap = XCreatePixmap(disp, win->win, win->w, win->h, DEPTH());
gc = XCreateGC(disp, win->bg_pmap, 0, &gcv);
XCopyArea(disp, win->bg_bg, win->bg_pmap, gc, 0, 0, win->w, win->h, 0, 0);
@ -5249,28 +5279,26 @@ RGB_buf
Epplet_make_rgb_buf(int w, int h)
{
RGB_buf buf;
unsigned char *data;
buf = malloc(sizeof(RGB_buf));
data = malloc(w * h * 3 * sizeof(unsigned char));
buf->im = Imlib_create_image_from_data(id, data, NULL, w, h);
free(data);
buf->im = imlib_create_image(w, h);
return buf;
}
unsigned char *
Epplet_get_rgb_pointer(RGB_buf buf)
{
return buf->im->rgb_data;
imlib_context_set_image(buf->im);
return (unsigned char*)imlib_image_get_data(); /* Readonly? */
}
void
Epplet_paste_buf(RGB_buf buf, Window win, int x, int y)
{
Imlib_changed_image(id, buf->im);
Imlib_paste_image(id, buf->im, win, x, y,
buf->im->rgb_width, buf->im->rgb_height);
imlib_context_set_image(buf->im);
imlib_context_set_drawable(win);
imlib_render_image_on_drawable(x, y);
}
void
@ -5280,7 +5308,8 @@ Epplet_free_rgb_buf(RGB_buf buf)
{
if (buf->im)
{
Imlib_destroy_image(id, buf->im);
imlib_context_set_image(buf->im);
imlib_free_image();
}
free(buf);
}

View File

@ -14,7 +14,7 @@
#include <X11/Xlib.h>
#include <X11/Xresource.h>
#include <X11/Xutil.h>
#include <Imlib.h>
#include <Imlib2.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -59,7 +59,7 @@ typedef struct _etimer ETimer;
typedef void *Epplet_gadget;
typedef struct _rgb_buf
{
ImlibImage *im;
Imlib_Image *im;
}
*RGB_buf;
@ -123,9 +123,6 @@ Window Epplet_get_main_window(void);
/* return the X display connection used */
Display *Epplet_get_display(void);
/* return the ImlibData pointer being used */
ImlibData *Epplet_get_imlib_data(void);
/* Get locations and sizes of gadgets */
int Epplet_gadget_get_x(Epplet_gadget gad);
int Epplet_gadget_get_y(Epplet_gadget gad);

View File

@ -1,7 +1,7 @@
dnl# $Id$
AC_INIT(api/epplet.c)
AM_INIT_AUTOMAKE(epplets, 0.8)
AM_INIT_AUTOMAKE(epplets, 0.9)
dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
if test ! -z "${CFLAGS}" -o ! -z "${CCOPTS}"; then
@ -28,7 +28,6 @@ AC_MINIX
dnl# At least make the attempt to support CygWin32
AC_CYGWIN
AC_ARG_PROGRAM
AM_PROG_LIBTOOL
@ -127,7 +126,7 @@ if test "$GL_LIBS" = "GL"; then
AC_CHECK_HEADERS(GL/glx.h,[P_GL="GL"], [echo "Warning Will Robinson. No OpenGL headers! Install Mesa our your favorite hardware GLX."])
if test "$P_GL" = "GL"; then
X_LIBS="-lGL -lGLU $X_LIBS"
AC_DEFINE(HAVE_LIBGL)
AC_DEFINE(HAVE_LIBGL, 1, [Have OpenGL])
GL_PROGS="E-OpenGL-Demo.epplet"
AC_MSG_WARN([*** Building for GLX. Grab your ankles and kiss your ass goodbye! ***])
fi
@ -135,21 +134,21 @@ else
AC_MSG_WARN(Warning Will Robinson. No OpenGL! Install Mesa or you favorite hardware GLX.)
fi
AC_CHECK_PROG(IMLIB_CONFIG, imlib-config, imlib-config, no)
AC_CHECK_PROG(IMLIB_CONFIG, imlib2-config, imlib2-config, no)
if test "$IMLIB_CONFIG" != "no"; then
if test "$prefix" = "NONE"; then
AC_MSG_CHECKING(imlib-config for prefix)
AC_MSG_CHECKING(imlib2-config for prefix)
prefix="`$IMLIB_CONFIG --prefix`"
AC_MSG_RESULT($prefix)
fi
AC_MSG_CHECKING(imlib-config for the value of CFLAGS)
AC_MSG_CHECKING(imlib2-config for the value of CFLAGS)
CFLAGS="$CFLAGS `$IMLIB_CONFIG --cflags`"
AC_MSG_RESULT($CFLAGS)
AC_MSG_CHECKING(imlib-config for the value of GRLIBS)
AC_MSG_CHECKING(imlib2-config for the value of GRLIBS)
GRLIBS="$GRLIBS `$IMLIB_CONFIG --libs`"
AC_MSG_RESULT($GRLIBS)
@ -178,7 +177,7 @@ if test "$IMLIB_CONFIG" = "no"; then
$SUBLIBS $X_LIBS)
AC_CHECK_LIB(ungif, DGifOpenFileName, GRLIBS="$GRLIBS -lungif", ,
$SUBLIBS $X_LIBS)
AC_CHECK_LIB(Imlib, Imlib_init, , [
AC_CHECK_LIB(Imlib2, imlib_create_image, , [
echo "WARNING: Imlib was not found or did not correctly link.";
echo " Please check config.log to see what the error was.";
echo " I will attempt to continue, but things may go wrong.";
@ -206,7 +205,7 @@ if test "$LIBGTOP_CONFIG" != "no"; then
AC_MSG_CHECKING(libgtop-config for the value of CFLAGS)
CFLAGS="$CFLAGS $LIBGTOP_INCS"
AC_DEFINE(HAVE_LIBGTOP)
AC_DEFINE(HAVE_LIBGTOP, 1, [Have libgtop])
AC_MSG_RESULT($CFLAGS)
AC_MSG_CHECKING(libgtop-config for the value of LIBS)
@ -241,15 +240,15 @@ AC_ARG_WITH(test-programs, [ --with-test-programs Builds the test programs [
# ok enlightenment d00ds want to ignore civilization and install
# everything in one place. The rest of use prefer sanity.
#
AC_ARG_ENABLE(fsstd, [ --enable-fsstd install files following FSSTD [default=no]], ,enable_fsstd=no)
AC_ARG_ENABLE(fsstd, [ --enable-fsstd install files following FSSTD [default=yes]], ,enable_fsstd=yes)
if test "x$enable_fsstd" = "xyes"; then
ENLIGHTENMENT_ROOT=${datadir}/enlightenment
ENLIGHTENMENT_ROOT=${datadir}/e16
ENLIGHTENMENT_BIN=${bindir}
USE_FSSTD=yes
else
ENLIGHTENMENT_ROOT=${prefix}/enlightenment
ENLIGHTENMENT_BIN=${prefix}/enlightenment/bin
ENLIGHTENMENT_ROOT=${prefix}/e16
ENLIGHTENMENT_BIN=${prefix}/e16/bin
USE_FSSTD=no
fi
@ -258,7 +257,7 @@ AC_ARG_ENABLE(auto-respawn, [ --disable-auto-respawn Be gnome-session friendly
epplets through e by default [default=no]],
no_respawn=yes,)
if test ! -z "$no_respawn"; then
AC_DEFINE(NO_AUTO_RESPAWN)
AC_DEFINE(NO_AUTO_RESPAWN, 1, [Disable auto-respawning])
fi
AC_ARG_ENABLE(new-remember,
@ -267,38 +266,38 @@ AC_ARG_ENABLE(new-remember,
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_DEFINE(NEW_REMEMBER)
AC_DEFINE(NEW_REMEMBER, 1, [Disable new remember (obsolete)])
fi,
AC_MSG_RESULT(no)
)
# If $EROOT is set use it, unless a make distcheck is being done
# Makes the gratuitous assumption that "=inst" is neccessary and
# sufficuent for a make distcheck
AC_MSG_CHECKING(for Enlightenment location)
if test -n "$EROOT" -a `echo "$prefix" | sed -e 's:=inst::'` = "$prefix"
then
AC_SUBST(EROOT)
AC_MSG_RESULT($EROOT)
else
## If $EROOT is set use it, unless a make distcheck is being done
## Makes the gratuitous assumption that "=inst" is neccessary and
## sufficuent for a make distcheck
#AC_MSG_CHECKING(for Enlightenment location)
#if test -n "$EROOT" -a `echo "$prefix" | sed -e 's:[=_]inst::'` = "$prefix"
#then
# AC_SUBST(EROOT)
# AC_MSG_RESULT($EROOT)
#else
EROOT=`eval echo $ENLIGHTENMENT_ROOT`
AC_MSG_RESULT(warning: EROOT environment variable not detected. Using $EROOT)
# AC_MSG_RESULT(warning: EROOT environment variable not detected. Using $EROOT)
AC_SUBST(EROOT)
fi
#fi
# If $EBIN is set use it, unless a make distcheck is being done
# Makes the gratuitous assumption that "=inst" is neccessary and
# sufficuent for a make distcheck
AC_MSG_CHECKING(for Enlightenment binary location)
if test -n "$EBIN" -a `echo "$prefix" | sed -e 's:=inst::'` = "$prefix"
then
AC_SUBST(EBIN)
AC_MSG_RESULT($EBIN)
else
#AC_MSG_CHECKING(for Enlightenment binary location)
#if test -n "$EBIN" -a `echo "$prefix" | sed -e 's:[=_]inst::'` = "$prefix"
#then
# AC_SUBST(EBIN)
# AC_MSG_RESULT($EBIN)
#else
EBIN=`eval echo $ENLIGHTENMENT_BIN`
AC_MSG_RESULT(warning: EBIN environment variable not detected. Using $EBIN)
# AC_MSG_RESULT(warning: EBIN environment variable not detected. Using $EBIN)
AC_SUBST(EBIN)
fi
#fi
# Should we install E-Mixer?
# Probably not ;-) But we may as well check!
@ -334,12 +333,12 @@ AC_SUBST(ESD_PROGS)
AC_PATH_PROG(MOUNT, mount)
AC_PATH_PROG(UMOUNT, umount)
AC_PATH_PROG(EJECT, eject)
AC_DEFINE_UNQUOTED(MOUNT, "$MOUNT")
AC_DEFINE_UNQUOTED(UMOUNT, "$UMOUNT")
AC_DEFINE_UNQUOTED(EJECT, "$EJECT")
AC_DEFINE_UNQUOTED(MOUNT, "$MOUNT", [Location of mount])
AC_DEFINE_UNQUOTED(UMOUNT, "$UMOUNT", [Location of umount])
AC_DEFINE_UNQUOTED(EJECT, "$EJECT", [Location of eject])
if test -n "$EJECT"; then
AC_DEFINE(HAVE_EJECT, 1)
AC_DEFINE(HAVE_EJECT, 1, [Have eject])
fi
CFLAGS=${CFLAGS--O}

View File

@ -2,7 +2,7 @@
Summary: Enlightenment Epplets
Name: epplets
Version: 0.8
Version: 0.9
Release: 0.%(date '+%Y%m%d')
License: BSD
Group: User Interface/X
@ -13,7 +13,7 @@ Vendor: %{?_vendorinfo:%{_vendorinfo}}%{!?_vendorinfo:The Enlightenment Project
Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
#BuildSuggests: freeglut-devel xorg-x11-devel
BuildRequires: imlib-devel XFree86-devel
Requires: enlightenment >= 0.16.0
#Requires: enlightenment >= 0.16.0
Provides: enlightenment-epplets = %{version}
Provides: e16-epplets = %{version}
Obsoletes: enlightenment-epplets
@ -61,7 +61,7 @@ test "x$RPM_BUILD_ROOT" != "x/" && rm -rf $RPM_BUILD_ROOT
%{_includedir}/*
%{_libdir}/*
%{_bindir}/*
%{_datadir}/enlightenment/epplet_icons/*
%{_datadir}/enlightenment/epplet_data/*
%{_datadir}/e16/epplet_icons/*
%{_datadir}/e16/epplet_data/*
%changelog

View File

@ -189,14 +189,14 @@ draw_flame(void)
for (y = 0; y < 40; y++)
{
ptr = flame + (y * 40);
rptr = rgb + (y * 40 * 3);
rptr = rgb + (y * 40 * 4);
for (x = 0; x < 40; x++)
{
val1 = ptr[x] & 0xff;
rptr[0] = rm[val1];
rptr[1] = gm[val1];
rptr[2] = bm[val1];
rptr += 3;
rptr += 4;
}
}
}

View File

@ -32,7 +32,6 @@ static void cb_configure(void *data);
static void
cb_close(void *data)
{
Epplet_cleanup();
Epplet_unremember();
exit(0);
data = NULL;

View File

@ -86,7 +86,6 @@ close_cb(void *data)
{
Epplet_unremember();
Esync();
Epplet_cleanup();
data = NULL;
exit(0);
}

View File

@ -494,7 +494,10 @@ CallbackAnimate(void *data)
int i, j, linear, linear_w;
double ratio;
unsigned char *current_tile_data;
imlib_context_set_image(current_tile->image);
current_tile_data = (unsigned char*)imlib_image_get_data();
if (k < M_PI)
{
if (mode.anim_mount)
@ -508,20 +511,20 @@ CallbackAnimate(void *data)
{
if (!IsTransparent(current_tile->image, j, i))
{
linear = 3*(i * 44 + j);
linear_w = (i*44*3*num_tiles) + (current_tile_index*44*3) + 3*j;
window_buf->im->rgb_data[linear] =
widescreen_buf->im->rgb_data[linear_w] =
ratio * (widescreen_canvas_buf->im->rgb_data[linear_w])
+ (1.0-ratio) * (current_tile->image->rgb_data[linear]);
window_buf->im->rgb_data[linear+1] =
widescreen_buf->im->rgb_data[linear_w+1] =
ratio * (widescreen_canvas_buf->im->rgb_data[linear_w+1])
+ (1.0-ratio) * (current_tile->image->rgb_data[linear+1]);
window_buf->im->rgb_data[linear+2] =
widescreen_buf->im->rgb_data[linear_w+2] =
ratio * (widescreen_canvas_buf->im->rgb_data[linear_w+2])
+ (1.0-ratio) * (current_tile->image->rgb_data[linear+2]);
linear = 4*(i * 44 + j);
linear_w = (i*44*4*num_tiles) + (current_tile_index*44*4) + 4*j;
Epplet_get_rgb_pointer(window_buf)[linear] =
Epplet_get_rgb_pointer(widescreen_buf)[linear_w] =
ratio * (Epplet_get_rgb_pointer(widescreen_canvas_buf)[linear_w])
+ (1.0-ratio) * (current_tile_data[linear]);
Epplet_get_rgb_pointer(window_buf)[linear+1] =
Epplet_get_rgb_pointer(widescreen_buf)[linear_w+1] =
ratio * (Epplet_get_rgb_pointer(widescreen_canvas_buf)[linear_w+1])
+ (1.0-ratio) * (current_tile_data[linear+1]);
Epplet_get_rgb_pointer(window_buf)[linear+2] =
Epplet_get_rgb_pointer(widescreen_buf)[linear_w+2] =
ratio * (Epplet_get_rgb_pointer(widescreen_canvas_buf)[linear_w+2])
+ (1.0-ratio) * (current_tile_data[linear+2]);
}
}
}
@ -548,9 +551,9 @@ UpdateView(int dir, int fast)
{
for (i=0; i<32; i++)
{
memcpy(window_buf->im->rgb_data + i * 44 * 3,
widescreen_buf->im->rgb_data + (i*44*3*num_tiles) + (current_tile_index*44*3),
44*3*sizeof(unsigned char));
memcpy(Epplet_get_rgb_pointer(window_buf) + i * 44 * 4,
Epplet_get_rgb_pointer(widescreen_buf) + (i*44*4*num_tiles) + (current_tile_index*44*4),
44*4*sizeof(unsigned char));
}
Epplet_paste_buf(window_buf, Epplet_get_drawingarea_window(action_area), -2, -2);
}
@ -566,9 +569,9 @@ UpdateView(int dir, int fast)
}
for (i=0; i<32; i++)
{
memcpy(window_buf->im->rgb_data + i * 44 * 3,
widescreen_buf->im->rgb_data + (i*44*3*num_tiles) + (current_tile_index*44*3) + (dir)*j*3,
44*3*sizeof(unsigned char));
memcpy(Epplet_get_rgb_pointer(window_buf) + i * 44 * 4,
Epplet_get_rgb_pointer(widescreen_buf) + (i*44*4*num_tiles) + (current_tile_index*44*4) + (dir)*j*4,
44*4*sizeof(unsigned char));
}
Epplet_paste_buf(window_buf, Epplet_get_drawingarea_window(action_area), -2, -2);
}
@ -577,24 +580,23 @@ UpdateView(int dir, int fast)
int
IsTransparent(ImlibImage *im, int x, int y)
IsTransparent(Imlib_Image *im, int x, int y)
{
int linear;
ImlibColor ic;
unsigned char *data;
if (!im || x < 0 || y < 0 || x >= im->rgb_width || y >= im->rgb_height)
if (!im || x < 0 || y < 0)
return 0;
Imlib_get_image_shape(id, im, &ic);
if ((ic.r == -1) && (ic.g == -1) && (ic.b == -1))
imlib_context_set_image(im);
if (x >= imlib_image_get_width() || y >= imlib_image_get_height())
return 0;
linear = 3*(y * im->rgb_width + x);
linear = 4*(y * imlib_image_get_width() + x);
if ((im->rgb_data[linear] == ic.r)
&& (im->rgb_data[linear+1] == ic.g)
&& (im->rgb_data[linear+2] == ic.b))
return 1;
data = (unsigned char*)imlib_image_get_data();
if (data[linear+3] != 0xff);
return 0; /* FIXME - Should return 1 but blending needs to be fixed */
return 0;
}
@ -642,7 +644,7 @@ AddMountPoint(char *device, char *path)
int i;
MountPointType *type = NULL;
char *s = NULL;
ImlibImage *tmp_image = NULL;
Imlib_Image *tmp_image = NULL;
static Tile *tail_tile = NULL;
@ -714,17 +716,18 @@ AddMountPoint(char *device, char *path)
if (!default_image)
{
tmp_image = Imlib_load_image(id, s);
tmp_image = imlib_load_image(s);
if (!tmp_image)
tmp_image = Imlib_load_image(id, __DEFAULT);
tmp_image = imlib_load_image(__DEFAULT);
if (!tmp_image)
{
Epplet_dialog_ok(" E-Mountbox could not load a default icon\n "
" for the mountpoints. Check your installation. ");
error_exit();
}
default_image = Imlib_clone_scaled_image(id, tmp_image, 44, 32);
Imlib_destroy_image(id, tmp_image);
imlib_context_set_image(tmp_image);
default_image = imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), 44, 32);
imlib_free_image();
}
tail_tile->image = default_image;
}
@ -741,7 +744,7 @@ void
AddMountPointType(char *key, char *image)
{
MountPointType *newtype = NULL;
ImlibImage *tmp_image = NULL;
Imlib_Image *tmp_image = NULL;
if (!types)
{
@ -773,11 +776,12 @@ AddMountPointType(char *key, char *image)
types->key = strdup(key);
if (image)
types->imagefile = strdup(image);
tmp_image = Imlib_load_image(id, image);
tmp_image = imlib_load_image(image);
if (tmp_image)
{
types->image = Imlib_clone_scaled_image(id, tmp_image, 44, 32);
Imlib_destroy_image(id, tmp_image);
imlib_context_set_image(tmp_image);
types->image = imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), 44, 32);
imlib_free_image();
}
}
}
@ -846,7 +850,8 @@ DeleteMountPointType(MountPointType *mpt)
}
if (mpt->image)
{
Imlib_destroy_image(id, mpt->image);
imlib_context_set_image(mpt->image);
imlib_free_image();
mpt->image = NULL;
}
free(mpt);
@ -859,12 +864,14 @@ FreeImages(void)
{
if (bg_image)
{
Imlib_destroy_image(id, bg_image);
imlib_context_set_image(bg_image);
imlib_free_image();
bg_image = NULL;
}
if (default_image)
{
Imlib_destroy_image(id, default_image);
imlib_context_set_image(default_image);
imlib_free_image();
default_image = NULL;
}
}
@ -914,7 +921,8 @@ FreeMountPointTypes(void)
}
if (current->image)
{
Imlib_destroy_image(id, current->image);
imlib_context_set_image(current->image);
imlib_free_image();
current->image = NULL;
}
tmp = current;
@ -1206,6 +1214,7 @@ PollMountpoints(void *data)
{
Tile *tile;
int i,j,k, linear, linear_w, status=0;
unsigned char *widescreen_data, *widescreen_canvas_data, *tile_data;
if (current_tile->mountpoint)
{
@ -1230,30 +1239,37 @@ PollMountpoints(void *data)
/* build new image */
tile = tiles;
imlib_context_set_image(widescreen_buf->im);
widescreen_data = (unsigned char*)imlib_image_get_data();
imlib_context_set_image(widescreen_canvas_buf->im);
widescreen_canvas_data = (unsigned char*)imlib_image_get_data();
for (k=0; k<num_tiles; k++, tile = tile->next)
{
imlib_context_set_image(tile->image);
tile_data = (unsigned char*)imlib_image_get_data();
for (i=0; i<32; i++)
{
for (j=0; j<44; j++)
{
if (!IsTransparent(tile->image, j, i))
{
linear = 3*(i * 44 + j);
linear_w = (i*44*3*num_tiles) + (k*44*3) + 3*j;
linear = 4*(i * 44 + j);
linear_w = (i*44*4*num_tiles) + (k*44*4) + 4*j;
if (tile->mountpoint->mounted)
{
widescreen_buf->im->rgb_data[linear_w] = tile->image->rgb_data[linear];
widescreen_buf->im->rgb_data[linear_w+1] = tile->image->rgb_data[linear+1];
widescreen_buf->im->rgb_data[linear_w+2] = tile->image->rgb_data[linear+2];
widescreen_data[linear_w] = tile_data[linear];
widescreen_data[linear_w+1] = tile_data[linear+1];
widescreen_data[linear_w+2] = tile_data[linear+2];
}
else
{
widescreen_buf->im->rgb_data[linear_w] =
0.65 * widescreen_canvas_buf->im->rgb_data[linear_w] + 0.35 * tile->image->rgb_data[linear];
widescreen_buf->im->rgb_data[linear_w+1] =
0.65 * widescreen_canvas_buf->im->rgb_data[linear_w+1] + 0.35 * tile->image->rgb_data[linear+1];
widescreen_buf->im->rgb_data[linear_w+2] =
0.65 * widescreen_canvas_buf->im->rgb_data[linear_w+2] + 0.35 * tile->image->rgb_data[linear+2];
widescreen_data[linear_w] =
0.65 * widescreen_canvas_data[linear_w] + 0.35 * tile_data[linear];
widescreen_data[linear_w+1] =
0.65 * widescreen_canvas_data[linear_w+1] + 0.35 * tile_data[linear+1];
widescreen_data[linear_w+2] =
0.65 * widescreen_canvas_data[linear_w+2] + 0.35 * tile_data[linear+2];
}
}
}
@ -1285,7 +1301,6 @@ CallbackExit(void * data)
FreeImages();
Epplet_unremember();
Esync();
Epplet_cleanup();
exit(0);
}
@ -1452,15 +1467,16 @@ SetupGraphx(void)
{
static int first_time = 1;
int i, j, k, linear, linear_w;
ImlibImage *tmp = NULL;
Imlib_Image *tmp = NULL;
Tile *tile;
char *s = NULL;
unsigned char *widescreen_data, *widescreen_canvas_data, *tile_data, *bg_data;
s = Epplet_query_config("BG_IMAGE");
tmp = Imlib_load_image(id, s);
tmp = imlib_load_image(s);
if (!tmp)
tmp = Imlib_load_image(id, __BG_IMAGE);
tmp = imlib_load_image(__BG_IMAGE);
if (!tmp)
{
/* Even the fallbacks didn't work. If we don't exit
@ -1474,8 +1490,9 @@ SetupGraphx(void)
&(border.left), &(border.right), &(border.top), &(border.bottom));
Imlib_set_image_border(id, tmp, &border);
*/
bg_image = Imlib_clone_scaled_image(id, tmp, 44 * num_tiles, 32);
Imlib_destroy_image(id, tmp);
imlib_context_set_image(tmp);
bg_image = imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), 44 * num_tiles, 32);
imlib_free_image();
/* setup widescreen according to current mounts */
if (!window_buf)
@ -1487,36 +1504,45 @@ SetupGraphx(void)
Epplet_free_rgb_buf(widescreen_canvas_buf);
widescreen_canvas_buf = Epplet_make_rgb_buf((44 * num_tiles), 32);
memcpy(widescreen_buf->im->rgb_data, bg_image->rgb_data,
sizeof(unsigned char) * 44 * 3 * num_tiles * 32);
memcpy(widescreen_canvas_buf->im->rgb_data, bg_image->rgb_data,
sizeof(unsigned char) * 44 * 3 * num_tiles * 32);
imlib_context_set_image(widescreen_buf->im);
widescreen_data = (unsigned char*)imlib_image_get_data();
imlib_context_set_image(widescreen_canvas_buf->im);
widescreen_canvas_data = (unsigned char*)imlib_image_get_data();
imlib_context_set_image(bg_image);
bg_data = (unsigned char*)imlib_image_get_data();
memcpy(widescreen_data, bg_data,
sizeof(unsigned char) * 44 * 4 * num_tiles * 32);
memcpy(widescreen_canvas_data, bg_data,
sizeof(unsigned char) * 44 * 4 * num_tiles * 32);
tile = tiles;
for (k=0; k<num_tiles; k++, tile = tile->next)
{
imlib_context_set_image(tile->image);
tile_data = (unsigned char*)imlib_image_get_data();
for (i=0; i<32; i++)
{
for (j=0; j<44; j++)
{
if (!IsTransparent(tile->image, j, i))
{
linear = 3*(i * 44 + j);
linear_w = (i*44*3*num_tiles) + (k*44*3) + 3*j;
linear = 4*(i * 44 + j);
linear_w = (i*44*4*num_tiles) + (k*44*4) + 4*j;
if (tile->mountpoint->mounted)
{
widescreen_buf->im->rgb_data[linear_w] = tile->image->rgb_data[linear];
widescreen_buf->im->rgb_data[linear_w+1] = tile->image->rgb_data[linear+1];
widescreen_buf->im->rgb_data[linear_w+2] = tile->image->rgb_data[linear+2];
widescreen_data[linear_w] = tile_data[linear];
widescreen_data[linear_w+1] = tile_data[linear+1];
widescreen_data[linear_w+2] = tile_data[linear+2];
}
else
{
widescreen_buf->im->rgb_data[linear_w] =
0.65 * widescreen_buf->im->rgb_data[linear_w] + 0.35 * tile->image->rgb_data[linear];
widescreen_buf->im->rgb_data[linear_w+1] =
0.65 * widescreen_buf->im->rgb_data[linear_w+1] + 0.35 * tile->image->rgb_data[linear+1];
widescreen_buf->im->rgb_data[linear_w+2] =
0.65 * widescreen_buf->im->rgb_data[linear_w+2] + 0.35 * tile->image->rgb_data[linear+2];
widescreen_data[linear_w] =
0.65 * widescreen_data[linear_w] + 0.35 * tile_data[linear];
widescreen_data[linear_w+1] =
0.65 * widescreen_data[linear_w+1] + 0.35 * tile_data[linear+1];
widescreen_data[linear_w+2] =
0.65 * widescreen_data[linear_w+2] + 0.35 * tile_data[linear+2];
}
}
}
@ -1612,7 +1638,6 @@ main(int argc, char** argv)
Epplet_Init("E-Mountbox", "0.1", "Enlightenment Mount Epplet",
3, 3, argc, argv, 0);
Epplet_load_config();
id = Epplet_get_imlib_data();
SetupDefaults();
SetupMounts();

View File

@ -72,7 +72,7 @@ struct _mountpointtype
{
char *key;
char *imagefile;
ImlibImage *image;
Imlib_Image *image;
MountPointType *next;
MountPointType *prev;
};
@ -87,7 +87,7 @@ MountPoint;
struct _tile
{
ImlibImage *image;
Imlib_Image *image;
MountPoint *mountpoint;
Tile *prev;
Tile *next;
@ -100,9 +100,8 @@ int current_tile_index = 0;
int num_tiles = 0;
MountPointType *types = NULL;
int num_types = 0;
ImlibData *id = NULL;
ImlibImage *bg_image = NULL;
ImlibImage *default_image = NULL;
Imlib_Image *bg_image = NULL;
Imlib_Image *default_image = NULL;
Epplet_gadget action_area, button_close, button_config, button_help;
/* stuff for the config win */
@ -118,7 +117,7 @@ RGB_buf widescreen_buf = NULL; /* the wide image of all mountpoin
RGB_buf widescreen_canvas_buf = NULL; /* only the background */
/* graphx handling */
int IsTransparent(ImlibImage * im, int x, int y);
int IsTransparent(Imlib_Image * im, int x, int y);
void UpdateView(int dir, int fast);
void FreeImages(void);
void UpdateGraphics(void);

View File

@ -229,13 +229,13 @@ draw_flame(void)
rgb = Epplet_get_rgb_pointer(buf);
for (y = 0; y < HEIGHT; y++) {
ptr = flame + (y * WIDTH) + 1;
rptr = rgb + (y * WIDTH * 3);
rptr = rgb + (y * WIDTH * 4);
for (x = 0; x < WIDTH; x++) {
val1 = ptr[x] & 0xff;
rptr[0] = rm[val1];
rptr[1] = gm[val1];
rptr[2] = bm[val1];
rptr += 3;
rptr += 4;
}
}
}

View File

@ -113,12 +113,12 @@ timer_draw(void *data)
/* whee.. shift the buffer one pixel to the left */
for (i = 0; i <= 39; i++)
{
for (rgb_pointer_dynamic = rgb_pointer_start + (i * 120);
rgb_pointer_dynamic <= rgb_pointer_start + (i * 120) + 114;
rgb_pointer_dynamic += 3)
for (rgb_pointer_dynamic = rgb_pointer_start + (i * 4*40);
rgb_pointer_dynamic <= rgb_pointer_start + (i * 4*40) + 4*38;
rgb_pointer_dynamic += 4)
{
for (j = 0; j <= 2; j++)
rgb_pointer_dynamic[j] = rgb_pointer_dynamic[j + 3];
rgb_pointer_dynamic[j] = rgb_pointer_dynamic[j + 4];
}
}
@ -126,7 +126,7 @@ timer_draw(void *data)
for (i = 1; i <= 38; i++)
{
rgb_pointer_dynamic = rgb_pointer_start
+ (i * 120) + 114;
+ (i * 4*40) + 4*38;
for (j = 0; j <= 2; j++)
rgb_pointer_dynamic[j] = bg_color[j];

View File

@ -148,7 +148,6 @@ static void
cb_close (void *data)
{
Epplet_unremember ();
Epplet_cleanup ();
cd_finish (cd_desc);
exit (0);
return;

View File

@ -313,7 +313,6 @@ cb_close(void *data)
{
Epplet_unremember();
Esync();
Epplet_cleanup();
data = NULL;
exit(0);
}

View File

@ -23,6 +23,7 @@
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <unistd.h>

View File

@ -233,7 +233,7 @@ static void
change_image(void *data)
{
ImlibImage *im = NULL;
Imlib_Image *im = NULL;
double ratio = 0.0;
unsigned long first = idx;
int new_w = 0, new_h = 0, new_x = 3, new_y = 3;
@ -242,7 +242,7 @@ change_image(void *data)
return;
/* Test-load each image to make sure it's a valid image file. */
for (; ((filenames[idx] == NULL) || ((im = Imlib_load_image(Epplet_get_imlib_data(), filenames[idx])) == NULL));) {
for (; ((filenames[idx] == NULL) || ((im = imlib_load_image(filenames[idx])) == NULL));) {
/* It isn't, so NULL out its name. */
filenames[idx] = NULL;
INC_PIC();
@ -259,15 +259,16 @@ change_image(void *data)
}
new_w = (w * 16 - 6);
new_h = (h * 16 - 6);
imlib_context_set_image(im);
if (maintain_aspect) {
ratio = ((double) im->rgb_width / im->rgb_height) / ((double) new_w / new_h);
ratio = ((double) imlib_image_get_width() / imlib_image_get_height()) / ((double) new_w / new_h);
if (ratio > 1.0) {
new_h /= ratio;
} else if (ratio != 1.0) {
new_w *= ratio;
}
}
Imlib_destroy_image(Epplet_get_imlib_data(), im); /* Destroy the image, but keep it in cache. */
imlib_free_image(); /* Destroy the image, but keep it in cache. */
new_x = ((w * 16) / 2) - (new_w / 2);
new_y = ((h * 16) / 2) - (new_h / 2);

View File

@ -70,9 +70,9 @@ void draw_line(unsigned char *rgb, int x1, int y1, int x2, int y2, unsigned char
for(i=0;i<dx;i++) {
if(steep) {
rptr=rgb+(((x1*WIDTH)+y1)*3);
rptr=rgb+(((x1*WIDTH)+y1)*4);
} else {
rptr=rgb+(((y1*WIDTH)+x1)*3);
rptr=rgb+(((y1*WIDTH)+x1)*4);
}
rptr[0]=clr[0];
rptr[1]=clr[1];
@ -85,7 +85,7 @@ void draw_line(unsigned char *rgb, int x1, int y1, int x2, int y2, unsigned char
e+=2*dy;
}
rptr=rgb+(((y2*WIDTH)+x2)*3);
rptr=rgb+(((y2*WIDTH)+x2)*4);
rptr[0]=clr[0];
rptr[1]=clr[1];
rptr[2]=clr[2];
@ -99,12 +99,12 @@ void draw_graph(void)
rgb=Epplet_get_rgb_pointer(buf);
for(y=0;y<HEIGHT;y++) {
rptr=rgb+(y*WIDTH*3);
rptr=rgb+(y*WIDTH*4);
for(x=0;x<WIDTH;x++) {
rptr[0]=colors[color][0][0];
rptr[1]=colors[color][0][1];
rptr[2]=colors[color][0][2];
rptr+=3;
rptr+=4;
}
}

View File

@ -6,6 +6,7 @@
#include "epplet.h"
#include <sys/ioctl.h>
#include <fcntl.h>
#ifdef __FreeBSD__
#include <machine/soundcard.h>
#else

View File

@ -1,6 +1,6 @@
# $Id$
bindir = $(EBIN)
#bindir = $(EBIN)
edatadir = $(EROOT)
bin_PROGRAMS = E-Load.epplet E-Clock.epplet E-Time.epplet E-Net.epplet \

View File

@ -115,11 +115,11 @@ blank_buf (void)
for (y = 0; y < 40; y++)
{
rgb = Epplet_get_rgb_pointer (buf);
rptr = rgb + (y * 40 * 3);
rptr = rgb + (y * 40 * 4);
for (x = 0; x < 40; x++)
{
rptr[0] = rptr[1] = rptr[2] = 0;
rptr += 3;
rptr += 4;
}
}
}
@ -134,13 +134,13 @@ color_buf (unsigned char rr, unsigned char gg, unsigned char bb)
for (y = 0; y < 40; y++)
{
rgb = Epplet_get_rgb_pointer (buf);
rptr = rgb + (y * 40 * 3);
rptr = rgb + (y * 40 * 4);
for (x = 0; x < 40; x++)
{
rptr[0] = rr;
rptr[1] = gg;
rptr[2] = bb;
rptr += 3;
rptr += 4;
}
}
}
@ -156,13 +156,13 @@ fade_buf (int percentage)
for (y = 0; y < 40; y++)
{
rgb = Epplet_get_rgb_pointer (buf);
rptr = rgb + (y * 40 * 3);
rptr = rgb + (y * 40 * 4);
for (x = 0; x < 40; x++)
{
rptr[0] = rptr[0] * percentage / 100;
rptr[1] = rptr[1] * percentage / 100;
rptr[2] = rptr[2] * percentage / 100;
rptr += 3;
rptr += 4;
}
}
}
@ -177,13 +177,13 @@ scroll_buf (void)
for (y = 0; y < 40; y++)
{
rgb = Epplet_get_rgb_pointer (buf);
rptr = rgb + (y * 40 * 3);
rptr = rgb + (y * 40 * 4);
for (x = 0; x < 39; x++)
{
rptr[0] = rptr[3];
rptr[1] = rptr[4];
rptr[2] = rptr[5];
rptr += 3;
rptr[0] = rptr[4];
rptr[1] = rptr[5];
rptr[2] = rptr[6];
rptr += 4;
}
rptr[0] = 0;
rptr[1] = 0;
@ -254,14 +254,14 @@ draw_flame (void)
for (y = 0; y < 40; y++)
{
ptr = flame + (y * 40) + 1;
rptr = rgb + (y * 40 * 3);
rptr = rgb + (y * 40 * 4);
for (x = 0; x < 40; x++)
{
val1 = ptr[x] & 0xff;
rptr[0] = rm[val1];
rptr[1] = gm[val1];
rptr[2] = bm[val1];
rptr += 3;
rptr += 4;
}
}
}
@ -1218,7 +1218,8 @@ set_col_pixel (int x, int y, unsigned char c, unsigned char rrr,
if ((((int) c) == 0) || (x < 0) || (y < 0) || (x > 39) || (y > 39))
return;
ptr = (buf)->im->rgb_data + ((buf)->im->rgb_width * 3 * (y)) + (3 * x);
ptr = Epplet_get_rgb_pointer(buf);
ptr += (imlib_image_get_width() * 4 * (y)) + (4 * x);
ptr[0] = ((double) rrr / 255 * (double) c);
ptr[1] = ((double) ggg / 255 * (double) c);
ptr[2] = ((double) bbb / 255 * (double) c);

View File

@ -125,11 +125,11 @@ blank_buf (void)
for (y = 0; y < 40; y++)
{
rgb = Epplet_get_rgb_pointer (buf);
rptr = rgb + (y * 40 * 3);
rptr = rgb + (y * 40 * 4);
for (x = 0; x < 40; x++)
{
rptr[0] = rptr[1] = rptr[2] = 0;
rptr += 3;
rptr += 4;
}
}
}
@ -144,13 +144,13 @@ color_buf (unsigned char rr, unsigned char gg, unsigned char bb)
for (y = 0; y < 40; y++)
{
rgb = Epplet_get_rgb_pointer (buf);
rptr = rgb + (y * 40 * 3);
rptr = rgb + (y * 40 * 4);
for (x = 0; x < 40; x++)
{
rptr[0] = rr;
rptr[1] = gg;
rptr[2] = bb;
rptr += 3;
rptr += 4;
}
}
}
@ -166,13 +166,13 @@ fade_buf (int percentage)
for (y = 0; y < 40; y++)
{
rgb = Epplet_get_rgb_pointer (buf);
rptr = rgb + (y * 40 * 3);
rptr = rgb + (y * 40 * 4);
for (x = 0; x < 40; x++)
{
rptr[0] = rptr[0] * percentage / 100;
rptr[1] = rptr[1] * percentage / 100;
rptr[2] = rptr[2] * percentage / 100;
rptr += 3;
rptr += 4;
}
}
}
@ -187,13 +187,13 @@ scroll_buf (void)
for (y = 0; y < 40; y++)
{
rgb = Epplet_get_rgb_pointer (buf);
rptr = rgb + (y * 40 * 3);
rptr = rgb + (y * 40 * 4);
for (x = 0; x < 39; x++)
{
rptr[0] = rptr[3];
rptr[1] = rptr[4];
rptr[2] = rptr[5];
rptr += 3;
rptr[0] = rptr[4];
rptr[1] = rptr[5];
rptr[2] = rptr[6];
rptr += 4;
}
rptr[0] = 0;
rptr[1] = 0;
@ -289,14 +289,14 @@ draw_flame (void)
for (y = 0; y < 40; y++)
{
ptr = flame + (y * 40) + 1;
rptr = rgb + (y * 40 * 3);
rptr = rgb + (y * 40 * 4);
for (x = 0; x < 40; x++)
{
val1 = ptr[x] & 0xff;
rptr[0] = rm[val1];
rptr[1] = gm[val1];
rptr[2] = bm[val1];
rptr += 3;
rptr += 4;
}
}
}
@ -838,7 +838,8 @@ set_col_pixel (int x, int y, unsigned char c, unsigned char rrr,
if ((((int) c) == 0) || (x < 0) || (y < 0) || (x > 39) || (y > 39))
return;
ptr = (buf)->im->rgb_data + ((buf)->im->rgb_width * 3 * (y)) + (3 * x);
ptr = Epplet_get_rgb_pointer(buf);
ptr += (imlib_image_get_width() * 4 * (y)) + (4 * x);
ptr[0] = ((double) rrr / 255 * (double) c);
ptr[1] = ((double) ggg / 255 * (double) c);
ptr[2] = ((double) bbb / 255 * (double) c);