C & Free Software & Hacking & ProFUSION Gustavo Sverzut Barbieri on 23 Sep 2008 05:35 pm
Translucent widgets on X11, EFL version.
Today I read on Trolltech Labs Blogs a great post from Samuel Rødal about how to get translucent widgets on X11 with Qt’s newest snapshot. Then I thought that if people find it cool to have such thing, why not say how to do the same in EFL?
EFL here is just Evas, Ecore and Edje. Evas does support rendering to semi-transparent buffers, including ARGB windows. Ecore and it’s sub-libraries Ecore-X and Ecore-Evas know how to create ARGB windows since a long time, just use ecore_evas_alpha_set(ee, 1) if you have composite manager or ecore_evas_shaped_set(ee, 1) if you don’t (it will be the best you can achieve on low end hardwares). Edje is just used to provide fancy button-like object without trouble, if you like Qt, then try QEdje.
My code is available at http://barbieri-playground.googlecode.com/svn/efl-tests/transp-bg/ and it requires a recent version of Ecore, not because of alpha/translucent support, but because I just added the helper ecore_evas_new(). If you have an older version, try to replace it with ecore_evas_software_x11_new(NULL, 0, 0, 0, 320, 240). Why I did used that function? First because I wanted to blog about it, second because it will make the same effect work elsewhere, like Windows and DirectFB
7 Responses to “Translucent widgets on X11, EFL version.”
Leave a Reply
You must be logged in to post a comment.
on 25 Nov 2008 at 11:34 pm 1.allenray said …
Hi, I have tried your code. It’s very interesting. But I am puzzled how to make the transparent thing as a glass. That means the transparent thing will accept the mouse message but you cannot see it.
on 25 Nov 2008 at 11:45 pm 2.Gustavo Sverzut Barbieri said …
It’s easy, just create a transparent rectangle (color: 0, 0, 0, 0). It can get events even without being visible, it just have to exist. Notice that window manager will still show border, you can set it to be borderless to avoid so.
on 26 Nov 2008 at 12:51 am 3.allenray said …
I have create a rectangle area with mouse_event and this area covers all the window.
part {
name: “event_area1″;
type: RECT;
mouse_events: 1;
description {
state: “default” 0.0;
color: 0 0 0 0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
}
}
but the rectangle is black.
on 26 Nov 2008 at 12:56 am 4.allenray said …
the whole test1.edc file is
collections {
group {
name: “main”;
parts{
part {
name: “event_area1″;
type: RECT;
mouse_events: 1;
description {
state: “default” 0.0;
color: 0 0 0 0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
}
}
}
}
}
something wrong with my last post. the window is all transparent but also cannot get mouse event.
on 26 Nov 2008 at 9:28 am 5.Gustavo Sverzut Barbieri said …
Ouch! Seems that X does not send events to transparent areas!
Well, I actually like that behavior, can make some things handy, but I see that for your case it might be a problem.
Depending on what you want, you can create an input window with ecore_x_window_input_new(), it can be of size 1×1 but it will work if you grab input there. You can use e17 code for e_grabinput() as example. If you want real examples on how to get typed keys with modifiers and all, use /e/src/modules/conf_keybindings/e_int_config_keybindings.c since it does that.
on 26 Nov 2008 at 11:42 pm 6.allenray said …
Thank you. What I really want is to create a window with mplayer in it. And when I click mouse, the play control panel appears. Like the behavior in canola.
on 27 Nov 2008 at 7:40 am 7.Gustavo Sverzut Barbieri said …
For Canola we just have the window to not listen to mouse events, so it goes to the window below it, in this case our application. I can’t remember if we just disabled mouse events with some mplayer command line option or by reseting event mask of the window that we give for mplayer with -wid.
Anyway, if you opt to go with inputwin, it will work.