1999-08-17 16:01:18 -07:00
/*
* Esetroot - - Set the root pixmap . This program enables non - Enlightenment
* users to use Eterm ' s support for pseudotransparency .
*
* Written by Nat Friedman < ndf @ mit . edu > with modifications by Gerald Britton
1999-08-17 18:12:47 -07:00
* < gbritton @ mit . edu > and Michael Jennings < mej @ eterm . org >
1999-08-17 16:01:18 -07:00
*
*/
static const char cvs_ident [ ] = " $Id$ " ;
# include "../config.h"
# include <stdio.h>
# include <stdlib.h>
# ifdef HAVE_UNISTD_H
# include <unistd.h>
# endif
2001-07-03 18:02:37 -07:00
# include <errno.h>
2000-05-02 16:46:08 -07:00
# ifdef PIXMAP_SUPPORT
1999-08-17 16:01:18 -07:00
# include <X11/Xlib.h>
# include <X11/Xutil.h>
# include <X11/Xatom.h>
# include <X11/Xos.h>
Wed Apr 12 21:18:19 PDT 2000 Michael Jennings <mej@eterm.org>
This is the initial commit with Imlib2 support. READ THIS CAREFULLY.
There is important information in this commit message that will keep
you from getting screwed.
First off, support for Imlib 1.x is GONE. It is no longer supported
as of now. If you want to continue using it, do NOT install this
version. I tried to support both for awhile, but the code ended up
being way too ugly and hackish. Imlib2 is the future. And trust me,
when you see what we do with this future, you'll be happy for the
switch.
The good news is that most of the basics work. Transparency still
works, and the basic image stuff works. Most users won't notice any
major problems, so long as your Imlib2 is 100% up-to-date.
However, a few things still don't work:
1. Auto mode is a bit broken. You'll get X errors in XFree86 4.0.
Don't use it if you're running XFree 4.
2. Color modifiers for images don't work. At all.
3. Transparency shading/tinting will not work in 8bpp or lower. Life
blows sometimes. Sorry. Time for a real video card. :-)
4. The built-in icon is broken.
5. You WILL need to update your theme.cfg files. The borders on the
horizontal and vertical bar images were incorrect when combined with
the new anti-aliased scaling. The horizontal bars should have a right
border of 3. Vertical bars should have a bottom border of 3. The
menu images should have both right *and* bottom borders of 3. You can
either make those changes by hand, or use the --with-theme-update
option to autogen.sh. Your call.
I think that covers everything I've run into. I will point out that
I don't really take advantage of a lot of the Imlib2 features just
yet. My first priority is to make all the stuff that worked before
work again (or at least the important stuff). Then I'll work on
new features.
So there it is. If you're not ready for it, don't use it. But if you
are, I hope you like it.
SVN revision: 2478
2000-04-12 21:19:05 -07:00
# include <Imlib2.h>
1999-08-17 16:01:18 -07:00
1999-10-19 10:44:02 -07:00
void set_pixmap_property ( Pixmap p ) ;
1999-08-17 16:01:18 -07:00
Display * Xdisplay ;
Screen * scr ;
Window Xroot ;
int screen ;
unsigned char debug = 0 ;
# define Xdepth (DefaultDepth(Xdisplay, screen))
void
set_pixmap_property ( Pixmap p )
{
Atom prop_root , prop_esetroot , type ;
int format ;
unsigned long length , after ;
unsigned char * data_root , * data_esetroot ;
prop_root = XInternAtom ( Xdisplay , " _XROOTPMAP_ID " , True ) ;
prop_esetroot = XInternAtom ( Xdisplay , " ESETROOT_PMAP_ID " , True ) ;
if ( debug ) {
fprintf ( stderr , " %s:%d: set_pixmap_property(0x%08x): prop_root == 0x%08x, prop_esetroot == 0x%08x \n " , __FILE__ , __LINE__ ,
1999-10-18 18:07:09 -07:00
( unsigned int ) p , ( unsigned int ) prop_root , ( unsigned int ) prop_esetroot ) ;
1999-08-17 16:01:18 -07:00
}
if ( prop_root ! = None & & prop_esetroot ! = None ) {
XGetWindowProperty ( Xdisplay , Xroot , prop_root , 0L , 1L , False , AnyPropertyType ,
& type , & format , & length , & after , & data_root ) ;
if ( type = = XA_PIXMAP ) {
XGetWindowProperty ( Xdisplay , Xroot , prop_esetroot , 0L , 1L , False , AnyPropertyType ,
& type , & format , & length , & after , & data_esetroot ) ;
if ( data_root & & data_esetroot ) {
if ( debug ) {
fprintf ( stderr , " %s:%d: set_pixmap_property(0x%08x): data_root == 0x%08x, data_esetroot == 0x%08x \n " , __FILE__ , __LINE__ ,
1999-10-18 18:07:09 -07:00
( unsigned int ) p , ( unsigned int ) * ( ( Pixmap * ) data_root ) , ( unsigned int ) * ( ( Pixmap * ) data_esetroot ) ) ;
1999-08-17 16:01:18 -07:00
}
if ( type = = XA_PIXMAP & & * ( ( Pixmap * ) data_root ) = = * ( ( Pixmap * ) data_esetroot ) ) {
if ( debug ) {
1999-10-18 18:07:09 -07:00
fprintf ( stderr , " %s:%d: set_pixmap_property(0x%08x): XKillClient() is being called. \n " , __FILE__ , __LINE__ , ( unsigned int ) p ) ;
1999-08-17 16:01:18 -07:00
}
XKillClient ( Xdisplay , * ( ( Pixmap * ) data_root ) ) ;
}
}
}
}
/* This will locate the property, creating it if it doesn't exist */
prop_root = XInternAtom ( Xdisplay , " _XROOTPMAP_ID " , False ) ;
prop_esetroot = XInternAtom ( Xdisplay , " ESETROOT_PMAP_ID " , False ) ;
/* The call above should have created it. If that failed, we can't continue. */
if ( prop_root = = None | | prop_esetroot = = None ) {
fprintf ( stderr , " Esetroot: creation of pixmap property failed. \n " ) ;
exit ( 1 ) ;
}
XChangeProperty ( Xdisplay , Xroot , prop_root , XA_PIXMAP , 32 , PropModeReplace ,
( unsigned char * ) & p , 1 ) ;
XChangeProperty ( Xdisplay , Xroot , prop_esetroot , XA_PIXMAP , 32 , PropModeReplace ,
( unsigned char * ) & p , 1 ) ;
if ( debug ) {
1999-10-18 18:07:09 -07:00
fprintf ( stderr , " %s:%d: set_pixmap_property(0x%08x): _XROOTPMAP_ID and ESETROOT_PMAP_ID set to 0x%08x. \n " , __FILE__ , __LINE__ , ( unsigned int ) p , ( unsigned int ) p ) ;
1999-08-17 16:01:18 -07:00
}
XSetCloseDownMode ( Xdisplay , RetainPermanent ) ;
XFlush ( Xdisplay ) ;
}
2000-05-02 16:46:08 -07:00
# endif
1999-08-17 16:01:18 -07:00
int
main ( int argc , char * argv [ ] )
{
2000-05-02 16:46:08 -07:00
# ifdef PIXMAP_SUPPORT
2000-06-16 13:13:09 -07:00
unsigned char scale = 0 , center = 0 , fit = 0 , mirror = 0 ;
2001-12-29 12:47:49 -08:00
char * displayname = NULL , * fname = NULL , * bgcolor = NULL ;
Wed Apr 12 21:18:19 PDT 2000 Michael Jennings <mej@eterm.org>
This is the initial commit with Imlib2 support. READ THIS CAREFULLY.
There is important information in this commit message that will keep
you from getting screwed.
First off, support for Imlib 1.x is GONE. It is no longer supported
as of now. If you want to continue using it, do NOT install this
version. I tried to support both for awhile, but the code ended up
being way too ugly and hackish. Imlib2 is the future. And trust me,
when you see what we do with this future, you'll be happy for the
switch.
The good news is that most of the basics work. Transparency still
works, and the basic image stuff works. Most users won't notice any
major problems, so long as your Imlib2 is 100% up-to-date.
However, a few things still don't work:
1. Auto mode is a bit broken. You'll get X errors in XFree86 4.0.
Don't use it if you're running XFree 4.
2. Color modifiers for images don't work. At all.
3. Transparency shading/tinting will not work in 8bpp or lower. Life
blows sometimes. Sorry. Time for a real video card. :-)
4. The built-in icon is broken.
5. You WILL need to update your theme.cfg files. The borders on the
horizontal and vertical bar images were incorrect when combined with
the new anti-aliased scaling. The horizontal bars should have a right
border of 3. Vertical bars should have a bottom border of 3. The
menu images should have both right *and* bottom borders of 3. You can
either make those changes by hand, or use the --with-theme-update
option to autogen.sh. Your call.
I think that covers everything I've run into. I will point out that
I don't really take advantage of a lot of the Imlib2 features just
yet. My first priority is to make all the stuff that worked before
work again (or at least the important stuff). Then I'll work on
new features.
So there it is. If you're not ready for it, don't use it. But if you
are, I hope you like it.
SVN revision: 2478
2000-04-12 21:19:05 -07:00
Imlib_Image im ;
2000-06-16 13:13:09 -07:00
Pixmap p = None , temp_pmap = None , m = None ;
1999-08-17 16:01:18 -07:00
register unsigned char i ;
GC gc ;
XGCValues gcv ;
2001-12-29 12:47:49 -08:00
XColor xcolor ;
1999-08-17 16:01:18 -07:00
int w , h , x , y ;
if ( argc < 2 ) {
2001-12-29 12:47:49 -08:00
fprintf ( stderr , " %s [-display <display_name>] [-bgcolor <color>] [-scale] [-center] [-fit] [-mirror] pixmap \n " , * argv ) ;
fprintf ( stderr , " \t Short options are also recognized (-d, -b, -s, -c, -f, and -m) \n " ) ;
1999-08-17 16:01:18 -07:00
exit ( 0 ) ;
}
for ( i = 1 ; i < argc ; i + + ) {
if ( * argv [ i ] ! = ' - ' ) {
break ;
}
if ( argv [ i ] [ 1 ] = = ' d ' ) {
displayname = argv [ + + i ] ;
2001-12-29 12:47:49 -08:00
} else if ( argv [ i ] [ 1 ] = = ' b ' ) {
bgcolor = argv [ + + i ] ;
1999-08-17 16:01:18 -07:00
} else if ( argv [ i ] [ 1 ] = = ' s ' ) {
scale = 1 ;
} else if ( argv [ i ] [ 1 ] = = ' c ' ) {
center = 1 ;
} else if ( argv [ i ] [ 1 ] = = ' f ' ) {
fit = 1 ;
2000-06-16 13:13:09 -07:00
} else if ( argv [ i ] [ 1 ] = = ' m ' ) {
mirror = 1 ;
1999-08-17 16:01:18 -07:00
} else if ( argv [ i ] [ 1 ] = = ' x ' ) {
fprintf ( stderr , " Debugging activated. \n " ) ;
debug = 1 ;
} else {
fprintf ( stderr , " %s: Unrecognized option \' %c \' \n \n " , * argv , argv [ i ] [ 1 ] ) ;
2001-12-29 12:47:49 -08:00
fprintf ( stderr , " %s [-display <display_name>] [-bgcolor <color>] [-scale] [-center] [-fit] [-mirror] pixmap \n " , * argv ) ;
fprintf ( stderr , " \t Short options are also recognized (-d, -b, -s, -c, -f, and -m) \n " ) ;
1999-08-17 16:01:18 -07:00
exit ( 2 ) ;
}
}
fname = argv [ i ] ;
2000-06-16 13:13:09 -07:00
if ( scale ) {
1999-08-17 16:01:18 -07:00
center = 0 ;
2000-06-16 13:13:09 -07:00
mirror = 0 ;
}
1999-08-17 16:01:18 -07:00
if ( debug ) {
fprintf ( stderr , " %s:%d: Display name is \" %s \" \n " , __FILE__ , __LINE__ , displayname ? displayname : " (nil) " ) ;
2001-12-29 12:47:49 -08:00
fprintf ( stderr , " %s:%d: Background color name is \" %s \" \n " , __FILE__ , __LINE__ , bgcolor ? bgcolor : " (nil) " ) ;
1999-08-17 16:01:18 -07:00
fprintf ( stderr , " %s:%d: Image will be %s \n " , __FILE__ , __LINE__ , scale ? " scaled " : ( center ? " centered " : ( fit ? " fit " : " tiled " ) ) ) ;
fprintf ( stderr , " %s:%d: Image file is %s \n " , __FILE__ , __LINE__ , fname ? fname : " (nil) " ) ;
}
if ( ! displayname ) {
displayname = getenv ( " DISPLAY " ) ;
if ( debug ) {
fprintf ( stderr , " %s:%d: Display name set to %s via getenv( \" DISPLAY \" ) \n " , __FILE__ , __LINE__ , displayname ? displayname : " (nil) " ) ;
}
}
if ( ! displayname ) {
displayname = " :0.0 " ;
if ( debug ) {
fprintf ( stderr , " %s:%d: Display name defaulted to %s \n " , __FILE__ , __LINE__ , displayname ? displayname : " (nil) " ) ;
}
}
if ( ( Xdisplay = XOpenDisplay ( displayname ) ) = = 0 ) {
fprintf ( stderr , " %s: Unable to open display %s \n " , * argv , displayname ) ;
exit ( 1 ) ;
}
screen = DefaultScreen ( Xdisplay ) ;
Xroot = RootWindow ( Xdisplay , screen ) ;
scr = ScreenOfDisplay ( Xdisplay , screen ) ;
if ( debug ) {
fprintf ( stderr , " %s:%d: Chose screen %d \n " , __FILE__ , __LINE__ , screen ) ;
1999-10-18 18:07:09 -07:00
fprintf ( stderr , " %s:%d: Root window is 0x%08x \n " , __FILE__ , __LINE__ , ( unsigned int ) Xroot ) ;
1999-10-27 06:39:30 -07:00
fprintf ( stderr , " %s:%d: Found screen information at %8p \n " , __FILE__ , __LINE__ , scr ) ;
1999-08-17 16:01:18 -07:00
}
Wed Apr 12 21:18:19 PDT 2000 Michael Jennings <mej@eterm.org>
This is the initial commit with Imlib2 support. READ THIS CAREFULLY.
There is important information in this commit message that will keep
you from getting screwed.
First off, support for Imlib 1.x is GONE. It is no longer supported
as of now. If you want to continue using it, do NOT install this
version. I tried to support both for awhile, but the code ended up
being way too ugly and hackish. Imlib2 is the future. And trust me,
when you see what we do with this future, you'll be happy for the
switch.
The good news is that most of the basics work. Transparency still
works, and the basic image stuff works. Most users won't notice any
major problems, so long as your Imlib2 is 100% up-to-date.
However, a few things still don't work:
1. Auto mode is a bit broken. You'll get X errors in XFree86 4.0.
Don't use it if you're running XFree 4.
2. Color modifiers for images don't work. At all.
3. Transparency shading/tinting will not work in 8bpp or lower. Life
blows sometimes. Sorry. Time for a real video card. :-)
4. The built-in icon is broken.
5. You WILL need to update your theme.cfg files. The borders on the
horizontal and vertical bar images were incorrect when combined with
the new anti-aliased scaling. The horizontal bars should have a right
border of 3. Vertical bars should have a bottom border of 3. The
menu images should have both right *and* bottom borders of 3. You can
either make those changes by hand, or use the --with-theme-update
option to autogen.sh. Your call.
I think that covers everything I've run into. I will point out that
I don't really take advantage of a lot of the Imlib2 features just
yet. My first priority is to make all the stuff that worked before
work again (or at least the important stuff). Then I'll work on
new features.
So there it is. If you're not ready for it, don't use it. But if you
are, I hope you like it.
SVN revision: 2478
2000-04-12 21:19:05 -07:00
imlib_context_set_display ( Xdisplay ) ;
imlib_context_set_visual ( DefaultVisual ( Xdisplay , DefaultScreen ( Xdisplay ) ) ) ;
2000-04-17 22:16:00 -07:00
im = imlib_load_image_immediately ( fname ) ;
1999-11-02 08:08:57 -08:00
if ( im = = NULL ) {
fprintf ( stderr , " %s: Unable to load image file \" %s \" . \n " , * argv , fname ) ;
exit ( 1 ) ;
} else if ( debug ) {
1999-10-27 06:39:30 -07:00
fprintf ( stderr , " %s:%d: The Imlib Image is at %8p \n " , __FILE__ , __LINE__ , im ) ;
1999-08-17 16:01:18 -07:00
}
Wed Apr 12 21:18:19 PDT 2000 Michael Jennings <mej@eterm.org>
This is the initial commit with Imlib2 support. READ THIS CAREFULLY.
There is important information in this commit message that will keep
you from getting screwed.
First off, support for Imlib 1.x is GONE. It is no longer supported
as of now. If you want to continue using it, do NOT install this
version. I tried to support both for awhile, but the code ended up
being way too ugly and hackish. Imlib2 is the future. And trust me,
when you see what we do with this future, you'll be happy for the
switch.
The good news is that most of the basics work. Transparency still
works, and the basic image stuff works. Most users won't notice any
major problems, so long as your Imlib2 is 100% up-to-date.
However, a few things still don't work:
1. Auto mode is a bit broken. You'll get X errors in XFree86 4.0.
Don't use it if you're running XFree 4.
2. Color modifiers for images don't work. At all.
3. Transparency shading/tinting will not work in 8bpp or lower. Life
blows sometimes. Sorry. Time for a real video card. :-)
4. The built-in icon is broken.
5. You WILL need to update your theme.cfg files. The borders on the
horizontal and vertical bar images were incorrect when combined with
the new anti-aliased scaling. The horizontal bars should have a right
border of 3. Vertical bars should have a bottom border of 3. The
menu images should have both right *and* bottom borders of 3. You can
either make those changes by hand, or use the --with-theme-update
option to autogen.sh. Your call.
I think that covers everything I've run into. I will point out that
I don't really take advantage of a lot of the Imlib2 features just
yet. My first priority is to make all the stuff that worked before
work again (or at least the important stuff). Then I'll work on
new features.
So there it is. If you're not ready for it, don't use it. But if you
are, I hope you like it.
SVN revision: 2478
2000-04-12 21:19:05 -07:00
imlib_context_set_image ( im ) ;
1999-08-17 16:01:18 -07:00
if ( scale ) {
w = scr - > width ;
h = scr - > height ;
2000-06-16 13:13:09 -07:00
} else if ( mirror ) {
w = imlib_image_get_width ( ) * 2 ;
h = imlib_image_get_height ( ) * 2 ;
1999-08-17 16:01:18 -07:00
} else {
Wed Apr 12 21:18:19 PDT 2000 Michael Jennings <mej@eterm.org>
This is the initial commit with Imlib2 support. READ THIS CAREFULLY.
There is important information in this commit message that will keep
you from getting screwed.
First off, support for Imlib 1.x is GONE. It is no longer supported
as of now. If you want to continue using it, do NOT install this
version. I tried to support both for awhile, but the code ended up
being way too ugly and hackish. Imlib2 is the future. And trust me,
when you see what we do with this future, you'll be happy for the
switch.
The good news is that most of the basics work. Transparency still
works, and the basic image stuff works. Most users won't notice any
major problems, so long as your Imlib2 is 100% up-to-date.
However, a few things still don't work:
1. Auto mode is a bit broken. You'll get X errors in XFree86 4.0.
Don't use it if you're running XFree 4.
2. Color modifiers for images don't work. At all.
3. Transparency shading/tinting will not work in 8bpp or lower. Life
blows sometimes. Sorry. Time for a real video card. :-)
4. The built-in icon is broken.
5. You WILL need to update your theme.cfg files. The borders on the
horizontal and vertical bar images were incorrect when combined with
the new anti-aliased scaling. The horizontal bars should have a right
border of 3. Vertical bars should have a bottom border of 3. The
menu images should have both right *and* bottom borders of 3. You can
either make those changes by hand, or use the --with-theme-update
option to autogen.sh. Your call.
I think that covers everything I've run into. I will point out that
I don't really take advantage of a lot of the Imlib2 features just
yet. My first priority is to make all the stuff that worked before
work again (or at least the important stuff). Then I'll work on
new features.
So there it is. If you're not ready for it, don't use it. But if you
are, I hope you like it.
SVN revision: 2478
2000-04-12 21:19:05 -07:00
w = imlib_image_get_width ( ) ;
h = imlib_image_get_height ( ) ;
1999-08-17 16:01:18 -07:00
}
if ( fit ) {
double x_ratio , y_ratio ;
x_ratio = ( ( double ) scr - > width ) / ( ( double ) w ) ;
y_ratio = ( ( double ) scr - > height ) / ( ( double ) h ) ;
if ( x_ratio > y_ratio ) {
x_ratio = y_ratio ;
}
w = ( int ) ( w * x_ratio ) ;
h = ( int ) ( h * x_ratio ) ;
}
2001-12-29 12:47:49 -08:00
1999-08-17 16:01:18 -07:00
p = XCreatePixmap ( Xdisplay , Xroot , scr - > width , scr - > height , Xdepth ) ;
gcv . foreground = gcv . background = BlackPixel ( Xdisplay , screen ) ;
2001-12-29 12:47:49 -08:00
if ( bgcolor & & XParseColor ( Xdisplay , DefaultColormap ( Xdisplay , screen ) , bgcolor , & xcolor )
& & XAllocColor ( Xdisplay , DefaultColormap ( Xdisplay , screen ) , & xcolor ) ) {
gcv . foreground = gcv . background = xcolor . pixel ;
}
gc = XCreateGC ( Xdisplay , p , ( GCForeground | GCBackground ) , & gcv ) ;
1999-08-17 16:01:18 -07:00
if ( scale ) {
XFillRectangle ( Xdisplay , p , gc , 0 , 0 , w , h ) ;
}
if ( center | | fit ) {
XFillRectangle ( Xdisplay , p , gc , 0 , 0 , scr - > width , scr - > height ) ;
x = ( scr - > width - w ) > > 1 ;
y = ( scr - > height - h ) > > 1 ;
} else {
x = 0 ;
y = 0 ;
}
if ( debug ) {
fprintf ( stderr , " %s:%d: Assigned width and height for rendering as %dx%d \n " , __FILE__ , __LINE__ , w , h ) ;
1999-10-18 18:07:09 -07:00
fprintf ( stderr , " %s:%d: Created %dx%d+%d+%d pixmap 0x%08x \n " , __FILE__ , __LINE__ , scr - > width , scr - > height , x , y , ( unsigned int ) p ) ;
1999-10-27 06:39:30 -07:00
fprintf ( stderr , " %s:%d: Applied Graphics Context %8p to pixmap. \n " , __FILE__ , __LINE__ , gc ) ;
1999-08-17 16:01:18 -07:00
}
Wed Apr 12 21:18:19 PDT 2000 Michael Jennings <mej@eterm.org>
This is the initial commit with Imlib2 support. READ THIS CAREFULLY.
There is important information in this commit message that will keep
you from getting screwed.
First off, support for Imlib 1.x is GONE. It is no longer supported
as of now. If you want to continue using it, do NOT install this
version. I tried to support both for awhile, but the code ended up
being way too ugly and hackish. Imlib2 is the future. And trust me,
when you see what we do with this future, you'll be happy for the
switch.
The good news is that most of the basics work. Transparency still
works, and the basic image stuff works. Most users won't notice any
major problems, so long as your Imlib2 is 100% up-to-date.
However, a few things still don't work:
1. Auto mode is a bit broken. You'll get X errors in XFree86 4.0.
Don't use it if you're running XFree 4.
2. Color modifiers for images don't work. At all.
3. Transparency shading/tinting will not work in 8bpp or lower. Life
blows sometimes. Sorry. Time for a real video card. :-)
4. The built-in icon is broken.
5. You WILL need to update your theme.cfg files. The borders on the
horizontal and vertical bar images were incorrect when combined with
the new anti-aliased scaling. The horizontal bars should have a right
border of 3. Vertical bars should have a bottom border of 3. The
menu images should have both right *and* bottom borders of 3. You can
either make those changes by hand, or use the --with-theme-update
option to autogen.sh. Your call.
I think that covers everything I've run into. I will point out that
I don't really take advantage of a lot of the Imlib2 features just
yet. My first priority is to make all the stuff that worked before
work again (or at least the important stuff). Then I'll work on
new features.
So there it is. If you're not ready for it, don't use it. But if you
are, I hope you like it.
SVN revision: 2478
2000-04-12 21:19:05 -07:00
imlib_context_set_anti_alias ( 1 ) ;
imlib_context_set_dither ( 1 ) ;
imlib_context_set_blend ( 0 ) ;
2000-06-16 13:13:09 -07:00
if ( mirror ) {
temp_pmap = XCreatePixmap ( Xdisplay , Xroot , w , h , Xdepth ) ;
imlib_context_set_drawable ( temp_pmap ) ;
imlib_render_image_on_drawable ( 0 , 0 ) ;
imlib_image_flip_horizontal ( ) ;
imlib_render_image_on_drawable ( imlib_image_get_width ( ) , 0 ) ;
imlib_image_flip_vertical ( ) ;
imlib_render_image_on_drawable ( imlib_image_get_width ( ) , imlib_image_get_height ( ) ) ;
imlib_image_flip_horizontal ( ) ;
imlib_render_image_on_drawable ( 0 , imlib_image_get_height ( ) ) ;
} else {
imlib_context_set_drawable ( Xroot ) ;
imlib_render_pixmaps_for_whole_image_at_size ( & temp_pmap , & m , w , h ) ;
}
1999-08-17 16:01:18 -07:00
if ( debug ) {
1999-10-18 18:07:09 -07:00
fprintf ( stderr , " %s:%d: Rendered at %dx%d onto pixmap 0x%08x \n " , __FILE__ , __LINE__ , w , h , ( unsigned int ) temp_pmap ) ;
1999-08-17 16:01:18 -07:00
}
if ( temp_pmap ! = None ) {
2000-06-16 13:13:09 -07:00
if ( m ) {
XFreePixmap ( Xdisplay , m ) ;
m = None ;
}
1999-08-17 16:01:18 -07:00
XSetTile ( Xdisplay , gc , temp_pmap ) ;
XSetTSOrigin ( Xdisplay , gc , x , y ) ;
XSetFillStyle ( Xdisplay , gc , FillTiled ) ;
if ( center | | fit ) {
XFillRectangle ( Xdisplay , p , gc , x , y , w , h ) ;
} else {
XFillRectangle ( Xdisplay , p , gc , x , y , scr - > width , scr - > height ) ;
}
set_pixmap_property ( p ) ;
XFlush ( Xdisplay ) ;
XSetWindowBackgroundPixmap ( Xdisplay , Xroot , p ) ;
XClearWindow ( Xdisplay , Xroot ) ;
XFlush ( Xdisplay ) ;
}
2000-05-02 16:46:08 -07:00
# else
fprintf ( stderr , " Eterm was built without pixmap support, so Esetroot is fairly useless. Sorry. \n " ) ;
# endif
1999-08-17 16:01:18 -07:00
return 0 ;
}