From 920135fe029d0fbd9bdc8ddede83d68d84f7352d Mon Sep 17 00:00:00 2001
From: Rob Bradford <rob@linux.intel.com>
Date: Tue, 10 Jul 2012 16:25:23 +0100
Subject: [PATCH] Elm (wayland): Expose and use a backend safe call for
 getting X window

This prevents us trying to use an invalid X window when running under the
Wayland backend.
---
 ChangeLog          |    7 +++++++
 src/lib/elm_cnp.c  |    2 +-
 src/lib/elm_priv.h |    2 ++
 src/lib/elm_win.c  |    2 +-
 4 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9f619fc..ce0d685 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -289,3 +289,10 @@
 	* Add slider popup mode (based in idea originally proposed in
           patches from Sumanth Krishna Mannam, but susbequently rejected
           a few times as it didn't measure up to commitable standards).
+
+2012-07-10  Rob Bradford
+
+	* Expose into private API a function for getting the X window from an
+	Ecore_Evas using the backend safe functions.
+	* Use this new API to replace a non backend safe call in the copy and
+	paste code
diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index cf79031..9e77344 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -442,7 +442,7 @@ _elm_widget_xwin_get(const Evas_Object *obj)
         if (!evas) return 0;
         ee = ecore_evas_ecore_evas_get(evas);
         if (!ee) return 0;
-        xwin = (Ecore_X_Window)ecore_evas_window_get(ee);
+        xwin = _elm_ee_xwin_get(ee);
      }
 
    return xwin;
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index e405723..0bed660 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -232,6 +232,8 @@ void                 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme);
 void                 _elm_win_access(Eina_Bool is_access);
 void                 _elm_win_translate(void);
 
+Ecore_X_Window       _elm_ee_xwin_get(const Ecore_Evas *ee);
+
 Eina_Bool            _elm_theme_object_set(Evas_Object *parent, Evas_Object *o, const char *clas, const char *group, const char *style);
 Eina_Bool            _elm_theme_object_icon_set(Evas_Object *o, const char *group, const char *style);
 Eina_Bool            _elm_theme_set(Elm_Theme *th, Evas_Object *o, const char *clas, const char *group, const char *style);
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index 36f1a3f..daa588b 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -1266,7 +1266,7 @@ _elm_win_delete_request(Ecore_Evas *ee)
    evas_object_unref(obj);
 }
 
-static Ecore_X_Window
+Ecore_X_Window
 _elm_ee_xwin_get(const Ecore_Evas *ee)
 {
 #ifdef HAVE_ELEMENTARY_X
-- 
1.7.10.4

