mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
Remove tools/ and tests/
This commit is contained in:
parent
adf0f70a04
commit
83f0ddc67b
34 changed files with 0 additions and 681 deletions
|
|
@ -54,7 +54,6 @@ labwc_deps = [
|
||||||
]
|
]
|
||||||
|
|
||||||
subdir('src')
|
subdir('src')
|
||||||
subdir('tests')
|
|
||||||
subdir('docs')
|
subdir('docs')
|
||||||
|
|
||||||
executable(
|
executable(
|
||||||
|
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
rcxml_lib = static_library(
|
|
||||||
'rcxml',
|
|
||||||
sources: files(
|
|
||||||
'../src/config/rcxml.c',
|
|
||||||
'../src/config/keybind.c',
|
|
||||||
'../src/common/dir.c',
|
|
||||||
'../src/common/buf.c',
|
|
||||||
'../src/common/font.c',
|
|
||||||
'../src/common/log.c',
|
|
||||||
),
|
|
||||||
dependencies: labwc_deps,
|
|
||||||
include_directories: [labwc_inc],
|
|
||||||
)
|
|
||||||
|
|
||||||
rcxml_tests = [
|
|
||||||
't1000-rcxml-simple-parse.c',
|
|
||||||
't1001-rcxml-nodenames-simple.c',
|
|
||||||
]
|
|
||||||
|
|
||||||
foreach t : rcxml_tests
|
|
||||||
testname = t.split('.')[0].underscorify()
|
|
||||||
exe = executable(
|
|
||||||
testname,
|
|
||||||
sources: [t, 'tap.c'],
|
|
||||||
dependencies: [wlroots, cairo, pangocairo],
|
|
||||||
include_directories: [labwc_inc],
|
|
||||||
link_with: [rcxml_lib],
|
|
||||||
)
|
|
||||||
test(testname, exe)
|
|
||||||
endforeach
|
|
||||||
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <cairo.h>
|
|
||||||
#include <pango/pangocairo.h>
|
|
||||||
|
|
||||||
#include "config/rcxml.h"
|
|
||||||
#include "tap.h"
|
|
||||||
|
|
||||||
struct rcxml rc = { 0 };
|
|
||||||
|
|
||||||
static char src[] =
|
|
||||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
|
||||||
"<openbox_config>\n"
|
|
||||||
"<lab>\n"
|
|
||||||
" <csd>yes</csd>\n"
|
|
||||||
"</lab>\n"
|
|
||||||
"</openbox_config>\n";
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
plan(1);
|
|
||||||
|
|
||||||
char template[] = "temp_file_XXXXXX";
|
|
||||||
int fd = mkstemp(template);
|
|
||||||
if (fd < 0)
|
|
||||||
exit(1);
|
|
||||||
write(fd, src, sizeof(src) - 1);
|
|
||||||
|
|
||||||
rcxml_read(template);
|
|
||||||
unlink(template);
|
|
||||||
|
|
||||||
diag("Simple parse rc.xml");
|
|
||||||
ok1(rc.xdg_shell_server_side_deco);
|
|
||||||
|
|
||||||
rcxml_finish();
|
|
||||||
pango_cairo_font_map_set_default(NULL);
|
|
||||||
return exit_status();
|
|
||||||
}
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <cairo.h>
|
|
||||||
#include <pango/pangocairo.h>
|
|
||||||
|
|
||||||
#include "config/rcxml.h"
|
|
||||||
#include "tap.h"
|
|
||||||
|
|
||||||
struct rcxml rc = { 0 };
|
|
||||||
|
|
||||||
static char src[] =
|
|
||||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
|
||||||
"<openbox_config>\n"
|
|
||||||
"<lab>\n"
|
|
||||||
" <csd>yes</csd>\n"
|
|
||||||
"</lab>\n"
|
|
||||||
"</openbox_config>\n";
|
|
||||||
|
|
||||||
static char expect[] =
|
|
||||||
"openbox_config\n"
|
|
||||||
"lab\n"
|
|
||||||
"csd.lab\n"
|
|
||||||
"csd.lab: yes\n";
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
struct buf actual, source;
|
|
||||||
|
|
||||||
buf_init(&actual);
|
|
||||||
buf_init(&source);
|
|
||||||
buf_add(&source, src);
|
|
||||||
|
|
||||||
plan(1);
|
|
||||||
diag("Parse simple rc.xml and read nodenames");
|
|
||||||
|
|
||||||
rcxml_get_nodenames(&actual);
|
|
||||||
rcxml_parse_xml(&source);
|
|
||||||
printf("%s\n", actual.buf);
|
|
||||||
printf("%s\n", expect);
|
|
||||||
|
|
||||||
ok1(!strcmp(expect, actual.buf));
|
|
||||||
free(actual.buf);
|
|
||||||
free(source.buf);
|
|
||||||
pango_cairo_font_map_set_default(NULL);
|
|
||||||
return exit_status();
|
|
||||||
}
|
|
||||||
73
tests/tap.c
73
tests/tap.c
|
|
@ -1,73 +0,0 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include "tap.h"
|
|
||||||
|
|
||||||
static int nr_tests_run;
|
|
||||||
static int nr_tests_expected;
|
|
||||||
static int nr_tests_failed;
|
|
||||||
|
|
||||||
void plan(int nr_tests)
|
|
||||||
{
|
|
||||||
static bool run_once;
|
|
||||||
|
|
||||||
if (run_once)
|
|
||||||
return;
|
|
||||||
run_once = true;
|
|
||||||
printf("1..%d\n", nr_tests);
|
|
||||||
nr_tests_expected = nr_tests;
|
|
||||||
}
|
|
||||||
|
|
||||||
void diag(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list params;
|
|
||||||
|
|
||||||
fprintf(stdout, "# ");
|
|
||||||
va_start(params, fmt);
|
|
||||||
vfprintf(stdout, fmt, params);
|
|
||||||
va_end(params);
|
|
||||||
fprintf(stdout, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
int ok(int result, const char *testname, ...)
|
|
||||||
{
|
|
||||||
va_list params;
|
|
||||||
|
|
||||||
++nr_tests_run;
|
|
||||||
if (!result) {
|
|
||||||
printf("not ");
|
|
||||||
nr_tests_failed++;
|
|
||||||
}
|
|
||||||
printf("ok %d", nr_tests_run);
|
|
||||||
if (testname) {
|
|
||||||
printf(" - ");
|
|
||||||
va_start(params, testname);
|
|
||||||
vfprintf(stdout, testname, params);
|
|
||||||
va_end(params);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
if (!result)
|
|
||||||
diag(" Failed test");
|
|
||||||
return result ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int exit_status(void)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (nr_tests_expected != nr_tests_run) {
|
|
||||||
diag("expected=%d; run=%d; failed=%d", nr_tests_expected,
|
|
||||||
nr_tests_run, nr_tests_failed);
|
|
||||||
}
|
|
||||||
if (nr_tests_expected < nr_tests_run)
|
|
||||||
ret = nr_tests_run - nr_tests_expected;
|
|
||||||
else
|
|
||||||
ret = nr_tests_failed + nr_tests_expected - nr_tests_run;
|
|
||||||
if (ret > 255)
|
|
||||||
ret = 255;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
17
tests/tap.h
17
tests/tap.h
|
|
@ -1,17 +0,0 @@
|
||||||
/*
|
|
||||||
* Minimalist, partial TAP implementation
|
|
||||||
*
|
|
||||||
* Copyright Johan Malm 2020
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef TAP_H
|
|
||||||
#define TAP_H
|
|
||||||
|
|
||||||
#define ok1(__x__) (ok(__x__, "%s", #__x__))
|
|
||||||
|
|
||||||
void plan(int nr_tests);
|
|
||||||
void diag(const char *fmt, ...);
|
|
||||||
int ok(int result, const char *test_name, ...);
|
|
||||||
int exit_status(void);
|
|
||||||
|
|
||||||
#endif /* TAP_H */
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
leak:libxcb*
|
|
||||||
59
tools/build
59
tools/build
|
|
@ -1,59 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# Automatically build labwc
|
|
||||||
#
|
|
||||||
|
|
||||||
builddir=build
|
|
||||||
g_asan=
|
|
||||||
g_wlroots=
|
|
||||||
|
|
||||||
die () { printf '\033[31mfatal:\033[m %b\n' "$@" >&2 ; exit 1 ; }
|
|
||||||
warn () { printf '\033[31mwarn:\033[m %b\n' "$@" >&2 ; }
|
|
||||||
say () { printf '\033[32m%s\033[m' "$@" ; }
|
|
||||||
|
|
||||||
usage () {
|
|
||||||
printf "%s\n" \
|
|
||||||
"Usage: ./tools/build [<options>]
|
|
||||||
Options:
|
|
||||||
-w install wlroots as subproject
|
|
||||||
--asan run with ASAN and UBSAN
|
|
||||||
--clang run with clang
|
|
||||||
-h, --help show help"
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
wlroots_subproject () {
|
|
||||||
if ! [ -e subprojects/wlroots ]; then
|
|
||||||
git clone https://github.com/swaywm/wlroots subprojects/wlroots
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main () {
|
|
||||||
[[ -e src/main.c ]] || die "must be run from top-level directory"
|
|
||||||
|
|
||||||
for arg
|
|
||||||
do
|
|
||||||
opt=${arg%%=*}
|
|
||||||
var=${arg#*=}
|
|
||||||
case "$opt" in
|
|
||||||
-w)
|
|
||||||
wlroots_subproject
|
|
||||||
g_wlroots="-Dwlroots:default_library=static"
|
|
||||||
;;
|
|
||||||
--asan)
|
|
||||||
g_asan="-Db_sanitize=address,undefined" ;;
|
|
||||||
--clang)
|
|
||||||
export CC=clang
|
|
||||||
;;
|
|
||||||
-h|--help)
|
|
||||||
usage ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
[ -e ${builddir} ] && die "build directory already exists - delete and run again"
|
|
||||||
meson ${g_asan} ${g_wlroots} ${builddir}
|
|
||||||
ninja -C ${builddir}
|
|
||||||
LSAN_OPTIONS=suppressions=../tools/asan_suppressions.txt ninja -C ${builddir} test
|
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
13
tools/check
13
tools/check
|
|
@ -1,13 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
options="\
|
|
||||||
--enable=all \
|
|
||||||
--suppress=missingInclude \
|
|
||||||
--suppress=unusedFunction \
|
|
||||||
--suppress=unmatchedSuppression \
|
|
||||||
"
|
|
||||||
|
|
||||||
for f in $(find src/ -name "*.c"); do
|
|
||||||
cppcheck ${options} "${f}"
|
|
||||||
done
|
|
||||||
|
|
||||||
2
tools/dirs/.gitignore
vendored
2
tools/dirs/.gitignore
vendored
|
|
@ -1,2 +0,0 @@
|
||||||
*.o
|
|
||||||
dir-list
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
CFLAGS += -g -Wall -I../../include
|
|
||||||
CFLAGS += `pkg-config --cflags glib-2.0`
|
|
||||||
LDFLAGS += `pkg-config --libs glib-2.0`
|
|
||||||
|
|
||||||
all:
|
|
||||||
$(CC) $(CFLAGS) -o dir-list dir-list.c ../../src/common/dir.c ../../src/common/log.c $(LDFLAGS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.o dir-list
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "common/dir.h"
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
setenv("LABWC_DEBUG_DIR_CONFIG_AND_THEME", "1", 1);
|
|
||||||
setenv("XDG_CONFIG_HOME", "/a:/bbb:/ccccc:/etc/foo", 1);
|
|
||||||
printf("%s\n", config_dir());
|
|
||||||
printf("%s\n", theme_dir("Numix"));
|
|
||||||
}
|
|
||||||
2
tools/hex/.gitignore
vendored
2
tools/hex/.gitignore
vendored
|
|
@ -1,2 +0,0 @@
|
||||||
hex-color-average
|
|
||||||
hex-color-average.o
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
hex-color-average: hex-color-average.o
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f hex-color-average *.o
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
static int hexval(int c)
|
|
||||||
{
|
|
||||||
int ret = -1;
|
|
||||||
switch (c) {
|
|
||||||
case '0'...'9':
|
|
||||||
ret = c - '0';
|
|
||||||
break;
|
|
||||||
case 'a'...'f':
|
|
||||||
ret = c - 'a' + 10;
|
|
||||||
break;
|
|
||||||
case 'A'...'F':
|
|
||||||
ret = c - 'A' + 10;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int hex2dec(const char *hexstring)
|
|
||||||
{
|
|
||||||
int value = 0, pos = 0, hex;
|
|
||||||
while ((hex = hexval(hexstring[pos++])) != -1)
|
|
||||||
value = (value << 4) + hex;
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void usage(const char *command)
|
|
||||||
{
|
|
||||||
printf("Usage: %s <rrggbb> <rrggbb>\n", command);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
double col[6] = { 0 };
|
|
||||||
|
|
||||||
if (argc < 3)
|
|
||||||
usage(argv[0]);
|
|
||||||
|
|
||||||
for (int j = 1; j < argc; j++) {
|
|
||||||
int len = strlen(argv[j]);
|
|
||||||
for (int i = 0; i < len / 2; i++) {
|
|
||||||
char buf[3] = { 0 };
|
|
||||||
buf[0] = argv[j][i * 2];
|
|
||||||
buf[1] = argv[j][i * 2 + 1];
|
|
||||||
col[(j - 1) * 3 + i] = hex2dec(buf) / 255.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printf("[%s] { %.2f, %.2f, %.2f }\n", argv[1], col[0], col[1], col[2]);
|
|
||||||
printf("[%s] { %.2f, %.2f, %.2f }\n", argv[2], col[3], col[4], col[5]);
|
|
||||||
printf("[ mean ] { %.2f, %.2f, %.2f }\n",
|
|
||||||
(col[0] + col[3]) / 2.0,
|
|
||||||
(col[1] + col[4]) / 2.0,
|
|
||||||
(col[2] + col[5]) / 2.0);
|
|
||||||
printf("[ mean ] #%x%x%x\n",
|
|
||||||
(int)((col[0] + col[3]) / 2.0 * 255),
|
|
||||||
(int)((col[1] + col[4]) / 2.0 * 255),
|
|
||||||
(int)((col[2] + col[5]) / 2.0 * 255));
|
|
||||||
}
|
|
||||||
|
|
||||||
2
tools/pango/.gitignore
vendored
2
tools/pango/.gitignore
vendored
|
|
@ -1,2 +0,0 @@
|
||||||
*.o
|
|
||||||
font-height
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
CFLAGS += -g -Wall -O0 -std=c11
|
|
||||||
CFLAGS += `pkg-config cairo pango pangocairo --cflags`
|
|
||||||
CFLAGS += -I../../include
|
|
||||||
LIBS += `pkg-config cairo pango pangocairo --libs`
|
|
||||||
LDFLAGS += $(LIBS)
|
|
||||||
|
|
||||||
PROGS = font-height
|
|
||||||
|
|
||||||
all: $(PROGS)
|
|
||||||
|
|
||||||
font-height: font-height.c ../../src/common/font.c
|
|
||||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f $(PROGS) *.o
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "common/font.h"
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
if (argc < 2) {
|
|
||||||
printf("Usage: %s <font-description> (e.g. 'sans 10')\n", argv[0]);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
printf("height=%d\n", font_height(argv[1]));
|
|
||||||
}
|
|
||||||
1
tools/rcxml/.gitignore
vendored
1
tools/rcxml/.gitignore
vendored
|
|
@ -1 +0,0 @@
|
||||||
rcxml-print-nodenames
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
CFLAGS = -g -O0 -Wall -Wextra -std=c11 -pedantic `xml2-config --cflags`
|
|
||||||
CFLAGS += -Wno-unused-parameter
|
|
||||||
CFLAGS += -I../../include
|
|
||||||
CFLAGS += -DWLR_USE_UNSTABLE
|
|
||||||
ASAN_FLAGS = -O0 -fsanitize=address -fno-common -fno-omit-frame-pointer -rdynamic
|
|
||||||
CFLAGS += $(ASAN_FLAGS)
|
|
||||||
LDFLAGS += $(ASAN_FLAGS) -fuse-ld=gold
|
|
||||||
LDFLAGS += `xml2-config --libs`
|
|
||||||
LDFLAGS += `pkg-config --cflags --libs glib-2.0 cairo pangocairo wayland-server xkbcommon`
|
|
||||||
|
|
||||||
PROGS = rcxml-print-nodenames
|
|
||||||
SRC = \
|
|
||||||
rcxml-print-nodenames.c \
|
|
||||||
../../src/config/rcxml.c \
|
|
||||||
../../src/common/dir.c \
|
|
||||||
../../src/common/buf.c \
|
|
||||||
../../src/common/font.c \
|
|
||||||
../../src/common/log.c \
|
|
||||||
../../src/config/keybind.c
|
|
||||||
|
|
||||||
|
|
||||||
all: $(PROGS)
|
|
||||||
|
|
||||||
rcxml-print-nodenames: $(SRC)
|
|
||||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f $(PROGS)
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
Try
|
|
||||||
|
|
||||||
./rcxml-print-nodenames /etc/xdg/openbox/rc.xml
|
|
||||||
./rcxml-print-nodenames ../../data/rc.xml
|
|
||||||
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <cairo.h>
|
|
||||||
#include <pango/pangocairo.h>
|
|
||||||
|
|
||||||
#include "config/rcxml.h"
|
|
||||||
#include "common/buf.h"
|
|
||||||
#include "common/log.h"
|
|
||||||
|
|
||||||
struct rcxml rc = { 0 };
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
struct buf b;
|
|
||||||
|
|
||||||
if (argc != 2) {
|
|
||||||
fprintf(stderr, "usage: %s <rc.xml file>\n", argv[0]);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
buf_init(&b);
|
|
||||||
rcxml_get_nodenames(&b);
|
|
||||||
rcxml_read(argv[1]);
|
|
||||||
printf("%s", b.buf);
|
|
||||||
free(b.buf);
|
|
||||||
pango_cairo_font_map_set_default(NULL);
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
LSAN_OPTIONS=suppressions=tools/asan_suppressions.txt ./build/labwc
|
|
||||||
|
|
||||||
|
|
||||||
1
tools/theme/.gitignore
vendored
1
tools/theme/.gitignore
vendored
|
|
@ -1 +0,0 @@
|
||||||
theme-helper
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
CFLAGS = -g -Wall -Wextra -pedantic -std=c11
|
|
||||||
CFLAGS += -I../../include/
|
|
||||||
CFLAGS += `pkg-config --cflags glib-2.0`
|
|
||||||
ASAN_FLAGS = -O0 -fsanitize=address -fno-common -fno-omit-frame-pointer -rdynamic
|
|
||||||
CFLAGS += $(ASAN_FLAGS)
|
|
||||||
LDFLAGS += $(ASAN_FLAGS) -fuse-ld=gold
|
|
||||||
LDFLAGS += `pkg-config --cflags --libs glib-2.0 wlroots wayland-server`
|
|
||||||
LDFLAGS += -DWLR_USE_UNSTABLE
|
|
||||||
|
|
||||||
SRCS = \
|
|
||||||
theme-helper.c \
|
|
||||||
../../src/theme/theme.c \
|
|
||||||
../../src/common/dir.c \
|
|
||||||
../../src/common/log.c
|
|
||||||
|
|
||||||
all:
|
|
||||||
gcc $(CFLAGS) -o theme-helper $(SRCS) $(LDFLAGS)
|
|
||||||
|
|
||||||
|
|
||||||
test:
|
|
||||||
XDG_DATA_HOME=../../data ./theme-helper labwc-default
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f theme-helper *.o
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# List available openbox themes
|
|
||||||
#
|
|
||||||
|
|
||||||
printf '%b\n' "#icons\ttheme name"
|
|
||||||
printf '%b\n' "-------------------"
|
|
||||||
|
|
||||||
for d in $HOME/.themes/* /usr/share/themes/*; do
|
|
||||||
if [ -d "$d/openbox-3" ]; then
|
|
||||||
icon_count=0
|
|
||||||
for f in $d/openbox-3/*; do
|
|
||||||
case $f in
|
|
||||||
*xbm) : $(( icon_count++ )) ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
printf '%b\n' "$icon_count\t$(basename $d)"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "theme/theme.h"
|
|
||||||
|
|
||||||
struct theme theme = { 0 };
|
|
||||||
|
|
||||||
static void usage(const char *application)
|
|
||||||
{
|
|
||||||
printf("Usage: %s <theme-name>\n", application);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
if (argc < 2)
|
|
||||||
usage(argv[0]);
|
|
||||||
theme_read(argv[1]);
|
|
||||||
|
|
||||||
printf("window_active_title_bg_color = ");
|
|
||||||
for (int i=0; i < 4; i++)
|
|
||||||
printf("%.2f; ", theme.window_active_title_bg_color[i]);
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
3
tools/xbm/.gitignore
vendored
3
tools/xbm/.gitignore
vendored
|
|
@ -1,3 +0,0 @@
|
||||||
xbm-tokenize
|
|
||||||
xbm-parse
|
|
||||||
*.png
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
#define max_width 5
|
|
||||||
#define max_height 5
|
|
||||||
static unsigned char max_bits[] = {
|
|
||||||
0x1F, 0x1B, 0x15, 0x1B, 0x1F };
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
#define close_width 8
|
|
||||||
#define close_height 8
|
|
||||||
static unsigned char close_bits[] = {
|
|
||||||
0xFF, 0xC3, 0xA5, 0x99, 0x99, 0xA5, 0xC3, 0xFF };
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
#define x9_width 9
|
|
||||||
#define x9_height 9
|
|
||||||
static unsigned char x9_bits[] = {
|
|
||||||
0xFF, 0x01, 0x83, 0x01, 0x45, 0x01, 0x29, 0x01, 0x11, 0x01, 0x29, 0x01,
|
|
||||||
0x45, 0x01, 0x83, 0x01, 0xFF, 0x01 };
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
CFLAGS += -g -Wall -O0 -std=c11
|
|
||||||
CFLAGS += -I../../include
|
|
||||||
LDFLAGS += `pkg-config --cflags --libs cairo`
|
|
||||||
ASAN += -fsanitize=address
|
|
||||||
|
|
||||||
PROGS = xbm-tokenize xbm-parse
|
|
||||||
|
|
||||||
DEP_TOKENIZE = \
|
|
||||||
../../src/common/buf.c \
|
|
||||||
../../src/xbm/tokenize.c
|
|
||||||
|
|
||||||
DEP_PARSE = $(DEP_TOKENIZE) \
|
|
||||||
../../src/xbm/parse.c \
|
|
||||||
../../src/common/grab-file.c
|
|
||||||
|
|
||||||
all: $(PROGS)
|
|
||||||
|
|
||||||
xbm-tokenize: xbm-tokenize.c $(DEP_TOKENIZE)
|
|
||||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(ASAN)
|
|
||||||
|
|
||||||
xbm-parse: xbm-parse.c $(DEP_PARSE)
|
|
||||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(ASAN)
|
|
||||||
|
|
||||||
clean :
|
|
||||||
$(RM) $(PROGS)
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <cairo.h>
|
|
||||||
|
|
||||||
#include "xbm/parse.h"
|
|
||||||
#include "common/grab-file.h"
|
|
||||||
|
|
||||||
static float red[] = { 1.0, 0.0, 0.0, 1.0 };
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
struct token *tokens;
|
|
||||||
|
|
||||||
if (argc != 2) {
|
|
||||||
fprintf(stderr, "usage: %s <xbm-file>\n", argv[0]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *buffer = grab_file(argv[1]);
|
|
||||||
if (!buffer)
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
tokens = tokenize_xbm(buffer);
|
|
||||||
free(buffer);
|
|
||||||
parse_set_color(red);
|
|
||||||
struct pixmap pixmap = parse_xbm_tokens(tokens);
|
|
||||||
free(tokens);
|
|
||||||
|
|
||||||
cairo_surface_t *g_surface;
|
|
||||||
g_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
|
|
||||||
pixmap.width, pixmap.height);
|
|
||||||
if (!g_surface) {
|
|
||||||
fprintf(stderr, "no surface\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
unsigned char *surface_data = cairo_image_surface_get_data(g_surface);
|
|
||||||
cairo_surface_flush(g_surface);
|
|
||||||
memcpy(surface_data, pixmap.data, pixmap.width * pixmap.height * 4);
|
|
||||||
if (pixmap.data)
|
|
||||||
free(pixmap.data);
|
|
||||||
cairo_surface_mark_dirty(g_surface);
|
|
||||||
|
|
||||||
char png_name[1024];
|
|
||||||
snprintf(png_name, sizeof(png_name), "%s.png", argv[1]);
|
|
||||||
if (cairo_surface_write_to_png(g_surface, png_name)) {
|
|
||||||
fprintf(stderr, "cannot save png\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
cairo_surface_destroy(g_surface);
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "common/buf.h"
|
|
||||||
#include "xbm/tokenize.h"
|
|
||||||
|
|
||||||
/* Read file into buffer, because it's easier to tokenize that way */
|
|
||||||
char *read_file(const char *filename)
|
|
||||||
{
|
|
||||||
char *line = NULL;
|
|
||||||
size_t len = 0;
|
|
||||||
FILE *stream = fopen(filename, "r");
|
|
||||||
if (!stream) {
|
|
||||||
fprintf(stderr, "warn: cannot read '%s'\n", filename);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
struct buf buffer;
|
|
||||||
buf_init(&buffer);
|
|
||||||
while ((getline(&line, &len, stream) != -1)) {
|
|
||||||
char *p = strrchr(line, '\n');
|
|
||||||
if (p)
|
|
||||||
*p = '\0';
|
|
||||||
buf_add(&buffer, line);
|
|
||||||
}
|
|
||||||
free(line);
|
|
||||||
fclose(stream);
|
|
||||||
return (buffer.buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
struct token *tokens;
|
|
||||||
|
|
||||||
if (argc != 2) {
|
|
||||||
fprintf(stderr, "usage: %s <xbm-file>\n", argv[0]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *buffer = read_file(argv[1]);
|
|
||||||
if (!buffer)
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
tokens = tokenize_xbm(buffer);
|
|
||||||
free(buffer);
|
|
||||||
for (struct token *t = tokens; t->type; t++)
|
|
||||||
printf("%s\n", t->name);
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue