Ruby Forum Ruby-Gnome 2 > transparent window (alpha support)

Posted by Philipp Goetzinger (pgoetzin)
on 17.05.2008 20:05
Hello everyone,
i use gtk::windows with various content(child) widgets like

#gstreamer widget
class SimpleVideoWidget < Gtk::DrawingArea
..........
end

#image widget
class SimpleImageWidget < Gtk::Image
..........
end

#html widget
class WebkitWidget < Gtk::WebKit::WebView
..............
end


now i want to set them transparent.


i found some cairo samples but im not sure if the are right for me
http://www.pri.univie.ac.at/~mangler/alphademo/alphademo.rb

my composite manager is enabled
Gdk::Screen.default.composited?  is true
and here i get the rgba colormap
 Gdk::Screen.default.rgba_colormap

do i have to use gtk:window#.input_shape_combine_mask(,0,0)?


does anyone have any hints ?

thanks ahead


Philipp
Posted by Guillaume Cottenceau (Guest)
on 17.05.2008 22:40
(Received via mailing list)
> does anyone have any hints ?

ruby-gnome2/trunk/gtk/sample/misc/composited-windows.rb might be a
good startting point.

--
Guillaume Cottenceau - http://zarb.org/~gc/
Posted by Philipp Goetzinger (pgoetzin)
on 19.05.2008 01:06
Hello  Guillaume,

thanks for the information ...


got it to work. if composite is enabled u can use 
gtk::window#set_opacity(<alpha>)

alpha must be between 0 an 1


e.g
@fraticles["#{fraticle['id']}"].signal_connect_after('map-event') do 
|widget, event|
                     widget.window.set_opacity(0.8)

end

i think its also important where u call the functions because sometimes 
alpha was set for a window but it was not transparent ... got best 
results with the map-event


regards
Philipp
Posted by Guillaume Cottenceau (Guest)
on 19.05.2008 09:47
(Received via mailing list)
On Mon, May 19, 2008 at 1:06 AM, Philipp Goetzinger
<ruby-forum-incoming@andreas-s.net> wrote:
>
> e.g
> @fraticles["#{fraticle['id']}"].signal_connect_after('map-event') do
> |widget, event|
>                     widget.window.set_opacity(0.8)
>
> end
>
> i think its also important where u call the functions because sometimes
> alpha was set for a window but it was not transparent ... got best
> results with the map-event

I don't understand fully what you're saying: do you imply that the
mentioned example should be fixed? Can you provide a patch if that's
the case? Or do you mean there is another way to do the same thing?
Can you program a short demo program if that's the case?

--
Guillaume Cottenceau - http://zarb.org/~gc/
Posted by Philipp Goetzinger (pgoetzin)
on 19.05.2008 12:23
Hello  Guillaume,
im not sure if this is a bug, or my fault

i loop through a xml and create 1-5 windows .. after 10-20 secs the 
windows will be destroyed and i create new windows ..

here my code to create the window

 xml_fraticles.find('fraticle').each{|fraticle|
      @fraticles["#{fraticle['id']}"] = Gtk::Window.new
      @fraticles["#{fraticle['id']}"].screen = 
Gdk::DisplayManager.get.default_display.get_screen 
fraticle['x11screen'].to_i
      @fraticles["#{fraticle['id']}"].move(fraticle['left'].to_i,fraticle['top'].to_i)
      @fraticles["#{fraticle['id']}"].resize(fraticle['width'].to_i,fraticle['height'].to_i)
       @fraticles["#{fraticle['id']}"].decorated = false
      fraticles["#{fraticle['id']}"].add 
eval(fraticle['playermodule']).new(self, fraticle)
       @fraticles["#{fraticle['id']}"].set_opacity(0.8) 
<<<<<<<<<<<<<<<<<<<<<< if i call it here only a few windows are 
transparent
   @fraticles["#{fraticle['id']}"].signal_connect_after('map-event') do 
|widget, event|
            widget.window.set_opacity(0.8)<<<<<<<<<< if i call i here 
its working for all windows
          end
}
Posted by Philipp Goetzinger (pgoetzin)
on 19.05.2008 12:28
ok code is ugly, one more try

http://pastie.caboo.se/199410
Posted by Martin Vales (martin_gnu)
on 22.05.2008 14:17
(Received via mailing list)
hi:

I am trying use the set_sort_func from the sortable interface for
liststore or for a column in a treeview.

By now i can order columns like this:
column.set_sort_column_id(3)

This works but i can not have my own set_sort_func

or,

@list_store_productos.set_sort_column_id(3)
 @list_store_productos.set_sort_func(3){|iter1,iter2|


  }

But this fail to me.

Any ideas?
Posted by Kouhei Sutou (Guest)
on 02.08.2008 09:01
(Received via mailing list)
Hi,

In <48356538.6050305@opengeomap.org>
  "[ruby-gnome2-devel-en] set_sort_func" on Thu, 22 May 2008 14:21:12 
+0200,
  "Martin (OpenGeoMap)" <martin@opengeomap.org> wrote:

> @list_store_productos.set_sort_column_id(3)
>  @list_store_productos.set_sort_func(3){|iter1,iter2|
>   
>    
>   }
> 
> But this fail to me.

Could you show us your example script that is executable?


Thanks,
--
kou