pdata->pointer = pointer;
pdata->seat = pseat;
pseat->pointers = eina_inlist_append(pseat->pointers, EINA_INLIST_GET(pdata));
+ pdata->ref_count = 0;
return pdata;
}
}
}
+Evas_Pointer_Data *
+_evas_pointer_data_ref(Evas_Pointer_Data *pdata)
+{
+ if (!pdata) return NULL;
+ pdata->ref_count++;
+ return pdata;
+}
+
+void
+_evas_pointer_data_unref(Evas_Pointer_Data *pdata)
+{
+ if (!pdata) return;
+
+ if (pdata->ref_count == 0)
+ {
+ ERR("Pointer data ref count is already zero.");
+ return;
+ }
+
+ pdata->ref_count--;
+
+ if (pdata->ref_count == 0)
+ {
+ Evas_Public_Data *edata = efl_data_scope_safe_get(efl_input_device_evas_get(pdata->pointer), EVAS_CANVAS_CLASS);
+ _evas_pointer_data_remove(edata, pdata->pointer, EINA_FALSE);
+ }
+}
+
Eina_List *
_evas_pointer_list_in_rect_get(Evas_Public_Data *edata, Evas_Object *obj,
Evas_Object_Protected_Data *obj_data,
events->pointer_grabs = eina_inlist_remove(events->pointer_grabs, EINA_INLIST_GET(pdata));
EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events);
}
-
+ _evas_pointer_data_unref(pdata->evas_pdata);
free(pdata);
return;
pdata = calloc(1, sizeof(Evas_Object_Pointer_Data));
EINA_SAFETY_ON_NULL_RETURN_VAL(pdata, NULL);
pdata->pointer_mode = EVAS_OBJECT_POINTER_MODE_AUTOGRAB;
- pdata->evas_pdata = evas_pdata;
+ pdata->evas_pdata = _evas_pointer_data_ref(evas_pdata);
pdata->obj = obj;
EINA_COW_WRITE_BEGIN(evas_object_events_cow, obj->events, Evas_Object_Events_Data, events)
events->pointer_grabs = eina_inlist_append(events->pointer_grabs,
Evas_Device *pointer;
DATA32 button;
Evas_Pointer_Seat *seat;
+ int ref_count;
};
typedef struct _Evas_Post_Render_Job
Evas_Pointer_Data *_evas_pointer_data_by_device_get(Evas_Public_Data *edata, Efl_Input_Device *pointer);
Evas_Pointer_Data *_evas_pointer_data_add(Evas_Public_Data *edata, Efl_Input_Device *pointer);
void _evas_pointer_data_remove(Evas_Public_Data *edata, Efl_Input_Device *pointer, Eina_Bool nofree);
+Evas_Pointer_Data *_evas_pointer_data_ref(Evas_Pointer_Data *pdata);
+void _evas_pointer_data_unref(Evas_Pointer_Data *pdata);
Eina_List *_evas_pointer_list_in_rect_get(Evas_Public_Data *edata,
Evas_Object *obj,
Evas_Object_Protected_Data *obj_data,