Eina_Bool e_mod_comp_wl_output_init(void) { Ecore_X_Window *roots; int num = 0, rw, rh; LOGFN(__FILE__, __LINE__, __FUNCTION__); roots = ecore_x_window_root_list(&num); if ((!roots) || (num <= 0)) { EINA_LOG_ERR("Could not get root window list\n"); return EINA_FALSE; } ecore_x_window_size_get(roots[0], &rw, &rh); free(roots); if (!(_wl_output = malloc(sizeof(Wayland_Output)))) { EINA_LOG_ERR("Could not allocate space for output\n"); return EINA_FALSE; } memset(_wl_output, 0, sizeof(*_wl_output)); _wl_output->mode.flags = (WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED); _wl_output->mode.w = rw; _wl_output->mode.h = rh; _wl_output->mode.refresh = 60; _wl_output->x = 0; _wl_output->y = 0; _wl_output->w = rw; _wl_output->h = rh; _wl_output->flags = WL_OUTPUT_FLIPPED; wl_list_init(&_wl_output->link); wl_list_init(&_wl_output->frame_callbacks); if (!wl_display_add_global(_wl_disp, &wl_output_interface, _wl_output, _e_mod_comp_wl_output_bind)) { EINA_LOG_ERR("Failed to add output to wayland\n"); free(_wl_output); return EINA_FALSE; } return EINA_TRUE; }
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; }
/** * @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; }
void elicit_magnify(Elicit *el) { int x, y; int px, py; int dw, dh; int w, h; if (el->conf.show_band) { if (!el->band) el->band = elicit_band_new(el->path.theme); elicit_band_show(el->band); } ecore_x_pointer_last_xy_get(&px, &py); elicit_shot_size_get(el->obj.shot, &w, &h); x = px - .5 * w; y = py - .5 * h; /* keep shot within desktop bounds */ ecore_x_window_size_get(RootWindow(ecore_x_display_get(),0), &dw, &dh); if (x < 0) x = 0; if (y < 0) y = 0; if (x + w > dw) x = dw - w; if (y + h > dh) y = dh - h; if (el->conf.show_band) elicit_band_move_resize(el->band, x-1, y-1, w+2, h+2); el->magnify.x = x; el->magnify.y = y; el->magnify.w = w; el->magnify.h = h; if (!el->magnify.timer) el->magnify.timer = ecore_timer_add(1.0/el->conf.grab_rate, elicit_magnify_timer, el); }
static void _set_edje_size() { Evas_Object *win; Ecore_X_Window root_window; int width, height; win = ui_utils_view_window_get(VIEW_PTR(view)); /* get screensize */ root_window = ecore_x_window_root_get (elm_win_xwindow_get (win)); ecore_x_window_size_get (root_window, &width, &height); if (height <= 480) { edje_object_signal_emit(ui_utils_view_layout_get(VIEW_PTR(view)), "set", "hvga"); } else { edje_object_signal_emit(ui_utils_view_layout_get(VIEW_PTR(view)), "set", "default"); } }
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); }