Mercurial > audlegacy
changeset 3221:9583cd62231f trunk
implement ui_skinned_window_expose
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Thu, 02 Aug 2007 15:40:46 +0200 |
parents | 9af29d8ccb61 |
children | bb7f5adc1677 |
files | src/audacious/ui_equalizer.c src/audacious/ui_main.c src/audacious/ui_main.h src/audacious/ui_playlist.c src/audacious/ui_playlist.h src/audacious/ui_preferences.c src/audacious/ui_skinned_window.c src/audacious/ui_skinned_window.h src/audacious/widgets/skin.c |
diffstat | 9 files changed, 132 insertions(+), 272 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/ui_equalizer.c Thu Aug 02 15:07:31 2007 +0200 +++ b/src/audacious/ui_equalizer.c Thu Aug 02 15:40:46 2007 +0200 @@ -156,8 +156,6 @@ GtkWidget *child = child_data->widget; g_signal_emit_by_name(child, "toggle-double-size"); } - - draw_equalizer_window(TRUE); } void @@ -187,8 +185,6 @@ gtk_widget_hide(equalizerwin_volume); gtk_widget_hide(equalizerwin_balance); } - - draw_equalizer_window(TRUE); } static void @@ -253,61 +249,6 @@ cfg.equalizer_autoload = UI_SKINNED_BUTTON(equalizerwin_auto)->inside; } -static void equalizerwin_draw_titlebar() { - if (gtk_window_has_toplevel_focus(GTK_WINDOW(equalizerwin)) || - !cfg.dim_titlebar) { - if (!cfg.equalizer_shaded) - skin_draw_pixmap(bmp_active_skin, equalizerwin_bg, - SKINNED_WINDOW(equalizerwin)->gc, SKIN_EQMAIN, 0, 134, 0, - 0, 275, 14); - else - skin_draw_pixmap(bmp_active_skin, equalizerwin_bg, - SKINNED_WINDOW(equalizerwin)->gc, SKIN_EQ_EX, 0, 0, 0, 0, - 275, 14); - } - else { - if (!cfg.equalizer_shaded) - skin_draw_pixmap(bmp_active_skin, equalizerwin_bg, - SKINNED_WINDOW(equalizerwin)->gc, SKIN_EQMAIN, 0, 149, 0, - 0, 275, 14); - else - skin_draw_pixmap(bmp_active_skin, equalizerwin_bg, - SKINNED_WINDOW(equalizerwin)->gc, SKIN_EQ_EX, 0, 15, 0, 0, - 275, 14); - } -} - -void -draw_equalizer_window(gboolean force) -{ - if (!cfg.equalizer_visible) - return; - - if (force) { - if (!cfg.equalizer_shaded) - skin_draw_pixmap(bmp_active_skin, equalizerwin_bg, SKINNED_WINDOW(equalizerwin)->gc, - SKIN_EQMAIN, 0, 0, 0, 0, 275, 116); - equalizerwin_draw_titlebar(); - - GList *iter; - for (iter = GTK_FIXED (SKINNED_WINDOW(equalizerwin)->fixed)->children; iter; iter = g_list_next (iter)) { - GtkFixedChild *child_data = (GtkFixedChild *) iter->data; - GtkWidget *child = child_data->widget; - gtk_widget_queue_draw(child); - } - - if (cfg.doublesize && cfg.eq_doublesize_linked) { - GdkPixmap *img2; - img2 = create_dblsize_pixmap(equalizerwin_bg); - gdk_draw_drawable(equalizerwin_bg_x2, SKINNED_WINDOW(equalizerwin)->gc, img2, 0, 0, 0, 0, 550, 232); - g_object_unref(img2); - } - - gdk_window_clear(equalizerwin->window); - gdk_flush(); - } -} - gboolean equalizerwin_press(GtkWidget * widget, GdkEventButton * event, gpointer callback_data) @@ -367,8 +308,6 @@ dock_move_release(GTK_WINDOW(equalizerwin)); } - draw_equalizer_window(FALSE); - return FALSE; } @@ -712,8 +651,6 @@ else gtk_widget_set_size_request(equalizerwin, 275, (cfg.equalizer_shaded ? 14 : 116)); - gdk_flush(); - draw_equalizer_window(TRUE); cfg.equalizer_visible = TRUE; UI_SKINNED_BUTTON(mainwin_eq)->inside = TRUE; gtk_widget_show_all(equalizerwin);
--- a/src/audacious/ui_main.c Thu Aug 02 15:07:31 2007 +0200 +++ b/src/audacious/ui_main.c Thu Aug 02 15:40:46 2007 +0200 @@ -127,8 +127,6 @@ gint seek_state = MAINWIN_SEEK_NIL; gint seek_initial_pos = 0; -static GdkPixmap *mainwin_bg = NULL, *mainwin_bg_x2 = NULL; - static GtkWidget *mainwin_menubtn; static GtkWidget *mainwin_minimize, *mainwin_shade, *mainwin_close; @@ -167,7 +165,6 @@ static gint mainwin_timeout_id; -static gboolean mainwin_force_redraw = FALSE; static gboolean mainwin_info_text_locked = FALSE; static int ab_position_a = -1; @@ -181,7 +178,6 @@ static void set_timer_mode_menu_cb(TimerMode mode); static void set_timer_mode(TimerMode mode); static void change_timer_mode(void); -static void mainwin_refresh_hints(void); void mainwin_position_motion_cb(GtkWidget *widget, gint pos); void mainwin_position_release_cb(GtkWidget *widget, gint pos); @@ -339,7 +335,6 @@ } ui_skinned_set_push_button_data(mainwin_shade, 0, cfg.player_shaded ? 27 : 18, 9, cfg.player_shaded ? 27 : 18); - draw_main_window(TRUE); } static void @@ -537,55 +532,6 @@ mainwin_quit_cb(); } -static void -mainwin_draw_titlebar(gboolean focus) -{ - /* FIXME: uses SkinnedWindow::gc directly. -nenolod */ - skin_draw_mainwin_titlebar(bmp_active_skin, mainwin_bg, - SKINNED_WINDOW(mainwin)->gc, - cfg.player_shaded, focus || !cfg.dim_titlebar); -} - -void -draw_main_window(gboolean force) -{ - if (!cfg.player_visible) - return; - - if (force) - mainwin_refresh_hints(); - - if (force) { - if (!cfg.player_shaded) - skin_draw_pixmap(bmp_active_skin, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, - SKIN_MAIN, 0, 0, 0, 0, bmp_active_skin->properties.mainwin_width, - bmp_active_skin->properties.mainwin_height); - mainwin_draw_titlebar(gtk_window_has_toplevel_focus - (GTK_WINDOW(mainwin))); - } - - if (force) { - if (cfg.doublesize) { - GdkPixmap *img2x = NULL; - img2x = create_dblsize_pixmap(mainwin_bg); - gdk_draw_drawable(mainwin_bg_x2, SKINNED_WINDOW(mainwin)->gc, img2x, 0, 0, - 0, 0, bmp_active_skin->properties.mainwin_width * 2, - cfg.player_shaded ? MAINWIN_SHADED_HEIGHT * - 2 : bmp_active_skin->properties.mainwin_height * 2); - g_object_unref(img2x); - } - GList *iter; - for (iter = GTK_FIXED (SKINNED_WINDOW(mainwin)->fixed)->children; iter; iter = g_list_next (iter)) { - GtkFixedChild *child_data = (GtkFixedChild *) iter->data; - GtkWidget *child = child_data->widget; - gtk_widget_queue_draw(child); - } - - gdk_flush(); - } -} - - static gchar *mainwin_tb_old_text = NULL; void @@ -635,7 +581,7 @@ gtk_window_set_title(GTK_WINDOW(mainwin), mainwin_title_text); } -static void +void mainwin_refresh_hints(void) { if (bmp_active_skin && bmp_active_skin->properties.mainwin_othertext @@ -799,15 +745,6 @@ bmp_active_skin->properties.mainwin_width * (cfg.doublesize + 1), bmp_active_skin->properties.mainwin_height * (cfg.doublesize + 1)); - g_object_unref(mainwin_bg); - g_object_unref(mainwin_bg_x2); - mainwin_bg = gdk_pixmap_new(mainwin->window, - bmp_active_skin->properties.mainwin_width, - bmp_active_skin->properties.mainwin_height, -1); - mainwin_bg_x2 = gdk_pixmap_new(mainwin->window, - bmp_active_skin->properties.mainwin_width * 2, - bmp_active_skin->properties.mainwin_height * 2, -1); - mainwin_set_back_pixmap(); gdk_flush(); } } @@ -823,6 +760,7 @@ playback_set_sample_params(bitrate, frequency, n_channels); + GDK_THREADS_ENTER(); if (bitrate != -1) { bitrate /= 1000; @@ -874,7 +812,7 @@ title = playlist_get_info_text(playlist); mainwin_set_song_title(title); g_free(title); - mainwin_force_redraw = TRUE; + GDK_THREADS_LEAVE(); } void @@ -947,11 +885,8 @@ if (dock_is_moving(GTK_WINDOW(mainwin))) { dock_move_release(GTK_WINDOW(mainwin)); - draw_playlist_window(TRUE); } - draw_main_window(FALSE); - return FALSE; } @@ -985,8 +920,6 @@ event->y /= 2; } - draw_main_window(FALSE); - gdk_flush(); return FALSE; @@ -1047,9 +980,6 @@ if (dock_is_moving(GTK_WINDOW(mainwin))) dock_move_release(GTK_WINDOW(mainwin)); } - else { - draw_main_window(FALSE); - } if (event->button == 3) { if ( (event->y > 70) && (event->x < 128) ) @@ -1283,16 +1213,6 @@ return FALSE; } -void -mainwin_set_back_pixmap(void) -{ - if (cfg.doublesize) - gdk_window_set_back_pixmap(mainwin->window, mainwin_bg_x2, 0); - else - gdk_window_set_back_pixmap(mainwin->window, mainwin_bg, 0); - gdk_window_clear(mainwin->window); -} - /* * Rewritten 09/13/06: * @@ -1856,8 +1776,6 @@ !bmp_active_skin->properties.mainwin_height ? PLAYER_HEIGHT : bmp_active_skin->properties.mainwin_height); - draw_main_window(TRUE); - if (cfg.player_x != -1 && cfg.save_window_position) gtk_window_move(GTK_WINDOW(mainwin), cfg.player_x, cfg.player_y); @@ -1893,6 +1811,11 @@ gtk_widget_show(mainwin_vis); else gtk_widget_hide(mainwin_vis); + + if (bmp_active_skin->properties.mainwin_menurow_visible) + gtk_widget_show(mainwin_menurow); + else + gtk_widget_hide(mainwin_menurow); } void @@ -1952,13 +1875,6 @@ cfg.player_shaded ? MAINWIN_SHADED_HEIGHT : bmp_active_skin->properties.mainwin_height, bmp_active_skin->properties.mainwin_width * 2, bmp_active_skin->properties.mainwin_height * 2); - if (cfg.doublesize) { - gdk_window_set_back_pixmap(mainwin->window, mainwin_bg_x2, 0); - } - else { - gdk_window_set_back_pixmap(mainwin->window, mainwin_bg, 0); - } - GList *iter; for (iter = GTK_FIXED (SKINNED_WINDOW(mainwin)->fixed)->children; iter; iter = g_list_next (iter)) { GtkFixedChild *child_data = (GtkFixedChild *) iter->data; @@ -1966,7 +1882,7 @@ g_signal_emit_by_name(child, "toggle-double-size"); } - draw_main_window(TRUE); + mainwin_refresh_hints(); } void @@ -2860,8 +2776,6 @@ G_CALLBACK(mainwin_motion), NULL); g_signal_connect(mainwin, "configure_event", G_CALLBACK(mainwin_configure), NULL); - g_signal_connect(mainwin, "style_set", - G_CALLBACK(mainwin_set_back_pixmap), NULL); bmp_drag_dest_set(mainwin); @@ -2878,13 +2792,6 @@ gtk_window_add_accel_group( GTK_WINDOW(mainwin) , ui_manager_get_accel_group() ); - mainwin_bg = gdk_pixmap_new(mainwin->window, - bmp_active_skin->properties.mainwin_width, - bmp_active_skin->properties.mainwin_height, -1); - mainwin_bg_x2 = gdk_pixmap_new(mainwin->window, - bmp_active_skin->properties.mainwin_width * 2, - bmp_active_skin->properties.mainwin_height * 2, -1); - mainwin_set_back_pixmap(); mainwin_create_widgets(); } @@ -2983,8 +2890,6 @@ GDK_THREADS_ENTER(); - draw_main_window(mainwin_force_redraw); - if (!count) { read_volume(VOLSET_UPDATE); count = 10; @@ -2992,10 +2897,6 @@ else count--; - mainwin_force_redraw = FALSE; - draw_equalizer_window(FALSE); - draw_playlist_window(FALSE); - /* tristate buttons seek */ if ( seek_state != MAINWIN_SEEK_NIL ) {
--- a/src/audacious/ui_main.h Thu Aug 02 15:07:31 2007 +0200 +++ b/src/audacious/ui_main.h Thu Aug 02 15:40:46 2007 +0200 @@ -150,6 +150,7 @@ void mainwin_vis_set_type(VisType mode); +void mainwin_refresh_hints(void); void mainwin_set_info_text(void); void mainwin_set_song_info(gint rate, gint freq, gint nch); void mainwin_clear_song_info(void);
--- a/src/audacious/ui_playlist.c Thu Aug 02 15:07:31 2007 +0200 +++ b/src/audacious/ui_playlist.c Thu Aug 02 15:40:46 2007 +0200 @@ -92,8 +92,6 @@ static gboolean playlistwin_select_search_kp_cb( GtkWidget *entry , GdkEventKey *event , gpointer searchdlg_win ); -static void playlistwin_draw_frame(void); - static gboolean playlistwin_fileinfopopup_probe(gpointer * filepopup_win); static gboolean playlistwin_resizing = FALSE; @@ -392,8 +390,6 @@ playlistwin_get_height()); playlistwin_set_mask(); - - draw_playlist_window(TRUE); } static void @@ -695,12 +691,7 @@ GtkWidget *child = child_data->widget; g_signal_emit_by_name(child, "redraw"); } - playlistwin_draw_frame(); - g_mutex_unlock(resize_mutex); - - gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0); - gdk_window_clear(playlistwin->window); } static void @@ -1172,28 +1163,6 @@ } static gboolean -playlistwin_focus_in(GtkWidget * widget, GdkEvent * event, gpointer data) -{ - draw_playlist_window(TRUE); - return FALSE; -} - -static gboolean -playlistwin_focus_out(GtkWidget * widget, - GdkEventButton * event, gpointer data) -{ - draw_playlist_window(TRUE); - return FALSE; -} - -void -playlistwin_set_back_pixmap(void) -{ - gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0); - gdk_window_clear(playlistwin->window); -} - -static gboolean playlistwin_delete(GtkWidget * w, gpointer data) { playlistwin_hide(); @@ -1362,44 +1331,6 @@ return TRUE; } -static void -playlistwin_draw_frame(void) -{ - gboolean focus = - gtk_window_has_toplevel_focus(GTK_WINDOW(playlistwin)) || - !cfg.dim_titlebar; - - if (cfg.playlist_shaded) { - skin_draw_playlistwin_shaded(bmp_active_skin, - playlistwin_bg, SKINNED_WINDOW(playlistwin)->gc, - playlistwin_get_width(), focus); - } - else { - skin_draw_playlistwin_frame(bmp_active_skin, - playlistwin_bg, SKINNED_WINDOW(playlistwin)->gc, - playlistwin_get_width(), - cfg.playlist_height, focus); - } -} - -void -draw_playlist_window(gboolean force) -{ - - if (force) { - playlistwin_draw_frame(); - gdk_window_clear(playlistwin->window); - GList *iter; - for (iter = GTK_FIXED (SKINNED_WINDOW(playlistwin)->fixed)->children; iter; iter = g_list_next (iter)) { - GtkFixedChild *child_data = (GtkFixedChild *) iter->data; - GtkWidget *child = child_data->widget; - gtk_widget_queue_draw(child); - } - gdk_flush(); - } -} - - void playlistwin_hide_timer(void) { @@ -1669,12 +1600,6 @@ G_CALLBACK(playlistwin_enter), NULL); g_signal_connect(playlistwin, "leave_notify_event", G_CALLBACK(playlistwin_leave), NULL); - g_signal_connect_after(playlistwin, "focus_in_event", - G_CALLBACK(playlistwin_focus_in), NULL); - g_signal_connect_after(playlistwin, "focus_out_event", - G_CALLBACK(playlistwin_focus_out), NULL); - g_signal_connect(playlistwin, "style_set", - G_CALLBACK(playlistwin_set_back_pixmap), NULL); bmp_drag_dest_set(playlistwin); @@ -1706,12 +1631,6 @@ resize_mutex = g_mutex_new(); playlistwin_create_window(); - /* create GC and back pixmap for custom widget to draw on */ - playlistwin_bg = gdk_pixmap_new(playlistwin->window, - playlistwin_get_width(), - playlistwin_get_height_unshaded(), -1); - gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0); - playlistwin_create_widgets(); playlistwin_update_info(playlist_get_active());
--- a/src/audacious/ui_playlist.h Thu Aug 02 15:07:31 2007 +0200 +++ b/src/audacious/ui_playlist.h Thu Aug 02 15:40:46 2007 +0200 @@ -61,7 +61,6 @@ void playlistwin_set_shade(gboolean shaded); void playlistwin_shade_toggle(void); void playlistwin_create(void); -void draw_playlist_window(gboolean force); void playlistwin_hide_timer(void); void playlistwin_set_time(gint time, gint length, TimerMode mode); void playlistwin_show(void);
--- a/src/audacious/ui_preferences.c Thu Aug 02 15:07:31 2007 +0200 +++ b/src/audacious/ui_preferences.c Thu Aug 02 15:40:46 2007 +0200 @@ -62,6 +62,7 @@ #include "ui_preferences.h" #include "ui_equalizer.h" #include "ui_skinned_playlist.h" +#include "ui_skinned_window.h" #include "build_stamp.h" @@ -891,7 +892,6 @@ cfg.mainwin_font = g_strdup(gtk_font_button_get_font_name(button)); ui_skinned_textbox_set_xfont(mainwin_info, cfg.mainwin_use_xfont, cfg.mainwin_font); - draw_main_window(TRUE); } static void @@ -911,10 +911,9 @@ ui_skinned_textbox_set_xfont(mainwin_info, cfg.mainwin_use_xfont, cfg.mainwin_font); playlistwin_set_sinfo_font(cfg.playlist_font); - draw_main_window(TRUE); if (cfg.playlist_shaded) { playlistwin_update_list(playlist_get_active()); - draw_playlist_window(TRUE); + ui_skinned_window_draw_all(playlistwin); } } @@ -935,7 +934,7 @@ ui_skinned_playlist_set_font(cfg.playlist_font); playlistwin_set_sinfo_font(cfg.playlist_font); /* propagate font setting to playlistwin_sinfo */ playlistwin_update_list(playlist_get_active()); - draw_playlist_window(TRUE); + gtk_widget_queue_draw(playlistwin_list); } static void @@ -958,7 +957,7 @@ { cfg.show_numbers_in_pl = gtk_toggle_button_get_active(button); playlistwin_update_list(playlist_get_active()); - draw_playlist_window(TRUE); + gtk_widget_queue_draw(playlistwin_list); } static void @@ -974,7 +973,7 @@ { cfg.show_separator_in_pl = gtk_toggle_button_get_active(button); playlistwin_update_list(playlist_get_active()); - draw_playlist_window(TRUE); + gtk_widget_queue_draw(playlistwin_list); } /* format detection */ @@ -2132,9 +2131,9 @@ /* reload the skin to apply the change */ skin_reload_forced(); - draw_main_window(TRUE); - draw_equalizer_window(TRUE); - draw_playlist_window(TRUE); + ui_skinned_window_draw_all(mainwin); + ui_skinned_window_draw_all(equalizerwin); + ui_skinned_window_draw_all(playlistwin); } } @@ -2153,9 +2152,9 @@ /* reload the skin to apply the change */ skin_reload_forced(); - draw_main_window(TRUE); - draw_equalizer_window(TRUE); - draw_playlist_window(TRUE); + ui_skinned_window_draw_all(mainwin); + ui_skinned_window_draw_all(equalizerwin); + ui_skinned_window_draw_all(playlistwin); } } @@ -2174,9 +2173,9 @@ /* reload the skin to apply the change */ skin_reload_forced(); - draw_main_window(TRUE); - draw_equalizer_window(TRUE); - draw_playlist_window(TRUE); + ui_skinned_window_draw_all(mainwin); + ui_skinned_window_draw_all(equalizerwin); + ui_skinned_window_draw_all(playlistwin); } }
--- a/src/audacious/ui_skinned_window.c Thu Aug 02 15:07:31 2007 +0200 +++ b/src/audacious/ui_skinned_window.c Thu Aug 02 15:40:46 2007 +0200 @@ -26,11 +26,14 @@ #include <glib/gmacros.h> #include <gtk/gtkmarshal.h> #include <gtk/gtkwindow.h> +#include <string.h> #include "main.h" #include "dock.h" #include "ui_skinned_window.h" #include "ui_skinned_cursor.h" +#include "util.h" +#include "ui_playlist.h" static void ui_skinned_window_class_init(SkinnedWindowClass *klass); static void ui_skinned_window_init(GtkWidget *widget); @@ -99,6 +102,79 @@ return FALSE; } +static gboolean ui_skinned_window_expose(GtkWidget *widget, GdkEventExpose *event) { + SkinnedWindow *window = SKINNED_WINDOW(widget); + + GdkPixmap *obj = NULL; + GdkGC *gc; + + gint width = 0, height = 0; + switch (window->type) { + case WINDOW_MAIN: + width = bmp_active_skin->properties.mainwin_width; + height = bmp_active_skin->properties.mainwin_height; + break; + case WINDOW_EQ: + width = 275; + height = 116; + break; + case WINDOW_PLAYLIST: + width = playlistwin_get_width(); + height = cfg.playlist_height; + break; + default: + return FALSE; + } + obj = gdk_pixmap_new(NULL, width, height, gdk_rgb_get_visual()->depth); + gc = gdk_gc_new(obj); + + gboolean focus = gtk_window_has_toplevel_focus(GTK_WINDOW(widget)); + + switch (window->type) { + case WINDOW_MAIN: + skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_MAIN, 0, 0, 0, 0, width, height); + skin_draw_mainwin_titlebar(bmp_active_skin, obj, gc, cfg.player_shaded, focus || !cfg.dim_titlebar); + break; + case WINDOW_EQ: + skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_EQMAIN, 0, 0, 0, 0, width, height); + if (focus || !cfg.dim_titlebar) { + if (!cfg.equalizer_shaded) + skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_EQMAIN, 0, 134, 0, 0, width, 14); + else + skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_EQ_EX, 0, 0, 0, 0, width, 14); + } else { + if (!cfg.equalizer_shaded) + skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_EQMAIN, 0, 149, 0, 0, width, 14); + else + skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_EQ_EX, 0, 15, 0, 0, width, 14); + } + break; + case WINDOW_PLAYLIST: + focus |= !cfg.dim_titlebar; + if (cfg.playlist_shaded) { + skin_draw_playlistwin_shaded(bmp_active_skin, obj, gc, playlistwin_get_width(), focus); + } else { + skin_draw_playlistwin_frame(bmp_active_skin, obj, gc, playlistwin_get_width(), cfg.playlist_height, focus); + } + break; + } + + GdkPixmap *image = NULL; + + if (window->type != WINDOW_PLAYLIST && cfg.doublesize) { + image = create_dblsize_pixmap(obj); + } else { + image = gdk_pixmap_new(NULL, width, height, gdk_rgb_get_visual()->depth); + gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, width, height); + } + g_object_unref(obj); + gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0, width*(1+cfg.doublesize), height*(1+cfg.doublesize)); + g_object_unref(gc); + g_object_unref(image); + + return FALSE; +} + static void ui_skinned_window_class_init(SkinnedWindowClass *klass) { @@ -110,6 +186,7 @@ widget_class->configure_event = ui_skinned_window_configure; widget_class->motion_notify_event = ui_skinned_window_motion_notify_event; + widget_class->expose_event = ui_skinned_window_expose; } void @@ -154,7 +231,7 @@ GDK_FOCUS_CHANGE_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_SCROLL_MASK | GDK_KEY_PRESS_MASK | - GDK_VISIBILITY_NOTIFY_MASK); + GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK); gtk_widget_realize(GTK_WIDGET(widget)); dock_window_list = dock_window_set_decorated(dock_window_list, @@ -164,6 +241,12 @@ ui_skinned_cursor_set(GTK_WIDGET(widget)); SKINNED_WINDOW(widget)->gc = gdk_gc_new(widget->window); + if (!strcmp(wmclass_name, "player")) + SKINNED_WINDOW(widget)->type = WINDOW_MAIN; + if (!strcmp(wmclass_name, "equalizer")) + SKINNED_WINDOW(widget)->type = WINDOW_EQ; + if (!strcmp(wmclass_name, "playlist")) + SKINNED_WINDOW(widget)->type = WINDOW_PLAYLIST; /* GtkFixed hasn't got its GdkWindow, this means that it can be used to display widgets while the logo below will be displayed anyway; @@ -178,3 +261,16 @@ gtk_container_add(GTK_CONTAINER(widget), GTK_WIDGET(SKINNED_WINDOW(widget)->fixed)); return widget; } + +void ui_skinned_window_draw_all(GtkWidget *widget) { + if (SKINNED_WINDOW(widget)->type == WINDOW_MAIN) + mainwin_refresh_hints(); + + gtk_widget_queue_draw(widget); + GList *iter; + for (iter = GTK_FIXED (SKINNED_WINDOW(widget)->fixed)->children; iter; iter = g_list_next (iter)) { + GtkFixedChild *child_data = (GtkFixedChild *) iter->data; + GtkWidget *child = child_data->widget; + gtk_widget_queue_draw(child); + } +}
--- a/src/audacious/ui_skinned_window.h Thu Aug 02 15:07:31 2007 +0200 +++ b/src/audacious/ui_skinned_window.h Thu Aug 02 15:40:46 2007 +0200 @@ -32,6 +32,12 @@ # define SKINNED_WINDOW_TYPE GTK_WINDOW_TOPLEVEL #endif +enum { + WINDOW_MAIN, + WINDOW_EQ, + WINDOW_PLAYLIST +}; + typedef struct _SkinnedWindow SkinnedWindow; typedef struct _SkinnedWindowClass SkinnedWindowClass; @@ -42,6 +48,7 @@ GtkWidget *canvas; gint x,y; + gint type; GdkGC *gc; GtkWidget *fixed; }; @@ -53,5 +60,6 @@ extern GType ui_skinned_window_get_type(void); extern GtkWidget *ui_skinned_window_new(const gchar *wmclass_name); +extern void ui_skinned_window_draw_all(GtkWidget *widget); #endif
--- a/src/audacious/widgets/skin.c Thu Aug 02 15:07:31 2007 +0200 +++ b/src/audacious/widgets/skin.c Thu Aug 02 15:40:46 2007 +0200 @@ -168,9 +168,9 @@ skin_setup_masks(bmp_active_skin); - draw_main_window(TRUE); - draw_playlist_window(TRUE); - draw_equalizer_window(TRUE); + ui_skinned_window_draw_all(mainwin); + ui_skinned_window_draw_all(equalizerwin); + ui_skinned_window_draw_all(playlistwin); playlistwin_update_list(playlist_get_active());