Exemple #1
0
static void
_elm_ews_border_maximized_apply(Ecore_Evas *ee, Evas_Object *o)
{
   int x, y, w, h;
   if (ecore_evas_maximized_get(ee))
     {
        Eina_Rectangle *r;
        int ex, ey, ew, eh;

        edje_object_signal_emit(o, "elm,state,maximized,on", "elm");
        edje_object_message_signal_process(o);
        ecore_evas_geometry_get(ee, &x, &y, &w, &h);

        r = _elm_ews_wm_border_geo_find(ee);
        if (!r)
          {
             r = malloc(sizeof(Eina_Rectangle));
             eina_hash_add(_ews_borders_geo, &ee, r);
          }

        r->x = x;
        r->y = y;
        r->w = w;
        r->h = h;
        _elm_ews_border_usable_screen_geometry_get(&x, &y, &w, &h);
        edje_object_parts_extends_calc(o, &ex, &ey, &ew, &eh);
        x -= ex;
        y -= ey;
        w -= ew - r->w;
        h -= eh - r->h;
     }
   else
     {
        Eina_Rectangle *r = _elm_ews_wm_border_geo_find(ee);
        edje_object_signal_emit(o, "elm,state,maximized,off", "elm");

        if (!r) ecore_evas_geometry_get(ee, &x, &y, &w, &h);
        else
          {
             x = r->x;
             y = r->y;
             w = r->w;
             h = r->h;
          }
     }

   ecore_evas_move_resize(ee, x, y, w, h);
   _elm_ews_border_geo_apply(ee, o);
}
Exemple #2
0
//Activate the menu item: deactivate other items and pop up the child menu of this item
void eclair_menu_item_activate(Eclair_Menu_Item *item)
{
   Eclair_Menu *menu;
   Eclair_Menu_Item *i;
   int menu_x, menu_y, menu_w, item_y = 0;
   int item_met = 0;
   Eina_List *l;

   if (!item || !(menu = item->parent) || item->is_active)
      return;

   //First, we deactivate all the items that are on the same menu than the item...
   for (l = menu->items; l; l = l->next)
   {
      if (!(i = l->data))
         continue;

      eclair_menu_item_deactivate(i);

      if (i == item)
         item_met = 1;
      if (!item_met)
         item_y += i->height;
   }

   edje_object_signal_emit(item->edje_object, "signal_activate", "eclair_bin");
   //...then we popup the child menu
   ecore_evas_geometry_get(menu->window, &menu_x, &menu_y, &menu_w, NULL);
   eclair_menu_popup_at_xy(item->child, menu_x + menu_w, menu_y + item_y);

   item->is_active = 1;
}
Exemple #3
0
//Feed the mouse move, in and out events to the menu windows and start to slide the windows if needed
static int _eclair_menu_mouse_move_cb(void *data, int type, void *event)
{
   Eclair_Menu *menu, *m;
   Eina_List *l;
   Ecore_X_Event_Mouse_Move *mouse_event;
   int menu_x, menu_y;

   mouse_event = event;
   if (!(menu = data) || mouse_event->win != _eclair_menu_input_window)
      return 1;

   _eclair_menu_mouse_x = mouse_event->x;
   _eclair_menu_mouse_y = mouse_event->y;

   for (l = _eclair_menu_popped_menus; l; l = l->next)
   {
      if (!(m = l->data))
         continue;

      ecore_evas_geometry_get(m->window, &menu_x, &menu_y, NULL, NULL);
      evas_event_feed_mouse_move(m->evas, mouse_event->x - menu_x, mouse_event->y - menu_y, mouse_event->time, NULL);
      
      //Start to slide the menu window if we need
      _eclair_menu_update_slide_timer(m);
   }

   return 1;
}
Exemple #4
0
/**
 * @brief: Automatically saves all open notes into the storage.
 */
