diff --git a/libs/argv.c b/libs/argv.c index e2f3bf7..f021c5f 100644 --- a/libs/argv.c +++ b/libs/argv.c @@ -1,4 +1,9 @@ /* See LICENSE file for copyright and license details. */ + +static void readargs(int argc, char *argv[]); +static void usage(int status); +static void comp_opts(void); + void readargs(int argc, char *argv[]) { int i = 0; int j = 0; diff --git a/libs/argv.h b/libs/argv.h deleted file mode 100644 index 306182b..0000000 --- a/libs/argv.h +++ /dev/null @@ -1,4 +0,0 @@ -/* See LICENSE file for copyright and license details. */ -static void readargs(int argc, char *argv[]); -static void usage(int status); -static void comp_opts(void); diff --git a/libs/colors.h b/libs/colors.h deleted file mode 100644 index 2c59460..0000000 --- a/libs/colors.h +++ /dev/null @@ -1,262 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -// sgr color array, first 16 colors are defined in the config, the rest are 256 colors -static char *textcolors[] = { - col_sgr0, - col_sgr1, - col_sgr2, - col_sgr3, - col_sgr4, - col_sgr5, - col_sgr6, - col_sgr7, - col_sgr8, - col_sgr9, - col_sgr10, - col_sgr11, - col_sgr12, - col_sgr13, - col_sgr14, - col_sgr15, - "#00005f", - "#000087", - "#0000af", - "#0000d7", - "#0000ff", - "#005f00", - "#005f5f", - "#005f87", - "#005faf", - "#005fd7", - "#005fff", - "#008700", - "#00875f", - "#008787", - "#0087af", - "#0087d7", - "#0087ff", - "#00af00", - "#00af5f", - "#00af87", - "#00afaf", - "#00afd7", - "#00afff", - "#00d700", - "#00d75f", - "#00d787", - "#00d7af", - "#00d7d7", - "#00d7ff", - "#00ff00", - "#00ff5f", - "#00ff87", - "#00ffaf", - "#00ffd7", - "#00ffff", - "#5f0000", - "#5f005f", - "#5f0087", - "#5f00af", - "#5f00d7", - "#5f00ff", - "#5f5f00", - "#5f5f5f", - "#5f5f87", - "#5f5faf", - "#5f5fd7", - "#5f5fff", - "#5f8700", - "#5f875f", - "#5f8787", - "#5f87af", - "#5f87d7", - "#5f87ff", - "#5faf00", - "#5faf5f", - "#5faf87", - "#5fafaf", - "#5fafd7", - "#5fafff", - "#5fd700", - "#5fd75f", - "#5fd787", - "#5fd7af", - "#5fd7d7", - "#5fd7ff", - "#5fff00", - "#5fff5f", - "#5fff87", - "#5fffaf", - "#5fffd7", - "#5fffff", - "#870000", - "#87005f", - "#870087", - "#8700af", - "#8700d7", - "#8700ff", - "#875f00", - "#875f5f", - "#875f87", - "#875faf", - "#875fd7", - "#875fff", - "#878700", - "#87875f", - "#878787", - "#8787af", - "#8787d7", - "#8787ff", - "#87af00", - "#87af5f", - "#87af87", - "#87afaf", - "#87afd7", - "#87afff", - "#87d700", - "#87d75f", - "#87d787", - "#87d7af", - "#87d7d7", - "#87d7ff", - "#87ff00", - "#87ff5f", - "#87ff87", - "#87ffaf", - "#87ffd7", - "#87ffff", - "#af0000", - "#af005f", - "#af0087", - "#af00af", - "#af00d7", - "#af00ff", - "#af5f00", - "#af5f5f", - "#af5f87", - "#af5faf", - "#af5fd7", - "#af5fff", - "#af8700", - "#af875f", - "#af8787", - "#af87af", - "#af87d7", - "#af87ff", - "#afaf00", - "#afaf5f", - "#afaf87", - "#afafaf", - "#afafd7", - "#afafff", - "#afd700", - "#afd75f", - "#afd787", - "#afd7af", - "#afd7d7", - "#afd7ff", - "#afff00", - "#afff5f", - "#afff87", - "#afffaf", - "#afffd7", - "#afffff", - "#d70000", - "#d7005f", - "#d70087", - "#d700af", - "#d700d7", - "#d700ff", - "#d75f00", - "#d75f5f", - "#d75f87", - "#d75faf", - "#d75fd7", - "#d75fff", - "#d78700", - "#d7875f", - "#d78787", - "#d787af", - "#d787d7", - "#d787ff", - "#d7af00", - "#d7af5f", - "#d7af87", - "#d7afaf", - "#d7afd7", - "#d7afff", - "#d7d700", - "#d7d75f", - "#d7d787", - "#d7d7af", - "#d7d7d7", - "#d7d7ff", - "#d7ff00", - "#d7ff5f", - "#d7ff87", - "#d7ffaf", - "#d7ffd7", - "#d7ffff", - "#ff0000", - "#ff005f", - "#ff0087", - "#ff00af", - "#ff00d7", - "#ff00ff", - "#ff5f00", - "#ff5f5f", - "#ff5f87", - "#ff5faf", - "#ff5fd7", - "#ff5fff", - "#ff8700", - "#ff875f", - "#ff8787", - "#ff87af", - "#ff87d7", - "#ff87ff", - "#ffaf00", - "#ffaf5f", - "#ffaf87", - "#ffafaf", - "#ffafd7", - "#ffafff", - "#ffd700", - "#ffd75f", - "#ffd787", - "#ffd7af", - "#ffd7d7", - "#ffd7ff", - "#ffff00", - "#ffff5f", - "#ffff87", - "#ffffaf", - "#ffffd7", - "#ffffff", - "#080808", - "#121212", - "#1c1c1c", - "#262626", - "#303030", - "#3a3a3a", - "#444444", - "#4e4e4e", - "#585858", - "#626262", - "#6c6c6c", - "#767676", - "#808080", - "#8a8a8a", - "#949494", - "#9e9e9e", - "#a8a8a8", - "#b2b2b2", - "#bcbcbc", - "#c6c6c6", - "#d0d0d0", - "#dadada", - "#e4e4e4", - "#eeeeee", -}; - -static char *txtcols[256]; diff --git a/libs/conf/config.c b/libs/conf/config.c index 5f6a48a..eb2cc10 100644 --- a/libs/conf/config.c +++ b/libs/conf/config.c @@ -1,5 +1,7 @@ /* See LICENSE file for copyright and license details. */ +#if USECONFIG #include +#include "config.h" int bind_init(void) { char *xdg_conf; @@ -1519,3 +1521,4 @@ void theme_load(void) { config_destroy(&cfg); return; } +#endif diff --git a/libs/conf/config.h b/libs/conf/config.h index 5bedf5f..b7d60d2 100644 --- a/libs/conf/config.h +++ b/libs/conf/config.h @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ - +#if USECONFIG #if USEX typedef struct { char *key; @@ -703,3 +703,4 @@ static ClickType ctp[] = { static void conf_init(void); static void theme_load(void); static int bind_init(void); +#endif diff --git a/libs/icon.c b/libs/icon.c index 81790fb..d93625b 100644 --- a/libs/icon.c +++ b/libs/icon.c @@ -1,6 +1,8 @@ /* See LICENSE file for copyright and license details. */ #if USEIMAGE +static int draw_icon(struct item *item, int x, int y, int w, int h); + int draw_icon(struct item *item, int x, int y, int w, int h) { int ich = 0; int icw = 0; diff --git a/libs/icon.h b/libs/icon.h deleted file mode 100644 index 6c79f9d..0000000 --- a/libs/icon.h +++ /dev/null @@ -1,5 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -#if USEIMAGE -static int draw_icon(struct item *item, int x, int y, int w, int h); -#endif diff --git a/libs/img.c b/libs/img.c index a3a5d52..a12be3f 100644 --- a/libs/img.c +++ b/libs/img.c @@ -1,6 +1,30 @@ /* See LICENSE file for copyright and license details. */ #if USEIMAGE + +#include +#include +#include +#include + +static void setimagesize(int width, int height); +static void setimageopts(void); +static void cleanupimage(void); +static void drawimage(void); +static void flipimage(void); +static void loadimage(const char *file, int *width, int *height); +static void loadimagecache(const char *file, int *width, int *height); +static void resizetoimageheight(int imageheight); +static void store_image_vars(void); +#if USEWAYLAND +static void resizetoimageheight_wl(int imageheight); +#endif +#if USEX +static void resizetoimageheight_x11(int imageheight); +#endif + +static Imlib_Image image = NULL; + void setimagesize(int width, int height) { if (!image || hideimage || height < 5 || width < 5 || width > sp.mw - sp.bh) { return; diff --git a/libs/img.h b/libs/img.h deleted file mode 100644 index d1f89eb..0000000 --- a/libs/img.h +++ /dev/null @@ -1,26 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -#if USEIMAGE -#include -#include -#include -#include - -static void setimagesize(int width, int height); -static void setimageopts(void); -static void cleanupimage(void); -static void drawimage(void); -static void flipimage(void); -static void loadimage(const char *file, int *width, int *height); -static void loadimagecache(const char *file, int *width, int *height); -static void resizetoimageheight(int imageheight); -#if USEWAYLAND -static void resizetoimageheight_wl(int imageheight); -#endif -#if USEX -static void resizetoimageheight_x11(int imageheight); -#endif -static void store_image_vars(void); - -static Imlib_Image image = NULL; -#endif diff --git a/libs/match.c b/libs/match.c index dcae623..27f0f2e 100644 --- a/libs/match.c +++ b/libs/match.c @@ -1,9 +1,15 @@ /* See LICENSE file for copyright and license details. */ #if USEREGEX +#include "regex/regex.h" #include "regex/regex.c" #endif +static void fuzzymatch(void); +static void match(void); +static int matchregex(const char *t, const char *itt); +static int compare_distance(const void *a, const void *b); + int matchregex(const char *t, const char *itt) { #if USEREGEX re_t reg = re_compile(t); diff --git a/libs/match.h b/libs/match.h deleted file mode 100644 index a42305f..0000000 --- a/libs/match.h +++ /dev/null @@ -1,10 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -#if USEREGEX -#include "regex/regex.h" -#endif - -static void fuzzymatch(void); -static void match(void); -static int matchregex(const char *t, const char *itt); -static int compare_distance(const void *a, const void *b); diff --git a/libs/rtl.c b/libs/rtl.c index e2b34cb..ccb3021 100644 --- a/libs/rtl.c +++ b/libs/rtl.c @@ -1,5 +1,8 @@ /* See LICENSE file for copyright and license details. */ +static char fribidi_text[BUFSIZ] = ""; +static void apply_fribidi(char *str); + #if USERTL void apply_fribidi(char *str) { FriBidiStrIndex len = strlen(str); diff --git a/libs/rtl.h b/libs/rtl.h deleted file mode 100644 index 2f76a8c..0000000 --- a/libs/rtl.h +++ /dev/null @@ -1,4 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -static char fribidi_text[BUFSIZ] = ""; -static void apply_fribidi(char *str); diff --git a/libs/schemes.c b/libs/schemes.c index 5201523..4ddd036 100644 --- a/libs/schemes.c +++ b/libs/schemes.c @@ -1,5 +1,7 @@ /* See LICENSE file for copyright and license details. */ +#include "schemes.h" + char sixd_to_8bit(int x) { return x == 0 ? 0 : 0x37 + 0x28 * x; } diff --git a/libs/schemes.h b/libs/schemes.h index 2451a7a..2d2203c 100644 --- a/libs/schemes.h +++ b/libs/schemes.h @@ -1,3 +1,262 @@ /* See LICENSE file for copyright and license details. */ +static char *textcolors[] = { + col_sgr0, + col_sgr1, + col_sgr2, + col_sgr3, + col_sgr4, + col_sgr5, + col_sgr6, + col_sgr7, + col_sgr8, + col_sgr9, + col_sgr10, + col_sgr11, + col_sgr12, + col_sgr13, + col_sgr14, + col_sgr15, + "#00005f", + "#000087", + "#0000af", + "#0000d7", + "#0000ff", + "#005f00", + "#005f5f", + "#005f87", + "#005faf", + "#005fd7", + "#005fff", + "#008700", + "#00875f", + "#008787", + "#0087af", + "#0087d7", + "#0087ff", + "#00af00", + "#00af5f", + "#00af87", + "#00afaf", + "#00afd7", + "#00afff", + "#00d700", + "#00d75f", + "#00d787", + "#00d7af", + "#00d7d7", + "#00d7ff", + "#00ff00", + "#00ff5f", + "#00ff87", + "#00ffaf", + "#00ffd7", + "#00ffff", + "#5f0000", + "#5f005f", + "#5f0087", + "#5f00af", + "#5f00d7", + "#5f00ff", + "#5f5f00", + "#5f5f5f", + "#5f5f87", + "#5f5faf", + "#5f5fd7", + "#5f5fff", + "#5f8700", + "#5f875f", + "#5f8787", + "#5f87af", + "#5f87d7", + "#5f87ff", + "#5faf00", + "#5faf5f", + "#5faf87", + "#5fafaf", + "#5fafd7", + "#5fafff", + "#5fd700", + "#5fd75f", + "#5fd787", + "#5fd7af", + "#5fd7d7", + "#5fd7ff", + "#5fff00", + "#5fff5f", + "#5fff87", + "#5fffaf", + "#5fffd7", + "#5fffff", + "#870000", + "#87005f", + "#870087", + "#8700af", + "#8700d7", + "#8700ff", + "#875f00", + "#875f5f", + "#875f87", + "#875faf", + "#875fd7", + "#875fff", + "#878700", + "#87875f", + "#878787", + "#8787af", + "#8787d7", + "#8787ff", + "#87af00", + "#87af5f", + "#87af87", + "#87afaf", + "#87afd7", + "#87afff", + "#87d700", + "#87d75f", + "#87d787", + "#87d7af", + "#87d7d7", + "#87d7ff", + "#87ff00", + "#87ff5f", + "#87ff87", + "#87ffaf", + "#87ffd7", + "#87ffff", + "#af0000", + "#af005f", + "#af0087", + "#af00af", + "#af00d7", + "#af00ff", + "#af5f00", + "#af5f5f", + "#af5f87", + "#af5faf", + "#af5fd7", + "#af5fff", + "#af8700", + "#af875f", + "#af8787", + "#af87af", + "#af87d7", + "#af87ff", + "#afaf00", + "#afaf5f", + "#afaf87", + "#afafaf", + "#afafd7", + "#afafff", + "#afd700", + "#afd75f", + "#afd787", + "#afd7af", + "#afd7d7", + "#afd7ff", + "#afff00", + "#afff5f", + "#afff87", + "#afffaf", + "#afffd7", + "#afffff", + "#d70000", + "#d7005f", + "#d70087", + "#d700af", + "#d700d7", + "#d700ff", + "#d75f00", + "#d75f5f", + "#d75f87", + "#d75faf", + "#d75fd7", + "#d75fff", + "#d78700", + "#d7875f", + "#d78787", + "#d787af", + "#d787d7", + "#d787ff", + "#d7af00", + "#d7af5f", + "#d7af87", + "#d7afaf", + "#d7afd7", + "#d7afff", + "#d7d700", + "#d7d75f", + "#d7d787", + "#d7d7af", + "#d7d7d7", + "#d7d7ff", + "#d7ff00", + "#d7ff5f", + "#d7ff87", + "#d7ffaf", + "#d7ffd7", + "#d7ffff", + "#ff0000", + "#ff005f", + "#ff0087", + "#ff00af", + "#ff00d7", + "#ff00ff", + "#ff5f00", + "#ff5f5f", + "#ff5f87", + "#ff5faf", + "#ff5fd7", + "#ff5fff", + "#ff8700", + "#ff875f", + "#ff8787", + "#ff87af", + "#ff87d7", + "#ff87ff", + "#ffaf00", + "#ffaf5f", + "#ffaf87", + "#ffafaf", + "#ffafd7", + "#ffafff", + "#ffd700", + "#ffd75f", + "#ffd787", + "#ffd7af", + "#ffd7d7", + "#ffd7ff", + "#ffff00", + "#ffff5f", + "#ffff87", + "#ffffaf", + "#ffffd7", + "#ffffff", + "#080808", + "#121212", + "#1c1c1c", + "#262626", + "#303030", + "#3a3a3a", + "#444444", + "#4e4e4e", + "#585858", + "#626262", + "#6c6c6c", + "#767676", + "#808080", + "#8a8a8a", + "#949494", + "#9e9e9e", + "#a8a8a8", + "#b2b2b2", + "#bcbcbc", + "#c6c6c6", + "#d0d0d0", + "#dadada", + "#e4e4e4", + "#eeeeee", +}; + +static char *txtcols[256]; static void init_appearance(void); diff --git a/libs/x11/def.h b/libs/x11/def.h deleted file mode 100644 index c6c34c7..0000000 --- a/libs/x11/def.h +++ /dev/null @@ -1,4 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -#define CLEANMASK(mask) (mask & ~(x11.numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) -#define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) diff --git a/libs/x11/inc.h b/libs/x11/inc.h index d182c6a..5c0e136 100644 --- a/libs/x11/inc.h +++ b/libs/x11/inc.h @@ -2,7 +2,6 @@ #if USEX #include "lib.h" -#include "def.h" #include "init.h" #include "event.h" #include "xrdb.h" diff --git a/libs/x11/init.h b/libs/x11/init.h index c8dbf52..7372cb1 100644 --- a/libs/x11/init.h +++ b/libs/x11/init.h @@ -1,5 +1,8 @@ /* See LICENSE file for copyright and license details. */ +#define CLEANMASK(mask) (mask & ~(x11.numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) +#define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) + static Atom clip, utf8, types, dock; static Display *dpy; static Window root, parentwin, win; diff --git a/spmenu.c b/spmenu.c index d88b6b0..a563b33 100644 --- a/spmenu.c +++ b/spmenu.c @@ -213,7 +213,6 @@ static struct item *mouseitem; // clicked item #include "libs/main.h" #include "libs/draw.h" #include "libs/stream.h" -#include "libs/schemes.h" #include "libs/arg.h" #include "libs/x11/inc.h" #include "libs/wl/inc.h" @@ -350,28 +349,15 @@ static WlMouse wl_buttons[] = { }; #endif -// color array -#include "libs/colors.h" - -// config file -#if USECONFIG -#include "libs/conf/config.h" -#include "libs/conf/config.c" -#endif - // include functions -#include "libs/img.h" #include "libs/img.c" -#include "libs/icon.h" #include "libs/icon.c" -#include "libs/rtl.h" #include "libs/rtl.c" #include "libs/sort.c" -#include "libs/match.h" #include "libs/match.c" -#include "libs/draw.c" #include "libs/schemes.c" -#include "libs/argv.h" +#include "libs/draw.c" +#include "libs/conf/config.c" #include "libs/argv.c" #include "libs/history.c" #include "libs/arg.c"