From: 이상진 <lsj119@samsung.com>
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 12 Feb 2010 05:31:26 +0000 (05:31 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 12 Feb 2010 05:31:26 +0000 (05:31 +0000)
I am attaching another patches for transparent window.

1. Use RGB Visual.
2. Set destination_alpha in ecore_evas for alpha composite in evas.
3. add Function
   - Ecore_Evas_Engine_Func->fn_transparent_set
   - ecore_evas_transparent_set , ecore_evas_transparent_get
   - elm_win_transparent_set, elm_win_transparent_get

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@46106 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/ecore_evas/Ecore_Evas.h
src/lib/ecore_evas/ecore_evas.c
src/lib/ecore_evas/ecore_evas_buffer.c
src/lib/ecore_evas/ecore_evas_directfb.c
src/lib/ecore_evas/ecore_evas_fb.c
src/lib/ecore_evas/ecore_evas_private.h
src/lib/ecore_evas/ecore_evas_quartz.c
src/lib/ecore_evas/ecore_evas_sdl.c
src/lib/ecore_evas/ecore_evas_win32.c
src/lib/ecore_evas/ecore_evas_wince.c
src/lib/ecore_evas/ecore_evas_x.c

index 548840b..30562ba 100644 (file)
@@ -285,6 +285,8 @@ EAPI void        ecore_evas_shaped_set(Ecore_Evas *ee, int shaped);
 EAPI int         ecore_evas_shaped_get(const Ecore_Evas *ee);
 EAPI void        ecore_evas_alpha_set(Ecore_Evas *ee, int alpha);
 EAPI int         ecore_evas_alpha_get(const Ecore_Evas *ee);
+EAPI void        ecore_evas_transparent_set(Ecore_Evas *ee, int transparent);
+EAPI int         ecore_evas_transparent_get(const Ecore_Evas *ee);
 EAPI void        ecore_evas_show(Ecore_Evas *ee);
 EAPI void        ecore_evas_hide(Ecore_Evas *ee);
 EAPI int         ecore_evas_visibility_get(const Ecore_Evas *ee);
index 983239d..400cc99 100644 (file)
@@ -1552,6 +1552,51 @@ ecore_evas_alpha_get(const Ecore_Evas *ee)
 }
 
 /**
+ * Set whether an Ecore_Evas has an transparent window or not.
+ * @param ee The Ecore_Evas to shape
+ * @param transparent 1 to enable the transparent window, 0 to disable it
+ *
+ * This function allows you to make an Ecore_Evas translucent using an
+ * alpha channel. See ecore_evas_shaped_set() for details. The difference
+ * between a shaped window and a window with an alpha channel is that an
+ * alpha channel supports multiple levels of transpararency, as opposed to
+ * the 1 bit transparency of a shaped window (a pixel is either opaque, or
+ * it's transparent).
+ */
+EAPI void
+ecore_evas_transparent_set(Ecore_Evas *ee, int transparent)
+{
+   if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
+     {
+       ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
+                        "ecore_evas_transparent_set");
+       return;
+     }
+   IFC(ee, fn_transparent_set) (ee, transparent);
+   IFE;
+}
+
+/**
+ * Query whether an Ecore_Evas has an alpha channel.
+ * @param ee The Ecore_Evas to query.
+ * @return 1 if ee has an alpha channel, 0 if it does not.
+ *
+ * This function returns 1 if @p ee has an alpha channel, and 0 if
+ * it does not.
+ */
+EAPI int
+ecore_evas_transparent_get(const Ecore_Evas *ee)
+{
+   if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
+     {
+       ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
+                        "ecore_evas_transparent_get");
+       return 0;
+     }
+   return ee->transparent ? 1:0;
+}
+
+/**
  * Show an Ecore_Evas' window
  * @param ee The Ecore_Evas to show.
  *
index 1335c68..0e194a4 100644 (file)
@@ -471,6 +471,7 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func =
      NULL,
      NULL,
      NULL,
+     NULL, //transparent
      
      NULL // render
 };
index acc8a53..46e81c9 100644 (file)
@@ -485,6 +485,7 @@ static Ecore_Evas_Engine_Func _ecore_directfb_engine_func =
      NULL,                             /* sticky */
      NULL,                              /* ignore events */
      NULL,                              /* alpha */
