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
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);
}
/**
+ * 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.
*
NULL,
NULL,
NULL,
+ NULL, //transparent
NULL // render
};
NULL, /* sticky */
NULL, /* ignore events */
NULL, /* alpha */
+ NULL, //transparent
NULL // render
};
NULL,
NULL,
NULL,
+ NULL, //transparent
NULL // render
};
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);
};
Eina_Bool draw_ok : 1;
Eina_Bool should_be_visible : 1;
Eina_Bool alpha : 1;
+ Eina_Bool transparent : 1;
Eina_Hash *data;
NULL,
NULL,
NULL,
+ NULL, //transparent
NULL // render
};
NULL,
NULL,
NULL,
+ NULL, //transparent
NULL // render
};
NULL, /* _ecore_evas_x_sticky_set */
NULL, /* _ecore_evas_x_ignore_events_set */
NULL, /* _ecore_evas_x_alpha_set */
+ NULL, //transparent
NULL // render
};
NULL, /* _ecore_evas_x_sticky_set */
NULL, /* _ecore_evas_x_ignore_events_set */
NULL, /* _ecore_evas_x_alpha_set */
+ NULL, //transparent
NULL // render
};
#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
_ecore_evas_x_sticky_set,
_ecore_evas_x_ignore_events_set,
_ecore_evas_x_alpha_set,
+ _ecore_evas_x_transparent_set,
NULL // render
};