static void button_ug_destroy_cb(ui_gadget_h ug, void *priv) { _D("%s\n", __func__); struct appdata *ad = (struct appdata *)priv; retm_if(ug == NULL, "Invalid argument: ug is NULL\n"); ug_destroy(ug); ad->ug = NULL; ecore_x_netwm_window_type_set(elm_win_xwindow_get(ad->win), ECORE_X_WINDOW_TYPE_NOTIFICATION); utilx_set_window_opaque_state(ecore_x_display_get(), elm_win_xwindow_get(ad->win), UTILX_OPAQUE_STATE_OFF); _close_volume(ad); }
ui_gadget_h create_button_ug(void *data) { ui_gadget_h ug = NULL; struct ug_cbs cbs = {0}; struct appdata *ad = (struct appdata *)data; retvm_if(ad == NULL, 0, "Invalid argument:appdata is NULL\n"); cbs.layout_cb = button_ug_layout_cb; cbs.destroy_cb = button_ug_destroy_cb; cbs.priv = (void *)data; ecore_x_netwm_window_type_set(elm_win_xwindow_get(ad->win), ECORE_X_WINDOW_TYPE_NORMAL); utilx_set_window_opaque_state(ecore_x_display_get(), elm_win_xwindow_get(ad->win), UTILX_OPAQUE_STATE_ON); ug = ug_create(NULL, "setting-profile-efl", UG_MODE_FULLVIEW, NULL, &cbs); return ug; }
/** * Sets the default properties for the given window. * * The default properties set for the window are @c WM_CLIENT_MACHINE and * @c _NET_WM_PID. * * @param win The given window. * @ingroup Ecore_X_Window_Properties_Group */ EAPI void ecore_x_window_defaults_set(Ecore_X_Window win) { long pid; char buf[MAXHOSTNAMELEN]; char *hostname[1]; int argc; char **argv; XTextProperty xprop; LOGFN(__FILE__, __LINE__, __FUNCTION__); /* * Set WM_CLIENT_MACHINE. */ gethostname(buf, MAXHOSTNAMELEN); buf[MAXHOSTNAMELEN - 1] = '\0'; hostname[0] = buf; /* The ecore function uses UTF8 which Xlib may not like (especially * with older clients) */ /* ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_CLIENT_MACHINE, (char *)buf); */ if (XStringListToTextProperty(hostname, 1, &xprop)) { XSetWMClientMachine(_ecore_x_disp, win, &xprop); XFree(xprop.value); } /* * Set _NET_WM_PID */ pid = getpid(); ecore_x_netwm_pid_set(win, pid); ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL); ecore_app_args_get(&argc, &argv); ecore_x_icccm_command_set(win, argc, argv); }
/* Basic popup widget */ int usbotg_unmount_create_and_show_basic_popup(struct appdata *ad) { Evas_Object *btn1; Evas_Object *btn2; char buf[PATH_MAX] = {0, }; /* Initialization */ int ret_val = 0; snprintf(buf, PATH_MAX, "Unmount %s?", dev_name); ad->device_name = malloc(strlen(dev_name)+1); strncpy(ad->device_name, dev_name, strlen(dev_name)); /* Add notify */ /* No need to give main window, it will create internally */ ad->popup = elm_popup_add(ad->win_main); evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_object_text_set(ad->popup, buf); elm_object_part_text_set(ad->popup, "title,text", _("IDS_COM_BODY_SYSTEM_INFO_ABB")); btn1 = elm_button_add(ad->popup); elm_object_text_set(btn1, "OK"); elm_object_part_content_set(ad->popup, "button1", btn1); evas_object_smart_callback_add(btn1, "clicked", ok_clicked_cb, ad); btn2 = elm_button_add(ad->popup); elm_object_text_set(btn2, "Cancel"); elm_object_part_content_set(ad->popup, "button2", btn2); evas_object_smart_callback_add(btn2, "clicked", bg_clicked_cb, ad); Ecore_X_Window xwin; xwin = elm_win_xwindow_get(ad->popup); ecore_x_netwm_window_type_set(xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION); evas_object_show(ad->popup); return 0; }
int create_and_show_basic_popup_min(struct appdata *ad) { Evas_Object *btn1; Evas_Object *btn2; ad->popup_poweroff = elm_popup_add(ad->win_main); if (ad->popup_poweroff == NULL) { system_print("\n System-popup : Add popup failed \n"); return -1; } evas_object_size_hint_weight_set(ad->popup_poweroff, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_object_text_set(ad->popup_poweroff, _("IDS_ST_BODY_POWER_OFF")); elm_object_part_text_set(ad->popup_poweroff, "title,text", _("IDS_COM_BODY_SYSTEM_INFO_ABB")); btn1 = elm_button_add(ad->popup_poweroff); elm_object_text_set(btn1, _("IDS_COM_SK_OK")); elm_object_part_content_set(ad->popup_poweroff, "button1", btn1); elm_object_style_set (btn1,"popup_button/default"); evas_object_smart_callback_add(btn1, "clicked", poweroff_response_yes_cb_min, ad); btn2 = elm_button_add(ad->popup_poweroff); elm_object_text_set(btn2, _("IDS_COM_SK_CANCEL")); elm_object_part_content_set(ad->popup_poweroff, "button2", btn2); elm_object_style_set (btn2,"popup_button/default"); evas_object_smart_callback_add(btn2, "clicked", poweroff_response_no_cb_min, ad); Ecore_X_Window xwin; xwin = elm_win_xwindow_get(ad->popup_poweroff); ecore_x_netwm_window_type_set(xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION); utilx_grab_key(ecore_x_display_get(), xwin, KEY_SELECT, SHARED_GRAB); ecore_event_handler_add(ECORE_EVENT_KEY_UP, poweroff_response_no_cb_min, NULL); evas_object_show(ad->popup_poweroff); return 0; }
static Erss_Tooltip *erss_tooltip_new (char *description) { Erss_Tooltip *tt; int x, y, w, h; Evas_Coord ew, eh; if(description == NULL) return NULL; tt = malloc (sizeof (Erss_Tooltip)); memset (tt, 0, sizeof (Erss_Tooltip)); tt->ee = ecore_evas_software_x11_new (NULL, 0, 0, 0, 250, 80); ecore_evas_override_set(tt->ee, 1); ecore_evas_borderless_set (tt->ee, TRUE); tt->win = ecore_evas_software_x11_window_get(ee); ecore_x_netwm_window_type_set (tt->win, ECORE_X_WINDOW_TYPE_UTILITY); ecore_evas_geometry_get (tt->ee, &x, &y, &w, &h); tt->evas = ecore_evas_get (tt->ee); evas_font_path_append (tt->evas, PACKAGE_DATA_DIR"/fonts/"); tt->bg = esmart_trans_x11_new (tt->evas); evas_object_move (tt->bg, 0, 0); evas_object_layer_set (tt->bg, -5); evas_object_resize (tt->bg, w, h); evas_object_name_set(tt->bg, "root_background"); evas_object_show (tt->bg); tt->bg = evas_object_rectangle_add(tt->evas); evas_object_move (tt->bg, 0, 0); evas_object_layer_set (tt->bg, -6); evas_object_resize (tt->bg, w, h); evas_object_color_set(tt->bg, 255, 255, 255, 20); evas_object_name_set(tt->bg, "background"); evas_object_show (tt->bg); tt->etox = etox_new_all(tt->evas, x + 5, y + 5, w - 10 , h - 10, 255, ETOX_ALIGN_LEFT); etox_context_set_wrap_marker(etox_get_context(tt->etox), NULL, NULL); etox_context_set_align(etox_get_context(tt->etox), ETOX_ALIGN_LEFT); etox_context_set_font(etox_get_context(tt->etox), "Vera", 10); etox_context_set_style(etox_get_context(tt->etox), "shadow"); etox_context_set_color(etox_get_context(tt->etox), 225, 225, 225, 255); etox_set_soft_wrap(tt->etox, 1); etox_set_word_wrap(tt->etox, 1); etox_set_alpha(tt->etox, 255); evas_object_layer_set(tt->etox, 1000); etox_set_text (tt->etox, description); evas_object_show (tt->etox); evas_object_geometry_get(tt->etox, NULL, NULL, &ew, &eh); if (eh > ew) { double scale = (double)ew / (double)eh; ew = ew / scale; eh *= scale; evas_object_resize(tt->etox, ew, eh); evas_object_geometry_get(tt->etox, NULL, NULL, &ew, &eh); } ecore_evas_callback_move_set (tt->ee, erss_window_move_tooltip); ecore_evas_callback_resize_set(tt->ee, erss_window_resize); ecore_evas_resize(tt->ee, ew + 10, eh + 10); return tt; }
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 EcoreXWindow::setNetWMWindowType( EcoreXWindowType type ) { ecore_x_netwm_window_type_set( _exwin, static_cast <Ecore_X_Window_Type> (type) ); }