コード例 #1
0
ファイル: edje_callbacks.c プロジェクト: tasn/efl
static void
_edje_mouse_down_signal_cb(void *data, const Efl_Event *event)
{
   Efl_Input_Pointer_Data *ev;
   Edje *ed;
   Edje_Real_Part *rp;
   char buf[256];
   int ignored;

   ev = efl_data_scope_get(event->info, EFL_INPUT_POINTER_CLASS);
   ed = data;
   rp = evas_object_data_get(event->object, "real_part");
   if (!rp) return;

   ignored = rp->ignore_flags & ev->event_flags;

   _edje_ref(ed);
   _edje_util_freeze(ed);

   if ((!ev->event_flags) || (!ignored))
     {
        if (ev->button_flags & EVAS_BUTTON_TRIPLE_CLICK)
          snprintf(buf, sizeof(buf), "mouse,down,%i,triple", ev->button);
        else if (ev->button_flags & EVAS_BUTTON_DOUBLE_CLICK)
          snprintf(buf, sizeof(buf), "mouse,down,%i,double", ev->button);
        else
          snprintf(buf, sizeof(buf), "mouse,down,%i", ev->button);
        _edje_seat_emit(ed, ev->device, buf, rp->part->name);
     }

   if (rp->part->dragable.event_id >= 0)
     {
        rp = ed->table_parts[rp->part->dragable.event_id % ed->table_parts_size];
        if (!ignored)
          {
             snprintf(buf, sizeof(buf), "mouse,down,%i", ev->button);
             _edje_seat_emit(ed, ev->device, buf, rp->part->name);
          }
     }

   if (rp->drag)
     {
        if (rp->drag->down.count == 0)
          {
             if (rp->part->dragable.x)
               rp->drag->down.x = ev->cur.x;
             if (rp->part->dragable.y)
               rp->drag->down.y = ev->cur.y;
             rp->drag->threshold_x = EINA_FALSE;
             rp->drag->threshold_y = EINA_FALSE;
             rp->drag->threshold_started_x = EINA_TRUE;
             rp->drag->threshold_started_y = EINA_TRUE;
          }
        rp->drag->down.count++;
     }

   if (rp->clicked_button == 0)
     {
        rp->clicked_button = ev->button;
        if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
          rp->still_in = EINA_TRUE;
     }
//   _edje_recalc_do(ed);
   _edje_util_thaw(ed);
   _edje_unref(ed);

   ev->event_flags |= rp->mask_flags;
}
コード例 #2
0
ファイル: edje_callbacks.c プロジェクト: tasn/efl
static void
_edje_mouse_up_signal_cb(void *data, const Efl_Event *event)
{
   Efl_Input_Pointer_Data *ev;
   Edje *ed;
   Edje_Real_Part *rp;
   char buf[256];
   int ignored;

   ev = efl_data_scope_get(event->info, EFL_INPUT_POINTER_CLASS);
   ed = data;
   rp = evas_object_data_get(event->object, "real_part");
   if (!rp) return;

   ignored = rp->ignore_flags & ev->event_flags;

   _edje_ref(ed);
   _edje_util_freeze(ed);

   if ((!ev->event_flags) || (!ignored))
     {
        snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button);
        _edje_seat_emit(ed, ev->device, buf, rp->part->name);
     }

   if (rp->part->dragable.event_id >= 0)
     {
        rp = ed->table_parts[rp->part->dragable.event_id % ed->table_parts_size];
        if (!ignored)
          {
             snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button);
             _edje_seat_emit(ed, ev->device, buf, rp->part->name);
          }
     }

   if (rp->drag)
     {
        if (rp->drag->down.count > 0)
          {
             rp->drag->down.count--;
             if (rp->drag->down.count == 0)
               {
                  rp->drag->threshold_started_x = EINA_FALSE;
                  rp->drag->threshold_started_y = EINA_FALSE;
                  rp->drag->need_reset = 1;
                  ed->recalc_call = EINA_TRUE;
                  ed->dirty = EINA_TRUE;
#ifdef EDJE_CALC_CACHE
                  rp->invalidate = EINA_TRUE;
#endif
                  if (!ignored && rp->drag->started)
                    _edje_seat_emit(ed, ev->device, "drag,stop",
                                    rp->part->name);
                  rp->drag->started = EINA_FALSE;
                  _edje_recalc_do(ed);
               }
          }
     }

   if ((rp->still_in) && (rp->clicked_button == ev->button) && (!ev->event_flags))
     {
        snprintf(buf, sizeof(buf), "mouse,clicked,%i", ev->button);
        _edje_seat_emit(ed, ev->device, buf, rp->part->name);
     }
   rp->clicked_button = 0;
   rp->still_in = EINA_FALSE;

