From 689b4f3fc5f61d14a010c5f9d255860ae592907c Mon Sep 17 00:00:00 2001 From: Daniel Zaoui Date: Thu, 8 Jan 2015 11:54:04 +0200 Subject: [PATCH] DnD: fix callbacks deletion for inline windows. During deletion of a window, widgets considered as droppable targets have to remove their DnD callbacks. To achieve this, elm_drop_target_del is called from the DEL callback (destructor). This function has to determine if X11 or Wayland is used. Since the parent is already unknown at this stage, only checking the engine name can give this information. On a regular window, the engine name is related to the target display. The problem happens when an inline window is used. The engine is a buffer and no information is given regarding the target display. The patch fixes it by checking the nature of the Ecore Evas parents. It supports nested windows (inline inside inline... inside XWin). @fix --- legacy/elementary/src/lib/elm_cnp.c | 35 +++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/legacy/elementary/src/lib/elm_cnp.c b/legacy/elementary/src/lib/elm_cnp.c index ee44a3caaa..363d85128e 100644 --- a/legacy/elementary/src/lib/elm_cnp.c +++ b/legacy/elementary/src/lib/elm_cnp.c @@ -1901,7 +1901,23 @@ _x11_elm_widget_xwin_get(const Evas_Object *obj) if (!evas) return 0; ee = ecore_evas_ecore_evas_get(evas); if (!ee) return 0; - xwin = _elm_ee_xwin_get(ee); + + while(!xwin) + { + const char *engine_name = ecore_evas_engine_name_get(ee); + if (!strcmp(engine_name, ELM_BUFFER)) + { + ee = ecore_evas_buffer_ecore_evas_parent_get(ee); + if (!ee) return 0; + xwin = _elm_ee_xwin_get(ee); + } + else + { + /* In case the engine is not a buffer, we want to check once. */ + xwin = _elm_ee_xwin_get(ee); + if (!xwin) return 0; + } + } } return xwin; } @@ -3492,7 +3508,22 @@ _wl_elm_widget_window_get(Evas_Object *obj) if (!(ee = ecore_evas_ecore_evas_get(evas))) return 0; - win = ecore_evas_wayland_window_get(ee); + while(!win) + { + const char *engine_name = ecore_evas_engine_name_get(ee); + if (!strcmp(engine_name, ELM_BUFFER)) + { + ee = ecore_evas_buffer_ecore_evas_parent_get(ee); + if (!ee) return 0; + win = ecore_evas_wayland_window_get(ee); + } + else + { + /* In case the engine is not a buffer, we want to check once. */ + win = ecore_evas_wayland_window_get(ee); + if (!win) return 0; + } + } } return ecore_wl_window_id_get(win);