Ejemplo n.º 1
0
Archivo: band.c Proyecto: 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;
}
Ejemplo n.º 2
0
EAPI void
e_popup_edje_bg_object_set(E_Popup *pop, Evas_Object *o)
{
   const char *shape_option;

   E_OBJECT_CHECK(pop);
   E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
   shape_option = edje_object_data_get(o, "shaped");
   if (shape_option)
     {
	if (!strcmp(shape_option, "1"))
	  pop->shaped = 1;
	else
	  pop->shaped = 0;
	if (e_config->use_composite)
	  {
	     ecore_evas_alpha_set(pop->ecore_evas, pop->shaped);
             eina_hash_del(_e_popup_hash, e_util_winid_str_get(pop->evas_win), pop);
	     pop->evas_win = ecore_evas_software_x11_window_get(pop->ecore_evas);
             eina_hash_add(_e_popup_hash, e_util_winid_str_get(pop->evas_win), pop);
	     e_container_window_raise(pop->zone->container, pop->evas_win, pop->layer);
	  }
	else
	  ecore_evas_shaped_set(pop->ecore_evas, pop->shaped);
     }
}
Ejemplo n.º 3
0
void EcoreEvasWindow::setShaped( bool b )
{
    ecore_evas_shaped_set( _ee, b );
}
Ejemplo n.º 4
0
bool ui_init(ePlayer *player) {
	int zero = 0;
	char buf[PATH_MAX];
	
	debug(DEBUG_LEVEL_INFO, "Starting setup\n");
	
	ecore_init();
	ecore_evas_init();
	edje_init();
	ewl_init(&zero, NULL);

	ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, app_signal_exit,
	                        NULL);

#ifdef HAVE_ECORE_EVAS_GL
	if (!strcasecmp(player->cfg.evas_engine, "gl")) {
		debug(DEBUG_LEVEL_INFO, "Starting EVAS GL X11\n");
		player->gui.ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 0, 0);
	} else
#endif

#ifdef HAVE_ECORE_EVAS_FB
	if (!strcasecmp(player->cfg.evas_engine, "fb")) {
		debug(DEBUG_LEVEL_INFO, "Starting EVAS FB\n");
		player->gui.ee = ecore_evas_fb_new(NULL, 0, 0, 0);
	} else
