antognolli pushed a commit to branch devs/antognolli/backport.

commit 1c2d03c10d03b235e97aee05a455b0f625899686
Author: Rafael Antognolli <[email protected]>
Date:   Thu Feb 28 17:59:19 2013 -0300

    Backport r83642.
    
    Export API to C++, add wl_registry and global accessors
    
    Add #ifdef __cpluscplus to Ecore_Wayland.h so the API can be used by C++
    programs.  Add accessors for the wl_registry and the globals list.
    
    Patch by: "U. Artie Eoff" <[email protected]>
---
 ChangeLog                             |  8 +++++++-
 src/lib/ecore_wayland/Ecore_Wayland.h | 34 ++++++++++++++++++++++++++++++++--
 src/lib/ecore_wayland/ecore_wl.c      | 15 +++++++++++++++
 3 files changed, 54 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7043252..5d68924 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1099,4 +1099,10 @@
 2013-02-20  Carsten Haitzler (The Rasterman)
 
         * Fix ecore-x edid fetch to ftech 128, not 100 bytes.
-    
+
+2013-02-28  U. Artie Eoff (uartie)
+
+        * ecore_wayland: Add #ifdef __cplusplus to Ecore_Wayland.h so the
+        API can be used by C++ programs.
+        * ecore_wayland: Add ecore_wl_registry_get
+        * ecore_wayland: Add ecore_wl_globals_get
diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h 
b/src/lib/ecore_wayland/Ecore_Wayland.h
index d1279fe..ad2c9e3 100644
--- a/src/lib/ecore_wayland/Ecore_Wayland.h
+++ b/src/lib/ecore_wayland/Ecore_Wayland.h
@@ -30,10 +30,14 @@
 extern "C" {
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct _Ecore_Wl_Display Ecore_Wl_Display;
 typedef struct _Ecore_Wl_Output Ecore_Wl_Output;
 typedef struct _Ecore_Wl_Input Ecore_Wl_Input;
-typedef struct _Ecore_Wl_Global Ecore_Wl_Global;
+typedef struct _Ecore_Wl_Global Ecore_Wl_Global; /** @since 1.8 */
 
 # ifndef _ECORE_WAYLAND_WINDOW_PREDEF
 typedef struct _Ecore_Wl_Window Ecore_Wl_Window;
@@ -76,6 +80,7 @@ enum _Ecore_Wl_Window_Buffer_Type
 typedef enum _Ecore_Wl_Window_Type Ecore_Wl_Window_Type;
 typedef enum _Ecore_Wl_Window_Buffer_Type Ecore_Wl_Window_Buffer_Type;
 
+/** @since 1.8 */
 struct _Ecore_Wl_Global
 {
    unsigned int id;
@@ -105,7 +110,7 @@ struct _Ecore_Wl_Display
 
    struct wl_list inputs;
    struct wl_list outputs;
-   struct wl_list globals;
+   struct wl_list globals; /** @since 1.8 */
 
    struct
      {
@@ -373,6 +378,27 @@ EAPI void 
ecore_wl_input_cursor_default_restore(Ecore_Wl_Input *input);
 
 EAPI struct wl_list *ecore_wl_outputs_get(void);
 
+/**
+ * Retrieves the Wayland Globals Interface list used for the current Wayland 
connection.
+ *
+ * @return The current wayland globals interface list
+ *
+ * @ingroup Ecore_Wl_Display_Group
+ * @since 1.7.6
+ */
+EAPI struct wl_list *ecore_wl_globals_get(void);
+
+/**
+ * Retrieves the Wayland Registry used for the current Wayland connection.
+ *
+ * @return The current wayland registry
+ *
+ * @ingroup Ecore_Wl_Display_Group
+ * @since 1.7.6
+ */
+EAPI struct wl_registry *ecore_wl_registry_get(void);
+
+
 EAPI Ecore_Wl_Window *ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int 
y, int w, int h, int buffer_type);
 EAPI void ecore_wl_window_free(Ecore_Wl_Window *win);
 EAPI void ecore_wl_window_move(Ecore_Wl_Window *win, int x, int y);
@@ -407,4 +433,8 @@ EAPI Eina_Bool 
ecore_wl_dnd_selection_has_owner(Ecore_Wl_Dnd *dnd);
 }
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c
index cc7dfd4..a20d97f 100644
--- a/src/lib/ecore_wayland/ecore_wl.c
+++ b/src/lib/ecore_wayland/ecore_wl.c
@@ -289,6 +289,18 @@ ecore_wl_display_get(void)
    return _ecore_wl_disp->wl.display;
 }
 
+EAPI struct wl_list *
+ecore_wl_globals_get(void)
+{
+   return &(_ecore_wl_disp->globals);
+}
+
+EAPI struct wl_registry *
+ecore_wl_registry_get(void)
+{
+   return _ecore_wl_disp->wl.registry;
+}
+
 /**
  * Retrieves the size of the current screen.
  * 
@@ -500,6 +512,9 @@ _ecore_wl_cb_handle_global(void *data, struct wl_registry 
*registry, unsigned in
    ewd = data;
 
    global = malloc(sizeof(*global));
+
+   memset(global, 0, sizeof(Ecore_Wl_Global));
+
    global->id = id;
    global->interface = strdup(interface);
    global->version = version;

-- 

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb

Reply via email to