//   _edje_recalc_do(ed);
   _edje_util_thaw(ed);
   _edje_unref(ed);

   ev->event_flags |= rp->mask_flags;
}
コード例 #3
0
ファイル: edje_callbacks.c プロジェクト: tasn/efl
static void
_edje_mouse_move_signal_cb(void *data, const Efl_Event *event)
{
   Efl_Input_Pointer_Data *ev;
   Edje *ed;
   Edje_Real_Part *rp;
   int ignored;

   ev = efl_data_scope_get(event->info, EFL_INPUT_POINTER_CLASS);
   ed = data;
   rp = evas_object_data_get(event->object, "real_part");
   if (!rp) return;
   if (rp->part->dragable.event_id >= 0)
     {
        rp = ed->table_parts[rp->part->dragable.event_id % ed->table_parts_size];
     }

   ignored = rp->ignore_flags & ev->event_flags;

   _edje_ref(ed);
   if ((!ev->event_flags) || (!ignored))
     _edje_seat_emit(ed, ev->device, "mouse,move", rp->part->name);

   if (rp->still_in)
     {
        if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
          rp->still_in = EINA_FALSE;
        else
          {
             Evas_Coord x, y, w, h;

             evas_object_geometry_get(event->object, &x, &y, &w, &h);
             if ((ev->cur.x < x) || (ev->cur.y < y) ||
                 (ev->cur.x >= (x + w)) || (ev->cur.y >= (y + h)))
               {
                  if ((ev->pressed_buttons) && ((!ev->event_flags) || (!ignored)))
                    _edje_seat_emit(ed, ev->device, "mouse,pressed,out",
                                    rp->part->name);

                  rp->still_in = EINA_FALSE;
               }
          }
     }
   else
     {
        if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
          {
             Evas_Coord x, y, w, h;

             evas_object_geometry_get(event->object, &x, &y, &w, &h);
             if ((ev->cur.x >= x) && (ev->cur.y >= y) &&
                 (ev->cur.x < (x + w)) && (ev->cur.y < (y + h)))
               {
                  if ((ev->pressed_buttons) && ((!ev->event_flags) || (!ignored)))
                    _edje_seat_emit(ed, ev->device, "mouse,pressed,in",
                                    rp->part->name);

                  rp->still_in = EINA_TRUE;
               }
          }
     }
   _edje_util_freeze(ed);
   if (rp->drag)
     {
        if (rp->drag->down.count > 0)
          {
             if (rp->part->dragable.x)
               rp->drag->tmp.x = ev->cur.x - rp->drag->down.x;
             if (rp->part->dragable.y)
               rp->drag->tmp.y = ev->cur.y - rp->drag->down.y;
             ed->recalc_call = EINA_TRUE;
             ed->dirty = EINA_TRUE;
#ifdef EDJE_CALC_CACHE
             rp->invalidate = EINA_TRUE;
#endif
          }
        _edje_recalc_do(ed);

        if (rp->drag->down.count > 0)
          {
             FLOAT_T dx, dy;

             _edje_part_dragable_calc(ed, rp, &dx, &dy);
             if ((NEQ(dx, rp->drag->val.x)) || (NEQ(dy, rp->drag->val.y)))
               {
                  rp->drag->val.x = dx;
                  rp->drag->val.y = dy;
                  if (!ignored)
                    {
                       if (!rp->drag->started)
                         _edje_seat_emit(ed, ev->device, "drag,start",
                                         rp->part->name);
                       _edje_seat_emit(ed, ev->device, "drag", rp->part->name);
                       rp->drag->started = EINA_TRUE;
                    }
                  ed->recalc_call = EINA_TRUE;
                  ed->dirty = EINA_TRUE;
#ifdef EDJE_CALC_CACHE
                  rp->invalidate = EINA_TRUE;
#endif
                  _edje_recalc_do(ed);
               }
          }
     }
   _edje_unref(ed);
   _edje_util_thaw(ed);

   ev->event_flags |= rp->mask_flags;
}
コード例 #4
0
             EINA_LIST_FREE(sources, rp)
	       {
		  /* XXX: curr_item and pack_it don't require to be NULL since
		   * XXX: they are just used when source != NULL and type == BOX,
		   * XXX: and they're always set in this case, but GCC fails to
		   * XXX: notice that, so let's shut it up
		   */
		  Edje_Pack_Element **curr_item = NULL;
		  unsigned int item_count = 0;
		  Edje_Pack_Element *pack_it = NULL;
		  const char *source = NULL;

		  switch (rp->part->type)
		    {
		     case EDJE_PART_TYPE_GROUP:
			source = rp->part->source;
			break;
		     case EDJE_PART_TYPE_BOX:
		     case EDJE_PART_TYPE_TABLE:
			if (rp->part->items)
			  {
			     curr_item = rp->part->items;
			     item_count = rp->part->items_count;
			     if (item_count > 0)
			       {
				  pack_it = *curr_item;
				  source = pack_it->source;
				  item_count--;
				  curr_item++;
			       }
			  }
			break;
		     default:
                        /* This list should only be filled by group, box or table, nothing else. */
                        abort();
			continue;
		    }

		  while (source)
		    {
		       Eina_List *l;
		       Evas_Object *child_obj;
		       const char *group_path_entry = eina_stringshare_add(source);
		       const char *data;

		       if (!group_path)
			 {
			    group_path = eina_list_append(NULL, eina_stringshare_add(group));
			    group_path_started = 1;
			 }
		       /* make sure that this group isn't already in the tree of parents */
		       EINA_LIST_FOREACH(group_path, l, data)
			 {
			    if (data == group_path_entry)
			      {
                                 ERR("recursive loop group '%s' already included inside part '%s' of group '%s' from file '%s'",
                                     group_path_entry, rp->part->name, group, file);
                                 textblocks = eina_list_free(textblocks);
                                 externals = eina_list_free(externals);
                                 sources = eina_list_free(sources);
				 _edje_thaw(ed);
				 _edje_unblock(ed);
				 _edje_unref(ed);
				 _edje_file_del(ed);
				 eina_stringshare_del(group_path_entry);
				 if (group_path_started)
				   {
				      eina_stringshare_del(eina_list_data_get(group_path));
				      eina_list_free(group_path);
				   }
				 ed->load_error = EDJE_LOAD_ERROR_RECURSIVE_REFERENCE;
                                 evas_event_thaw(tev);
                                 evas_event_thaw_eval(tev);
				 return 0;
			      }
			 }

		       child_obj = edje_object_add(ed->base.evas);
		       group_path = eina_list_append(group_path, group_path_entry);
		       if (rp->part->type == EDJE_PART_TYPE_GROUP)
			 {
                            _edje_real_part_swallow(rp, child_obj, EINA_FALSE);
			 }

		       if (!_edje_object_file_set_internal(child_obj, file, source, rp->part->name, group_path))
			 {
                            ERR("impossible to set part '%s' of group '%s' from file '%s' to '%s'",
                                rp->part->name, group_path_entry, file, source);
                            textblocks = eina_list_free(textblocks);
                            externals = eina_list_free(externals);
                            sources = eina_list_free(sources);
			    _edje_thaw(ed);
			    _edje_unblock(ed);
			    _edje_unref(ed);
			    _edje_file_del(ed);

			    if (group_path_started)
			      {
				 while (group_path)
				   {
				      eina_stringshare_del(eina_list_data_get(group_path));
				      group_path = eina_list_remove_list(group_path, group_path);
				   }
			      }
			    ed->load_error = edje_object_load_error_get(child_obj);
                            evas_object_del(child_obj);
                            evas_event_thaw(tev);
                            evas_event_thaw_eval(tev);
			    return 0;
			 }

		       group_path = eina_list_remove(group_path, group_path_entry);
		       eina_stringshare_del(group_path_entry);

                       edje_object_propagate_callback_add(child_obj,
                                                          _cb_signal_repeat,
                                                          obj);
		       if (rp->part->type == EDJE_PART_TYPE_GROUP)
			 {
                            _edje_real_part_swallow(rp, child_obj, EINA_TRUE);
                            _edje_subobj_register(ed, child_obj);
			    source = NULL;
			 }
		       else
			 {
                            pack_it->parent = rp;

			    _edje_object_pack_item_hints_set(child_obj, pack_it);
			    if (pack_it->name)
                                 evas_object_name_set(child_obj, pack_it->name);

			    if (rp->part->type == EDJE_PART_TYPE_BOX)
			      {
				 _edje_real_part_box_append(rp, child_obj);
				 evas_object_data_set(child_obj, "\377 edje.box_item", pack_it);
			      }
			    else if (rp->part->type == EDJE_PART_TYPE_TABLE)
			      {
				 _edje_real_part_table_pack(rp, child_obj, pack_it->col, pack_it->row, pack_it->colspan, pack_it->rowspan);
				 evas_object_data_set(child_obj, "\377 edje.table_item", pack_it);
			      }
                            _edje_subobj_register(ed, child_obj);
			    evas_object_show(child_obj);
			    rp->items = eina_list_append(rp->items, child_obj);

			    if (item_count > 0)
			      {
				 pack_it = *curr_item;
				 source = pack_it->source;
				 curr_item++;
				 item_count--;
			      }
			    else
			      {
				 source = NULL;
				 curr_item = NULL;
				 pack_it = NULL;
			      }
			 }
		    }
	       }