Re: Transparency



Narendran K wrote:
Hi,
 here the background is fully transparent, and if i click inside the
 window, the backwindow is getting activated. How can I avoid such
things ? help me please
thanks
Narendran

On Mon, 01 Dec 2003 Julio Pastrana wrote :

Hello Russell here are some examples



http://mail.gnome.org/archives/gtk-app-devel-list/2003-October/msg00067.html

http://mail.gnome.org/archives/gtk-app-devel-list/2003-October/msg00369.html


Check them out ...
I hope it helps

Bye!!
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



with regards,
Naren

Ok, i finally got some transparency working with pixmaps. YAY! Now to figure out how to use the _rest_ of GTK2. Just so i know im moving in the right direction, does this look like a fairly straight forward way to draw a pixmap with transparancy? (this is hacked up code from the link above)



#include <gtk/gtk.h>
#include <stdlib.h>

void close_application( GtkWidget *widget, GdkEvent
*event, gpointer data ) {
    gtk_main_quit();
}

int main (int argc, char *argv[])
{
       GtkWidget *window, *pixmap;

    GdkPixmap   *p;      // this is the color pixmap
        GdkPixmap *xpm; //this is the mask

        GtkWidget *vbox1;

    int sizeX = 256;
    int sizeY = 256;

    gtk_init (&argc, &argv);

    window = gtk_window_new( GTK_WINDOW_TOPLEVEL);
    gtk_widget_set_usize (window,  sizeX ,  sizeY);
    gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, TRUE);
    gtk_signal_connect (GTK_OBJECT (window), "delete_event",
                        GTK_SIGNAL_FUNC (close_application), NULL);
    gtk_widget_show (window);

    vbox1 = gtk_vbox_new (FALSE, 0);
    gtk_widget_set_name (vbox1, "vbox1");
    gtk_widget_ref (vbox1);
    gtk_object_set_data_full (GTK_OBJECT (window), "vbox1", vbox1,
                             (GtkDestroyNotify) gtk_widget_unref);
    gtk_container_add (GTK_CONTAINER (window), vbox1);
       gtk_widget_show (vbox1);

//do i need these 2 lines or will those be initialze by the fucntion below that populates them?
    p =  gdk_pixmap_new ( window->window, sizeX,sizeY, -1);
    xpm = gdk_pixmap_new ( NULL, sizeX, sizeY, 1);

p = gdk_pixmap_create_from_xpm ( window->window, &xpm, NULL, (gchar *) "test.xpm");
    pixmap = gtk_pixmap_new( p, xpm);


    gdk_pixmap_unref(p);
    gdk_pixmap_unref(xpm);

    gtk_container_add( GTK_CONTAINER(vbox1),  pixmap);

    gtk_widget_shape_combine_mask( window, xpm, 0, 0 );
    gtk_widget_show( pixmap );

    gtk_main ();

    return 0;
}

Thanks in advance for any help/advice!

Nick










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