EAPI int elm_main(int argc, char **argv) { Ecore_X_Window xwin; Ecore_X_Window_State states[2]; Evas_Object *bg; int w, h; win = elm_win_add(NULL, "elm_kbd", ELM_WIN_BASIC); elm_win_title_set(win, "Elm Keyboard"); evas_object_smart_callback_add(win, "delete,request", _cb_win_del, NULL); elm_win_keyboard_win_set(win, EINA_TRUE); xwin = elm_win_xwindow_get(win); states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR; states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER; ecore_x_netwm_window_state_set(xwin, states, 2); ecore_x_icccm_hints_set(xwin, 0, 0, 0, 0, 0, 0, 0); bg = elm_bg_add(win); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, bg); evas_object_show(bg); _load_keys(win, &w, &h); evas_object_resize(win, w, h); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }
//Create a new menu //The parent menu will have to be destroyed by eclair_menu_free //Return NULL if failed Eclair_Menu *eclair_menu_new(Eclair_Engine menu_engine) { Eclair_Menu *menu; Ecore_X_Window_State window_states[2]; menu = calloc(1, sizeof(Eclair_Menu)); menu->engine = menu_engine; if (menu_engine == ECLAIR_GL) { menu->window = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 0, 0); menu->x_window = ecore_evas_gl_x11_window_get(menu->window); } else { menu->window = ecore_evas_software_x11_new(NULL, 0, 0, 0, 0, 0); menu->x_window = ecore_evas_software_x11_window_get(menu->window); } ecore_evas_title_set(menu->window, "eclair menu"); ecore_evas_name_class_set(menu->window, "eclair", "Eclair"); window_states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR; window_states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER; ecore_x_netwm_window_state_set(menu->x_window, window_states, 2); ecore_evas_borderless_set(menu->window, 1); menu->evas = ecore_evas_get(menu->window); menu->edje_object = edje_object_add(menu->evas); if (!edje_object_file_set(menu->edje_object, ECLAIR_WIDGETS_THEME, "eclair_menu")) { evas_object_del(menu->edje_object); ecore_evas_free(menu->window); free(menu); return NULL; } evas_object_move(menu->edje_object, 0, 0); evas_object_show(menu->edje_object); ecore_evas_data_set(menu->window, "eclair_menu", menu); ecore_evas_callback_resize_set(menu->window, _eclair_menu_resize_cb); ecore_evas_hide(menu->window); return menu; }
EAPI int elm_main(int argc, char **argv) { Ecore_X_Window *roots = NULL; int num = 0, i = 0; roots = ecore_x_window_root_list(&num); if ((!roots) || (num <= 0)) return EXIT_FAILURE; for (i = 0; i < num; i++) { Ecore_X_Window *zones; int x = 0, count = 0; count = ecore_x_window_prop_window_list_get(roots[i], ECORE_X_ATOM_E_ILLUME_ZONE_LIST, &zones); if (!zones) continue; for (x = 0; x < count; x++) { Evas_Object *win; Evas_Object *bg, *box, *btn, *icon; Ecore_X_Window xwin; Ecore_X_Window_State states[2]; char buff[PATH_MAX]; int zx, zy, zw, zh; /* create new window */ win = elm_win_add(NULL, "Illume-Softkey", ELM_WIN_DOCK); elm_win_title_set(win, "Illume Softkey"); evas_object_smart_callback_add(win, "delete-request", _cb_win_del, NULL); evas_object_data_set(win, "zone", (const void *)zones[x]); xwin = elm_win_xwindow_get(win); ecore_x_icccm_hints_set(xwin, 0, 0, 0, 0, 0, 0, 0); states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR; states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER; ecore_x_netwm_window_state_set(xwin, states, 2); bg = elm_bg_add(win); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, bg); evas_object_show(bg); box = elm_box_add(win); elm_box_horizontal_set(box, EINA_TRUE); evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, box); evas_object_show(box); icon = elm_icon_add(win); snprintf(buff, sizeof(buff), "%s/images/back.png", PACKAGE_DATA_DIR); elm_icon_file_set(icon, buff, NULL); evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); btn = elm_button_add(win); elm_button_icon_set(btn, icon); evas_object_smart_callback_add(btn, "clicked", _cb_btn_back_clicked, win); evas_object_size_hint_align_set(btn, 1.0, 0.5); elm_box_pack_end(box, btn); evas_object_show(btn); evas_object_show(icon); icon = elm_icon_add(win); snprintf(buff, sizeof(buff), "%s/images/close.png", PACKAGE_DATA_DIR); elm_icon_file_set(icon, buff, NULL); evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); btn = elm_button_add(win); elm_button_icon_set(btn, icon); evas_object_smart_callback_add(btn, "clicked", _cb_btn_close_clicked, win); evas_object_size_hint_align_set(btn, 1.0, 0.5); elm_box_pack_end(box, btn); evas_object_show(btn); evas_object_show(icon); ecore_x_window_geometry_get(zones[x], &zx, &zy, &zw, &zh); ecore_x_e_illume_softkey_geometry_set(zones[x], zx, (zy + zh - 40), zw, 40); evas_object_move(win, zx, (zy + zh - 40)); evas_object_resize(win, zw, 40); evas_object_show(win); } free(zones); } free(roots); elm_run(); elm_shutdown(); return EXIT_SUCCESS; }
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; }