Re: Can I make GtkPlug transparent?




 
Hi Lihao,

If you set the socket color you will be OK. You won't have to worry about the transparency of the plug, in 
that case.

For setting the transparency for the different windows you can try setting the window, socket and plug 
widgets with the following. It worked on GTK3.18. Couldn't get the transparency to work with CSS though. I 
don't know why that is.

Eric

...
static gboolean draw_background(GtkWidget *widget, cairo_t *cr, gpointer data)
  {
    cairo_set_source_rgba(cr, 1.0, 0.0, 0.0, 0.5);
    cairo_paint(cr);
    return FALSE;
  } 
...
gtk_widget_set_app_paintable("widget", TRUE);
if(gtk_widget_is_composited("widget"))
  {
    GdkScreen *screen=gtk_widget_get_screen("widget");  
    GdkVisual *visual=gdk_screen_get_rgba_visual(screen);
    gtk_widget_set_visual("widget", visual);
  }
else g_print("Can't set window transparency.\n");
g_signal_connect("widget", "draw", G_CALLBACK(draw_background), NULL);
... 

 




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