Change API: tpl_display_get() 81/59481/1
authorMun, Gwan-gyeong <kk.moon@samsung.com>
Tue, 16 Feb 2016 03:48:53 +0000 (12:48 +0900)
committerMun, Gwan-gyeong <kk.moon@samsung.com>
Tue, 16 Feb 2016 03:48:53 +0000 (12:48 +0900)
   seperate tpl_display_get() to tpl_display_create() and tpl_display_get()

Change-Id: I8c044fba19bd522d23a32dbef72c3bb7b880b7c1

src/tpl.h
src/tpl_display.c

index 1d240c9..6d41edc 100644 (file)
--- a/src/tpl.h
+++ b/src/tpl.h
@@ -29,7 +29,7 @@
  *
  * Here is a simple example
  *
- * dpy = tpl_display_get(NULL);
+ * dpy = tpl_display_create(...);
  * sfc = tpl_surface_create(dpy, ...);
  *
  * while (1)
@@ -178,10 +178,9 @@ typedef enum
  * TPL provides platform independent APIs by implementing platform dependent
  * things in a backend. These types represent types of such backends. One of
  * these types should be specified when creating a TPL display object when
- * calling tpl_display_get().
+ * calling tpl_display_create().
  *
- * @see tpl_display_get()
- * @see tpl_display_get_backend_type()
+ * @see tpl_display_create()
  */
 typedef enum
 {
@@ -268,7 +267,7 @@ tpl_bool_t tpl_object_set_user_data(tpl_object_t *object,
 void * tpl_object_get_user_data(tpl_object_t *object);
 
 /**
- * Create or get TPL display object for the given native display.
+ * Create TPL display object for the given native display.
  *
  * Create a TPL display if there's no already existing TPL display for the
  * given native display. If given NULL for native_dpy, this function will
@@ -278,8 +277,19 @@ void * tpl_object_get_user_data(tpl_object_t *object);
  * @param native_dpy handle to the native display.
  * @return pointer to the display on success, NULL on failure.
  */
-tpl_display_t * tpl_display_get(tpl_backend_type_t type,
-                               tpl_handle_t native_dpy);
+tpl_display_t * tpl_display_create(tpl_backend_type_t type,
+                                  tpl_handle_t native_dpy);
+
+/**
+ * Get TPL display object for the given native display.
+ *
+ * If there's already existing TPL display for the given native display,
+ * then return the TPL display.
+ *
+ * @param native_dpy handle to the native display.
+ * @return pointer to the display on success, NULL on failure.
+ */
+tpl_display_t * tpl_display_get(tpl_handle_t native_dpy);
 
 /**
  * Bind a client connection(display handle) to the existed TPL display.
index 17b45a8..6a0a42a 100644 (file)
@@ -21,7 +21,7 @@ __tpl_display_free(void *display)
 }
 
 tpl_display_t *
-tpl_display_get(tpl_backend_type_t type, tpl_handle_t native_dpy)
+tpl_display_create(tpl_backend_type_t type, tpl_handle_t native_dpy)
 {
        tpl_display_t *display;
        tpl_bool_t ret;
@@ -29,9 +29,8 @@ tpl_display_get(tpl_backend_type_t type, tpl_handle_t native_dpy)
        /* Search for an already connected display for the given native display. */
        display = __tpl_runtime_find_display(type, native_dpy);
 
-       /* exact match found, can return immediately */
-       if (NULL != display)
-               return display;
+       /* If tpl_display already exists, then return NULL */
+       if (display) return NULL;
 
        /* if backend is unknown, try to find the best match from the list of supported types */
        if (TPL_BACKEND_UNKNOWN == type)
@@ -85,6 +84,17 @@ tpl_display_get(tpl_backend_type_t type, tpl_handle_t native_dpy)
        return display;
 }
 
+tpl_display_t *
+tpl_display_get(tpl_handle_t native_dpy)
+{
+       tpl_display_t *display;
+
+       /* Search for an already connected display for the given native display. */
+       display = __tpl_runtime_find_display(TPL_BACKEND_UNKNOWN, native_dpy);
+
+       return display;
+}
+
 tpl_bool_t
 tpl_display_bind_client_display_handle(tpl_display_t *display, tpl_handle_t native_dpy)
 {