Hiho,
sorry for picking up this old thread, but today I tried again to get
this managed using Gtk2::ClutterEmbed - still with no luck but I am
getting closer ;)
Emmanuele Bassi wrote:
> > Sounds like we have some misunderstanding here. What you suggest is to
> > change to opacity of the toplevel window, which is indeed outside of
> > clutter's scope. I like to get a stage with no background color (what I
> > called transparent), without window decorations (I know how to manage
> > that), so I can do OSD like stuff.
>
> first of all, there are no portable ways to do that.
>
> on X11, you might need to create your own Window with an ARGB visual and
> an opacity of 0, and set the Window as the stage surface using the
> clutter_x11_set_stage_foreach() function. you'll obviously need a
> compositor for this.
So I tried to get a window with an ARGB visual using Gtk2 and
Gtk2::ClutterEmbed to put a Clutter stage into that window. I
successfully checked whether a transparent toplevel window works at all
this way by using a Cairo surface. But I don't get a transparent Clutter
stage in the same window.
Here the code of my approach: (I know that's not what you suggested, but
since clutter_x11_set_stage_foreach() isn't bound in Perl and my XS/C
knowlege is limited, I just tried this in a very naive fashion ;)
--snip--
#!/usr/bin/perl
use strict;
use Cairo;
use Gtk2 '-init';
use Clutter ':gtk-init';
use Glib qw(TRUE FALSE);
main: {
my $window = Gtk2::Window->new('toplevel');
$window->set_default_size(500, 200);
$window->signal_connect('delete_event', sub { Gtk2->main_quit; });
my $colormap = $window->get_screen->get_rgba_colormap;
$window->set_colormap($colormap) if $colormap;
my $drawable = Gtk2::DrawingArea->new;
$drawable->size(300, 200);
$drawable->signal_connect('expose_event', sub {
my $cr = Gtk2::Gdk::Cairo::Context->create($drawable->window);
$cr->set_source_rgba (1, 1, 1, 0);
$cr->set_operator("source");
$cr->paint;
$cr->rectangle (10, 10, 80, 80);
$cr->set_source_rgba (1, 0, 0, 0.2);
$cr->fill;
FALSE;
});
my $clutter_embed = Gtk2::ClutterEmbed->new;
my $stage = $clutter_embed->get_stage;
$stage->set_color(Clutter::Color->parse('DarkBlue'));
$stage->set_opacity(128);
my $hbox = Gtk2::HBox->new;
$hbox->pack_start($drawable, 0, 1, 0);
$hbox->pack_start($clutter_embed, 1, 1, 0);
$window->add($hbox);
$window->show_all;
Gtk2->main;
}
--snip--
This opens a window with a transparent drawing area on the left side
(containing a translucent red box), and an dark blue non-translucent
Clutter stage on the right.
Does anyone has any idea what's missing in this approach or whether I am
on the totally wrong track? If it's really necessary to do some stuff in
C/XS, I'll try that - but at first it would be great if it's doable in
pure Perl.
Thanks,
Jörn
--
.''`. Jörn Reder <[email protected]>
: :' : http://www.exit1.org/
`. `'
`- Debian GNU/Linux -- The power of freedom
--
To unsubscribe send a mail to [email protected]