changeset 3062:eaf597833f74

branch merge
author William Pitcock <nenolod@atheme-project.org>
date Fri, 13 Jul 2007 06:56:16 -0500
parents 7d858d2b4031 (current diff) a0f79856693b (diff)
children 70835f111875
files
diffstat 5 files changed, 125 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_main.c	Fri Jul 13 06:55:44 2007 -0500
+++ b/src/audacious/ui_main.c	Fri Jul 13 06:56:16 2007 -0500
@@ -732,6 +732,11 @@
     gtk_widget_hide(mainwin_othertext);
     }
 
+    if (bmp_active_skin->properties.mainwin_vis_visible)
+        gtk_widget_show(mainwin_vis);
+    else
+        gtk_widget_hide(mainwin_vis);
+
     /* positioning and size attributes */
     if (bmp_active_skin->properties.mainwin_vis_x && bmp_active_skin->properties.mainwin_vis_y)
     gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_vis), bmp_active_skin->properties.mainwin_vis_x,
--- a/src/audacious/ui_skinned_button.c	Fri Jul 13 06:55:44 2007 -0500
+++ b/src/audacious/ui_skinned_button.c	Fri Jul 13 06:56:16 2007 -0500
@@ -61,6 +61,9 @@
 static void ui_skinned_button_init(UiSkinnedButton *button);
 static void ui_skinned_button_destroy(GtkObject *object);
 static void ui_skinned_button_realize(GtkWidget *widget);
+static void ui_skinned_button_unrealize(GtkWidget *widget);
+static void ui_skinned_button_map(GtkWidget *widget);
+static void ui_skinned_button_unmap(GtkWidget *widget);
 static void ui_skinned_button_size_request(GtkWidget *widget, GtkRequisition *requisition);
 static gint ui_skinned_button_expose(GtkWidget *widget,GdkEventExpose *event);
 
@@ -116,6 +119,9 @@
     object_class->destroy = ui_skinned_button_destroy;
 
     widget_class->realize = ui_skinned_button_realize;
+    widget_class->unrealize = ui_skinned_button_unrealize;
+    widget_class->map = ui_skinned_button_map;
+    widget_class->unmap = ui_skinned_button_unmap;
     widget_class->expose_event = ui_skinned_button_expose;
     widget_class->size_request = ui_skinned_button_size_request;
     widget_class->size_allocate = ui_skinned_button_size_allocate;
@@ -171,6 +177,7 @@
     button->type = TYPE_NOT_SET;
     priv->move_x = 0;
     priv->move_y = 0;
+    button->event_window = NULL;
 }
 
 static void ui_skinned_button_destroy (GtkObject *object) {
@@ -200,28 +207,64 @@
     attributes.height = widget->allocation.height;
     attributes.window_type = GDK_WINDOW_CHILD;
     attributes.event_mask = gtk_widget_get_events(widget);
-    attributes.visual = gtk_widget_get_visual(widget);
-    attributes.colormap = gtk_widget_get_colormap(widget);
     attributes.event_mask |= GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK;
 
     if (button->type == TYPE_SMALL || button->type == TYPE_NOT_SET) {
+        widget->window = gtk_widget_get_parent_window (widget);
+        g_object_ref (widget->window);
         attributes.wclass = GDK_INPUT_ONLY;
         attributes_mask = GDK_WA_X | GDK_WA_Y;
+        button->event_window = gdk_window_new (widget->window, &attributes, attributes_mask);
         GTK_WIDGET_SET_FLAGS (widget, GTK_NO_WINDOW);
+        gdk_window_set_user_data(button->event_window, widget);
     } else {
+        attributes.visual = gtk_widget_get_visual(widget);
+        attributes.colormap = gtk_widget_get_colormap(widget);
         attributes.wclass = GDK_INPUT_OUTPUT;
         attributes.event_mask |= GDK_EXPOSURE_MASK;
         attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+        widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask);
+        GTK_WIDGET_UNSET_FLAGS (widget, GTK_NO_WINDOW);
+        gdk_window_set_user_data(widget->window, widget);
     }
 
-    widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask);
-
     widget->style = gtk_style_attach(widget->style, widget->window);
+}
 
