ecore-wl2: Add API to return window available rotations
authorChris Michael <cp.michael@samsung.com>
Fri, 9 Jun 2017 14:08:06 +0000 (10:08 -0400)
committerChris Michael <cp.michael@samsung.com>
Fri, 9 Jun 2017 16:30:41 +0000 (12:30 -0400)
@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/ecore_wl2/Ecore_Wl2.h
src/lib/ecore_wl2/ecore_wl2_window.c

index 8bd591c..f3a8ddd 100644 (file)
@@ -1054,6 +1054,20 @@ EAPI int ecore_wl2_window_preferred_rotation_get(Ecore_Wl2_Window *window);
 EAPI void ecore_wl2_window_available_rotations_set(Ecore_Wl2_Window *window, const int *rots, unsigned int count);
 
 /**
+ * Get a windows available rotations
+ *
+ * @param window
+ * @param rots
+ * @param count
+ *
+ * @return EINA_TRUE on success, EINA_FALSE otherwise
+ *
+ * @ingroup Ecore_Wl2_Window_Group
+ * @since 1.20
+ */
+EAPI Eina_Bool ecore_wl2_window_available_rotations_get(Ecore_Wl2_Window *window, int **rots, unsigned int count);
+
+/**
  * @defgroup Ecore_Wl2_Input_Group Wayland Library Input Functions
  * @ingroup Ecore_Wl2_Group
  *
index 29e3eae..08b56ff 100644 (file)
@@ -1263,3 +1263,28 @@ ecore_wl2_window_available_rotations_set(Ecore_Wl2_Window *window, const int *ro
    window->wm_rot.count = count;
    window->wm_rot.available_rots = rots;
 }
+
+EAPI Eina_Bool
+ecore_wl2_window_available_rotations_get(Ecore_Wl2_Window *window, int **rots, unsigned int count)
+{
+   int i = 0;
+   int *val = NULL;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
+
+   *count = window->wm_rot.count;
+
+   if (window->wm_rot.count >= 1)
+     {
+        val = calloc(window->wm_rot.count, sizeof(int));
+        if (!val) return EINA_FALSE;
+
+        for (; i < window->wm_rot.count; i++)
+          val[i] = ((int *)window->wm_rot.available_rots)[i];
+
+        *rots = val;
+        return EINA_TRUE;
+     }
+
+   return EINA_FALSE;
+}