void Widget::applyCursor() { const char *file; Evas_Coord x, y; String theme = edjeThemeRecursive(); if (!theme.isNull()) file = edjeThemeRecursive().utf8().data(); m_data->m_cursorObject = edje_object_add(evas()); if (!edje_object_file_set(m_data->m_cursorObject, file, m_data->m_cursorGroup.utf8().data())) { evas_object_del(m_data->m_cursorObject); m_data->m_cursorObject = 0; ecore_evas_object_cursor_set(ecoreEvas(), 0, 0, 0, 0); applyFallbackCursor(); } else { Evas_Coord w, h; const char *d; edje_object_size_min_get(m_data->m_cursorObject, &w, &h); if ((w <= 0) || (h <= 0)) edje_object_size_min_calc(m_data->m_cursorObject, &w, &h); if ((w <= 0) || (h <= 0)) w = h = 16; evas_object_resize(m_data->m_cursorObject, w, h); d = edje_object_data_get(m_data->m_cursorObject, "hot.x"); x = d ? atoi(d) : 0; d = edje_object_data_get(m_data->m_cursorObject, "hot.y"); y = d ? atoi(d) : 0; ecore_evas_object_cursor_set(ecoreEvas(), m_data->m_cursorObject, EVAS_LAYER_MAX, x, y); } }
int main(void) { Ecore_Evas *ee; Evas_Object *bg, *cursor, *obj; int layer, x, y; ecore_evas_init(); ee = ecore_evas_new(NULL, 0, 0, 200, 200, NULL); ecore_evas_title_set(ee, "Ecore Evas Object Example"); ecore_evas_show(ee); bg = evas_object_rectangle_add(ecore_evas_get(ee)); evas_object_color_set(bg, 0, 0, 255, 255); evas_object_resize(bg, 200, 200); evas_object_show(bg); ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE); if (bg == ecore_evas_object_associate_get(ee)) printf("Association worked!\n"); cursor = evas_object_rectangle_add(ecore_evas_get(ee)); evas_object_color_set(cursor, 0, 255, 0, 255); evas_object_resize(cursor, 5, 10); ecore_evas_object_cursor_set(ee, cursor, 0, 1, 1); ecore_evas_cursor_get(ee, &obj, &layer, &x, &y); if (obj == cursor && layer == 0 && x == 1 && y == 1) printf("Set cursor worked!\n"); ecore_main_loop_begin(); ecore_evas_free(ee); ecore_evas_shutdown(); return 0; }
ApplicationController::ApplicationController(Evas *_e, Evas_Object *_l): evas(_e), layout(_l), mouseCursor(NULL), menu_hidden(false), homeController(NULL), mediaController(NULL), scenariosController(NULL), configController(NULL), keyboardController(NULL), webController(NULL), editScController(NULL), scheduleScController(NULL) { if (Utils::get_config_option("show_cursor") == "true") { mouseCursor = new EdjeObject(ApplicationMain::getTheme(), evas); try { mouseCursor->LoadEdje("calaos/cursor"); } catch(exception const& e) { cCritical() << "ApplicationController: Can't load mouse cursor"; throw; } int w, h; edje_object_size_min_get(mouseCursor->getEvasObject(), &w, &h); mouseCursor->Resize(w, h); mouseCursor->Show(); ecore_evas_object_cursor_set(ecore_evas_ecore_evas_get(evas), mouseCursor->getEvasObject(), EVAS_LAYER_MAX - 32, w / 2, h / 2); } else { Evas_Object *cursor = evas_object_rectangle_add(evas); evas_object_color_set(cursor, 0, 0, 0, 0); evas_object_resize(cursor, 1, 1); evas_object_show(cursor); ecore_evas_object_cursor_set(ecore_evas_ecore_evas_get(evas), cursor, EVAS_LAYER_MAX - 32, 0, 0); } menuView = new MainMenuView(evas, layout); menuView->setVersionString(PACKAGE_VERSION); menuView->on_home_click.connect(sigc::mem_fun(*this, &ApplicationController::onMenuHomeClick)); menuView->on_media_click.connect(sigc::mem_fun(*this, &ApplicationController::onMenuMediaClick)); menuView->on_scenario_click.connect(sigc::mem_fun(*this, &ApplicationController::onMenuScenarioClick)); menuView->on_config_click.connect(sigc::mem_fun(*this, &ApplicationController::onMenuConfigClick)); menuView->on_reboot_click.connect(sigc::mem_fun(*this, &ApplicationController::onMenuRebootClick)); menuView->on_suspend_click.connect(sigc::mem_fun(*this, &ApplicationController::onMenuSuspendClick)); menuView->on_widget_click.connect(sigc::mem_fun(*this, &ApplicationController::onMenuWidgetClick)); menuView->on_addwidget_click.connect(sigc::mem_fun(*this, &ApplicationController::onMenuAddWidgetClick)); //Start the model instance CalaosModel::Instance().home_loaded.connect(sigc::mem_fun(*this, &ApplicationController::home_loaded)); CalaosModel::Instance().login_failed.connect(sigc::mem_fun(*this, &ApplicationController::login_failed)); contentView = new MainContentView(evas, layout); elm_object_part_content_set(layout, "calaos.main.content", contentView->getSmartObject()); widgetsController = new ActivityWidgetsController(evas, layout); contentView->addView(widgetsController->getView()); menuView->on_menu_open.connect(sigc::mem_fun(*widgetsController, &ActivityWidgetsController::dimView)); menuView->on_menu_close.connect(sigc::mem_fun(*widgetsController, &ActivityWidgetsController::resetView)); menuView->on_widget_valid_click.connect(sigc::mem_fun(*widgetsController, &ActivityWidgetsController::validEdit)); menuView->on_widget_cancel_click.connect(sigc::mem_fun(*widgetsController, &ActivityWidgetsController::cancelEdit)); }
static Eina_Bool _e_elm_win_trap_show(void *data, Evas_Object *o) { Elm_Win_Trap_Ctx *ctx = data; Evas *e = evas_object_evas_get(o); Ecore_Evas *ee = ecore_evas_ecore_evas_get(e); Eina_Bool borderless; EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, EINA_TRUE); borderless = elm_win_borderless_get(o); if (!ctx->client) { E_Client *ec; Ecore_Window win; #ifdef HAVE_WAYLAND int64_t wl_win_id = -1; #endif E_Pixmap_Type type = E_PIXMAP_TYPE_X; win = elm_win_window_id_get(o); #ifdef HAVE_WAYLAND if (!strncmp(ecore_evas_engine_name_get(ee), "wayland", 7)) { Ecore_Wl2_Window *ewin = elm_win_wl_window_get(o); type = E_PIXMAP_TYPE_WL; ecore_evas_object_cursor_set(ee, NULL, 0, 0, 0); ctx->pointer = e_comp->pointer; elm_win_borderless_set(o, 1); wl_win_id = ecore_wl2_window_surface_id_get(ewin); } else #endif { type = E_PIXMAP_TYPE_X; ctx->pointer = e_pointer_window_new(win, EINA_TRUE); } if (type == E_PIXMAP_TYPE_WL) ec = e_pixmap_find_client(type, (int64_t)win); else ec = e_pixmap_find_client(type, win); if (ec) ctx->client = ec; else { E_Pixmap *cp; const char *title, *name, *clas; ecore_evas_name_class_get(ee, &name, &clas); if (!name) name = "E"; if (!clas) clas = "_e_internal_window"; ecore_evas_name_class_set(ee, name, clas); title = elm_win_title_get(o); if ((!title) || (!title[0])) title = "E"; ecore_evas_title_set(ee, title); if (type == E_PIXMAP_TYPE_WL) cp = e_pixmap_new(type, (int64_t)win); else cp = e_pixmap_new(type, win); EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_TRUE); #ifdef HAVE_WAYLAND if (wl_win_id >= 0) e_pixmap_alias(cp, type, wl_win_id); #endif current_win = ctx; ctx->client = e_client_new(cp, 0, 1); current_win = NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(ctx->client, EINA_TRUE); eina_stringshare_replace(&ctx->client->icccm.name, name); eina_stringshare_replace(&ctx->client->icccm.class, clas); eina_stringshare_replace(&ctx->client->icccm.title, title); } ctx->client->placed = ctx->placed | ctx->centered; ctx->client->internal_no_remember = ctx->internal_no_remember; ctx->client->internal_no_reopen = ctx->internal_no_reopen; ctx->client->internal_elm_win = o; elm_win_autodel_set(o, 1); evas_object_data_set(o, "E_Client", ctx->client); ctx->client->dialog = elm_win_type_get(o) == ELM_WIN_DIALOG_BASIC; ctx->client->tooltip = elm_win_type_get(o) == ELM_WIN_TOOLTIP; evas_object_size_hint_min_get(o, &ctx->client->icccm.min_w, &ctx->client->icccm.min_h); ctx->client->icccm.min_w = MAX(ctx->client->icccm.min_w, 0); ctx->client->icccm.min_h = MAX(ctx->client->icccm.min_h, 0); evas_object_size_hint_max_get(o, &ctx->client->icccm.max_w, &ctx->client->icccm.max_h); ctx->client->icccm.max_w = MAX(ctx->client->icccm.max_w, 0); ctx->client->icccm.max_h = MAX(ctx->client->icccm.max_h, 0); }