void
autosave(void)
{
	int             x, y, w, h;
	Note           *note;
	Evas_List      *tmp = gbl_notes;
	NoteStor       *n;

	dml("Autosaving", 1);

	while (tmp != NULL) {
		note = evas_list_data(tmp);
		ecore_evas_geometry_get(note->win, &x, &y, &w, &h);
		n = alloc_note_stor();
		n->width = w;
		n->height = h;
		n->x = x;
		n->y = y;
		n->shaded = note->shaded;
		n->content = strdup(get_content_by_note(tmp));
		append_note_stor(n);
		free_note_stor(n);
		tmp = evas_list_next(tmp);
	}

	dml("Autosaved Notes", 1);

	return;
}
Exemple #5
0
//Return a flag incating on which edges of the screen the menu is over
static Eclair_Menu_Screen_Edge _eclair_menu_over_screen_edge(Eclair_Menu *menu)
{
   int root_x, root_y, root_w, root_h;
   int menu_x, menu_y, menu_w, menu_h;
   Eclair_Menu_Screen_Edge result = ECLAIR_MENU_NO_EDGE;

   if (!menu)
      return ECLAIR_MENU_NO_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 (menu_x < root_x)
   {
      result |= ECLAIR_MENU_LEFT_EDGE;
   }
   if (menu_x + menu_w > root_x + root_w)
      result |= ECLAIR_MENU_RIGHT_EDGE;
   if (menu_y < root_y)
      result |= ECLAIR_MENU_TOP_EDGE;
   if (menu_y + menu_h > root_y + root_h)
      result |= ECLAIR_MENU_BOTTOM_EDGE;
      
   return result;
}
Exemple #6
0
static void
_elm_ews_border_geo_apply(Ecore_Evas *ee, Evas_Object *o)
{
   int x, y, w, h;
   ecore_evas_geometry_get(ee, &x, &y, &w, &h);
   evas_object_geometry_set(o, x, y, w, h);
}
Exemple #7
0
/**
 * @brief Implementation of get_extents from AtkComponetnt interface
 *
 * @param component object instance
 * @param x address of gint to store x coordinate
 * @param y address of gint to store y coordinate
 * @param width address of gint to store width
 * @param height address of gint to store height
 * @param coord_type  coordinates type as ATK defines
 */
static void
eail_naviframe_page_get_extents(AtkComponent *component,
                                gint *x,
                                gint *y,
                                gint *width,
                                gint *height,
                                AtkCoordType coord_type)
{
   EailNaviframePage *page;
   Evas_Object *widget;
   g_return_if_fail(EAIL_IS_NAVIFRAME_PAGE(component));

   page = EAIL_NAVIFRAME_PAGE(component);
   *x = *y = *width = *height = G_MININT;
   if (!page->naviframe) return;

   widget = page->naviframe;

   evas_object_geometry_get(widget, x, y, width, height);
   if (coord_type == ATK_XY_SCREEN)
     {
        int ee_x, ee_y;

        Ecore_Evas *ee = ecore_evas_ecore_evas_get(
           evas_object_evas_get(widget));
        ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL);
        *x += ee_x;
        *y += ee_y;
     }
}
Exemple #8
0
END_TEST

/* This will only check that all pixels are valid premultiplied values
 * and that they are not all zero.
 */
static Eina_Bool
_ecore_evas_pixels_check(Ecore_Evas *ee)
{
   const DATA32 *pixels;
   Eina_Bool nonzero = EINA_FALSE;
   int w = 0, h = 0;

   pixels = ecore_evas_buffer_pixels_get(ee);
   if (!pixels) return EINA_FALSE;

   ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
   if (!w || !h) return EINA_FALSE;

   for (int k = w * h; k; k--, pixels++)
     {
        DATA8 *rgba = (DATA8 *) pixels;

        if (*pixels && (*pixels != 0xFF000000)) nonzero = EINA_TRUE;
        if ((rgba[ALPHA] < rgba[RED])
            || (rgba[ALPHA] < rgba[GREEN])
            || (rgba[ALPHA] < rgba[BLUE]))
          {
             printf("Invalid RGBA values!\n");
             return EINA_FALSE;
          }
     }

   if (!nonzero) printf("All pixels are empty!\n");
   return nonzero;
}
/* here just to keep our example's window size and background image's
 * size in synchrony */