-    gdk_window_set_user_data(widget->window, widget);
+static void ui_skinned_button_unrealize (GtkWidget *widget) {
+    UiSkinnedButton *button = UI_SKINNED_BUTTON (widget);
+
+    if ( button->event_window != NULL )
+    {
+      gdk_window_set_user_data( button->event_window , NULL );
+      gdk_window_destroy( button->event_window );
+      button->event_window = NULL;
+    }
+
+    if (GTK_WIDGET_CLASS (parent_class)->unrealize)
+        (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
+}
 
-    if (attributes.wclass == GDK_INPUT_ONLY)
-        gdk_window_show (widget->window);
+static void ui_skinned_button_map (GtkWidget *widget)
+{
+    UiSkinnedButton *button = UI_SKINNED_BUTTON (widget);
+
+    if (button->event_window != NULL)
+      gdk_window_show (button->event_window);
+
+    if (GTK_WIDGET_CLASS (parent_class)->map)
+      (* GTK_WIDGET_CLASS (parent_class)->map) (widget);
+}
+
+static void ui_skinned_button_unmap (GtkWidget *widget)
+{
+    UiSkinnedButton *button = UI_SKINNED_BUTTON (widget);
+
+    if (button->event_window != NULL)
+      gdk_window_hide (button->event_window);
+
+    if (GTK_WIDGET_CLASS (parent_class)->unmap)
+      (* GTK_WIDGET_CLASS (parent_class)->unmap) (widget);
 }
 
 static void ui_skinned_button_size_request(GtkWidget *widget, GtkRequisition *requisition) {
@@ -239,7 +282,12 @@
     widget->allocation.y *= (1+priv->double_size);
 
     if (GTK_WIDGET_REALIZED (widget))
-        gdk_window_move_resize(widget->window, allocation->x*(1+priv->double_size), allocation->y*(1+priv->double_size), allocation->width, allocation->height);
+    {
+        if ( button->event_window != NULL )
+            gdk_window_move_resize(button->event_window, allocation->x*(1+priv->double_size), allocation->y*(1+priv->double_size), allocation->width, allocation->height);
+        else
+            gdk_window_move_resize(widget->window, allocation->x*(1+priv->double_size), allocation->y*(1+priv->double_size), allocation->width, allocation->height);
+    }
 
     button->x = widget->allocation.x/(priv->double_size ? 2 : 1);
     button->y = widget->allocation.y/(priv->double_size ? 2 : 1);
@@ -261,6 +309,10 @@
     if (button->type == TYPE_SMALL || button->type == TYPE_NOT_SET)
         return FALSE;
 
+    /* paranoia */
+    if (button->event_window != NULL)
+        return FALSE;
+
     GdkPixmap *obj;
     GdkGC *gc;
     obj = gdk_pixmap_new(NULL, priv->w, priv->h, gdk_rgb_get_visual()->depth);
@@ -298,15 +350,12 @@
                                  gdk_rgb_get_visual()->depth);
 
     if (priv->double_size) {
-        GdkPixbuf *img, *img2x;
-        GdkColormap *colormap = gdk_colormap_get_system();
-        img = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, priv->w, priv->h);
-        gdk_pixbuf_get_from_drawable(img, obj, colormap, 0, 0, 0, 0, priv->w, priv->h);
-        img2x = gdk_pixbuf_scale_simple(img, priv->w*2, priv->h*2, GDK_INTERP_NEAREST);
-        gdk_draw_pixbuf (image, gc, img2x, 0, 0, 0, 0, priv->w*2, priv->h*2, GDK_RGB_DITHER_NONE, 0, 0);
+        GdkImage *img, *img2x;
+        img = gdk_drawable_get_image(obj, 0, 0, priv->w, priv->h);
+        img2x = create_dblsize_image(img);
+        gdk_draw_image (image, gc, img2x, 0, 0, 0, 0, priv->w*2, priv->h*2);
+        g_object_unref(img2x);
         g_object_unref(img);
-        g_object_unref(img2x);
-        g_object_unref(colormap);
     } else
         gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, priv->w, priv->h);
 
--- a/src/audacious/ui_skinned_horizontal_slider.c	Fri Jul 13 06:55:44 2007 -0500
+++ b/src/audacious/ui_skinned_horizontal_slider.c	Fri Jul 13 06:56:16 2007 -0500
@@ -25,6 +25,7 @@
 #include "widgets/widgetcore.h"
 #include "ui_skinned_horizontal_slider.h"
 #include "main.h"
+#include "util.h"
 #include <gtk/gtkmain.h>
 #include <gtk/gtkmarshal.h>
 #include <gtk/gtkimage.h>
@@ -268,15 +269,12 @@
                                  gdk_rgb_get_visual()->depth);
 
     if (priv->double_size) {
-        GdkPixbuf *img, *img2x;
-        GdkColormap *colormap = gdk_colormap_get_system();
-        img = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, priv->width, priv->height);
-        gdk_pixbuf_get_from_drawable(img, obj, colormap, 0, 0, 0, 0, priv->width, priv->height);
-        img2x = gdk_pixbuf_scale_simple(img, priv->width*2, priv->height*2, GDK_INTERP_NEAREST);
-        gdk_draw_pixbuf (image, gc, img2x, 0, 0, 0, 0, priv->width*2, priv->height*2, GDK_RGB_DITHER_NONE, 0, 0);
+        GdkImage *img, *img2x;
+        img = gdk_drawable_get_image(obj, 0, 0, priv->width, priv->height);
+        img2x = create_dblsize_image(img);
+        gdk_draw_image (image, gc, img2x, 0, 0, 0, 0, priv->width*2, priv->height*2);
+        g_object_unref(img2x);
         g_object_unref(img);
