示例#1
0
文件: band.c 项目: Elive/elicit
Elicit_Band *
elicit_band_new(const char *theme_file)
{
  Elicit_Band *band;

  band = calloc(1, sizeof(Elicit_Band));

  //XXX allow other engines
  band->ee = ecore_evas_software_x11_new(0,0,0,0,10,10);
  ecore_evas_borderless_set(band->ee, 1);
  if (ecore_x_screen_is_composited(0))
    ecore_evas_alpha_set(band->ee, 1);
  else
    ecore_evas_shaped_set(band->ee, 1);

  band->obj = edje_object_add(ecore_evas_get(band->ee));

  //XXX theme file!
  if (!edje_object_file_set(band->obj, theme_file, "elicit.band"))
  {
    fprintf(stderr, "[Elicit] Error: Can't set band theme\n");
  }
  evas_object_move(band->obj, 0, 0);
  evas_object_show(band->obj);

  return band;
}
示例#2
0
文件: elicit.c 项目: rephorm/elicit
Elicit *
elicit_new()
{
  Elicit *el;
  char buf[PATH_MAX];
  char *dir;
  
  el = calloc(sizeof(Elicit), 1);

  el->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 500, 500);
  if (!el->ee)
  {
    fprintf(stderr, "[Elicit] Error creating new ecore evas\n");
    free(el);
    return NULL;
  }
  el->evas = ecore_evas_get(el->ee);

  ecore_evas_title_set(el->ee, "Elicit");
  ecore_evas_name_class_set(el->ee, "Elicit", "Elicit");
  ecore_evas_borderless_set(el->ee, 1);

  // XXX get correct screen number
  if (ecore_x_screen_is_composited(0))
    ecore_evas_alpha_set(el->ee, 1);
  else
    ecore_evas_shaped_set(el->ee, 1);

  ecore_evas_data_set(el->ee, "Elicit", el);
  ecore_evas_callback_resize_set(el->ee, cb_ee_resize);
  ecore_evas_callback_mouse_in_set(el->ee, cb_ee_mouse_in);
  ecore_evas_callback_mouse_out_set(el->ee, cb_ee_mouse_out);

  ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE, cb_x_configure, el);

  el->obj.main = edje_object_add(el->evas);

  /* setup paths */
  dir = br_find_data_dir(DATADIR);
  snprintf(buf, sizeof(buf), "%s/%s/", dir, PACKAGE);
  if (!ecore_file_exists(buf))
  {
    fprintf(stderr, "[Elicit] Warning: falling back to hardcoded data dir.\n");
    snprintf(buf, sizeof(buf), "%s/%s/", DATADIR, PACKAGE);
  }
  el->path.datadir = strdup(buf);
  free(dir);

  if (getenv("HOME"))
  {
    snprintf(buf, sizeof(buf), "%s/.e/apps/elicit/", getenv("HOME"));
    if (!ecore_file_is_dir(buf))
      ecore_file_mkpath(buf);
    el->path.confdir = strdup(buf);

    snprintf(buf, sizeof(buf), "%s/.e/apps/elicit/elicit.conf", getenv("HOME"));
    el->path.conffile = strdup(buf);

    snprintf(buf, sizeof(buf), "%s/.e/apps/elicit/elicit.gpl", getenv("HOME"));
    el->path.palette = strdup(buf);
  }

  /* color */
  el->color = color_new();
  color_callback_changed_add(el->color, cb_color_changed, el);

  /* palette */
  el->palette = palette_new();
  palette_load(el->palette, el->path.palette);


  return el;
}