icon-loader: support xpm icons

This commit is contained in:
Johan Malm 2024-09-29 13:33:01 +01:00
parent 3394f191a4
commit e1c85f0ef5
5 changed files with 1986 additions and 2 deletions

14
include/img/img-xpm.h Normal file
View file

@ -0,0 +1,14 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_IMG_XPM_H
#define LABWC_IMG_XPM_H
struct lab_data_buffer;
/**
* img_xpm_load() - Convert xpm file to buffer with cairo surface
* @filename: xpm file
* @buffer: cairo-surface-buffer to create
*/
void img_xpm_load(const char *filename, struct lab_data_buffer **buffer);
#endif /* LABWC_IMG_XPM_H */

View file

@ -1,6 +1,6 @@
#!/bin/sh
banned="malloc,g_strcmp0,sprintf,vsprintf,strcpy,strncpy,strcat,strncat,atof"
banned="malloc,g_strcmp0,sprintf,vsprintf,strcat,atof"
echo "Searching for banned functions"
find src/ include/ \( -name "*.c" -o -name "*.h" \) -type f \

View file

@ -8,6 +8,7 @@
#include "config.h"
#include "icon-loader.h"
#include "img/img-png.h"
#include "img/img-xpm.h"
#if HAVE_RSVG
#include "img/img-svg.h"
@ -179,7 +180,7 @@ icon_loader_lookup(struct server *server, const char *app_id, int size, int scal
#endif
break;
case SFDO_ICON_FILE_FORMAT_XPM:
/* XPM is not supported */
img_xpm_load(ctx.path, &icon_buffer);
break;
}

1968
src/img/img-xpm.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,7 @@
labwc_sources += files(
'img-png.c',
'img-xbm.c',
'img-xpm.c',
)
if have_rsvg