Ecore_Evas: Patch from Robert Bradford <robert.bradford@intel.com>:

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.



SVN revision: 71453
This commit is contained in:
Christopher Michael 2012-05-28 12:24:30 +00:00
parent be66a4e03b
commit 74a4a3ff81
3 changed files with 24 additions and 5 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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;