static void erss_tooltip_show (Erss_Tooltip *tt) { tt->timer = NULL; ecore_evas_move (tt->ee, world_x + tt->x - 10, world_y + tt->y - 10); ecore_evas_show (tt->ee); }
//Popup the menu at the position (x, y) void eclair_menu_popup_at_xy(Eclair_Menu *menu, int x, int y) { if (!menu) return; if (!_eclair_menu_input_window) { Ecore_X_Window root, parent; int root_x, root_y, root_w, root_h; root = menu->x_window; while ((parent = ecore_x_window_parent_get(root)) != 0) root = parent; ecore_x_window_geometry_get(root, &root_x, &root_y, &root_w, &root_h); _eclair_menu_input_window = ecore_x_window_input_new(root, root_x, root_y, root_w, root_h); } if (!_eclair_menu_root) { _eclair_menu_mouse_up_handler = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_UP, _eclair_menu_mouse_up_cb, menu); _eclair_menu_mouse_move_handler = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_MOVE, _eclair_menu_mouse_move_cb, menu); ecore_x_window_show(_eclair_menu_input_window); ecore_x_keyboard_grab(_eclair_menu_input_window); ecore_x_pointer_confine_grab(_eclair_menu_input_window); _eclair_menu_root = menu; } ecore_evas_move(menu->window, x, y); ecore_evas_show(menu->window); evas_event_feed_mouse_move(menu->evas, -100000, -100000, ecore_x_current_time_get(), NULL); evas_event_feed_mouse_in(menu->evas, ecore_x_current_time_get(), NULL); _eclair_menu_popped_menus = eina_list_append(_eclair_menu_popped_menus, menu); _eclair_menu_update_slide_timer(menu); }
static void _ecore_evas_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y) { Ecore_Evas *ee = data; // FIXME: account for frame ecore_evas_move(ee, x, y); if (ecore_evas_override_get(ee)) evas_object_move(obj, x, y); }
static Eina_Bool _stdin_cb(void *data, Ecore_Fd_Handler *handler) { const Eina_List *l; Ecore_Evas *ee; char c = getchar(); if (c == EOF) { ecore_main_loop_quit(); return EINA_FALSE; } switch (c) { case 'h': printf("hide all windows\n"); EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee) ecore_evas_hide(ee); break; case 's': printf("show all windows\n"); EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee) ecore_evas_show(ee); break; case 'l': printf("move all windows left\n"); EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee) { int x, y; ecore_evas_geometry_get(ee, &x, &y, NULL, NULL); ecore_evas_move(ee, x - 10, y); } break; case 'r': printf("move all windows right\n"); EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee) { int x, y; ecore_evas_geometry_get(ee, &x, &y, NULL, NULL); ecore_evas_move(ee, x + 10, y); }
static Eina_Bool _e_popup_idle_enterer(void *data) { E_Popup *pop; if (!(pop = data)) return ECORE_CALLBACK_CANCEL; ecore_evas_move(pop->ecore_evas, pop->zone->x + pop->x, pop->zone->y + pop->y); e_container_shape_show(pop->shape); pop->idle_enterer = NULL; return ECORE_CALLBACK_CANCEL; }
EAPI void e_popup_move(E_Popup *pop, int x, int y) { E_OBJECT_CHECK(pop); E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE); if ((pop->x == x) && (pop->y == y)) return; pop->x = x; pop->y = y; ecore_evas_move(pop->ecore_evas, pop->zone->x + pop->x, pop->zone->y + pop->y); e_container_shape_move(pop->shape, pop->zone->x + pop->x, pop->zone->y + pop->y); }
EAPI void e_popup_show(E_Popup *pop) { E_OBJECT_CHECK(pop); E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE); if (pop->visible) return; pop->visible = 1; if ((pop->shaped) && (!e_config->use_composite)) { ecore_evas_move(pop->ecore_evas, pop->zone->container->manager->w, pop->zone->container->manager->h); ecore_evas_show(pop->ecore_evas); if (pop->idle_enterer) ecore_idle_enterer_del(pop->idle_enterer); pop->idle_enterer = ecore_idle_enterer_add(_e_popup_idle_enterer, pop); } else { ecore_evas_show(pop->ecore_evas); if (!(pop->shaped && e_config->use_composite)) e_container_shape_show(pop->shape); } }
static void _mouse_move_cb (void *data, Evas * evas, Evas_Object * obj, void *ev) { Esmart_Draggies *drag = NULL; Ecore_Event_Mouse_Move *evx = NULL; if ((drag = (Esmart_Draggies *) data)) { if (ecore_event_current_type_get () == ECORE_EVENT_MOUSE_MOVE) { if ((evx = ecore_event_current_event_get ())) { if (drag->clicked) { int dx, dy; dx = evx->root.x - drag->dx; dy = evx->root.y - drag->dy; ecore_evas_move (drag->ee, dx, dy); } } } } }
void EcoreEvasWindow::move( const Point& point ) { ecore_evas_move( _ee, point.x(), point.y() ); }
void setup_cc_with_pos(int x, int y) { ControlCentre *cc; char *edjefn = malloc(PATH_MAX); char *fontpath = malloc(PATH_MAX); Evas_Coord edje_w, edje_h; CCPos *pos; cc = malloc(sizeof(ControlCentre)); controlcentre = cc; pos = get_cc_pos(); if (x >= 0 || y >= 0) { pos->x = x; pos->y = y; } /* Setup the Window */ if (!strcmp(main_config->render_method, "gl")) { #ifdef HAVE_ECORE_EVAS_GL cc->win = ecore_evas_gl_x11_new(NULL, 0, pos->x, pos->y, pos->width, pos->height); #else dml("GL not in Ecore_Evas module. Falling back on software!", 1); free(main_config->render_method); main_config->render_method = strdup("software"); cc->win = ecore_evas_software_x11_new(NULL, 0, pos->x, pos->y, pos->width, pos->height); #endif } else cc->win = ecore_evas_software_x11_new(NULL, 0, pos->x, pos->y, pos->width, pos->height); ecore_evas_title_set(cc->win, "Enotes"); ecore_evas_name_class_set(cc->win, "Enotes", "Enotes"); if (main_config->ontop == 1) ecore_evas_layer_set(cc->win, 7); else ecore_evas_layer_set(cc->win, 2); if (main_config->sticky == 1) ecore_evas_sticky_set(cc->win, 1); else ecore_evas_sticky_set(cc->win, 0); ecore_evas_borderless_set(cc->win, 1); ecore_evas_shaped_set(cc->win, 1); if (pos->x != 0 && pos->y != 0) ecore_evas_resize(cc->win, pos->x, pos->y); ecore_evas_show(cc->win); // if(main_config->ontop==1) /* Moving the damn thing */ ecore_evas_move(cc->win, pos->x, pos->y); /* Setup the Canvas, Render-Method and Font Path */ cc->evas = ecore_evas_get(cc->win); evas_output_method_set(cc->evas, evas_render_method_lookup(main_config-> render_method)); snprintf(fontpath, PATH_MAX, "%s/fonts", PACKAGE_DATA_DIR); evas_font_path_append(cc->evas, fontpath); free(fontpath); /* Draggable Setup */ cc->dragger = esmart_draggies_new(cc->win); evas_object_name_set(cc->dragger, "dragger"); evas_object_move(cc->dragger, 0, 0); evas_object_layer_set(cc->dragger, 0); evas_object_color_set(cc->dragger, 255, 255, 255, 0); esmart_draggies_button_set(cc->dragger, 1); evas_object_show(cc->dragger); /* Setup the EDJE */ cc->edje = edje_object_add(cc->evas); snprintf(edjefn, PATH_MAX, CC_EDJE, PACKAGE_DATA_DIR, main_config->theme); edje_object_file_set(cc->edje, edjefn, CC_PART); free(edjefn); evas_object_move(cc->edje, 0, 0); evas_object_layer_set(cc->edje, 1); evas_object_name_set(cc->edje, "edje"); evas_object_pass_events_set(cc->edje, 0); evas_object_show(cc->edje); if (pos->shaded) edje_object_signal_emit(cc->edje, EDJE_SIGNAL_CC_SHADE "_GO", ""); else edje_object_signal_emit(cc->edje, EDJE_SIGNAL_CC_UNSHADE "_GO", ""); /* EDJE and ECORE min, max and resizing */ edje_object_size_max_get(cc->edje, &edje_w, &edje_h); ecore_evas_size_max_set(cc->win, edje_w, edje_h); edje_object_size_min_get(cc->edje, &edje_w, &edje_h); ecore_evas_size_min_set(cc->win, edje_w, edje_h); ecore_evas_resize(cc->win, (int) edje_w, (int) edje_h); evas_object_resize(cc->edje, edje_w, edje_h); evas_object_resize(cc->dragger, edje_w, edje_h); /* Ecore Callbacks */ ecore_evas_callback_resize_set(cc->win, cc_resize); ecore_evas_callback_destroy_set(cc->win, cc_close_win); ecore_evas_callback_delete_request_set(cc->win, cc_close_win); /* Edje Callbacks */ edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_MINIMIZE, "", (void *) cc_minimize, cc->win); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_CLOSE, "", (void *) cc_close, NULL); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SAVELOAD, "", (void *) cc_saveload, NULL); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SETTINGS, "", (void *) cc_settings, NULL); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_NEW, "", (void *) cc_newnote, NULL); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SHADE, "", (void *) cc_shade, NULL); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_UNSHADE, "", (void *) cc_unshade, NULL); free(pos); return; }
//Slide the menu (called every 1/60 sec) static int _eclair_menu_slide_timer_cb(void *data) { Eclair_Menu *menu = NULL, *m; Eina_List *l; Eclair_Menu_Screen_Edge mouse_edge, menu_edge = ECLAIR_MENU_NO_EDGE; int root_x, root_y, root_w, root_h; int menu_x, menu_y, menu_w, menu_h; int x, y; int dx = 0, dy = 0, max_delta = (int)(1.0 / 60.0 * 800); //TODO: FIXME: We could have problem with menus bigger than the screen width //We first look the menu that is over an edge of the screen for (l = _eclair_menu_popped_menus; l; l = l->next) { if (!(m = l->data)) continue; if ((menu_edge = _eclair_menu_over_screen_edge(m)) != ECLAIR_MENU_NO_EDGE) { menu = m; break; } } if (!menu) { _eclair_menu_slide_timer = NULL; return 0; } //Then we move all the menu windows in the right direction mouse_edge = _eclair_menu_mouse_on_screen_edge(); ecore_x_window_geometry_get(_eclair_menu_input_window, &root_x, &root_y, &root_w, &root_h); ecore_evas_geometry_get(menu->window, &menu_x, &menu_y, &menu_w, &menu_h); if (mouse_edge & menu_edge & ECLAIR_MENU_LEFT_EDGE) { if (max_delta < root_x - menu_x) dx = max_delta; else dx = root_x - menu_x; } if (mouse_edge & menu_edge & ECLAIR_MENU_RIGHT_EDGE) { if (max_delta < menu_w - root_x - root_w + menu_x) dx = -max_delta; else dx = -menu_w + root_x + root_w - menu_x; } if (mouse_edge & menu_edge & ECLAIR_MENU_TOP_EDGE) { if (max_delta < root_y - menu_y) dy = max_delta; else dy = root_y - menu_y; } if (mouse_edge & menu_edge & ECLAIR_MENU_BOTTOM_EDGE) { if (max_delta < menu_h - root_y - root_h + menu_y) dy = -max_delta; else dy = -menu_h + root_y + root_h - menu_y; } if (dx == 0 && dy == 0) { _eclair_menu_slide_timer = NULL; return 0; } for (l = _eclair_menu_popped_menus; l; l = l->next) { if (!(m = l->data)) continue; ecore_evas_geometry_get(m->window, &x, &y, NULL, NULL); ecore_evas_move(m->window, x + dx, y + dy); //We feed a mouse move event since the relative position between //the mouse pointer and the menu window has changed evas_event_feed_mouse_move(m->evas, _eclair_menu_mouse_x - x, _eclair_menu_mouse_y - y, ecore_x_current_time_get(), NULL); } return 1; }