Connect to wayland display server 18/176618/3
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 20 Apr 2018 08:47:01 +0000 (17:47 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 20 Apr 2018 08:53:57 +0000 (17:53 +0900)
Change-Id: I6ba06916be7c2b782866f72100b885b85cf8f931
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/media_key.c

index 36ac7c7..2f35571 100644 (file)
@@ -53,6 +53,7 @@ struct key_map media_keys[] = {
 static media_key_event_cb _media_key_event_cb;
 static void *_media_key_data;
 static int _media_key_initialized;
+static Ecore_Wl2_Display *_wl2_dpy;
 
 static Ecore_Event_Handler *media_key_up;
 static Ecore_Event_Handler *media_key_down;
@@ -63,6 +64,13 @@ static int _media_key_init(void)
                return 0;
 
        ecore_wl2_init();
+       _wl2_dpy = ecore_wl2_display_connect(NULL);
+       if (!_wl2_dpy) {
+               LOGE("Failed to connect to wl2 display");
+               ecore_wl2_shutdown();
+               return -1;
+       }
+
        _media_key_initialized = 1;
 
        return 0;
@@ -70,6 +78,10 @@ static int _media_key_init(void)
 
 static void _media_key_fini(void)
 {
+       if (_wl2_dpy) {
+               ecore_wl2_display_disconnect(_wl2_dpy);
+               _wl2_dpy = NULL;
+       }
        ecore_wl2_shutdown();
        _media_key_initialized = 0;
 }