aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-01-09 18:19:32 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-01-09 18:57:23 +0000
commitab6c0e9f2b8c469586af2785d79e2f4fcf2070cf (patch)
treebab3f55b8c27e0099310eda6699cb5186fc998bb /src/lib
parentedje - stop trying to access ready deleted exrt/group swallow objects (diff)
downloadefl-ab6c0e9f2b8c469586af2785d79e2f4fcf2070cf.tar.gz
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.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elementary/efl_ui_dnd.c21
-rw-r--r--src/lib/elementary/efl_ui_selection.c43
-rw-r--r--src/lib/elementary/efl_ui_selection_manager.c4
3 files changed, 23 insertions, 45 deletions
diff --git a/src/lib/elementary/efl_ui_dnd.c b/src/lib/elementary/efl_ui_dnd.c
index 4f491cea39..c368beb0d1 100644
--- a/src/lib/elementary/efl_ui_dnd.c
+++ b/src/lib/elementary/efl_ui_dnd.c
@@ -20,6 +20,9 @@ struct _Efl_Ui_Dnd_Container_Data
};
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*
_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.len = strlen(data);
#ifdef HAVE_ELEMENTARY_WL2
- seatid = _wl_default_seat_id_get(obj);
+ if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
#endif
ic->icon_data = icon_create_data;
@@ -366,7 +369,7 @@ elm_drag_action_set(Evas_Object *obj, Elm_Xdnd_Action action)
int seatid = 1;
#ifdef HAVE_ELEMENTARY_WL2
- seatid = _wl_default_seat_id_get(obj);
+ if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
#endif
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;
#ifdef HAVE_ELEMENTARY_WL2
- seatid = _wl_default_seat_id_get(obj);
+ if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
#endif
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));
if (!enter || !leave || !pos || !drop) goto on_error;
#ifdef HAVE_ELEMENTARY_WL2
- seatid = _wl_default_seat_id_get(obj);
+ if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
#endif
enter->state_cb = enter_cb;
enter->state_data = enter_data;
@@ -489,7 +492,7 @@ elm_drop_target_del(Evas_Object *obj, Elm_Sel_Format format,
Dnd_Drop *drop;
#ifdef HAVE_ELEMENTARY_WL2
- seatid = _wl_default_seat_id_get(obj);
+ if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
#endif
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));
if (!enter || !leave || !pos || !drop) goto on_error;
#ifdef HAVE_ELEMENTARY_WL2
- seatid = _wl_default_seat_id_get(obj);
+ if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
#endif
enter->state_cb = enter_cb;
@@ -703,7 +706,7 @@ elm_drop_item_container_del(Evas_Object *obj)
int seatid = 1;
#ifdef HAVE_ELEMENTARY_WL2
- seatid = _wl_default_seat_id_get(obj);
+ if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
#endif
_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;
#ifdef HAVE_ELEMENTARY_WL2
- seatid = _wl_default_seat_id_get(obj);
+ if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
#endif
di = calloc(1, sizeof(Item_Container_Drag_Info));
@@ -833,7 +836,7 @@ elm_drag_item_container_del(Evas_Object *obj)
int seatid = 1;
#ifdef HAVE_ELEMENTARY_WL2
- seatid = _wl_default_seat_id_get(obj);
+ if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
#endif
_cont_drag_free_data(obj);
diff --git a/src/lib/elementary/efl_ui_selection.c b/src/lib/elementary/efl_ui_selection.c
index cb5f0a5c32..2fd60c4a38 100644
--- a/src/lib/elementary/efl_ui_selection.c
+++ b/src/lib/elementary/efl_ui_selection.c
@@ -10,6 +10,10 @@
#define MY_CLASS EFL_UI_SELECTION_MIXIN
#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
_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)
@@ -72,34 +76,6 @@ _wl_is_wl(const Evas_Object *obj)
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
_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;
#ifdef HAVE_ELEMENTARY_WL2
-
- seatid = _wl_default_seat_id_get((Evas_Object *)obj);
+ if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get((Evas_Object *)obj);
#endif
wdata->udata = udata;
wdata->datacb = datacb;
@@ -238,7 +213,7 @@ elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type type,
data.mem = selbuf;
data.len = buflen;
#ifdef HAVE_ELEMENTARY_WL2
- seatid = _wl_default_seat_id_get(obj);
+ if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
#endif
f = efl_ui_selection_manager_selection_set(sel_man, obj, (Efl_Ui_Selection_Type)type,
(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);
#ifdef HAVE_ELEMENTARY_WL2
- seatid = _wl_default_seat_id_get(obj);
+ if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
#endif
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);
#ifdef HAVE_ELEMENTARY_WL2
- seatid = _wl_default_seat_id_get(obj);
+ if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
#endif
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);
#ifdef HAVE_ELEMENTARY_WL2
- seatid = _wl_default_seat_id_get(obj);
+ if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj);
#endif
return efl_ui_selection_manager_selection_has_owner(sel_man, obj,
EFL_UI_SELECTION_TYPE_CLIPBOARD, seatid);
diff --git a/src/lib/elementary/efl_ui_selection_manager.c b/src/lib/elementary/efl_ui_selection_manager.c
index 4391dfcd5a..b17e1263fc 100644
--- a/src/lib/elementary/efl_ui_selection_manager.c
+++ b/src/lib/elementary/efl_ui_selection_manager.c
@@ -37,7 +37,7 @@ static Ecore_X_Window _x11_xwin_get(const Evas_Object *obj);
#endif
#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);
#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));
}
-static Ecore_Wl2_Window *
+Ecore_Wl2_Window *
_wl_window_get(const Evas_Object *obj)
{
Evas_Object *top;