#endif
	
	{
		debug(DEBUG_LEVEL_INFO, "Starting EVAS X11\n");
		player->gui.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 0, 0);
	}
			
	if (!player->gui.ee) {
		debug(DEBUG_LEVEL_CRITICAL,
		      "Cannot create Ecore Evas (using %s engine)\n",
		      player->cfg.evas_engine);

		return false;
	}
	
	ecore_evas_title_set(player->gui.ee, "ePlayer");
	ecore_evas_name_class_set(player->gui.ee, "ecore_test",
	                          "test_evas");
	ecore_evas_borderless_set(player->gui.ee, 1);
	ecore_evas_shaped_set(player->gui.ee, 1);

	ecore_evas_callback_pre_render_set(player->gui.ee,
	                                   cb_ee_pre_render);
	ecore_evas_callback_post_render_set(player->gui.ee,
	                                    cb_ee_post_render);
	ecore_evas_callback_resize_set(player->gui.ee, cb_ee_resize);

	ecore_evas_show(player->gui.ee);

	player->gui.evas = ecore_evas_get(player->gui.ee);

	snprintf(buf, sizeof(buf), "%s/.e/apps/%s/fonts",
	         getenv("HOME"), PACKAGE);

	evas_font_path_append(player->gui.evas, buf);
	evas_font_path_append(player->gui.evas, DATA_DIR "/fonts");
	evas_font_path_append(player->gui.evas, "/usr/X11R6/lib/X11/fonts");
	evas_font_path_append(player->gui.evas, "/usr/share/fonts");

	if (!ui_init_dragger(player))
		return false;

	return ui_init_edje(player, "eplayer");
}
Ejemplo n.º 5
0
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;
}
Ejemplo n.º 6
0
void
setup_cc_with_pos(int x, int y)
{
	ControlCentre  *cc;
	char           *edjefn = malloc(PATH_MAX);
	char           *fontpath = malloc(PATH_MAX);
	Evas_Coord      edje_w, edje_h;
	CCPos          *pos;

	cc = malloc(sizeof(ControlCentre));
	controlcentre = cc;

	pos = get_cc_pos();

	if (x >= 0 || y >= 0) {
		pos->x = x;
		pos->y = y;
	}

	/* Setup the Window */
	if (!strcmp(main_config->render_method, "gl")) {
#ifdef HAVE_ECORE_EVAS_GL
		cc->win =
			ecore_evas_gl_x11_new(NULL, 0, pos->x, pos->y,
					      pos->width, pos->height);
#else
		dml("GL not in Ecore_Evas module.  Falling back on software!",
		    1);
		free(main_config->render_method);
		main_config->render_method = strdup("software");
		cc->win =
			ecore_evas_software_x11_new(NULL, 0, pos->x, pos->y,
						    pos->width, pos->height);
#endif
	} else
		cc->win =
			ecore_evas_software_x11_new(NULL, 0, pos->x, pos->y,
						    pos->width, pos->height);

	ecore_evas_title_set(cc->win, "Enotes");
	ecore_evas_name_class_set(cc->win, "Enotes", "Enotes");

	if (main_config->ontop == 1)
		ecore_evas_layer_set(cc->win, 7);
	else
		ecore_evas_layer_set(cc->win, 2);

	if (main_config->sticky == 1)
		ecore_evas_sticky_set(cc->win, 1);
	else
		ecore_evas_sticky_set(cc->win, 0);

	ecore_evas_borderless_set(cc->win, 1);
	ecore_evas_shaped_set(cc->win, 1);
	if (pos->x != 0 && pos->y != 0)
		ecore_evas_resize(cc->win, pos->x, pos->y);
	ecore_evas_show(cc->win);

//      if(main_config->ontop==1)

	/* Moving the damn thing */
	ecore_evas_move(cc->win, pos->x, pos->y);

	/* Setup the Canvas, Render-Method and Font Path */
	cc->evas = ecore_evas_get(cc->win);
	evas_output_method_set(cc->evas,
			       evas_render_method_lookup(main_config->
							 render_method));
	snprintf(fontpath, PATH_MAX, "%s/fonts", PACKAGE_DATA_DIR);
	evas_font_path_append(cc->evas, fontpath);
	free(fontpath);

	/* Draggable Setup */
	cc->dragger = esmart_draggies_new(cc->win);
	evas_object_name_set(cc->dragger, "dragger");
	evas_object_move(cc->dragger, 0, 0);
	evas_object_layer_set(cc->dragger, 0);
	evas_object_color_set(cc->dragger, 255, 255, 255, 0);
	esmart_draggies_button_set(cc->dragger, 1);
	evas_object_show(cc->dragger);

	/* Setup the EDJE */
	cc->edje = edje_object_add(cc->evas);
	snprintf(edjefn, PATH_MAX, CC_EDJE, PACKAGE_DATA_DIR,
		 main_config->theme);
	edje_object_file_set(cc->edje, edjefn, CC_PART);
	free(edjefn);
	evas_object_move(cc->edje, 0, 0);
	evas_object_layer_set(cc->edje, 1);
	evas_object_name_set(cc->edje, "edje");
	evas_object_pass_events_set(cc->edje, 0);
	evas_object_show(cc->edje);
	if (pos->shaded)
		edje_object_signal_emit(cc->edje, EDJE_SIGNAL_CC_SHADE "_GO",
					"");
	else
		edje_object_signal_emit(cc->edje, EDJE_SIGNAL_CC_UNSHADE "_GO",
					"");

	/* EDJE and ECORE min, max and resizing */
	edje_object_size_max_get(cc->edje, &edje_w, &edje_h);
	ecore_evas_size_max_set(cc->win, edje_w, edje_h);
	edje_object_size_min_get(cc->edje, &edje_w, &edje_h);
	ecore_evas_size_min_set(cc->win, edje_w, edje_h);
	ecore_evas_resize(cc->win, (int) edje_w, (int) edje_h);
	evas_object_resize(cc->edje, edje_w, edje_h);
	evas_object_resize(cc->dragger, edje_w, edje_h);

	/* Ecore Callbacks */
	ecore_evas_callback_resize_set(cc->win, cc_resize);
	ecore_evas_callback_destroy_set(cc->win, cc_close_win);
	ecore_evas_callback_delete_request_set(cc->win, cc_close_win);

	/* Edje Callbacks */
	edje_object_signal_callback_add(cc->edje,
					EDJE_SIGNAL_CC_MINIMIZE, "",
					(void *) cc_minimize, cc->win);
	edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_CLOSE, "",
					(void *) cc_close, NULL);
	edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SAVELOAD, "",
					(void *) cc_saveload, NULL);
	edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SETTINGS, "",
					(void *) cc_settings, NULL);
	edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_NEW, "",
					(void *) cc_newnote, NULL);
	edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SHADE, "",
					(void *) cc_shade, NULL);
	edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_UNSHADE, "",
					(void *) cc_unshade, NULL);

	free(pos);
	return;
}