View Full Version : General Application Compositing
Maskawanian
June 30th, 2007, 12:45 AM
I am interested in creating a Mac OS X dock like application for fun to learn compositing. I am a former Mac OS X developer but am finding that Linux could soon replace most of the reasons I liked Mac OS X. I digress, Does anyone know how in GTK to create a window that is transparent, but a child widget is not, for example having an image full opacity. with nothing behind it?
Any pointers would be much appreciated.
-- Dan
lagorgy
June 30th, 2007, 06:21 AM
Maybe you should take a look at avant-window-navigator, its a dock like the one you're trying to develop. You can talk to the main dev and maybe help him instead of duplicating efforts, what do u think?
http://code.google.com/p/avant-window-navigator/
rememo
June 30th, 2007, 12:48 PM
Hi,
seeing that you already asked at the awn forums, I thought I would give you a direct reply. This is how it is done in gnome-terminal:
static void
initialize_alpha_mode (TerminalWindow *window)
{
GdkScreen *screen;
GdkColormap *colormap;
screen = gtk_widget_get_screen (GTK_WIDGET (window));
colormap = gdk_screen_get_rgba_colormap (screen);
if (colormap != NULL && gdk_screen_is_composited (screen))
{
/* Set RGBA colormap if possible so VTE can use real alpha
* channels for transparency. */
gtk_widget_set_colormap(GTK_WIDGET (window), colormap);
window->priv->have_argb_visual = TRUE;
}
else
{
window->priv->have_argb_visual = FALSE;
}
}
So you have to check if compositing (i.e. through compiz) is available first, before setting the rgba colormap. You can take a closer look at the code of gnome-terminal here:
http://cvs.gnome.org/viewcvs/gnome-terminal/src/terminal-window.c?rev=1.139&view=markup
However, as lagorgy said: I strongly recommend to help neil with his avant-window-navigator dock or the authors of the other docks (mainly kiba-dock and gnome-dock, although they already have zoom support).
FunkyM
June 30th, 2007, 10:53 PM
Another example in C# here (http://macslow.thepimp.net/?p=46) (in general faster to understand the overall basics). Also checkout other posts in that blog with loads of examples of different stuff. Then either checkout AWN as suggested or check gnome-dock's sources here (http://www.gnome-dock.org).
Maskawanian
June 30th, 2007, 11:17 PM
Hi,
seeing that you already asked at the awn forums, I thought I would give you a direct reply. This is how it is done in gnome-terminal:
static void
initialize_alpha_mode (TerminalWindow *window)
{
GdkScreen *screen;
GdkColormap *colormap;
screen = gtk_widget_get_screen (GTK_WIDGET (window));
colormap = gdk_screen_get_rgba_colormap (screen);
if (colormap != NULL && gdk_screen_is_composited (screen))
{
/* Set RGBA colormap if possible so VTE can use real alpha
* channels for transparency. */
gtk_widget_set_colormap(GTK_WIDGET (window), colormap);
window->priv->have_argb_visual = TRUE;
}
else
{
window->priv->have_argb_visual = FALSE;
}
}
So you have to check if compositing (i.e. through compiz) is available first, before setting the rgba colormap. You can take a closer look at the code of gnome-terminal here:
http://cvs.gnome.org/viewcvs/gnome-terminal/src/terminal-window.c?rev=1.139&view=markup
However, as lagorgy said: I strongly recommend to help neil with his avant-window-navigator dock or the authors of the other docks (mainly kiba-dock and gnome-dock, although they already have zoom support).
Don't get me wrong I just want to learn myself duplicating the efforts of others so that I can submit quality patches rather then poor code.
But thanks I really appreciate it.
Maskawanian
July 1st, 2007, 05:23 AM
In fact I did more research and found this example for anyone who is interested:
http://plan99.net/%7Emike/blog/?p=38
If you want transparency with XShape:
http://macslow.thepimp.net/?p=26
RYX
July 10th, 2007, 08:44 PM
For the python-approach to XShape/compositing you could also have a look at the screenlets base classes.
:)
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.