changeset 4120:51641a875a01

revise setting mask on windows
author Tomasz Mon <desowin@gmail.com>
date Tue, 25 Dec 2007 19:03:38 +0100
parents 9d4b5cdae3ba
children bb35123048fb
files src/audacious/skin.c 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_skinned_window.c
diffstat 7 files changed, 4 insertions(+), 114 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/skin.c	Tue Dec 25 16:42:10 2007 +0100
+++ b/src/audacious/skin.c	Tue Dec 25 19:03:38 2007 +0100
@@ -139,8 +139,6 @@
                                                GdkWindow *,
                                                gint, gint, gboolean);
 
-static void skin_setup_masks(Skin * skin);
-
 static void skin_set_default_vis_color(Skin * skin);
 
 void
@@ -173,8 +171,6 @@
         return FALSE;
     }
 
-    skin_setup_masks(bmp_active_skin);
-
     ui_skinned_window_draw_all(mainwin);
     ui_skinned_window_draw_all(equalizerwin);
     ui_skinned_window_draw_all(playlistwin);
@@ -418,23 +414,6 @@
                                      skin_mask_info[id].height * 2, TRUE);
 }
 
-static void
-skin_setup_masks(Skin * skin)
-{
-    GdkBitmap *mask;
-
-    if (cfg.show_wm_decorations)
-        return;
-
-    if (cfg.player_visible) {
-        mask = skin_get_mask(skin, SKIN_MASK_MAIN + cfg.player_shaded);
-        gtk_widget_shape_combine_mask(mainwin, mask, 0, 0);
-    }
-
-    mask = skin_get_mask(skin, SKIN_MASK_EQ + cfg.equalizer_shaded);
-    gtk_widget_shape_combine_mask(equalizerwin, mask, 0, 0);
-}
-
 static GdkBitmap *
 create_default_mask(GdkWindow * parent, gint w, gint h)
 {
--- a/src/audacious/ui_equalizer.c	Tue Dec 25 16:42:10 2007 +0100
+++ b/src/audacious/ui_equalizer.c	Tue Dec 25 19:03:38 2007 +0100
@@ -111,21 +111,6 @@
     g_free(preset);
 }
 
