Beispiel #1
0
bool
wlc_view(struct wlc_view *view)
{
   assert(view);
   assert(!view->state.created);
   return chck_iter_pool(&view->wl_state, 8, 0, sizeof(uint32_t));
}
Beispiel #2
0
static void
do_autostart(void)
{
   struct chck_string key = {0}, command = {0};
   struct chck_iter_pool argv;

   if (!chck_iter_pool(&argv, 4, 4, sizeof(char*)))
      return;

   for (uint32_t i = 0; ; i++) {
      if (!chck_string_set_format(&key, "/autostart/%u", i))
         break;

      const char *command_cstr;
      if (!configuration_get(key.data, 's', &command_cstr))
         break;

      if (!chck_string_set_cstr(&command, command_cstr, true))
         break;

      char *t;
      size_t len;
      const char *state = NULL;
      while ((t = (char*)chck_cstr_tokenize_quoted(command.data, &len, " ", "\"'", &state))) {
         chck_iter_pool_push_back(&argv, &t);
         t[len] = 0; /* replaces each token with \0 */
      }

      const char *null = NULL;
      chck_iter_pool_push_back(&argv, &null); /* NULL indicates end of the array */
      plog(plugin.self, PLOG_INFO, "spawning: %s", command_cstr);
      wlc_exec(command.data, chck_iter_pool_to_c_array(&argv, NULL));
      chck_iter_pool_empty(&argv);
   }

   chck_string_release(&key);
   chck_string_release(&command);
   chck_iter_pool_release(&argv);
}