Re: window with widgets and adjustable transparency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Pablo,

30.07.2018 21:14 pablo andrade pereira via gtk-list <gtk-list@xxxxxxxxx> wrote:
> 
>  Dear Sirs/Madams,
>   
>  I am new in C programming and in GTK,[...]

You are welcome. :-)

>   [...]
>   void value_changed(GtkRange *range, gpointer window) {
>     
>     val = gtk_range_get_value(range);
>     gtk_widget_set_opacity (GTK_WIDGET (window), val);
>   
>  }
>   
>   [...]
>   
>       g_signal_connect(hscale, "value-changed", G_CALLBACK(value_changed),
> NULL);

This should be:

    g_signal_connect(hscale, "value-changed", G_CALLBACK(value_changed),
window);

The 4th argument of g_signal_connect() is the value which will be
passed later as the 2nd argument of the value_changed() callback,
that is also called window.

Once I did this change your program started working.

Few more remarks:

* The initial value of the hscale is 0 but the initial opacity
  of the window is not 0.
* It is wrong idea to set the initial opacity of the window to 0
  because the window would be invisible (fully transparent).
* The transparency/opacity setting works only if you use a compositing
  window manager (which handles translucent windows).
* Setting the window opacity before the window is shown (gtk_widget_show
  or gtk_widget_show_all) has no effect and may even disable setting
  the opacity in future. This is the bug which I have discovered
  recently and did not yet have time to report it.

Regards,

Rafal
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list



[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux