Revert "Add preliminary support for XPM format"

This reverts commit 5f8b538a5e4eeea159b26c3d0b943cac745ffdce.
This commit is contained in:
Julien Danjou 2008-03-19 17:51:12 +01:00
parent df2555d9fe
commit a3f9eb7af9
9 changed files with 13 additions and 54 deletions

View File

@ -140,7 +140,7 @@ awesome_SOURCES = \
ewmh.c ewmh.h
awesome_SOURCES += $(LAYOUTS)
awesome_SOURCES += $(WIDGETS)
awesome_LDADD = $(X_LIBS) $(PANGOCAIRO_LIBS) $(CONFUSE_LIBS) $(XRANDR_LIBS) $(XINERAMA_LIBS) $(XPM_LIBS)
awesome_LDADD = $(X_LIBS) $(PANGOCAIRO_LIBS) $(CONFUSE_LIBS) $(XRANDR_LIBS) $(XINERAMA_LIBS)
bin_PROGRAMS += awesome-client
awesome_client_SOURCES = \
@ -159,7 +159,7 @@ awesome_message_SOURCES = \
common/xscreen.h common/xscreen.c \
awesome-message.c
awesome_message_LDADD = $(X_LIBS) $(PANGOCAIRO_LIBS) $(CONFUSE_LIBS) $(XINERAMA_LIBS) $(XPM_LIBS)
awesome_message_LDADD = $(X_LIBS) $(PANGOCAIRO_LIBS) $(CONFUSE_LIBS) $(XINERAMA_LIBS)
bin_PROGRAMS += awesome-menu
awesome_menu_SOURCES = \
@ -171,7 +171,7 @@ awesome_menu_SOURCES = \
common/xutil.h common/xutil.c \
awesome-menu.c
awesome_menu_LDADD = $(X_LIBS) $(PANGOCAIRO_LIBS) $(CONFUSE_LIBS) $(XINERAMA_LIBS) $(XPM_LIBS)
awesome_menu_LDADD = $(X_LIBS) $(PANGOCAIRO_LIBS) $(CONFUSE_LIBS) $(XINERAMA_LIBS)
if HAVE_XMLTO
if HAVE_ASCIIDOC

View File

