Hi,
Here is a patch I started. It does build but segfaults and I'm probably
a bit over my head. Hope this helps at least a little.
Thanks,
Barry deFreese
diff -urN repo/xteddy-2.1/configure.in xteddy-2.1/configure.in
--- repo/xteddy-2.1/configure.in 2005-05-25 01:23:57.000000000 -0400
+++ xteddy-2.1/configure.in 2008-12-10 11:12:24.000000000 -0500
@@ -4,7 +4,7 @@
AC_PROG_CC
AC_PATH_XTRA
-AC_CHECK_LIB(Imlib, main, , , $X_LIBS -lX11)
+AC_CHECK_LIB(Imlib2, main, , , $X_LIBS -lX11)
PIXMAP_PATH="/usr/share/xteddy"
AC_SUBST(PIXMAP_PATH)
diff -urN repo/xteddy-2.1/debian/changelog xteddy-2.1/debian/changelog
--- repo/xteddy-2.1/debian/changelog 2008-12-10 13:02:34.000000000 -0500
+++ xteddy-2.1/debian/changelog 2008-12-10 11:14:12.000000000 -0500
@@ -1,3 +1,10 @@
+xteddy (2.1-3.1) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Test build with imlib2
+
+ -- Barry deFreese <[EMAIL PROTECTED]> Wed, 10 Dec 2008 11:14:00 -0500
+
xteddy (2.1-3) unstable; urgency=low
* Applied patch to turn X11 cursor off at request
diff -urN repo/xteddy-2.1/debian/control xteddy-2.1/debian/control
--- repo/xteddy-2.1/debian/control 2008-12-10 13:02:34.000000000 -0500
+++ xteddy-2.1/debian/control 2008-12-10 11:12:01.000000000 -0500
@@ -4,7 +4,7 @@
Maintainer: Debian Games Team <[EMAIL PROTECTED]>
Uploaders: Andreas Tille <[EMAIL PROTECTED]>
DM-Upload-Allowed: yes
-Build-Depends: debhelper (>= 6.0.7), imlib11-dev (>= 1.9.14-16), quilt
+Build-Depends: debhelper (>= 6.0.7), imlib2-dev (>= 1.1.0), quilt
Standards-Version: 3.8.0
Vcs-Svn: svn://svn.debian.org/svn/pkg-games/packages/trunk/xteddy/
Vcs-Browser: http://svn.debian.org/wsvn/pkg-games/packages/trunk/xteddy/?op=log
@@ -18,4 +18,3 @@
top of him, zap him around until he becomes dizzy, do what you like;
he will always be your true (albeit virtual) friend.
Now you can load other pixmaps than the nice teddy, too.
-
diff -urN repo/xteddy-2.1/Makefile.am xteddy-2.1/Makefile.am
--- repo/xteddy-2.1/Makefile.am 2005-05-25 01:52:03.000000000 -0400
+++ xteddy-2.1/Makefile.am 2008-12-10 11:13:38.000000000 -0500
@@ -3,7 +3,7 @@
bin_PROGRAMS = xteddy
xteddy_SOURCES = xteddy.c
-LIBS = `imlib-config --libs`
+LIBS = `pkg-config --libs imlib2`
man_MANS = xteddy.6
bin_SCRIPTS = xtoys xteddy_test
diff -urN repo/xteddy-2.1/xteddy.c xteddy-2.1/xteddy.c
--- repo/xteddy-2.1/xteddy.c 2005-05-25 02:11:37.000000000 -0400
+++ xteddy-2.1/xteddy.c 2008-12-10 12:57:10.000000000 -0500
@@ -28,7 +28,7 @@
#include <X11/extensions/shape.h>
#include <X11/cursorfont.h>
-#include <Imlib.h>
+#include <Imlib2.h>
#include <ctype.h>
#include <stdio.h>
@@ -158,8 +158,10 @@
int offs_x, offs_y, new_x, new_y, tmp_x, tmp_y;
unsigned int tmp_mask;
- ImlibData *id;
- ImlibImage *im;
+ Imlib_Context *id;
+ Imlib_Image *im;
+
+ int im_w, im_h;
/* Determine program name */
if ((progname = strrchr(argv[0],'/')) == NULL)
@@ -232,33 +234,40 @@
display_width = DisplayWidth(display, screen_num);
display_height = DisplayHeight(display, screen_num);
- if ( !(id=Imlib_init(display)) ) return -1;
+/* if ( !(id=Imlib_init(display)) ) return -1; */
+ imlib_context_set_display(display);
if ( !(file = InitTeddy(teddy)) ) {
fprintf(stderr, "Can not find any image with name '%s'.\n", teddy);
return -1;
}
- if ( !(im=Imlib_load_image(id, file)) ) {
+ if ( !(im=imlib_load_image(file)) ) {
fprintf(stderr, "Most probably, the file '%s' is not a valid image.\n",
teddy);
return -1;
}
+ imlib_context_set_image(im);
+
/* Set the window position according to user preferences */
+ im_w = imlib_image_get_width();
+ im_h = imlib_image_get_height();
+
if (geomflags & XNegative)
- x = display_width - im->rgb_width + x;
+ x = display_width - im_w + x;
if (geomflags & YNegative)
- y = display_height - im->rgb_height + y;
+ y = display_height - im_h + y;
/* Clip against bounds to stay on the screen */
if (x<0) x=0;
- if (x > display_width - im->rgb_width) x = display_width - im->rgb_width;
+ if (x > display_width - im_w) x = display_width - im_w;
if (y<0) y=0;
- if (y > display_height - im->rgb_height) y = display_height - im->rgb_height;
+ if (y > display_height - im_h) y = display_height - im_h;
/* Create the main window */
win = XCreateSimpleWindow(display, DefaultRootWindow(display),
- x,y,im->rgb_width,im->rgb_height,border_width,
+ x,y,im_w,im_h,border_width,
BlackPixel(display,screen_num),
WhitePixel(display,screen_num));
XSelectInput(display,win,StructureNotifyMask);
- Imlib_apply_image(id,im,win);
+ /* imlib_apply_image(id,im,win); */
+ imlib_render_image_on_drawable(x,y);
basewin = win;
@@ -272,15 +281,16 @@
XChangeWindowAttributes(display, win, valuemask, &setwinattr);
/* Report size hints and other stuff to the window manager */
- size_hints.min_width = im->rgb_width; /* Don't allow any resizing */
- size_hints.min_height = im->rgb_height;
- size_hints.max_width = im->rgb_width;
- size_hints.max_height = im->rgb_height;
+ size_hints.min_width = im_w; /* Don't allow any resizing */
+ size_hints.min_height = im_h;
+ size_hints.max_width = im_w;
+ size_hints.max_height = im_h;
size_hints.flags = PPosition | PSize | PMinSize | PMaxSize;
if (XStringListToTextProperty(&(teddy), 1, &windowName) == 0)
{
(void) fprintf(stderr, "%s: structure allocation for windowName
failed.\n", progname);
- Imlib_kill_image(id, im);
+ imlib_free_image_and_decache();
+ /* Imlib_kill_image(id, im); */
return -1;
}
wm_hints.initial_state = NormalState;
@@ -320,7 +330,9 @@
break;
case ConfigureNotify:
/* Window has been resized */
- Imlib_apply_image(id,im,win);
+ /* Imlib_apply_image(id,im,win); */
+ /* What values should x,y have here?) */
+ imlib_render_image_on_drawable(0,0);
XSync(display,False);
break;
case ReparentNotify:
@@ -382,7 +394,8 @@
{
if (allow_quit)
{
- Imlib_kill_image(id, im);
+ /* Imlib_kill_image(id, im); */
+ imlib_free_image_and_decache();
XCloseDisplay(display);
return 0;
}