-
-static void
-equalizerwin_set_shape_mask(void)
-{
-    if (cfg.show_wm_decorations)
-        return;
-
-    if (cfg.doublesize == FALSE)
-        gtk_widget_shape_combine_mask(equalizerwin,
-                                      skin_get_mask(bmp_active_skin,
-                                                    SKIN_MASK_EQ), 0, 0);
-    else
-        gtk_widget_shape_combine_mask(equalizerwin, NULL, 0, 0);
-}
-
 void
 equalizerwin_set_doublesize(gboolean ds)
 {
@@ -136,8 +121,6 @@
     else
         height = 116;
 
-    equalizerwin_set_shape_mask();
-
     if (ds) {
         dock_window_resize(GTK_WINDOW(equalizerwin), 550, height * 2, 550, height * 2);
     } else {
@@ -157,8 +140,6 @@
 {
     cfg.equalizer_shaded = shaded;
 
-    equalizerwin_set_shape_mask();
-
     if (shaded) {
         dock_shade(dock_window_list, GTK_WINDOW(equalizerwin),
                    14 * (EQUALIZER_DOUBLESIZE + 1));
--- a/src/audacious/ui_main.c	Tue Dec 25 16:42:10 2007 +0100
+++ b/src/audacious/ui_main.c	Tue Dec 25 19:03:38 2007 +0100
@@ -116,7 +116,6 @@
 GtkWidget *mainwin = NULL;
 GtkWidget *err = NULL; /* an error dialog for miscellaneous error messages */
 
-static GdkBitmap *nullmask;
 static gint balance;
 
 static GtkWidget *mainwin_jtt = NULL;
@@ -233,20 +232,6 @@
 }
 
 static void
-mainwin_set_shape_mask(void)
-{
-    if (!cfg.player_visible)
-        return;
-
-    if (cfg.doublesize == FALSE)
-        gtk_widget_shape_combine_mask(mainwin,
-                                  skin_get_mask(bmp_active_skin,
-                                                SKIN_MASK_MAIN), 0, 0);
-    else
-        gtk_widget_shape_combine_mask(mainwin, NULL, 0, 0);
-}
-
-static void
 mainwin_set_shade(gboolean shaded)
 {
     GtkAction *action = gtk_action_group_get_action(
@@ -259,7 +244,6 @@
 {
     cfg.player_shaded = shaded;
 
-    mainwin_set_shape_mask();
     if (shaded) {
         dock_shade(dock_window_list, GTK_WINDOW(mainwin),
                    MAINWIN_SHADED_HEIGHT * (cfg.doublesize + 1));
@@ -1761,8 +1745,6 @@
     if (cfg.player_shaded)
         ui_vis_clear_data(mainwin_vis);
 
-    mainwin_set_shape_mask();
-
     if (cfg.show_wm_decorations) {
         if (cfg.player_x != -1 && cfg.save_window_position)
             gtk_window_move(GTK_WINDOW(mainwin), cfg.player_x, cfg.player_y);
@@ -1771,12 +1753,6 @@
         return;
     }
 
-    if (nullmask)
-    {
-      g_object_unref(nullmask);
-      nullmask = NULL;
-    }
-
     if (cfg.player_x != -1 && cfg.save_window_position)
         gtk_window_move(GTK_WINDOW(mainwin), cfg.player_x, cfg.player_y);
 
@@ -1787,24 +1763,11 @@
 void
 mainwin_real_hide(void)
 {
-    GdkGC *gc;
-    GdkColor pattern;
-
     check_set( toggleaction_group_others , "show player", FALSE);
 
     if (cfg.player_shaded)
         ui_svis_clear_data(mainwin_svis);
 
-    if (!cfg.show_wm_decorations) {
-        nullmask = gdk_pixmap_new(mainwin->window, 20, 20, 1);
-        gc = gdk_gc_new(nullmask);
-        pattern.pixel = 0;
-        gdk_gc_set_foreground(gc, &pattern);
-        gdk_draw_rectangle(nullmask, gc, TRUE, 0, 0, 20, 20);
-        g_object_unref(gc);
-        gtk_widget_shape_combine_mask(mainwin, nullmask, 0, 0);
-    }
-
     gtk_widget_hide(mainwin);
 
     cfg.player_visible = FALSE;
@@ -1835,8 +1798,6 @@
     else
         height = bmp_active_skin->properties.mainwin_height;
 
-    mainwin_set_shape_mask();
-
     dock_window_resize(GTK_WINDOW(mainwin), cfg.player_shaded ? MAINWIN_SHADED_WIDTH : bmp_active_skin->properties.mainwin_width,
         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);
--- a/src/audacious/ui_main.h	Tue Dec 25 16:42:10 2007 +0100
+++ b/src/audacious/ui_main.h	Tue Dec 25 19:03:38 2007 +0100
@@ -128,8 +128,6 @@
 void mainwin_fwd_pushed(void);
 void mainwin_fwd_release(void);
 
-void mainwin_set_back_pixmap(void);
-
 void mainwin_adjust_volume_motion(gint v);
 void mainwin_adjust_volume_release(void);
 void mainwin_adjust_balance_motion(gint b);
--- a/src/audacious/ui_playlist.c	Tue Dec 25 16:42:10 2007 +0100
+++ b/src/audacious/ui_playlist.c	Tue Dec 25 19:03:38 2007 +0100
@@ -73,8 +73,6 @@
 GtkWidget *playlistwin_list = NULL;
 GtkWidget *playlistwin_shade, *playlistwin_close;
 
-static GdkBitmap *playlistwin_mask = NULL;
-
 static gboolean playlistwin_hint_flag = FALSE;
 
 static GtkWidget *playlistwin_slider = NULL;
@@ -279,28 +277,6 @@
 }
 
 static void
-playlistwin_set_mask(void)
-{
-    GdkGC *gc;
-    GdkColor pattern;
-
-    if (playlistwin_mask)
-        g_object_unref(playlistwin_mask);
-
-    playlistwin_mask =
-        gdk_pixmap_new(playlistwin->window, playlistwin_get_width(),
-                       playlistwin_get_height(), 1);
-    gc = gdk_gc_new(playlistwin_mask);
-    pattern.pixel = 1;
-    gdk_gc_set_foreground(gc, &pattern);
-    gdk_draw_rectangle(playlistwin_mask, gc, TRUE, 0, 0,
-                       playlistwin_get_width(), playlistwin_get_height());
-    g_object_unref(gc);
-
-    gtk_widget_shape_combine_mask(playlistwin, playlistwin_mask, 0, 0);
-}
-
-static void
 playlistwin_set_geometry_hints(gboolean shaded)
 {
     GdkGeometry geometry;
@@ -384,8 +360,6 @@
     gtk_window_resize(GTK_WINDOW(playlistwin),
                       playlistwin_get_width(),
                       playlistwin_get_height());
-
-    playlistwin_set_mask();
 }
 
 static void
@@ -676,8 +650,6 @@
     ui_skinned_button_move_relative(playlistwin_sscroll_up, dx, dy);
     ui_skinned_button_move_relative(playlistwin_sscroll_down, dx, dy);
 
-    playlistwin_set_mask();
-
     gtk_widget_set_size_request(playlistwin_sinfo, playlistwin_get_width() - 35,
                                 bmp_active_skin->properties.textbox_bitmap_font_height);
     GList *iter;
@@ -1533,8 +1505,6 @@
     gtk_window_set_icon(GTK_WINDOW(playlistwin), icon);
     g_object_unref(icon);
 
-    gtk_widget_set_app_paintable(playlistwin, TRUE);
-
     if (cfg.playlist_x != -1 && cfg.save_window_position)
         gtk_window_move(GTK_WINDOW(playlistwin),
                         cfg.playlist_x, cfg.playlist_y);
@@ -1576,8 +1546,6 @@
                      G_CALLBACK(playlistwin_keypress), NULL);
     g_signal_connect(playlistwin, "selection_received",
                      G_CALLBACK(selection_received), NULL);
-
-    playlistwin_set_mask();
 }
 
 void
--- a/src/audacious/ui_playlist.h	Tue Dec 25 16:42:10 2007 +0100
+++ b/src/audacious/ui_playlist.h	Tue Dec 25 19:03:38 2007 +0100
@@ -64,7 +64,6 @@
 void playlistwin_set_time(gint time, gint length, TimerMode mode);
 void playlistwin_show(void);
 void playlistwin_hide(void);
-void playlistwin_set_back_pixmap(void);
 void playlistwin_scroll(gint num);
 void playlistwin_scroll_up_pushed(void);
 void playlistwin_scroll_down_pushed(void);
--- a/src/audacious/ui_skinned_window.c	Tue Dec 25 16:42:10 2007 +0100
+++ b/src/audacious/ui_skinned_window.c	Tue Dec 25 19:03:38 2007 +0100
@@ -147,10 +147,12 @@
         case WINDOW_MAIN:
             width = bmp_active_skin->properties.mainwin_width;
             height = bmp_active_skin->properties.mainwin_height;
+            gtk_widget_shape_combine_mask(widget, skin_get_mask(bmp_active_skin, SKIN_MASK_MAIN + cfg.player_shaded), 0, 0);
             break;
         case WINDOW_EQ:
             width = 275;
             height = 116;
+            gtk_widget_shape_combine_mask(widget, skin_get_mask(bmp_active_skin, SKIN_MASK_EQ + cfg.equalizer_shaded), 0, 0);
             break;
         case WINDOW_PLAYLIST:
             width = playlistwin_get_width();
@@ -273,6 +275,8 @@
     dock_window_list = dock_window_set_decorated(dock_window_list,
 	GTK_WINDOW(widget), cfg.show_wm_decorations);
     gtk_widget_set_app_paintable(GTK_WIDGET(widget), TRUE);
+    gdk_window_set_back_pixmap(widget->window, NULL, FALSE);
+    gtk_widget_shape_combine_mask(widget, NULL, 0, 0);
 
     ui_skinned_cursor_set(GTK_WIDGET(widget));