forked from enlightenment/efl
elm dnd/selection - only query wl things if thje window is a wl one...
check at RUNTIME not just with ifdefs at compile time. less ERR noise for sure.
This commit is contained in:
parent
afb779bda5
commit
ab6c0e9f2b
|
@ -20,6 +20,9 @@ struct _Efl_Ui_Dnd_Container_Data
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int _wl_default_seat_id_get(Evas_Object *obj);
|
extern int _wl_default_seat_id_get(Evas_Object *obj);
|
||||||
|
#ifdef HAVE_ELEMENTARY_WL2
|
||||||
|
Ecore_Wl2_Window *_wl_window_get(const Evas_Object *obj);
|
||||||
|
#endif
|
||||||
|
|
||||||
Eo*
|
Eo*
|
||||||
_efl_ui_selection_manager_get(Eo *obj)
|
_efl_ui_selection_manager_get(Eo *obj)
|
||||||
|
@ -339,7 +342,7 @@ elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data,
|
||||||
sl.mem = data;
|
sl.mem = data;
|
||||||
sl.len = strlen(data);
|
sl.len = strlen(data);
|
||||||
#ifdef HAVE_ELEMENTARY_WL2
|
#ifdef HAVE_ELEMENTARY_WL2
|
||||||
seatid = _wl_default_seat_id_get(obj);
|
if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ic->icon_data = icon_create_data;
|
ic->icon_data = icon_create_data;
|
||||||
|
@ -366,7 +369,7 @@ elm_drag_action_set(Evas_Object *obj, Elm_Xdnd_Action action)
|
||||||
int seatid = 1;
|
int seatid = 1;
|
||||||
|
|
||||||
#ifdef HAVE_ELEMENTARY_WL2
|
#ifdef HAVE_ELEMENTARY_WL2
|
||||||
seatid = _wl_default_seat_id_get(obj);
|
if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
|
||||||
#endif
|
#endif
|
||||||
efl_ui_selection_manager_drag_action_set(sel_man, obj, (Efl_Ui_Selection_Action)action, seatid);
|
efl_ui_selection_manager_drag_action_set(sel_man, obj, (Efl_Ui_Selection_Action)action, seatid);
|
||||||
|
|
||||||
|
@ -380,7 +383,7 @@ elm_drag_cancel(Evas_Object *obj)
|
||||||
int seatid = 1;
|
int seatid = 1;
|
||||||
|
|
||||||
#ifdef HAVE_ELEMENTARY_WL2
|
#ifdef HAVE_ELEMENTARY_WL2
|
||||||
seatid = _wl_default_seat_id_get(obj);
|
if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
efl_ui_selection_manager_drag_cancel(sel_man, obj, seatid);
|
efl_ui_selection_manager_drag_cancel(sel_man, obj, seatid);
|
||||||
|
@ -433,7 +436,7 @@ elm_drop_target_add(Evas_Object *obj, Elm_Sel_Format format,
|
||||||
drop = calloc(1, sizeof(Dnd_Drop));
|
drop = calloc(1, sizeof(Dnd_Drop));
|
||||||
if (!enter || !leave || !pos || !drop) goto on_error;
|
if (!enter || !leave || !pos || !drop) goto on_error;
|
||||||
#ifdef HAVE_ELEMENTARY_WL2
|
#ifdef HAVE_ELEMENTARY_WL2
|
||||||
seatid = _wl_default_seat_id_get(obj);
|
if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
|
||||||
#endif
|
#endif
|
||||||
enter->state_cb = enter_cb;
|
enter->state_cb = enter_cb;
|
||||||
enter->state_data = enter_data;
|
enter->state_data = enter_data;
|
||||||
|
@ -489,7 +492,7 @@ elm_drop_target_del(Evas_Object *obj, Elm_Sel_Format format,
|
||||||
Dnd_Drop *drop;
|
Dnd_Drop *drop;
|
||||||
|
|
||||||
#ifdef HAVE_ELEMENTARY_WL2
|
#ifdef HAVE_ELEMENTARY_WL2
|
||||||
seatid = _wl_default_seat_id_get(obj);
|
if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
drop_list = efl_key_data_get(obj, "__drop_list");
|
drop_list = efl_key_data_get(obj, "__drop_list");
|
||||||
|
@ -650,7 +653,7 @@ elm_drop_item_container_add(Evas_Object *obj,
|
||||||
drop = calloc(1, sizeof(Dnd_Cont_Drop));
|
drop = calloc(1, sizeof(Dnd_Cont_Drop));
|
||||||
if (!enter || !leave || !pos || !drop) goto on_error;
|
if (!enter || !leave || !pos || !drop) goto on_error;
|
||||||
#ifdef HAVE_ELEMENTARY_WL2
|
#ifdef HAVE_ELEMENTARY_WL2
|
||||||
seatid = _wl_default_seat_id_get(obj);
|
if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enter->state_cb = enter_cb;
|
enter->state_cb = enter_cb;
|
||||||
|
@ -703,7 +706,7 @@ elm_drop_item_container_del(Evas_Object *obj)
|
||||||
int seatid = 1;
|
int seatid = 1;
|
||||||
|
|
||||||
#ifdef HAVE_ELEMENTARY_WL2
|
#ifdef HAVE_ELEMENTARY_WL2
|
||||||
seatid = _wl_default_seat_id_get(obj);
|
if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_cont_drop_free_data(obj);
|
_cont_drop_free_data(obj);
|
||||||
|
@ -806,7 +809,7 @@ elm_drag_item_container_add(Evas_Object *obj, double anim_tm, double tm_to_drag,
|
||||||
Item_Container_Drag_Info *di;
|
Item_Container_Drag_Info *di;
|
||||||
|
|
||||||
#ifdef HAVE_ELEMENTARY_WL2
|
#ifdef HAVE_ELEMENTARY_WL2
|
||||||
seatid = _wl_default_seat_id_get(obj);
|
if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
di = calloc(1, sizeof(Item_Container_Drag_Info));
|
di = calloc(1, sizeof(Item_Container_Drag_Info));
|
||||||
|
@ -833,7 +836,7 @@ elm_drag_item_container_del(Evas_Object *obj)
|
||||||
int seatid = 1;
|
int seatid = 1;
|
||||||
|
|
||||||
#ifdef HAVE_ELEMENTARY_WL2
|
#ifdef HAVE_ELEMENTARY_WL2
|
||||||
seatid = _wl_default_seat_id_get(obj);
|
if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_cont_drag_free_data(obj);
|
_cont_drag_free_data(obj);
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
#define MY_CLASS EFL_UI_SELECTION_MIXIN
|
#define MY_CLASS EFL_UI_SELECTION_MIXIN
|
||||||
#define MY_CLASS_NAME "Efl.Ui.Selection"
|
#define MY_CLASS_NAME "Efl.Ui.Selection"
|
||||||
|
|
||||||
|
#ifdef HAVE_ELEMENTARY_WL2
|
||||||
|
Ecore_Wl2_Window *_wl_window_get(const Evas_Object *obj);
|
||||||
|
#endif
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_ui_selection_selection_get(Eo *obj, void *pd EINA_UNUSED, Efl_Ui_Selection_Type type, Efl_Ui_Selection_Format format,
|
_efl_ui_selection_selection_get(Eo *obj, void *pd EINA_UNUSED, Efl_Ui_Selection_Type type, Efl_Ui_Selection_Format format,
|
||||||
void *data_func_data, Efl_Ui_Selection_Data_Ready data_func, Eina_Free_Cb data_func_free_cb, unsigned int seat)
|
void *data_func_data, Efl_Ui_Selection_Data_Ready data_func, Eina_Free_Cb data_func_free_cb, unsigned int seat)
|
||||||
|
@ -72,34 +76,6 @@ _wl_is_wl(const Evas_Object *obj)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Ecore_Wl2_Window *
|
|
||||||
_wl_window_get(const Evas_Object *obj)
|
|
||||||
{
|
|
||||||
Evas_Object *top;
|
|
||||||
Ecore_Wl2_Window *win = NULL;
|
|
||||||
|
|
||||||
if (elm_widget_is(obj))
|
|
||||||
{
|
|
||||||
top = elm_widget_top_get(obj);
|
|
||||||
if (!top) top = elm_widget_top_get(elm_widget_parent_widget_get(obj));
|
|
||||||
if (top && (efl_isa(top, EFL_UI_WIN_CLASS)))
|
|
||||||
win = elm_win_wl_window_get(top);
|
|
||||||
}
|
|
||||||
if (!win)
|
|
||||||
{
|
|
||||||
Ecore_Evas *ee = _wl_is_wl(obj);
|
|
||||||
|
|
||||||
if (ee)
|
|
||||||
{
|
|
||||||
/* In case the engine is not a buffer, we want to check once. */
|
|
||||||
win = ecore_evas_wayland2_window_get(ee);
|
|
||||||
if (!win) return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return win;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
_wl_default_seat_id_get(Evas_Object *obj)
|
_wl_default_seat_id_get(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
|
@ -212,8 +188,7 @@ elm_cnp_selection_get(const Evas_Object *obj, Elm_Sel_Type type,
|
||||||
if (!wdata) return EINA_FALSE;
|
if (!wdata) return EINA_FALSE;
|
||||||
|
|
||||||
#ifdef HAVE_ELEMENTARY_WL2
|
#ifdef HAVE_ELEMENTARY_WL2
|
||||||
|
if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get((Evas_Object *)obj);
|
||||||
seatid = _wl_default_seat_id_get((Evas_Object *)obj);
|
|
||||||
#endif
|
#endif
|
||||||
wdata->udata = udata;
|
wdata->udata = udata;
|
||||||
wdata->datacb = datacb;
|
wdata->datacb = datacb;
|
||||||
|
@ -238,7 +213,7 @@ elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type type,
|
||||||
data.mem = selbuf;
|
data.mem = selbuf;
|
||||||
data.len = buflen;
|
data.len = buflen;
|
||||||
#ifdef HAVE_ELEMENTARY_WL2
|
#ifdef HAVE_ELEMENTARY_WL2
|
||||||
seatid = _wl_default_seat_id_get(obj);
|
if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
|
||||||
#endif
|
#endif
|
||||||
f = efl_ui_selection_manager_selection_set(sel_man, obj, (Efl_Ui_Selection_Type)type,
|
f = efl_ui_selection_manager_selection_set(sel_man, obj, (Efl_Ui_Selection_Type)type,
|
||||||
(Efl_Ui_Selection_Format)format, data, seatid);
|
(Efl_Ui_Selection_Format)format, data, seatid);
|
||||||
|
@ -257,7 +232,7 @@ elm_object_cnp_selection_clear(Evas_Object *obj, Elm_Sel_Type type)
|
||||||
Eo *sel_man = _efl_ui_selection_manager_get((Evas_Object *)obj);
|
Eo *sel_man = _efl_ui_selection_manager_get((Evas_Object *)obj);
|
||||||
|
|
||||||
#ifdef HAVE_ELEMENTARY_WL2
|
#ifdef HAVE_ELEMENTARY_WL2
|
||||||
seatid = _wl_default_seat_id_get(obj);
|
if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
|
||||||
#endif
|
#endif
|
||||||
efl_ui_selection_manager_selection_clear(sel_man, obj, (Efl_Ui_Selection_Type)type, seatid);
|
efl_ui_selection_manager_selection_clear(sel_man, obj, (Efl_Ui_Selection_Type)type, seatid);
|
||||||
|
|
||||||
|
@ -289,7 +264,7 @@ elm_selection_selection_has_owner(Evas_Object *obj)
|
||||||
Eo *sel_man = _efl_ui_selection_manager_get((Evas_Object *)obj);
|
Eo *sel_man = _efl_ui_selection_manager_get((Evas_Object *)obj);
|
||||||
|
|
||||||
#ifdef HAVE_ELEMENTARY_WL2
|
#ifdef HAVE_ELEMENTARY_WL2
|
||||||
seatid = _wl_default_seat_id_get(obj);
|
if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return efl_ui_selection_manager_selection_has_owner(sel_man, obj,
|
return efl_ui_selection_manager_selection_has_owner(sel_man, obj,
|
||||||
|
@ -303,7 +278,7 @@ elm_cnp_clipboard_selection_has_owner(Evas_Object *obj)
|
||||||
Eo *sel_man = _efl_ui_selection_manager_get((Evas_Object *)obj);
|
Eo *sel_man = _efl_ui_selection_manager_get((Evas_Object *)obj);
|
||||||
|
|
||||||
#ifdef HAVE_ELEMENTARY_WL2
|
#ifdef HAVE_ELEMENTARY_WL2
|
||||||
seatid = _wl_default_seat_id_get(obj);
|
if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
|
||||||
#endif
|
#endif
|
||||||
return efl_ui_selection_manager_selection_has_owner(sel_man, obj,
|
return efl_ui_selection_manager_selection_has_owner(sel_man, obj,
|
||||||
EFL_UI_SELECTION_TYPE_CLIPBOARD, seatid);
|
EFL_UI_SELECTION_TYPE_CLIPBOARD, seatid);
|
||||||
|
|
|
@ -37,7 +37,7 @@ static Ecore_X_Window _x11_xwin_get(const Evas_Object *obj);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_ELEMENTARY_WL2
|
#ifdef HAVE_ELEMENTARY_WL2
|
||||||
static Ecore_Wl2_Window *_wl_window_get(const Evas_Object *obj);
|
Ecore_Wl2_Window *_wl_window_get(const Evas_Object *obj);
|
||||||
static Ecore_Wl2_Input *_wl_seat_get(Ecore_Wl2_Window *win, Evas_Object *obj, unsigned int seat_id);
|
static Ecore_Wl2_Input *_wl_seat_get(Ecore_Wl2_Window *win, Evas_Object *obj, unsigned int seat_id);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2806,7 +2806,7 @@ _wl_seat_get(Ecore_Wl2_Window *win, Evas_Object *obj, unsigned int seat_id)
|
||||||
evas_device_seat_id_get(seat));
|
evas_device_seat_id_get(seat));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Ecore_Wl2_Window *
|
Ecore_Wl2_Window *
|
||||||
_wl_window_get(const Evas_Object *obj)
|
_wl_window_get(const Evas_Object *obj)
|
||||||
{
|
{
|
||||||
Evas_Object *top;
|
Evas_Object *top;
|
||||||
|
|
Loading…
Reference in New Issue