struct wl_surface *surface);
int screen_connector_provider_set_event_filter(
screen_connector_provider_h provider, unsigned int filter);
+int screen_connector_provider_destroy(screen_connector_provider_h provider);
int screen_connector_provider_init(void);
int screen_connector_provider_fini(void);
#define LOG_TAG "SC_PROVIDER"
-static int __init_count = 0;
-static struct tizen_remote_surface_manager *__rsm = NULL;
+static int __init_count;
+static struct tizen_remote_surface_manager *__rsm;
+static GList *__providers;
struct screen_connector_provider_s {
struct wl_surface *surface;
screen_connector_provider_h handle;
handle = screen_connector_provider_create(id, surface);
- if (handle)
- return 0;
+ if (!handle)
+ return -1;
+
+ __providers = g_list_append(__providers, handle);
- return -1;
+ return 0;
}
EXPORT_API int screen_connector_provider_set_event_filter(screen_connector_provider_h provider, unsigned int filter)
return 0;
}
+static void __destroy_provider(gpointer data)
+{
+ screen_connector_provider_h provider;
+
+ provider = (screen_connector_provider_h)data;
+
+ if (provider->rsp)
+ tizen_remote_surface_provider_destroy(provider->rsp);
+ if (provider->id)
+ free(provider->id);
+ free(provider);
+}
+
+EXPORT_API int screen_connector_provider_destroy(screen_connector_provider_h provider)
+{
+ if (!provider) {
+ LOGE("Invalid parameter");
+ return -1;
+ }
+
+ __providers = g_list_remove(__providers, provider);
+ __destroy_provider(provider);
+
+ return 0;
+}
+
static void __shutdown_ecore_wl2_display()
{
LOGE("disconnect wl2_display");
if (__init_count > 1) {
__init_count--;
return 0;
+ } else if (__init_count == 0) {
+ return 0;
}
- if (__rsm)
+ if (__providers) {
+ g_list_free_full(__providers, __destroy_provider);
+ __providers = NULL;
+ }
+
+ if (__rsm) {
tizen_remote_surface_manager_destroy(__rsm);
+ __rsm = NULL;
+ }
__shutdown_ecore_wl2_display();