-        g_object_unref(img2x);
-        g_object_unref(colormap);
     } else
         gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, priv->width, priv->height);
 
--- a/src/audacious/ui_vis.c	Fri Jul 13 06:55:44 2007 -0500
+++ b/src/audacious/ui_vis.c	Fri Jul 13 06:56:16 2007 -0500
@@ -53,6 +53,8 @@
 static void ui_vis_destroy            (GtkObject *object);
 static void ui_vis_realize            (GtkWidget *widget);
 static void ui_vis_unrealize          (GtkWidget *widget);
+static void ui_vis_map                (GtkWidget *widget);
+static void ui_vis_unmap              (GtkWidget *widget);
 static void ui_vis_size_request       (GtkWidget *widget, GtkRequisition *requisition);
 static void ui_vis_size_allocate      (GtkWidget *widget, GtkAllocation *allocation);
 static gboolean ui_vis_expose         (GtkWidget *widget, GdkEventExpose *event);
@@ -93,6 +95,8 @@
 
     widget_class->realize = ui_vis_realize;
     widget_class->unrealize = ui_vis_unrealize;
+    widget_class->map = ui_vis_map;
+    widget_class->unmap = ui_vis_unmap;
     widget_class->expose_event = ui_vis_expose;
     widget_class->size_request = ui_vis_size_request;
     widget_class->size_allocate = ui_vis_size_allocate;
@@ -122,6 +126,7 @@
     vis->double_size = FALSE;
 
     vis->visible_window = TRUE;
+    vis->event_window = NULL;
 
     gtk_fixed_put(GTK_FIXED(vis->fixed), GTK_WIDGET(vis), vis->x, vis->y);
 
@@ -167,31 +172,62 @@
       attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
       widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask);
       GTK_WIDGET_UNSET_FLAGS(widget, GTK_NO_WINDOW);
+      gdk_window_set_user_data(widget->window, widget);
     }
     else
     {
+      widget->window = gtk_widget_get_parent_window (widget);
+      g_object_ref (widget->window);
+
       attributes.wclass = GDK_INPUT_ONLY;
       attributes_mask = GDK_WA_X | GDK_WA_Y;
-      widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
+      vis->event_window = gdk_window_new (widget->window, &attributes, attributes_mask);
       GTK_WIDGET_SET_FLAGS (widget, GTK_NO_WINDOW);
+      gdk_window_set_user_data(vis->event_window, widget);
     }
 
     widget->style = gtk_style_attach(widget->style, widget->window);
-
-    gdk_window_set_user_data(widget->window, widget);
-
-    if (attributes.wclass == GDK_INPUT_ONLY)
-        gdk_window_show (widget->window);
 }
 
 static void ui_vis_unrealize(GtkWidget *widget) {
     UiVis *vis;
     vis = UI_VIS(widget);
 
+    if ( vis->event_window != NULL )
+    {
+      gdk_window_set_user_data( vis->event_window , NULL );
+      gdk_window_destroy( vis->event_window );
+      vis->event_window = NULL;
+    }
+
     if (GTK_WIDGET_CLASS (parent_class)->unrealize)
         (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
 }
 
+static void ui_vis_map(GtkWidget *widget)
+{
+    UiVis *vis;
+    vis = UI_VIS(widget);
+
+    if (vis->event_window != NULL)
+      gdk_window_show (vis->event_window);
+
+    if (GTK_WIDGET_CLASS (parent_class)->map)
+      (* GTK_WIDGET_CLASS (parent_class)->map) (widget);
+}
+
+static void ui_vis_unmap (GtkWidget *widget)
+{
+    UiVis *vis;
+    vis = UI_VIS(widget);
+
+    if (vis->event_window != NULL)
+      gdk_window_hide (vis->event_window);
+
+    if (GTK_WIDGET_CLASS (parent_class)->unmap)
+      (* GTK_WIDGET_CLASS (parent_class)->unmap) (widget);
+}
+
 static void ui_vis_size_request(GtkWidget *widget, GtkRequisition *requisition) {
     UiVis *vis = UI_VIS(widget);
 
@@ -206,7 +242,12 @@
     widget->allocation.x *= (1+vis->double_size);
     widget->allocation.y *= (1+vis->double_size);
     if (GTK_WIDGET_REALIZED (widget))
-        gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
+    {
+        if (vis->event_window != NULL)
+            gdk_window_move_resize(vis->event_window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
+        else
+            gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
+    }
 
     vis->x = widget->allocation.x/(vis->double_size ? 2 : 1);
     vis->y = widget->allocation.y/(vis->double_size ? 2 : 1);
--- a/src/audacious/ui_vis.h	Fri Jul 13 06:55:44 2007 -0500
+++ b/src/audacious/ui_vis.h	Fri Jul 13 06:56:16 2007 -0500
@@ -76,6 +76,7 @@
     gboolean         double_size;
     GtkWidget        *fixed;
     gboolean         visible_window;
+    GdkWindow        *event_window;
 };
 
 struct _UiVisClass {