This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository e16.

View the commit online.

commit dccc8cb55b6b83bfd42436dc1b2f3e5f6c85424f
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Mon Oct 23 17:41:06 2023 +0200

    config: Introduce method to invalidate theme cache
    
    This will cause the theme configuration to be re-parsed on the next run
    and whenever E_CFG_VER_CACHE is changed.
---
 src/E.h      | 5 ++++-
 src/config.c | 9 ++++++++-
 src/theme.c  | 3 ++-
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/E.h b/src/E.h
index 90722ae3..3803e21e 100644
--- a/src/E.h
+++ b/src/E.h
@@ -3,7 +3,7 @@
 /*****************************************************************************/
 /*
  * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
- * Copyright (C) 2004-2022 Kim Woelders
+ * Copyright (C) 2004-2023 Kim Woelders
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
@@ -33,6 +33,7 @@
 #include "util.h"
 #include "xtypes.h"
 
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
@@ -283,6 +284,7 @@ typedef struct {
       char                animate;
    } startup;
    struct {
+      int                 cache_ver;
       char                use_theme_font_cfg;
       char                use_alt_font_cfg;
       char               *name;
@@ -399,6 +401,7 @@ typedef struct {
       char                ext_pmap_valid;
    } root;
    struct {
+      bool                cache_rebuild;
       char               *paths;
       char               *path;
       char               *variant;
diff --git a/src/config.c b/src/config.c
index f4fc45f3..2194c0d8 100644
--- a/src/config.c
+++ b/src/config.c
@@ -38,6 +38,7 @@
 #include "windowmatch.h"
 
 #define E_CFG_VER_MAX     2	/* Max. supported theme config version */
+#define E_CFG_VER_CACHE   1	/* Cache version (bump to invalidate cache) */
 
 void
 SkipTillEnd(FILE * fs)
@@ -529,7 +530,7 @@ ConfigFileFind(const char *name, const char *themepath, int pp)
    Esnprintf(s, sizeof(s), "%s/cached/cfg/%s.preparsed", EDirUserCache(), file);
 
    ppfile = Estrdup(s);
-   if (exists(s) && moddate(s) > moddate(fullname))
+   if (!Mode.theme.cache_rebuild && exists(s) && moddate(s) > moddate(fullname))
       goto done;
 
    /* No preparesd file or source is newer. Do preparsing. */
@@ -593,6 +594,12 @@ ThemeConfigLoad(void)
    Progressbar        *p = NULL;
    unsigned int        i, delay_ms;
 
+   if (Conf.theme.cache_ver != E_CFG_VER_CACHE)
+     {
+	Mode.theme.cache_rebuild = true;
+	Conf.theme.cache_ver = E_CFG_VER_CACHE;
+     }
+
    /* Font mappings */
    FontConfigLoad();
 
diff --git a/src/theme.c b/src/theme.c
index c5f8205f..8b976adb 100644
--- a/src/theme.c
+++ b/src/theme.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
- * Copyright (C) 2004-2021 Kim Woelders
+ * Copyright (C) 2004-2023 Kim Woelders
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
@@ -509,6 +509,7 @@ static const IpcItem ThemeIpcArray[] = {
 };
 
 static const CfgItem ThemeCfgItems[] = {
+   CFG_ITEM_INT(Conf.theme, cache_ver, 0),
    CFG_ITEM_STR(Conf.theme, name),
    CFG_ITEM_STR(Conf.theme, extra_path),
    CFG_ITEM_BOOL(Conf.theme, use_theme_font_cfg, 0),

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to