+     NULL, //transparent
      
      NULL // render
 };
index 2d77889..3280589 100644 (file)
@@ -562,6 +562,7 @@ static Ecore_Evas_Engine_Func _ecore_fb_engine_func =
      NULL,
      NULL,
      NULL,
+     NULL, //transparent
      
      NULL // render
 };
index e36f02d..f9a2e3f 100644 (file)
@@ -183,6 +183,7 @@ struct _Ecore_Evas_Engine_Func
    void        (*fn_sticky_set) (Ecore_Evas *ee, int sticky);
    void        (*fn_ignore_events_set) (Ecore_Evas *ee, int ignore);
    void        (*fn_alpha_set) (Ecore_Evas *ee, int alpha);
+   void        (*fn_transparent_set) (Ecore_Evas *ee, int transparent);
 
    int         (*fn_render) (Ecore_Evas *ee);
 };
@@ -273,6 +274,7 @@ struct _Ecore_Evas
    Eina_Bool   draw_ok : 1;
    Eina_Bool   should_be_visible : 1;
    Eina_Bool   alpha  : 1;
+   Eina_Bool   transparent  : 1;
 
    Eina_Hash  *data;
 
index ed74819..791b2bf 100644 (file)
@@ -340,6 +340,7 @@ static Ecore_Evas_Engine_Func _ecore_quartz_engine_func =
    NULL,
    NULL,
    NULL,
+   NULL, //transparent
      
      NULL // render
 };
index de7c912..153c87e 100644 (file)
@@ -335,6 +335,7 @@ static Ecore_Evas_Engine_Func _ecore_sdl_engine_func =
    NULL,
    NULL,
    NULL,
+   NULL, //transparent
      
      NULL // render
 };
index f264d63..69ab158 100644 (file)
@@ -850,6 +850,7 @@ static Ecore_Evas_Engine_Func _ecore_win32_engine_func =
      NULL, /* _ecore_evas_x_sticky_set */
      NULL, /* _ecore_evas_x_ignore_events_set */
      NULL,  /* _ecore_evas_x_alpha_set */
+     NULL, //transparent
      
      NULL // render
 };
index f7fd509..d283302 100644 (file)
@@ -720,6 +720,7 @@ static Ecore_Evas_Engine_Func _ecore_wince_engine_func =
    NULL, /* _ecore_evas_x_sticky_set */
    NULL, /* _ecore_evas_x_ignore_events_set */
    NULL, /* _ecore_evas_x_alpha_set */
+   NULL, //transparent
      
      NULL // render
 };
index 37aa24b..32045ea 100644 (file)
@@ -1795,6 +1795,27 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
 #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
      }
 }
+
+static void
+_ecore_evas_x_transparent_set(Ecore_Evas *ee, int transparent)
+{
+   if (((ee->transparent) && (transparent)) || 
+       ((!ee->transparent) && (!transparent)))
+     return;
+
+   if (!strcmp(ee->driver, "software_x11"))
+     {
+       Evas_Engine_Info_Software_X11 *einfo;
+
+       einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
+       if (!einfo) return;
+
+       ee->transparent = transparent;
+       einfo->info.destination_alpha = transparent;
+       evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
+       evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
+     }
+}
 #endif /* BUILD_ECORE_EVAS_X11 */
 
 #ifdef BUILD_ECORE_EVAS_X11
@@ -2332,6 +2353,7 @@ static Ecore_Evas_Engine_Func _ecore_x_engine_func =
      _ecore_evas_x_sticky_set,
      _ecore_evas_x_ignore_events_set,
      _ecore_evas_x_alpha_set,
+     _ecore_evas_x_transparent_set,
      
      NULL // render
 };