From: devilhorns Date: Mon, 28 May 2012 12:24:30 +0000 (+0000) Subject: Ecore_Evas: Patch from Robert Bradford : X-Git-Tag: 2.0_alpha~25^2~77 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b4896ffaff592d44ef5d40a159822a39299f2e82;p=framework%2Fuifw%2Fecore.git Ecore_Evas: Patch from Robert Bradford : The challenge here is that the native window representation is stored in Ecore_Evas's prop.window. But currently there is no checking of what driver the Ecore_Evas is for when calls are made to e.g. ecore_evas_software_x11_window_get. The attached change to Ecore makes the appropriate functions return 0 or NULL if the driver for the Ecore doesn't match as expected. This can then be used to identify if an Ecore_Evas is e.g. from X11 or from Wayland. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@71453 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index 14bbd9b..0405cd2 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -2779,6 +2779,9 @@ ecore_evas_wayland_type_set(Ecore_Evas *ee, int type) EAPI Ecore_Wl_Window * ecore_evas_wayland_window_get(const Ecore_Evas *ee) { + if (!(!strncmp(ee->driver, "wayland", 7))) + return NULL; + return ee->engine.wl.win; } diff --git a/src/lib/ecore_evas/ecore_evas_directfb.c b/src/lib/ecore_evas/ecore_evas_directfb.c index ed24355..c11167e 100644 --- a/src/lib/ecore_evas/ecore_evas_directfb.c +++ b/src/lib/ecore_evas/ecore_evas_directfb.c @@ -592,6 +592,7 @@ ecore_evas_directfb_new(const char *disp_name __UNUSED__, int windowed __UNUSED_ EAPI Ecore_DirectFB_Window * ecore_evas_directfb_window_get(const Ecore_Evas *ee) { + if (!(!strcmp(ee->driver, "directfb"))) return 0; return (Ecore_DirectFB_Window *) _ecore_evas_directfb_window_get(ee); } #else diff --git a/src/lib/ecore_evas/ecore_evas_x.c b/src/lib/ecore_evas/ecore_evas_x.c index fe124ac..edf1c3a 100644 --- a/src/lib/ecore_evas/ecore_evas_x.c +++ b/src/lib/ecore_evas/ecore_evas_x.c @@ -3189,7 +3189,9 @@ ecore_evas_software_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window par /** * @brief Get the window from Ecore_Evas using software x11. - * @note If ecore is not compiled with support to x11 then nothing is done and 0 is returned. + * @note If ecore is not compiled with support for x11 or if @ee was not + * created with ecore_evas_software_x11_new() then nothing is done and + * 0 is returned. * @param ee The Ecore_Evas from which to get the window. * @return The window of type Ecore_X_Window. */ @@ -3197,6 +3199,7 @@ ecore_evas_software_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window par EAPI Ecore_X_Window ecore_evas_software_x11_window_get(const Ecore_Evas *ee) { + if (!(!strcmp(ee->driver, "software_x11"))) return 0; return (Ecore_X_Window) ecore_evas_window_get(ee); } #else @@ -3436,7 +3439,9 @@ ecore_evas_gl_x11_options_new(const char *disp_name __UNUSED__, Ecore_X_Window p /** * @brief Get the window from Ecore_Evas using opengl x11. - * @note If ecore is not compiled with support to x11 then nothing is done and 0 is returned. + * @note If ecore is not compiled with support for x11 or if @ee was not + * created with ecore_evas_gl_x11_new() then nothing is done and + * 0 is returned. * @param ee The Ecore_Evas from which to get the window. * @return The window of type Ecore_X_Window of Ecore_Evas. */ @@ -3444,6 +3449,7 @@ ecore_evas_gl_x11_options_new(const char *disp_name __UNUSED__, Ecore_X_Window p EAPI Ecore_X_Window ecore_evas_gl_x11_window_get(const Ecore_Evas *ee) { + if (!(!strcmp(ee->driver, "opengl_x11"))) return 0; return (Ecore_X_Window) ecore_evas_window_get(ee); } #else @@ -3741,7 +3747,9 @@ ecore_evas_software_x11_16_new(const char *disp_name __UNUSED__, Ecore_X_Window /** * @brief Get the window from Ecore_Evas using software 16 x11. - * @note If ecore is not compiled with support to x11 then nothing is done and 0 is returned. + * @note If ecore is not compiled with support for x11 or if @ee was not + * created with ecore_evas_software_x11_16_new() then nothing is done and + * 0 is returned. * @param ee The Ecore_Evas from which to get the window. * @return The window of type Ecore_X_Window of Ecore_Evas. */ @@ -3749,6 +3757,7 @@ ecore_evas_software_x11_16_new(const char *disp_name __UNUSED__, Ecore_X_Window EAPI Ecore_X_Window ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee) { + if (!(!strcmp(ee->driver, "software_16_x11"))) return 0; return (Ecore_X_Window) ecore_evas_window_get(ee); } #else @@ -4070,7 +4079,9 @@ ecore_evas_software_x11_8_new(const char *disp_name, Ecore_X_Window parent, /** * @brief Get window from Ecore_Evas using software 8 x11. - * @note If ecore is not compiled with support to x11 then nothing is done and 0 is returned. + * @note If ecore is not compiled with support for x11 or if @ee was not + * created with ecore_evas_software_x11_8_new() then nothing is done and + * 0 is returned. * @param ee The Ecore_Evas from which to get the window. * @return The window of type Ecore_X_Window of Ecore_Evas. */ @@ -4078,6 +4089,7 @@ EAPI Ecore_X_Window ecore_evas_software_x11_8_window_get(const Ecore_Evas *ee) { #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) + if (!(!strcmp(ee->driver, "software_8_x11"))) return 0; return (Ecore_X_Window) ecore_evas_window_get(ee); #else return 0; @@ -4087,7 +4099,9 @@ ecore_evas_software_x11_8_window_get(const Ecore_Evas *ee) /** * @brief Get subwindow from Ecore_Evas using software 8 x11. - * @note If ecore is not compiled with support to x11 then nothing is done and 0 is returned. + * @note If ecore is not compiled with support for x11 or if @ee was not + * created with ecore_evas_software_x11_8_new() then nothing is done and + * 0 is returned. * @param ee The Ecore_Evas from which to get the subwindow. * @return The window of type Ecore_X_Window of Ecore_Evas. */ @@ -4095,6 +4109,7 @@ EAPI Ecore_X_Window ecore_evas_software_x11_8_subwindow_get(const Ecore_Evas *ee) { #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) + if (!(!strcmp(ee->driver, "software_8_x11"))) return 0; return (Ecore_X_Window) ecore_evas_window_get(ee); #else return 0;