@ -184,7 +184,7 @@ main(int argc, char **argv)
if(argc - optind >= 2)
{
icon_geometry = draw_image_size_format_png(argv[optind + 1]);
icon_geometry = draw_get_image_size(argv[optind + 1]);
if(icon_geometry.width <= 0 || icon_geometry.height <= 0)
eprint("invalid image\n");
else

View File

@ -22,8 +22,6 @@
#include <cairo.h>
#include <cairo-xlib.h>
#include <X11/xpm.h>
#include <langinfo.h>
#include <iconv.h>
#include <errno.h>
@ -583,26 +581,6 @@ void draw_image_from_argb_data(DrawCtx *ctx, int x, int y, int w, int h,
cairo_surface_destroy(source);
}
static void
draw_image_format_xpm(DrawCtx *ctx, int x, int y, char *filename)
{
Pixmap pxm, shapemask;
XpmAttributes attr;
if(XpmReadFileToPixmap(ctx->display, ctx->drawable,
filename,
&pxm, &shapemask,
&attr))
return warn("cannot load image %s\n", filename);
XCopyArea(ctx->display, pxm, ctx->drawable,
DefaultGC(ctx->display, ctx->phys_screen),
0, 0, attr.width, attr.height,
x, y);
XFreePixmap(ctx->display, pxm);
}
/** Draw an image (PNG format only) from a file to a draw context
* \param ctx Draw context to draw to
* \param x x coordinate
@ -610,8 +588,8 @@ draw_image_format_xpm(DrawCtx *ctx, int x, int y, char *filename)
* \param wanted_h wanted height: if > 0, image will be resized
* \param filename file name to draw
*/
static void
draw_image_format_png(DrawCtx *ctx, int x, int y, int wanted_h, const char *filename)
void
draw_image(DrawCtx *ctx, int x, int y, int wanted_h, const char *filename)
{
double ratio;
int h;
@ -641,29 +619,12 @@ draw_image_format_png(DrawCtx *ctx, int x, int y, int wanted_h, const char *file
cairo_surface_destroy(source);
}
void
draw_image(DrawCtx *ctx, int x, int y, int wanted_h, char *filename)
{
char *dot;
if(!a_strlen(filename))
return;
if(!(dot = strrchr(filename, '.')))
return warn("cannot determine file type for %s\n", filename);
if(!a_strcasecmp(++dot, "png"))
draw_image_format_png(ctx, x, y, wanted_h, filename);
else if(!a_strcasecmp(dot, "xpm"))
draw_image_format_xpm(ctx, x, y, filename);
}
/** Get an imag size (PNG format only)
* \param filename file name
* \return area_t structure with width and height set to image size
*/
area_t
draw_image_size_format_png(const char *filename)
draw_get_image_size(const char *filename)
{
area_t size = { -1, -1, -1, -1, NULL, NULL };
cairo_surface_t *surface;

View File

@ -130,9 +130,9 @@ void draw_graph_setup(DrawCtx *);
void draw_graph(DrawCtx *, area_t, int *, int *, int, Position, area_t, XColor *, XColor *, XColor *);
void draw_graph_line(DrawCtx *, area_t, int *, int, Position, area_t, XColor *, XColor *, XColor *);
void draw_circle(DrawCtx *, int, int, int, Bool, XColor);
void draw_image(DrawCtx *, int, int, int, char *);
void draw_image(DrawCtx *, int, int, int, const char *);
void draw_image_from_argb_data(DrawCtx *, int, int, int, int, int, unsigned char *);
area_t draw_image_size_format_png(const char *filename);
area_t draw_get_image_size(const char *filename);
Drawable draw_rotate(DrawCtx *, int, double, int, int);
unsigned short draw_textwidth(Display *, font_t *, char *);
Alignment draw_align_get_from_str(const char *);

View File

@ -114,8 +114,6 @@ PKG_CHECK_MODULES([XINERAMA], [xinerama],,
[AC_MSG_ERROR([awesome requires Xinerama.])])
PKG_CHECK_MODULES([XRANDR], [xrandr],,
[AC_MSG_ERROR([awesome requires Xrandr.])])
PKG_CHECK_MODULES([XPM], [xpm],,
[AC_MSG_ERROR([awesome requires XPM.])])
# Checks for header files.
AC_PATH_X

View File

@ -48,7 +48,7 @@ focusicon_draw(Widget *widget, DrawCtx *ctx, int offset,
if((r = rule_matching_client(sel)) && r->icon)
{
area = draw_image_size_format_png(r->icon);
area = draw_get_image_size(r->icon);
widget->area.width = ((double) widget->statusbar->height / (double) area.height)
* area.width;
if(!widget->user_supplied_x)

View File

@ -36,7 +36,7 @@ iconbox_draw(Widget *widget, DrawCtx *ctx, int offset,
int used __attribute__ ((unused)))
{
Data *d = widget->data;
area_t area = draw_image_size_format_png(d->image);
area_t area = draw_get_image_size(d->image);
/* image not valid */
if(area.width < 0 || area.height < 0)

View File

@ -35,7 +35,7 @@ layoutinfo_draw(Widget *widget,
int used __attribute__ ((unused)))
{
Tag **curtags = tags_get_current(widget->statusbar->screen);
area_t area = draw_image_size_format_png(curtags[0]->layout->image);
area_t area = draw_get_image_size(curtags[0]->layout->image);
if(!widget->user_supplied_x)
widget->area.x = widget_calculate_offset(widget->statusbar->width,

View File

@ -136,7 +136,7 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
if((r = rule_matching_client(c)) && r->icon)
{
area = draw_image_size_format_png(r->icon);
area = draw_get_image_size(r->icon);
if(area.width > 0 && area.height > 0)
{
icon_width = ((double) widget->statusbar->height / (double) area.height) * area.width;