static Eina_Bool _ecore_x_window_keytable_possible_global_exclusiveness_unset(int keycode) { int ret = 0; Ecore_X_Window_Key_Table keytable; keytable.win = ecore_x_window_root_first_get(); keytable.key_list = NULL; keytable.key_cnt = 0; if(_atom_grab_excl_win == None ) _atom_grab_excl_win = XInternAtom(_ecore_x_disp, STR_ATOM_GRAB_EXCL_WIN, False); ret = _keytable_property_list_get(keytable.win, _atom_grab_excl_win, (unsigned int **)&(keytable.key_list)); if (ret <= 0) return EINA_FALSE; keytable.key_cnt = ret; //check keycode exists in the global exclusiveness keytable ret = _ecore_x_window_keytable_key_search(&keytable, keycode); if (ret == -1) { WRN("Already key exists"); _keytable_free(&keytable); return EINA_FALSE; } else ret = _ecore_x_window_keytable_key_del(&keytable, keycode, _atom_grab_excl_win); _keytable_free(&keytable); return EINA_FALSE; }
EAPI int wizard_page_show(E_Wizard_Page *pg) { Evas_Object *o, *of, *ob; Ecore_Evas *ee; #ifndef HAVE_WAYLAND_ONLY Ecore_X_Window_Attributes att; if (!ecore_x_composite_query()) return 0; if (!ecore_x_damage_query()) return 0; memset((&att), 0, sizeof(Ecore_X_Window_Attributes)); ecore_x_window_attributes_get(ecore_x_window_root_first_get(), &att); if ((att.depth <= 8)) return 0; gl_avail = ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_OPENGL_X11); #endif o = e_widget_list_add(pg->evas, 1, 0); e_wizard_title_set(_("Compositing")); of = e_widget_framelist_add(pg->evas, _("Settings"), 0); if (gl_avail) { ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 320, 240); if (ee) { ecore_evas_free(ee); if ( (match_xorg_log("*(II)*NVIDIA*: Creating default Display*")) || (match_xorg_log("*(II)*intel*: Creating default Display*")) || (match_xorg_log("*(II)*NOUVEAU*: Creating default Display*")) || (match_xorg_log("*(II)*RADEON*: Creating default Display*")) ) { do_gl = 1; do_vsync = 1; } } ob = e_widget_check_add(pg->evas, _("Hardware Accelerated (OpenGL)"), &(do_gl)); e_widget_framelist_object_append(of, ob); ob = e_widget_check_add(pg->evas, _("Tear-free Rendering (OpenGL only)"), &(do_vsync)); e_widget_framelist_object_append(of, ob); } ob = e_widget_check_add(pg->evas, _("Disable composite effects"), &(disable_effects)); e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, of, 0, 0, 0.5); evas_object_show(of); e_wizard_page_show(o); return 0; /* 1 == show ui, and wait for user, 0 == just continue */ }
static inline unsigned long rootWindowID() { #if PLATFORM(GTK) return GDK_ROOT_WINDOW(); #elif PLATFORM(EFL) && defined(HAVE_ECORE_X) return ecore_x_window_root_first_get(); #else return 0; #endif }
static inline unsigned long rootWindowID() { #if PLATFORM(QT) return XDefaultRootWindow(NetscapePlugin::x11HostDisplay()); #elif PLATFORM(GTK) return GDK_ROOT_WINDOW(); #elif PLATFORM(EFL) && defined(HAVE_ECORE_X) return ecore_x_window_root_first_get(); #else return 0; #endif }
static Evas_Object* create_win(const char *name) { Evas_Object *eo; int w, h; eo = elm_win_add(NULL, name, ELM_WIN_BASIC); if (!eo) return NULL; elm_win_title_set(eo, name); elm_win_borderless_set(eo, EINA_TRUE); elm_win_autodel_set(eo, EINA_TRUE); evas_object_smart_callback_add(eo, "delete,request", _quit_cb, NULL); ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); evas_object_resize(eo, w, h); return eo; }
Evas_Object* appcore_create_win(const char *name) { Evas_Object *eo; int w, h; eo = elm_win_add(NULL, name, ELM_WIN_BASIC); if (eo) { elm_win_title_set(eo, name); elm_win_borderless_set(eo, EINA_TRUE); evas_object_smart_callback_add(eo, "delete,request", (Evas_Smart_Cb)appcore_win_del, NULL); ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); evas_object_resize(eo, w, h); } return eo; }
static Eina_Bool _ecore_x_window_keytable_possible_global_exclusiveness_set(int keycode) { int ret = 0; Ecore_X_Window_Key_Table keytable; keytable.win = ecore_x_window_root_first_get(); keytable.key_list = NULL; keytable.key_cnt = 0; if(_atom_grab_excl_win == None ) _atom_grab_excl_win = XInternAtom(_ecore_x_disp, STR_ATOM_GRAB_EXCL_WIN, False); ret = _keytable_property_list_get(keytable.win, _atom_grab_excl_win, (unsigned int **)&(keytable.key_list)); if (ret < 0) return EINA_FALSE; keytable.key_cnt = ret; if (keytable.key_cnt == 0) { XChangeProperty(_ecore_x_disp, keytable.win, _atom_grab_excl_win, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&keycode, 1); XSync(_ecore_x_disp, False); _keytable_free(&keytable); return EINA_TRUE; } //check keycode exists in the global exclusiveness keytable ret = _ecore_x_window_keytable_key_search(&keytable, keycode); if (ret != -1) { XChangeProperty(_ecore_x_disp, keytable.win, _atom_grab_excl_win, XA_CARDINAL, 32, PropModeAppend, (unsigned char *)&keycode, 1); XSync(_ecore_x_disp, False); _keytable_free(&keytable); return EINA_TRUE; } WRN("Already key is grabbed"); _keytable_free(&keytable); return EINA_FALSE; }
static Eina_Bool _ecore_x_window_keytable_possible_global_exclusiveness_get(int keycode) { int ret = 0; Ecore_X_Window_Key_Table keytable; keytable.win = ecore_x_window_root_first_get(); keytable.key_list = NULL; keytable.key_cnt = 0; if(_atom_grab_excl_win == None ) _atom_grab_excl_win = XInternAtom(_ecore_x_disp, STR_ATOM_GRAB_EXCL_WIN, False); ret = _keytable_property_list_get(keytable.win, _atom_grab_excl_win, (unsigned int **)&(keytable.key_list)); if (ret < 0) { return EINA_FALSE; } keytable.key_cnt = ret; if (keytable.key_cnt == 0) { WRN("There is no keygrab entry in the table"); return EINA_TRUE; } //check keycode exists in the global exclusiveness keytable ret = _ecore_x_window_keytable_key_search(&keytable, keycode); if (ret != -1) { WRN("Can't search keygrab entry in the table"); _keytable_free(&keytable); return EINA_FALSE; } _keytable_free(&keytable); return EINA_TRUE; }
/** * @brief __create_main_win 创建住窗口 * @param app_data 传递的程序结构体 * @return 返回创建的对象 */ static Evas_Object *__create_main_win(void *app_data) { Evas_Object *window = elm_win_add(NULL, BROWSER_PACKAGE_NAME, ELM_WIN_BASIC); if (window) { int w; int h; elm_win_title_set(window, BROWSER_PACKAGE_NAME); elm_win_borderless_set(window, EINA_TRUE); elm_win_conformant_set(window, EINA_TRUE); evas_object_smart_callback_add(window, "delete,request", __main_win_del_cb, app_data); ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); evas_object_resize(window, w, h); elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_SHOW); evas_object_show(window); } return window; }
static Evas_Object* consumerapp_create_win(const char *name) { Evas_Object *eo; int w , h; eo = elm_win_add(NULL , name , ELM_WIN_BASIC); if(eo) { elm_win_title_set(eo , name); elm_win_borderless_set(eo , EINA_TRUE); evas_object_smart_callback_add(eo , "delete,request" , _win_del , NULL); ecore_x_window_size_get(ecore_x_window_root_first_get() , &w , &h); evas_object_resize(eo , w , h); elm_win_indicator_mode_set(eo , ELM_WIN_INDICATOR_SHOW); elm_win_indicator_opacity_set(eo , ELM_WIN_INDICATOR_OPAQUE); } evas_object_show(eo); return eo; }
/* EAPI int wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__) { return 1; } EAPI int wizard_page_shutdown(E_Wizard_Page *pg __UNUSED__) { return 1; } */ EAPI int wizard_page_show(E_Wizard_Page *pg) { Evas_Object *o, *of, *ob; Ecore_Evas *ee; Ecore_X_Window_Attributes att; if (!ecore_x_composite_query()) return 0; if (!ecore_x_damage_query()) return 0; memset((&att), 0, sizeof(Ecore_X_Window_Attributes)); ecore_x_window_attributes_get(ecore_x_window_root_first_get(), &att); if ((att.depth <= 8)) return 0; ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 320, 240); if (ee) { ecore_evas_free(ee); if ( (match_xorg_log("*(II)*NVIDIA*: Creating default Display*")) || (match_xorg_log("*(II)*intel*: Creating default Display*")) || (match_xorg_log("*(II)*NOUVEAU*: Creating default Display*")) || (match_xorg_log("*(II)*RADEON*: Creating default Display*")) ) { do_gl = 1; do_vsync = 1; } } o = e_widget_list_add(pg->evas, 1, 0); e_wizard_title_set(_("Compositing")); of = e_widget_framelist_add(pg->evas, _("Transparent windows and effects"), 0); ob = e_widget_textblock_add(pg->evas); e_widget_size_min_set(ob, 260 * e_scale, 200 * e_scale); e_widget_textblock_markup_set (ob, _("Compositing provides translucency<br>" "for windows, window effects like<br>" "fading in and out and zooming<br>" "when they appear and dissapear.<br>" "It is highly recommended to<br>" "enable this for a better<br>" "experience, but it comes at a<br>" "cost. It requires extra CPU<br>" "or a GLSL Shader capable GPU<br>" "with well written drivers.<br>" "It also will add between 10 to<br>" "100 MB to the memory needed<br>" "for Enlightenment." ) ); e_widget_framelist_object_append(of, ob); ob = e_widget_check_add(pg->evas, _("Enable Compositing"), &(do_comp)); e_widget_framelist_object_append(of, ob); if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_OPENGL_X11)) { ob = e_widget_check_add(pg->evas, _("Hardware Accelerated (OpenGL)"), &(do_gl)); e_widget_framelist_object_append(of, ob); ob = e_widget_check_add(pg->evas, _("Tear-free Rendering (OpenGL only)"), &(do_vsync)); e_widget_framelist_object_append(of, ob); } e_widget_list_object_append(o, of, 0, 0, 0.5); evas_object_show(of); e_wizard_page_show(o); // pg->data = o; return 1; /* 1 == show ui, and wait for user, 0 == just continue */ }
static void winmain() { const char* name = "Hapti_UI_TEST"; int w,h; Evas_Object* win; Evas_Object* bg; Evas_Object* main_layout; Evas_Object* btns_box; Evas_Object* btn_vibe; Evas_Object* btn_stop; Evas* evas; win = elm_win_add(NULL, name, ELM_WIN_BASIC); if(!win) return; elm_win_title_set(win, name); elm_win_borderless_set(win, EINA_TRUE); elm_win_autodel_set(win, EINA_TRUE); evas_object_smart_callback_add(win, "delete,request", _quit_cb, NULL); ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); evas_object_resize(win, w, h); evas_object_show(win); evas = evas_object_evas_get(win); // set background bg = elm_bg_add(win); elm_bg_color_set(bg, 0xff, 0xff, 0xff); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, bg); evas_object_show(bg); // Base Layout main_layout = elm_layout_add(win); elm_layout_theme_set(main_layout, "layout", "application", "default"); evas_object_size_hint_weight_set(main_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, main_layout); evas_object_show(main_layout); // Indicator elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_SHOW); // add box btns_box = elm_box_add(win); elm_box_horizontal_set(btns_box, EINA_TRUE); elm_win_resize_object_add(win, btns_box); elm_box_padding_set(btns_box, 10, 0); evas_object_show(btns_box); // add Button btn_vibe = elm_button_add(main_layout); btn_stop = elm_button_add(main_layout); elm_object_text_set(btn_vibe, "Vibe"); elm_object_text_set(btn_stop, "Stop"); evas_object_smart_callback_add(btn_vibe, "clicked", _vibe_clicked_cb, NULL); evas_object_smart_callback_add(btn_stop, "clicked", _stop_clicked_cb, NULL); elm_box_pack_end(btns_box, btn_vibe); elm_box_pack_end(btns_box, btn_stop); evas_object_show(btn_vibe); evas_object_show(btn_stop); }