From: Christopher Michael Date: Mon, 28 May 2012 12:28:46 +0000 (+0000) Subject: Elm: Patch from Robert Bradford for native X-Git-Tag: v1.7.0~597 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3872994a24d1744a0b10cfcadaa8419829ab4784;p=platform%2Fupstream%2Felementary.git Elm: Patch from Robert Bradford for native window representation. The attached change to Elementary makes a small refactor to use existing code that was already conditional on the Elm engine to retrieve the underlying window - thus allowing elm_win_xwindow_get to return 0 in the case when called on a Wayland based Elm window. Patches have been tested against X11 and Wayland built together by running elementary_test. SVN revision: 71455 --- diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c index 9daef5f..d596dcd 100644 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c @@ -1252,19 +1252,19 @@ _elm_win_delete_request(Ecore_Evas *ee) evas_object_unref(obj); } -#ifdef HAVE_ELEMENTARY_X -static void -_elm_win_xwindow_get(Elm_Win_Smart_Data *sd) +static Ecore_X_Window +_elm_ee_xwin_get(const Ecore_Evas *ee) { - sd->xwin = 0; + Ecore_X_Window xwin; + if (!ee) return 0; +#ifdef HAVE_ELEMENTARY_X #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name)) if (ENGINE_COMPARE(ELM_SOFTWARE_X11)) { - if (sd->ee) sd->xwin = ecore_evas_software_x11_window_get(sd->ee); + if (ee) xwin = ecore_evas_software_x11_window_get(ee); } - else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) || - ENGINE_COMPARE(ELM_SOFTWARE_FB) || + else if (ENGINE_COMPARE(ELM_SOFTWARE_FB) || ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) || ENGINE_COMPARE(ELM_SOFTWARE_SDL) || ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) || @@ -1274,21 +1274,32 @@ _elm_win_xwindow_get(Elm_Win_Smart_Data *sd) } else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11)) { - if (sd->ee) sd->xwin = ecore_evas_software_x11_16_window_get(sd->ee); + if (ee) xwin = ecore_evas_software_x11_16_window_get(ee); } else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11)) { - if (sd->ee) sd->xwin = ecore_evas_software_x11_8_window_get(sd->ee); + if (ee) xwin = ecore_evas_software_x11_8_window_get(ee); } else if (ENGINE_COMPARE(ELM_OPENGL_X11)) { - if (sd->ee) sd->xwin = ecore_evas_gl_x11_window_get(sd->ee); + if (ee) xwin = ecore_evas_gl_x11_window_get(ee); } else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32)) { - if (sd->ee) sd->xwin = (long)ecore_evas_win32_window_get(sd->ee); + if (ee) xwin = (long)ecore_evas_win32_window_get(ee); } + return xwin; + #undef ENGINE_COMPARE +#endif + return 0; +} + +#ifdef HAVE_ELEMENTARY_X +static void +_elm_win_xwindow_get(Elm_Win_Smart_Data *sd) +{ + sd->xwin = _elm_ee_xwin_get(sd->ee); } #endif @@ -3353,24 +3364,16 @@ elm_win_socket_listen(Evas_Object *obj, /* windowing specific calls - shall we do this differently? */ -static Ecore_X_Window -_elm_ee_win_get(const Evas_Object *obj) -{ - if (!obj) return 0; -#ifdef HAVE_ELEMENTARY_X - Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); - if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee); -#endif - return 0; -} - EAPI Ecore_X_Window elm_win_xwindow_get(const Evas_Object *obj) { if (!obj) return 0; if (!evas_object_smart_type_check_ptr(obj, WIN_SMART_NAME)) - return _elm_ee_win_get(obj); + { + Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); + return _elm_ee_xwin_get(ee); + } ELM_WIN_CHECK(obj) 0; ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, 0);