Mercurial > audlegacy
changeset 475:cd5793de075c trunk
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
author | nenolod |
---|---|
date | Thu, 19 Jan 2006 15:45:01 -0800 |
parents | f3b46533da81 |
children | 0389b92ed03f |
files | audacious/Makefile.am audacious/about.c |
diffstat | 2 files changed, 26 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/audacious/Makefile.am Wed Jan 18 21:21:50 2006 -0800 +++ b/audacious/Makefile.am Thu Jan 19 15:45:01 2006 -0800 @@ -62,7 +62,7 @@ equalizer.c equalizer.h \ glade.c glade.h \ hints.c hints.h \ - credits.c credits.h \ + about.c credits.h \ plugin.h \ softvolume.c softvolume.h \ getopt.c getopt1.c getopt.h \
--- a/audacious/about.c Wed Jan 18 21:21:50 2006 -0800 +++ b/audacious/about.c Thu Jan 19 15:45:01 2006 -0800 @@ -35,6 +35,11 @@ static GtkWidget *about_window = NULL; static GdkPixbuf *about_pixbuf = NULL; +static GdkPixmap *mask_pixmap_window1 = NULL, + *mask_pixmap_window2 = NULL; +static GdkBitmap *mask_bitmap_window1 = NULL, + *mask_bitmap_window2 = NULL; + enum { COL_LEFT, @@ -177,6 +182,17 @@ }; static gboolean +on_about_window_expose(GtkWidget *widget, GdkEventExpose *expose, gpointer data) +{ + g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); + + gdk_window_set_back_pixmap(GDK_WINDOW(widget->window), mask_pixmap_window2, 0); + gdk_window_clear(GDK_WINDOW(widget->window)); + + return FALSE; +} + +static gboolean on_about_window_key_press (GtkWidget *widget, GdkEventKey *event, gpointer data) { g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); @@ -259,15 +275,13 @@ void show_about_window(void) { - GdkPixmap *mask_pixmap_window1 = NULL, - *mask_pixmap_window2 = NULL; - GdkBitmap *mask_bitmap_window1 = NULL, - *mask_bitmap_window2 = NULL; - gchar *filename = DATA_DIR G_DIR_SEPARATOR_S "images" G_DIR_SEPARATOR_S "about-logo.png"; if (about_window != NULL) + { + gtk_window_present(GTK_WINDOW(about_window)); return; + } about_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_type_hint(GTK_WINDOW(about_window), @@ -276,7 +290,7 @@ g_signal_connect(about_window, "destroy", G_CALLBACK(gtk_widget_destroyed), &about_window); -// gtk_widget_realize(about_window); + gtk_widget_realize(about_window); about_pixbuf = gdk_pixbuf_new_from_file(filename, NULL); @@ -284,6 +298,7 @@ gdk_pixbuf_get_width (about_pixbuf), gdk_pixbuf_get_height (about_pixbuf)); + gtk_widget_set_app_paintable (about_window, TRUE); gtk_window_set_title(GTK_WINDOW(about_window), _("About Audacious")); gtk_window_set_position(GTK_WINDOW(about_window), GTK_WIN_POS_CENTER); gtk_window_set_resizable(GTK_WINDOW(about_window), FALSE); @@ -300,6 +315,9 @@ gtk_widget_add_events(about_window, GDK_ALL_EVENTS_MASK); + g_signal_connect(about_window, "expose-event", + G_CALLBACK(on_about_window_expose), &about_window); + g_signal_connect(about_window, "key-press-event", G_CALLBACK(on_about_window_key_press), &about_window); @@ -374,10 +392,7 @@ gtk_widget_grab_default(close_btn); #endif - gtk_window_present(GTK_WINDOW(about_window)); - gtk_widget_shape_combine_mask(GTK_WIDGET(about_window), mask_bitmap_window2, 0, 0); - gdk_draw_pixbuf(GDK_DRAWABLE(about_window->window), NULL, about_pixbuf, 0, 0, 0, 0, -1, -1, - GDK_RGB_DITHER_NONE, 0, 0); + gtk_window_present(GTK_WINDOW(about_window)); }