static void
_canvas_resize_cb(Ecore_Evas *ee)
{
   int w, h;

   ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
   evas_object_resize(d.bg, w, h);
}
void EcoreEvasWindow::resizeEvent()
{
    int x, y, w, h;
    ecore_evas_geometry_get( _ee, &x, &y, &w, &h );
    Dout( dc::notice, "EcoreEvasWindow::resizeEvent( " << x << "," << y << "*" << w << "," << h << " )" );
    Dout( dc::notice, " - evas viewport size = " << _canvas->viewport() );
    Dout( dc::notice, " - evas output   size = " << _canvas->size() );
    //FIXME: Resize manually if not fullscreen
}
Exemple #11
0
WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage()
{
    int width;
    int height;
    ecore_evas_geometry_get(m_window, 0, 0, &width, &height);
    ASSERT(width > 0 && height > 0);

    return adoptWK(WKViewCreateSnapshot(EWKViewGetWKView(m_view)));
}
Exemple #12
0
/**
 * @internal
 *
 * This function takes actual shot and saves it in PNG
 * @param data Tsuite_Data pointer initiated by user
 * @param obj  Window pointer
 * @param obj  name file name. Will use name_+serial if NULL
 *
 * @ingroup Tsuite
 */
void
tsuite_shot_do(char *name, Evas *e)
{
   if (!e)
     return;

   Ecore_Evas *ee, *ee_orig;
   Evas_Object *o;
   unsigned int *pixels;
   int w, h,dir_name_len = 0;
   char *filename;
   if (_hook_setting->dest_dir)
     dir_name_len = strlen(_hook_setting->dest_dir) + 1; /* includes space of a '/' */

   if (name)
     {
        filename = malloc(strlen(name) + strlen(IMAGE_FILENAME_EXT) +
              dir_name_len + 4);

        if (_hook_setting->dest_dir)
          sprintf(filename, "%s/", _hook_setting->dest_dir);

        sprintf(filename + dir_name_len, "%s%s", name, IMAGE_FILENAME_EXT);
     }
   else
     {
        filename = malloc(strlen(_hook_setting->test_name) + strlen(IMAGE_FILENAME_EXT) +
              dir_name_len + 8); /* also space for serial */

        ts.serial++;
        if (_hook_setting->dest_dir)
          sprintf(filename, "%s/", _hook_setting->dest_dir);

        sprintf(filename + dir_name_len, "%s_%d%s", _hook_setting->test_name,
              ts.serial, IMAGE_FILENAME_EXT);
     }

   ee_orig = ecore_evas_ecore_evas_get(e);

   ecore_evas_manual_render(ee_orig);
   pixels = (void *)ecore_evas_buffer_pixels_get(ee_orig);
   if (!pixels) return;
   ecore_evas_geometry_get(ee_orig, NULL, NULL, &w, &h);
   if ((w < 1) || (h < 1)) return;
   ee = ecore_evas_buffer_new(1, 1);
   o = evas_object_image_add(ecore_evas_get(ee));
   evas_object_image_alpha_set(o, ecore_evas_alpha_get(ee_orig));
   evas_object_image_size_set(o, w, h);
   evas_object_image_data_set(o, pixels);

   if (!evas_object_image_save(o, filename, NULL, NULL))
     {
        printf("Cannot save widget to <%s>\n", filename);
     }
   ecore_evas_free(ee);
   free(filename);
}
Exemple #13
0
static void
_elm_ews_border_usable_screen_geometry_get(int *x, int *y, int *w, int *h)
{
   Ecore_Evas *ee = ecore_evas_ews_ecore_evas_get();
   ecore_evas_geometry_get(ee, NULL, NULL, w, h);
   if (x) *x = 0;
   if (y) *y = 0;
   // TODO: when add a shelf for iconified, subtract its area here.
}
static Eina_Bool
_wm_win_resize(void *data, int type, void *event_info)
{
   Ecore_Evas *ee = event_info;
   int w, h;
   ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
   printf("WM: window=%p resized to %dx%d\n", ee, w, h);
   return EINA_TRUE;
}
static Eina_Bool
_wm_win_move(void *data, int type, void *event_info)
{
   Ecore_Evas *ee = event_info;
   int x, y;
   ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
   printf("WM: window=%p moved to %d,%d\n", ee, x, y);
   return EINA_TRUE;
}
Exemple #16
0
static void
update_state(WaylandIMContext *imcontext)
{
   char *surrounding = NULL;
   int cursor_pos;
   Ecore_Evas *ee;
   int canvas_x = 0, canvas_y = 0;
   Eina_Bool changed = EINA_FALSE;

   if (!imcontext->ctx)
     return;

   /* cursor_pos is a byte index */
   if (ecore_imf_context_surrounding_get(imcontext->ctx, &surrounding, &cursor_pos))
     {
        if (imcontext->text_input)
          {
             zwp_text_input_v1_set_surrounding_text(imcontext->text_input,
                                                    surrounding,
                                                    cursor_pos, cursor_pos);
             changed = EINA_TRUE;
          }

        if (surrounding)
          free(surrounding);
     }

   if (imcontext->canvas)
     {
        ee = ecore_evas_ecore_evas_get(imcontext->canvas);
        if (ee)
          ecore_evas_geometry_get(ee, &canvas_x, &canvas_y, NULL, NULL);
     }

   EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "canvas (x: %d, y: %d)", 
                     canvas_x, canvas_y);

   if (imcontext->text_input)
     {
        if (imcontext->cursor_location.do_set)
          {
             zwp_text_input_v1_set_cursor_rectangle(imcontext->text_input,
                                                    imcontext->cursor_location.x + canvas_x,
                                                    imcontext->cursor_location.y + canvas_y,
                                                    imcontext->cursor_location.width,
                                                    imcontext->cursor_location.height);
             imcontext->cursor_location.do_set = EINA_FALSE;
             changed = EINA_TRUE;
          }
     }

   if (changed)
     zwp_text_input_v1_commit_state(imcontext->text_input, ++imcontext->serial);

   _clear_hide_timer();
}
Exemple #17
0
static void erss_window_move_tooltip (Ecore_Evas * ee)
{
	int x, y, w, h;
	Evas_Object *o = NULL;
	
	ecore_evas_geometry_get (ee, &x, &y, &w, &h);

	if((o = evas_object_name_find(ecore_evas_get(ee), "root_background")))
			esmart_trans_x11_freshen(o, x, y, w, h);
}
Exemple #18
0
/**
 * Resizes the Edje to the size of our Ecore Evas
 *
 * @param ee
 */
