static Eina_Bool _e_mod_ind_win_cb_zone_resize(void *data, int type __UNUSED__, void *event) { Ind_Win *iwin; E_Event_Zone_Move_Resize *ev; Evas_Coord h = 0; ev = event; if (!(iwin = data)) return ECORE_CALLBACK_PASS_ON; if (ev->zone != iwin->zone) return ECORE_CALLBACK_PASS_ON; h = (il_ind_cfg->height * e_scale); /* set minimum size of this window to match zone size */ e_win_size_min_set(iwin->win, ev->zone->w, h); ecore_evas_size_min_set(iwin->popup->ecore_evas, ev->zone->w, h); return ECORE_CALLBACK_PASS_ON; }
bool ui_init_edje(ePlayer *player, const char *name) { double edje_w = 0, edje_h = 0; debug(DEBUG_LEVEL_INFO, "EDJE: Defining Edje \n"); if (!(player->gui.edje = edje_object_add(player->gui.evas))) { debug(DEBUG_LEVEL_CRITICAL, "Cannot create Edje!\n"); return false; } evas_object_name_set(player->gui.edje, "main_edje"); if (!edje_object_file_set(player->gui.edje, find_theme(player->cfg.theme), name)) { debug(DEBUG_LEVEL_CRITICAL, "Cannot load theme '%s'!\n", player->cfg.theme); return false; } evas_object_move(player->gui.edje, 0, 0); evas_object_pass_events_set (player->gui.edje, 1); evas_object_show(player->gui.edje); /* set max size */ edje_object_size_max_get(player->gui.edje, &edje_w, &edje_h); ecore_evas_size_max_set(player->gui.ee, edje_w, edje_h); /* set min size */ edje_object_size_min_get(player->gui.edje, &edje_w, &edje_h); ecore_evas_size_min_set(player->gui.ee, edje_w, edje_h); /* resize to the min size */ ecore_evas_resize(player->gui.ee, (int) edje_w, (int) edje_h); setup_playlist(player); ui_refresh_volume(player); register_callbacks(player); return true; }
static Eina_Bool _e_mod_ind_win_cb_win_prop(void *data, int type __UNUSED__, void *event) { Ind_Win *iwin; Ecore_X_Event_Window_Property *ev; Evas_Coord h = 0; ev = event; if (!(iwin = data)) return ECORE_CALLBACK_PASS_ON; if (ev->win != iwin->win->container->manager->root) return ECORE_CALLBACK_PASS_ON; if (ev->atom != ATM_ENLIGHTENMENT_SCALE) return ECORE_CALLBACK_PASS_ON; h = (il_ind_cfg->height * e_scale); /* set minimum size of this window */ e_win_size_min_set(iwin->win, iwin->zone->w, h); ecore_evas_size_min_set(iwin->popup->ecore_evas, iwin->zone->w, h); /* NB: Not sure why, but we need to tell this border to fetch icccm * size position hints now :( (NOTE: This was not needed a few days ago) * If we do not do this, than indicator does not change w/ scale anymore */ iwin->win->border->client.icccm.fetch.size_pos_hints = 1; /* resize this window */ e_win_resize(iwin->win, iwin->zone->w, h); e_popup_resize(iwin->popup, iwin->zone->w, h); /* tell conformant apps our position and size */ ecore_x_e_illume_indicator_geometry_set(iwin->zone->black_win, iwin->win->x, iwin->win->y, iwin->win->w, h); return ECORE_CALLBACK_PASS_ON; }
/* Theme Change */ void cc_update_theme() { int w, h; char *edjefn; if (!controlcentre) return; edjefn = malloc(PATH_MAX); snprintf(edjefn, PATH_MAX, PACKAGE_DATA_DIR "/themes/%s.edj", main_config->theme); edje_object_file_set(controlcentre->edje, edjefn, CC_PART); free(edjefn); /* EDJE and ECORE min, max and resizing */ edje_object_size_max_get(controlcentre->edje, &w, &h); ecore_evas_size_max_set(controlcentre->win, w, h); edje_object_size_min_get(controlcentre->edje, &w, &h); ecore_evas_size_min_set(controlcentre->win, w, h); ecore_evas_resize(controlcentre->win, w, h); evas_object_resize(controlcentre->edje, w, h); evas_object_resize(controlcentre->dragger, w, h); }
Ind_Win * e_mod_ind_win_new(E_Zone *zone) { Ind_Win *iwin; Ecore_X_Window_State states[2]; Evas_Coord h = 0; /* create our new indicator window object */ iwin = E_OBJECT_ALLOC(Ind_Win, IND_WIN_TYPE, _e_mod_ind_win_cb_free); if (!iwin) return NULL; h = (il_ind_cfg->height * e_scale); iwin->zone = zone; /* create new window */ iwin->win = e_win_new(zone->container); iwin->win->data = iwin; /* set some properties on the window */ e_win_title_set(iwin->win, _("Illume Indicator")); e_win_name_class_set(iwin->win, "Illume-Indicator", "Illume-Indicator"); e_win_no_remember_set(iwin->win, EINA_TRUE); /* hook into window resize so we can resize our objects */ e_win_resize_callback_set(iwin->win, _e_mod_ind_win_cb_resize); /* set this window to not show in taskbar or pager */ states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR; states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER; ecore_x_netwm_window_state_set(iwin->win->evas_win, states, 2); /* set this window to not accept or take focus */ ecore_x_icccm_hints_set(iwin->win->evas_win, 0, 0, 0, 0, 0, 0, 0); /* create the popup */ iwin->popup = e_popup_new(zone, 0, 0, zone->w, h); e_popup_name_set(iwin->popup, "indicator"); e_popup_layer_set(iwin->popup, 200); /* create our event rectangle */ iwin->o_event = evas_object_rectangle_add(iwin->win->evas); evas_object_color_set(iwin->o_event, 0, 0, 0, 0); evas_object_event_callback_add(iwin->o_event, EVAS_CALLBACK_MOUSE_DOWN, _e_mod_ind_win_cb_mouse_down, iwin); evas_object_event_callback_add(iwin->o_event, EVAS_CALLBACK_MOUSE_UP, _e_mod_ind_win_cb_mouse_up, iwin); evas_object_event_callback_add(iwin->o_event, EVAS_CALLBACK_MOUSE_MOVE, _e_mod_ind_win_cb_mouse_move, iwin); evas_object_move(iwin->o_event, 0, 0); evas_object_show(iwin->o_event); /* create our base object */ iwin->o_base = edje_object_add(iwin->win->evas); if (!e_theme_edje_object_set(iwin->o_base, "base/theme/modules/illume-indicator", "modules/illume-indicator/window")) { char buff[PATH_MAX]; snprintf(buff, sizeof(buff), "%s/e-module-illume-indicator.edj", _ind_mod_dir); edje_object_file_set(iwin->o_base, buff, "modules/illume-indicator/window"); } evas_object_move(iwin->o_base, 0, 0); evas_object_show(iwin->o_base); e_popup_edje_bg_object_set(iwin->popup, iwin->o_base); /* create our gadget container */ iwin->gadcon = e_gadcon_swallowed_new("illume-indicator", zone->id, iwin->o_base, "e.swallow.content"); edje_extern_object_min_size_set(iwin->gadcon->o_container, zone->w, h); e_gadcon_min_size_request_callback_set(iwin->gadcon, _e_mod_ind_win_cb_min_size_request, iwin); e_gadcon_size_request_callback_set(iwin->gadcon, _e_mod_ind_win_cb_size_request, iwin); e_gadcon_frame_request_callback_set(iwin->gadcon, _e_mod_ind_win_cb_frame_request, iwin); e_gadcon_orient(iwin->gadcon, E_GADCON_ORIENT_FLOAT); e_gadcon_zone_set(iwin->gadcon, zone); e_gadcon_ecore_evas_set(iwin->gadcon, iwin->win->ecore_evas); e_gadcon_util_menu_attach_func_set(iwin->gadcon, _e_mod_ind_win_cb_menu_items_append, iwin); e_gadcon_populate(iwin->gadcon); /* hook into property change so we can adjust w/ e_scale */ iwin->hdls = eina_list_append(iwin->hdls, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, _e_mod_ind_win_cb_win_prop, iwin)); /* hook into zone resize so we can set minimum window width when zone * size changes */ iwin->hdls = eina_list_append(iwin->hdls, ecore_event_handler_add(E_EVENT_ZONE_MOVE_RESIZE, _e_mod_ind_win_cb_zone_resize, iwin)); iwin->hdls = eina_list_append(iwin->hdls, ecore_event_handler_add(E_EVENT_BORDER_HIDE, _e_mod_ind_win_cb_border_hide, iwin)); iwin->hdls = eina_list_append(iwin->hdls, ecore_event_handler_add(E_EVENT_BORDER_SHOW, _e_mod_ind_win_cb_border_show, iwin)); /* set minimum size of this window & popup */ e_win_size_min_set(iwin->win, zone->w, h); ecore_evas_size_min_set(iwin->popup->ecore_evas, zone->w, h); /* position and resize this window */ e_win_move_resize(iwin->win, zone->x, zone->y, zone->w, h); e_popup_move_resize(iwin->popup, zone->x, zone->y, zone->w, h); /* show the window */ e_win_show(iwin->win); e_popup_show(iwin->popup); /* set this window on proper zone */ e_border_zone_set(iwin->win->border, zone); iwin->win->border->user_skip_winlist = 1; iwin->win->border->lock_focus_in = 1; iwin->win->border->lock_focus_out = 1; /* set this window to be a dock window. This needs to be done after show * as E will sometimes reset the window type */ ecore_x_netwm_window_type_set(iwin->win->evas_win, ECORE_X_WINDOW_TYPE_DOCK); /* tell conformant apps our position and size */ ecore_x_e_illume_indicator_geometry_set(zone->black_win, zone->x, zone->y, zone->w, h); return iwin; }
void EcoreEvasWindow::setMinimumSize( const Size& size ) { ecore_evas_size_min_set( _ee, size.width(), size.height() ); }
int elicit_theme_set(Elicit *el, const char *theme) { const char *path; int w, h; if (!theme) theme = "default"; /* first check if full path is given */ if (theme[0] == '/') { if (!edje_file_group_exists(theme, "elicit.main")) return 0; path = theme; } else path = elicit_theme_find(el, theme); if (!path) { fprintf(stderr, "[Elicit] Warning: theme \"%s\" not found, falling back to default.\n", theme); theme = "default"; path = elicit_theme_find(el, theme); } if (!path) { fprintf(stderr, "[Elicit] Error: theme \"%s\" not found.\n", theme); return 0; } if (el->path.theme) free(el->path.theme); el->path.theme = strdup(path); if (el->conf.theme != theme) { if (el->conf.theme) free(el->conf.theme); el->conf.theme = strdup(theme); } elicit_theme_unswallow_objs(el); edje_object_file_set(el->obj.main, path, "elicit.main"); edje_object_size_min_get(el->obj.main, &w, &h); if (w > el->conf.w) el->conf.w = w; if (h > el->conf.h) el->conf.h = h; ecore_evas_size_min_set(el->ee, w, h); ecore_evas_resize(el->ee, el->conf.w, el->conf.h); evas_object_move(el->obj.main, 0, 0); evas_object_resize(el->obj.main, el->conf.w, el->conf.h); evas_object_show(el->obj.main); elicit_theme_swallow_objs(el); edje_object_signal_callback_add(el->obj.main, "elicit,*", "*", cb_edje_signal, el); edje_object_signal_callback_add(el->obj.main, "mouse,move", "*", cb_edje_move, el); color_changed(el->color); /* emit signals to set theme state */ if (el->conf.grid_visible) edje_object_signal_emit(el->obj.main, "elicit,grid,on", "elicit"); else edje_object_signal_emit(el->obj.main, "elicit,grid,off", "elicit"); if (el->conf.show_band) edje_object_signal_emit(el->obj.main, "elicit,band,on", "elicit"); else edje_object_signal_emit(el->obj.main, "elicit,band,off", "elicit"); return 1; }
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; }