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

git pushed a commit to branch v-0.28
in repository enlightenment-mxd.

View the commit online.

commit bd045b39e779118b515b9ee2e47adc2566801a68
Author: Valera <[email protected]>
AuthorDate: Wed Dec 2 16:49:09 2026 +0000

    Загрузить файлы в «src/bin»
---
 src/bin/e_theme.c             | 271 ++++++++++++++++++++++++++++++++++++++++++
 src/bin/e_wallpaper_palette.h |  12 ++
 src/bin/e_watchdog.c          | 110 +++++++++++++++++
 3 files changed, 393 insertions(+)

diff --git a/src/bin/e_theme.c b/src/bin/e_theme.c
new file mode 100644
index 000000000..5d6a61716
--- /dev/null
+++ b/src/bin/e_theme.c
@@ -0,0 +1,271 @@
+#include "e.h"
+
+static void       e_theme_handler_set(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *path);
+static int        e_theme_handler_test(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *path);
+
+static E_Fm2_Mime_Handler *theme_hdl = NULL;
+
+/* externally accessible functions */
+
+EINTERN int
+e_theme_init(void)
+{
+   /* Register mime handler */
+   theme_hdl = e_fm2_mime_handler_new(_("Set As Theme"), "preferences-desktop-theme",
+                                      e_theme_handler_set, NULL,
+                                      e_theme_handler_test, NULL);
+   if (theme_hdl) e_fm2_mime_handler_glob_add(theme_hdl, "*.edj");
+   return 1;
+}
+
+EINTERN int
+e_theme_shutdown(void)
+{
+   if (theme_hdl)
+     {
+        e_fm2_mime_handler_glob_del(theme_hdl, "*.edj");
+        e_fm2_mime_handler_free(theme_hdl);
+     }
+   return 1;
+}
+
+E_API Eina_List *
+e_theme_collection_items_find(const char *base EINA_UNUSED, const char *collname)
+{
+   Eina_List *list, *list2 = NULL, *l;
+   const char *s, *s2;
+   size_t len = strlen(collname);
+
+   list = elm_theme_group_base_list(NULL, collname);
+   if (!list) return NULL;
+   EINA_LIST_FREE(list, s)
+     {
+        char *trans, *p, *p2;
+        size_t slen;
+
+        slen = strlen(s);
+        if (slen <= len) goto done;
+        trans = alloca(slen + 1);
+        if (!trans) goto done;
+        memcpy(trans, s, slen + 1);
+        p = trans + len;
+        if (*p != '/') goto done;
+        p++;
+        if (*p)
+          {
+             p2 = strchr(p, '/');
+             if (p2) *p2 = 0;
+             EINA_LIST_FOREACH(list2, l, s2)
+               {
+                  if (!strcmp(s2, p)) break;
+               }
+             if (!l) list2 = eina_list_append(list2, eina_stringshare_add(p));
+          }
+done:
+        eina_stringshare_del(s);
+     }
+   return list2;
+}
+
+E_API int
+e_theme_edje_object_set(Evas_Object *o, const char *category EINA_UNUSED, const char *group)
+{
+   const char *file;
+
+   /* v2.51: guard — don't pass NULL to edje_object_file_set (efl_file_simple_load) */
+   if (!o) return 0;
+
+   file = elm_theme_group_path_find(NULL, group);
+   if (!file) return 0;
+   edje_object_file_set(o, file, group);
+   return 1;
+}
+
+E_API const char *
+e_theme_edje_file_get(const char *category EINA_UNUSED, const char *group)
+{
+   const char *file = elm_theme_group_path_find(NULL, group);
+   if (!file) return "";
+   return file;
+}
+
+E_API const char *
+e_theme_edje_icon_fallback_file_get(const char *group)
+{
+   const char *file;
+
+   if ((e_config->icon_theme) && (!strncmp(group, "e/icons", 7))) return "";
+   file = elm_theme_group_path_find(NULL, group);
+   if (!file) return "";
+   return file;
+}
+
+E_API int
+e_theme_transition_find(const char *transition)
+{
+   Eina_List *trans = NULL;
+   int found = 0;
+   const char *str;
+
+   trans = e_theme_collection_items_find(NULL, "e/transitions");
+   if (eina_list_search_sorted(trans, EINA_COMPARE_CB(strcmp), transition))
+     found = 1;
+   EINA_LIST_FREE(trans, str) eina_stringshare_del(str);
+   return found;
+}
+
+E_API Eina_List *
+e_theme_transition_list(void)
+{
+   return e_theme_collection_items_find(NULL, "e/transitions");
+}
+
+E_API int
+e_theme_border_find(const char *border)
+{
+   Eina_List *bds = NULL;
+   int found = 0;
+   const char *str;
+
+   bds = e_theme_collection_items_find(NULL, "e/widgets/border");
+   if (eina_list_search_sorted(bds, EINA_COMPARE_CB(strcmp), border))
+     found = 1;
+   EINA_LIST_FREE(bds, str) eina_stringshare_del(str);
+   return found;
+}
+
+E_API Eina_List *
+e_theme_border_list(void)
+{
+   Eina_List *list, *l;
+   const char *s;
+
+   list = e_theme_collection_items_find(NULL, "e/widgets/border");
+   // XXX: a horrible hack due to history and bad group naming choices
+   // but filter out volume as a border because it is the volume gadget
+   // thing not a border
+   EINA_LIST_FOREACH(list, l, s)
+     {
+        if (!strcmp(s, "volume"))
+          {
+             list = eina_list_remove_list(list, l);
+             eina_stringshare_del(s);
+             break;
+          }
+     }
+   return list;
+}
+
+E_API int
+e_theme_shelf_find(const char *shelf)
+{
+   Eina_List *shelfs = NULL;
+   int found = 0;
+   const char *str;
+
+   shelfs = e_theme_collection_items_find(NULL, "e/shelf");
+   if (eina_list_search_sorted(shelfs, EINA_COMPARE_CB(strcmp), shelf))
+     found = 1;
+   EINA_LIST_FREE(shelfs, str) eina_stringshare_del(str);
+   return found;
+}
+
+E_API Eina_List *
+e_theme_shelf_list(void)
+{
+   return e_theme_collection_items_find(NULL, "e/shelf");
+}
+
+E_API int
+e_theme_comp_frame_find(const char *comp)
+{
+   Eina_List *comps = NULL;
+   int found = 0;
+   const char *str;
+
+   comps = e_theme_collection_items_find(NULL, "e/comp/frame");
+   if (eina_list_search_sorted(comps, EINA_COMPARE_CB(strcmp), comp))
+     found = 1;
+   EINA_LIST_FREE(comps, str) eina_stringshare_del(str);
+   return found;
+}
+
+E_API Eina_List *
+e_theme_comp_frame_list(void)
+{
+   return e_theme_collection_items_find(NULL, "e/comp/frame");
+}
+
+/* local subsystem functions */
+static void
+e_theme_handler_set(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *path)
+{
+   E_Action *a;
+   char buf[PATH_MAX];
+   int copy = 1;
+
+   if (!path) return;
+   /* if not in system dir or user dir, copy to user dir */
+   snprintf(buf, sizeof(buf), "%s", elm_theme_system_dir_get());
+   if (!strncmp(buf, path, strlen(buf))) copy = 0;
+   if (copy)
+     {
+        snprintf(buf, sizeof(buf), "%s", elm_theme_user_dir_get());
+        if (!strncmp(buf, path, strlen(buf))) copy = 0;
+     }
+   if (copy)
+     {
+        const char *file;
+        char *name;
+
+        file = ecore_file_file_get(path);
+        name = ecore_file_strip_ext(file);
+
+        if (name)
+          {
+             double tim = ecore_time_unix_get();
+
+             snprintf(buf, sizeof(buf), "%s/%s-%f.edj",
+                      elm_theme_user_dir_get(), name, tim);
+             if (!ecore_file_exists(buf))
+               {
+                  ecore_file_cp(path, buf);
+                  snprintf(buf, sizeof(buf), "%s-%f", name, tim);
+                  elm_theme_set(NULL, buf);
+               }
+             else
+               elm_theme_set(NULL, path);
+             elm_config_all_flush();
+             elm_config_save();
+             free(name);
+          }
+     }
+   else
+     {
+        const char *file;
+        char *name;
+
+        file = ecore_file_file_get(path);
+        name = ecore_file_strip_ext(file);
+        if (name)
+          {
+             elm_theme_set(NULL, name);
+             elm_config_all_flush();
+             elm_config_save();
+             free(name);
+          }
+     }
+
+   e_config_save_queue();
+   a = e_action_find("restart");
+   if ((a) && (a->func.go)) a->func.go(NULL, NULL);
+}
+
+static int
+e_theme_handler_test(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *path)
+{
+   if (!path) return 0;
+   if (!edje_file_group_exists(path, "e/widgets/border/default/border"))
+     return 0;
+   return 1;
+}
diff --git a/src/bin/e_wallpaper_palette.h b/src/bin/e_wallpaper_palette.h
new file mode 100644
index 000000000..1d78021c2
--- /dev/null
+++ b/src/bin/e_wallpaper_palette.h
@@ -0,0 +1,12 @@
+#ifdef E_TYPEDEFS
+#else
+#ifndef E_WALLPAPER_PALETTE_H
+#define E_WALLPAPER_PALETTE_H
+
+EINTERN int       e_wallpaper_palette_init(void);
+EINTERN int       e_wallpaper_palette_shutdown(void);
+EINTERN Eina_Bool e_wallpaper_palette_is_active(void);
+EINTERN void      e_wallpaper_palette_reload(void);
+
+#endif
+#endif
diff --git a/src/bin/e_watchdog.c b/src/bin/e_watchdog.c
new file mode 100644
index 000000000..7663e7990
--- /dev/null
+++ b/src/bin/e_watchdog.c
@@ -0,0 +1,110 @@
+#include "e.h"
+
+static Ecore_Thread *_watchdog_thread = NULL;
+static Ecore_Pipe *_watchdog_pipe = NULL;
+static unsigned long last_seq = 0;
+
+static void
+_cb_watchdog_thread_pingpong_pipe(void *data EINA_UNUSED, void *buf, unsigned int bytes)
+{
+   unsigned long long *seq = buf;
+   unsigned long long seq_num = bytes / sizeof(unsigned long long);
+
+   if (seq_num < 1)
+     {
+        return;
+     }
+   last_seq = seq[seq_num - 1];
+}
+
+static void
+_cb_watchdog_thread_pingpong(void *data EINA_UNUSED, Ecore_Thread *thread)
+{
+   unsigned long long *seq_new;
+   unsigned long long seq = 0;
+
+   while (!ecore_thread_check(thread))
+     {
+        // send ping
+        seq_new = malloc(sizeof(unsigned long long));
+        if (seq_new)
+          {
+             seq++;
+             *seq_new = seq;
+             ecore_thread_feedback(thread, seq_new);
+             // wait for ping from mainloop upto 10 sec
+             if (ecore_pipe_wait(_watchdog_pipe, 1, 7.0) < 1)
+               {
+                  char buf[PATH_MAX];
+
+                  L("WD: Enlightenment main loop hung. No response to ping for 10sec");
+                  if (!getenv("E_NO_WATCHDOG"))
+                   {
+                     // do hard-exit as cleanup isnt doable
+                     e_user_dir_concat_static(buf, "/watchdog-crash");
+                     // if ~/.e/e/watchdog-crash then crash (segv)
+                     if (ecore_file_exists(buf))
+                       {
+                         L("WD: Forcing a SEGV crash to get a backtracxe - see ~/.e-crashdump.txt");
+                         kill(getpid(), SIGSEGV);
+                       }
+                     // otherwise just restart so user can march on
+                     else
+                       {
+                         L("WD: Exiting E allowing it to be restarted to un-block");
+                         _exit(121);
+                       }
+                   }
+               }
+             // wait another 10 sec before pinging
+             sleep(5);
+          }
+        else
+          {
+             L("WD: Watchdog response alloc fail!!!!");
+             // XXX: alloc fail
+             break;
+          }
+     }
+}
+
+static void
+_cb_watchdog_thread_pingpong_reply(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, void *msg)
+{
+   // reply back to mainloop with same ping number
+   unsigned long long *seq = msg;
+
+   ecore_pipe_write(_watchdog_pipe, seq, sizeof(unsigned long long));
+   free(seq);
+}
+
+static void
+_cb_watchdog_thread_pingpong_end(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED)
+{
+   ecore_pipe_del(_watchdog_pipe);
+   _watchdog_pipe = NULL;
+   _watchdog_thread = NULL;
+}
+
+E_API void
+e_watchdog_begin(void)
+{
+  if (getenv("E_NO_WATCHDOG")) return;
+   // set up main-loop ping-pong to a thread
+   _watchdog_pipe = ecore_pipe_add(_cb_watchdog_thread_pingpong_pipe, NULL);
+   // stop mainloop watching with fd handler as wer wait manually
+   ecore_pipe_freeze(_watchdog_pipe);
+   _watchdog_thread = ecore_thread_feedback_run
+     (_cb_watchdog_thread_pingpong,
+      _cb_watchdog_thread_pingpong_reply,
+      _cb_watchdog_thread_pingpong_end,
+      NULL,
+      NULL, EINA_TRUE);
+}
+
+E_API void
+e_watchdog_end(void)
+{
+   if (_watchdog_thread) ecore_thread_cancel(_watchdog_thread);
+   _watchdog_thread = NULL;
+}

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

Reply via email to