static void cb_ee_resize(Ecore_Evas *ee) {
	Evas *evas = ecore_evas_get(ee);
	Evas_Object *edje = evas_object_name_find(evas, "main_edje");
	Evas_Object *dragger = evas_object_name_find(evas, "dragger");
	int w = 0, h = 0;

	ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
	evas_object_resize(edje, (Evas_Coord) w, (Evas_Coord) h);
	evas_object_resize(dragger, (Evas_Coord) w, (Evas_Coord) h);
}
Exemple #19
0
static void
_elm_plug_resized(Ecore_Evas *ee)
{
   Evas_Coord_Size size = {0, 0};
   Evas_Object *plug = ecore_evas_data_get(ee, PLUG_KEY);
   EINA_SAFETY_ON_NULL_RETURN(plug);

   ecore_evas_geometry_get(ee, NULL, NULL, &(size.w), &(size.h));
   eo_do(plug, eo_event_callback_call(ELM_PLUG_EVENT_IMAGE_RESIZED, &size));
}
Exemple #20
0
//Return 1 is the mouse is in the menu
static int _eclair_menu_mouse_is_in(Eclair_Menu *menu)
{
   int menu_x, menu_y, menu_w, menu_h;

   if (!menu)
      return 0;

   ecore_evas_geometry_get(menu->window, &menu_x, &menu_y, &menu_w, &menu_h);
   return (_eclair_menu_mouse_x >= menu_x && _eclair_menu_mouse_x <= menu_x + menu_w
      && _eclair_menu_mouse_y >= menu_y && _eclair_menu_mouse_y <= menu_y + menu_h);
}
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);
         }
Exemple #22
0
static void resizeInspectorWindow(Ecore_Evas* inspectorWindow)
{
    Evas_Object* inspectorView = evas_object_name_find(ecore_evas_get(inspectorWindow), "inspector");
    if (!inspectorView)
        return;

    int width, height;
    ecore_evas_geometry_get(inspectorWindow, 0, 0, &width, &height);

    evas_object_move(inspectorView, 0, 0);
    evas_object_resize(inspectorView, width, height);
}
Exemple #23
0
/**
 * @param ee: The Ecore_Evas the event occurred on.
 * @brief: Ecore callback for the resising of the window.  This function
 *         resises the edje and esmart dragger according to the new
 *         window size.
 */
