Ejemplo n.º 1
0
static Eina_Bool
_wkb_ibus_exe_data_cb(void *data, int type, void *event_data)
{
   Ecore_Exe_Event_Data *exe_data = (Ecore_Exe_Event_Data *) event_data;
   const char *cmd = NULL;

   if (!exe_data || !exe_data->exe)
     {
        INF("Unable to get information about the process");
        return ECORE_CALLBACK_RENEW;
     }

   cmd = ecore_exe_cmd_get(exe_data->exe);

   if (strncmp(cmd, IBUS_ADDRESS_CMD, strlen(IBUS_ADDRESS_CMD)))
      return ECORE_CALLBACK_RENEW;

   if (strncmp(exe_data->data, "(null)", exe_data->size) == 0)
     {
        if (!wkb_ibus->ibus_daemon)
          {
             INF("IBus daemon is not running, spawning");
             ecore_idler_add(_wkb_ibus_launch_idler, NULL);
          }
        goto end;
     }
   else if (strstr(exe_data->data, "unknown command") != NULL)
     {
        ERR("ibus command does not support the 'address' argument");
        goto end;
     }

   free(wkb_ibus->address);
   wkb_ibus->address = strndup(exe_data->data, exe_data->size);
   DBG("Got IBus address: '%s'", wkb_ibus->address);
   ecore_idler_add(_wkb_ibus_connect_idler, NULL);

end:
   wkb_ibus->address_pending = EINA_FALSE;
   return ECORE_CALLBACK_RENEW;
}
Ejemplo n.º 2
0
static Eina_Bool
_wkb_ibus_exe_add_cb(void *data, int type, void *event_data)
{
   Ecore_Exe_Event_Add *exe_data = (Ecore_Exe_Event_Add *)event_data;
   const char *cmd = NULL;

   if (!exe_data || !exe_data->exe)
     {
        INF("Unable to get information about the process");
        return ECORE_CALLBACK_RENEW;
     }

   cmd = ecore_exe_cmd_get(exe_data->exe);

   if (strncmp(cmd, IBUS_DAEMON_CMD, strlen(IBUS_DAEMON_CMD)))
      return ECORE_CALLBACK_RENEW;

   INF("IBus daemon is up");
   ecore_timer_add(1, _wkb_ibus_address_idler, NULL);

   return ECORE_CALLBACK_RENEW;
}