comp-wl: show warning window to notify failure of gl init 56/42656/4
authorMinJeong Kim <minjjj.kim@samsung.com>
Wed, 1 Jul 2015 08:19:20 +0000 (17:19 +0900)
committerMinJeong Kim <minjjj.kim@samsung.com>
Wed, 1 Jul 2015 14:51:13 +0000 (07:51 -0700)
To inform that gl init was failed, enlightenment creates elm_window by itself,
and checks pid of wl_client that is requesting "get_shell_surface". These check
will help to determine if it is internal window or not.

Change-Id: I528939ee2dbbf275c4a1d185ec86f0a3968b234e
Signed-off-by: MinJeong Kim <minjjj.kim@samsung.com>
src/bin/e_comp_wl.c
src/modules/wl_desktop_shell/e_mod_main.c

index 3b15b9bfcaad9a49cdd9521230c8e002e17f154c..e22ea90c6407edfc013e004fb0fccf26c2d40324 100644 (file)
@@ -2961,6 +2961,47 @@ _e_comp_wl_gl_shutdown(E_Comp_Data *cdata)
    cdata->gl.evasgl = NULL;
 }
 
+static void
+_e_comp_wl_gl_cb_popup(void *data,
+                       Evas_Object *obj EINA_UNUSED,
+                       void *event_info EINA_UNUSED)
+{
+   evas_object_del(data);
+}
+
+static Eina_Bool
+_e_comp_wl_gl_idle(void *data)
+{
+   if (!e_comp->gl)
+     {
+        /* show warning window to notify failue of gl init */
+        Evas_Object *win, *popup, *btn;
+
+        win = elm_win_util_standard_add("compositor warning", "Compositor Warning");
+        elm_win_autodel_set(win, EINA_TRUE);
+        elm_win_borderless_set(win, EINA_TRUE);
+        elm_win_role_set(win, "wl-warning-popup");
+
+        popup = elm_popup_add(win);
+        elm_object_text_set(popup,
+                            _( "Your screen does not support OpenGL.<br>"
+                               "Falling back to software engine."));
+        elm_object_part_text_set(popup, "title,text", "Compositor Warning");
+
+        btn = elm_button_add(popup);
+        elm_object_text_set(btn, "Close");
+        elm_object_part_content_set(popup, "button1", btn);
+        evas_object_smart_callback_add(btn, "unpressed", _e_comp_wl_gl_cb_popup, win);
+
+        evas_object_show(popup);
+        evas_object_show(win);
+     }
+
+   return ECORE_CALLBACK_CANCEL;
+}
+
+
+
 static Eina_Bool
 _e_comp_wl_compositor_create(void)
 {
@@ -3110,6 +3151,9 @@ _e_comp_wl_compositor_create(void)
    /* setup module idler to load shell mmodule */
    ecore_idler_add(_e_comp_wl_cb_module_idle, cdata);
 
+   /* check if gl init succeded */
+   ecore_idler_add(_e_comp_wl_gl_idle, cdata);
+
    if (comp->comp_type == E_PIXMAP_TYPE_X)
      {
         e_comp_wl_input_pointer_enabled_set(EINA_TRUE);
index 6613be6a8d4fb1ad48d6d16d19addefe6f60137a..da7b264d81fcb11c6a59712013b919a1ae4322de 100644 (file)
@@ -574,8 +574,14 @@ _e_shell_cb_shell_surface_get(struct wl_client *client, struct wl_resource *reso
 
    if (!ec)
      {
-        /* no client found. not internal window. maybe external client app ? */
-        if (!(ec = e_client_new(NULL, ep, 0, 0)))
+        pid_t pid;
+        int internal = 0;
+
+        /* check if it's internal or external */
+        wl_client_get_credentials(client, &pid, NULL, NULL);
+        if (pid == getpid()) internal = 1;
+
+        if (!(ec = e_client_new(NULL, ep, 0, internal)))
           {
              wl_resource_post_error(surface_resource,
                                     WL_DISPLAY_ERROR_INVALID_OBJECT,
@@ -1155,8 +1161,14 @@ _e_xdg_shell_cb_surface_get(struct wl_client *client, struct wl_resource *resour
 
    if (!ec)
      {
-        /* no client found. not internal window. maybe external client app ? */
-        if (!(ec = e_client_new(NULL, ep, 0, 0)))
+        pid_t pid;
+        int internal = 0;
+
+        /* check if it's internal or external */
+        wl_client_get_credentials(client, &pid, NULL, NULL);
+        if (pid == getpid()) internal = 1;
+
+        if (!(ec = e_client_new(NULL, ep, 0, internal)))
           {
              wl_resource_post_error(surface_resource,
                                     WL_DISPLAY_ERROR_INVALID_OBJECT,