From a3f9eb7af95a48d7a9376a003b5abb55437d8655 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 19 Mar 2008 17:51:12 +0100 Subject: [PATCH] Revert "Add preliminary support for XPM format" This reverts commit 5f8b538a5e4eeea159b26c3d0b943cac745ffdce. --- Makefile.am | 6 +++--- awesome-message.c | 2 +- common/draw.c | 45 +++----------------------------------------- common/draw.h | 4 ++-- configure.ac | 2 -- widgets/focusicon.c | 2 +- widgets/iconbox.c | 2 +- widgets/layoutinfo.c | 2 +- widgets/tasklist.c | 2 +- 9 files changed, 13 insertions(+), 54 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9b2b6492d..55ccfc22f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/awesome-message.c b/awesome-message.c index aded3561f..106a2ea92 100644 --- a/awesome-message.c +++ b/awesome-message.c @@ -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 diff --git a/common/draw.c b/common/draw.c index f544420a4..10e5e52f0 100644 --- a/common/draw.c +++ b/common/draw.c @@ -22,8 +22,6 @@ #include #include -#include - #include #include #include @@ -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; diff --git a/common/draw.h b/common/draw.h index 94df16eaf..4d2e2afbb 100644 --- a/common/draw.h +++ b/common/draw.h @@ -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 *); diff --git a/configure.ac b/configure.ac index 0a9b942a5..94ea525b0 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/widgets/focusicon.c b/widgets/focusicon.c index a0b8588d7..71860cc77 100644 --- a/widgets/focusicon.c +++ b/widgets/focusicon.c @@ -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) diff --git a/widgets/iconbox.c b/widgets/iconbox.c index 4fc20e403..3a3410f9f 100644 --- a/widgets/iconbox.c +++ b/widgets/iconbox.c @@ -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) diff --git a/widgets/layoutinfo.c b/widgets/layoutinfo.c index 1d6ef076c..5f1c7cfd7 100644 --- a/widgets/layoutinfo.c +++ b/widgets/layoutinfo.c @@ -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, diff --git a/widgets/tasklist.c b/widgets/tasklist.c index ebcf9174b..218000808 100644 --- a/widgets/tasklist.c +++ b/widgets/tasklist.c @@ -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;