void
cc_resize(Ecore_Evas * ee)
{
	int             x, y, w, h;

	ecore_evas_geometry_get(ee, &x, &y, &w, &h);
	evas_object_resize(evas_object_name_find
			   (ecore_evas_get(ee), "edje"), w, h);
	evas_object_resize(evas_object_name_find(ecore_evas_get(ee), "dragger"),
			   w, h);
	return;
}
/* to inform current window's size */
static void
_canvas_resize_cb(Ecore_Evas *ee_)
{
   int w, h;
   char buf[1024];

   ecore_evas_geometry_get(ee_, NULL, NULL, &w, &h);
   snprintf(buf, sizeof(buf), "%d x %d", w, h);
   evas_object_text_text_set(text, buf);
   evas_object_move(text, (w - 150) / 2, (h - 50) / 2);

   evas_object_resize(bg, w, h);
}
Exemple #25
0
/* here just to keep our example's window size and background image's
 * size in synchrony */
static void
_canvas_resize_cb(Ecore_Evas *ee)
{
   int w, h;

   ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
   evas_object_resize(d.bg, w, h);

   evas_object_move(d.box, (w / 4), (h / 4));
   evas_object_resize(d.box, (w / 2), (h / 2));

   evas_object_move(d.border, (w / 4) - 3, (h / 4) - 3);
   evas_object_resize(d.border, (w / 2) + 6, (h / 2) + 6);
}
Exemple #26
0
static void on_ecore_evas_resize(Ecore_Evas *ee)
{
    Evas_Object *webview;
    Evas_Object *bg;
    int w, h;

    ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);

    bg = evas_object_name_find(ecore_evas_get(ee), "bg");
    evas_object_move(bg, 0, 0);
    evas_object_resize(bg, w, h);

    webview = evas_object_name_find(ecore_evas_get(ee), "browser");
    evas_object_move(webview, 0, 0);
    evas_object_resize(webview, w, h);
}
Exemple #27
0
void
set_cc_pos()
{
	int             x, y, width, height;

	if (controlcentre == NULL) {
		return;
	}

	ecore_evas_geometry_get(controlcentre->win, &x, &y, &width, &height);

	ecore_config_int_set("controlcentre.x", x);
	ecore_config_int_set("controlcentre.y", y);
	ecore_config_int_set("controlcentre.w", width);
	ecore_config_int_set("controlcentre.h", height);

	return;
}
PassRefPtr<cairo_surface_t> createSurfaceForBackingStore(Ecore_Evas* ee)
{
    ASSERT(ee);

    int width;
    int height;
    ecore_evas_geometry_get(ee, 0, 0, &width, &height);
    ASSERT(width > 0 && height > 0);

    unsigned char* buffer = static_cast<unsigned char*>(const_cast<void*>(ecore_evas_buffer_pixels_get(ee)));
    RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create_for_data(buffer, CAIRO_FORMAT_ARGB32, width, height, width * 4));

    cairo_status_t status = cairo_surface_status(surface.get());
    if (status != CAIRO_STATUS_SUCCESS) {
        EINA_LOG_ERR("Could not create cairo surface: %s", cairo_status_to_string(status));
        return 0;
    }

    return surface.release();
}
Exemple #29
0
static int
fix_bg (void *data)
{
  int x, y, w, h;
  Ecore_Evas *ee = NULL;
  Evas_Object *o = NULL;

  if ((ee = (Ecore_Evas *) data))
    {
      ecore_evas_geometry_get (ee, &x, &y, &w, &h);
      if ((o =
	   evas_object_name_find (ecore_evas_get (ee), "root_background")))
	{
	  evas_object_resize (o, w, h);
	  esmart_trans_x11_freshen (o, x, y, w, h);
	}
    }
  refresh_timer = NULL;
  return (0);
}
Exemple #30
0
static void
window_resize_cb (Ecore_Evas * ee)
{
  int x, y, w, h;
  Evas_Object *o = NULL;

  ecore_evas_geometry_get (ee, &x, &y, &w, &h);
  if (refresh_timer)
    ecore_timer_del (refresh_timer);
  refresh_timer = ecore_timer_add (RESIZE_REFRESH, fix_bg, ee);

  if ((o = evas_object_name_find (ecore_evas_get (ee), "background")))
    evas_object_resize (o, w, h);
  if ((o = evas_object_name_find (ecore_evas_get (ee), "container")))
    evas_object_resize (o, w, h);
  if ((o = evas_object_name_find (ecore_evas_get (ee), "dragger")))
    evas_object_resize (o, w, h);
  if ((o = evas_object_name_find (ecore_evas_get (ee), "xpixmap")))
    evas_object_resize (o, w, h);
}