changeset 2888:7c7471554d88

convert some widgets into windowless ones
author Tomasz Mon <desowin@gmail.com>
date Tue, 12 Aug 2008 15:50:01 +0200
parents 3fce72e687dd
children 5e97b55f87cf
files src/skins/ui_skinned_button.c src/skins/ui_skinned_equalizer_graph.c src/skins/ui_skinned_equalizer_slider.c src/skins/ui_skinned_equalizer_slider.h src/skins/ui_skinned_horizontal_slider.c src/skins/ui_skinned_horizontal_slider.h src/skins/ui_skinned_menurow.c src/skins/ui_skinned_menurow.h src/skins/ui_skinned_monostereo.c src/skins/ui_skinned_number.c src/skins/ui_skinned_number.h src/skins/ui_skinned_playstatus.c
diffstat 12 files changed, 258 insertions(+), 136 deletions(-) [+]
line wrap: on
line diff
--- a/src/skins/ui_skinned_button.c	Sun Aug 10 12:34:29 2008 +0900
+++ b/src/skins/ui_skinned_button.c	Tue Aug 12 15:50:01 2008 +0200
@@ -198,8 +198,6 @@
     button->event_window = gdk_window_new (widget->window, &attributes, attributes_mask);
 
     gdk_window_set_user_data(button->event_window, widget);
-
-    widget->style = gtk_style_attach(widget->style, widget->window);
 }
 
 static void ui_skinned_button_unrealize (GtkWidget *widget) {
--- a/src/skins/ui_skinned_equalizer_graph.c	Sun Aug 10 12:34:29 2008 +0900
+++ b/src/skins/ui_skinned_equalizer_graph.c	Tue Aug 12 15:50:01 2008 +0200
@@ -93,6 +93,8 @@
 static void ui_skinned_equalizer_graph_init(UiSkinnedEqualizerGraph *equalizer_graph) {
     equalizer_graph->width = 113;
     equalizer_graph->height = 19;
+
+    GTK_WIDGET_SET_FLAGS(equalizer_graph, GTK_NO_WINDOW);
 }
 
 GtkWidget* ui_skinned_equalizer_graph_new(GtkWidget *fixed, gint x, gint y) {
@@ -121,33 +123,8 @@
 }
 
 static void ui_skinned_equalizer_graph_realize(GtkWidget *widget) {
-    UiSkinnedEqualizerGraph *equalizer_graph;
-    GdkWindowAttr attributes;
-    gint attributes_mask;
-
-    g_return_if_fail (widget != NULL);
-    g_return_if_fail (UI_SKINNED_IS_EQUALIZER_GRAPH(widget));
-
-    GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
-    equalizer_graph = UI_SKINNED_EQUALIZER_GRAPH(widget);
-
-    attributes.x = widget->allocation.x;
-    attributes.y = widget->allocation.y;
-    attributes.width = widget->allocation.width;
-    attributes.height = widget->allocation.height;
-    attributes.wclass = GDK_INPUT_OUTPUT;
-    attributes.window_type = GDK_WINDOW_CHILD;
-    attributes.event_mask = gtk_widget_get_events(widget);
-    attributes.event_mask |= GDK_EXPOSURE_MASK;
-    attributes.visual = gtk_widget_get_visual(widget);
-    attributes.colormap = gtk_widget_get_colormap(widget);
-
-    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);
-
-    widget->style = gtk_style_attach(widget->style, widget->window);
-
-    gdk_window_set_user_data(widget->window, widget);
+    if (GTK_WIDGET_CLASS (parent_class)->realize)
+        (* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
 }
 
 static void ui_skinned_equalizer_graph_size_request(GtkWidget *widget, GtkRequisition *requisition) {
@@ -163,8 +140,6 @@
     widget->allocation = *allocation;
     widget->allocation.x *= (equalizer_graph->scaled ? config.scale_factor : 1);
     widget->allocation.y *= (equalizer_graph->scaled ? config.scale_factor : 1);
-    if (GTK_WIDGET_REALIZED (widget))
-        gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
 
     equalizer_graph->x = widget->allocation.x/(equalizer_graph->scaled ? config.scale_factor : 1);
     equalizer_graph->y = widget->allocation.y/(equalizer_graph->scaled ? config.scale_factor : 1);
@@ -289,7 +264,10 @@
         }
     }
 
-    ui_skinned_widget_draw(widget, obj, equalizer_graph->width, equalizer_graph->height, equalizer_graph->scaled);
+    ui_skinned_widget_draw_with_coordinates(widget, obj, equalizer_graph->width, equalizer_graph->height,
+                                            widget->allocation.x,
+                                            widget->allocation.y,
+                                            equalizer_graph->scaled);
 
     g_object_unref(obj);
 
--- a/src/skins/ui_skinned_equalizer_slider.c	Sun Aug 10 12:34:29 2008 +0900
+++ b/src/skins/ui_skinned_equalizer_slider.c	Tue Aug 12 15:50:01 2008 +0200
@@ -51,6 +51,9 @@
 static void ui_skinned_equalizer_slider_init               (UiSkinnedEqualizerSlider *equalizer_slider);
 static void ui_skinned_equalizer_slider_destroy            (GtkObject *object);
 static void ui_skinned_equalizer_slider_realize            (GtkWidget *widget);
+static void ui_skinned_equalizer_slider_unrealize          (GtkWidget *widget);
+static void ui_skinned_equalizer_slider_map                (GtkWidget *widget);
+static void ui_skinned_equalizer_slider_unmap              (GtkWidget *widget); 
 static void ui_skinned_equalizer_slider_size_request       (GtkWidget *widget, GtkRequisition *requisition);
 static void ui_skinned_equalizer_slider_size_allocate      (GtkWidget *widget, GtkAllocation *allocation);
 static gboolean ui_skinned_equalizer_slider_expose         (GtkWidget *widget, GdkEventExpose *event);
@@ -97,6 +100,9 @@
     object_class->destroy = ui_skinned_equalizer_slider_destroy;
 
     widget_class->realize = ui_skinned_equalizer_slider_realize;
+    widget_class->unrealize = ui_skinned_equalizer_slider_unrealize;
+    widget_class->map = ui_skinned_equalizer_slider_map;
+    widget_class->unmap = ui_skinned_equalizer_slider_unmap; 
     widget_class->expose_event = ui_skinned_equalizer_slider_expose;
     widget_class->size_request = ui_skinned_equalizer_slider_size_request;
     widget_class->size_allocate = ui_skinned_equalizer_slider_size_allocate;
@@ -118,6 +124,9 @@
 static void ui_skinned_equalizer_slider_init(UiSkinnedEqualizerSlider *equalizer_slider) {
     UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(equalizer_slider);
     priv->pressed = FALSE;
+
+    equalizer_slider->event_window = NULL;
+    GTK_WIDGET_SET_FLAGS(equalizer_slider, GTK_NO_WINDOW);
 }
 
 GtkWidget* ui_skinned_equalizer_slider_new(GtkWidget *fixed, gint x, gint y) {
@@ -155,26 +164,60 @@
     g_return_if_fail (widget != NULL);
     g_return_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER(widget));
 
-    GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
+    if (GTK_WIDGET_CLASS (parent_class)->realize)
+        (* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
     equalizer_slider = UI_SKINNED_EQUALIZER_SLIDER(widget);
 
     attributes.x = widget->allocation.x;
     attributes.y = widget->allocation.y;
     attributes.width = widget->allocation.width;
     attributes.height = widget->allocation.height;
-    attributes.wclass = GDK_INPUT_OUTPUT;
+    attributes.wclass = GDK_INPUT_ONLY;
     attributes.window_type = GDK_WINDOW_CHILD;
     attributes.event_mask = gtk_widget_get_events(widget);
-    attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
+    attributes.event_mask |= GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
                              GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK;
-    attributes.visual = gtk_widget_get_visual(widget);
-    attributes.colormap = gtk_widget_get_colormap(widget);
+
+    attributes_mask = GDK_WA_X | GDK_WA_Y;
+    equalizer_slider->event_window = gdk_window_new(widget->parent->window, &attributes, attributes_mask);
+
+    gdk_window_set_user_data(equalizer_slider->event_window, widget);
+}
+
+static void ui_skinned_equalizer_slider_unrealize(GtkWidget *widget) {
+    UiSkinnedEqualizerSlider *equalizer_slider = UI_SKINNED_EQUALIZER_SLIDER(widget);
+
+    if ( equalizer_slider->event_window != NULL )
+    {
+        gdk_window_set_user_data( equalizer_slider->event_window , NULL );
+        gdk_window_destroy( equalizer_slider->event_window );
+        equalizer_slider->event_window = NULL;
+    }
 
-    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);
+    if (GTK_WIDGET_CLASS (parent_class)->unrealize)
+        (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
+}
+
+static void ui_skinned_equalizer_slider_map (GtkWidget *widget)
+{
+    UiSkinnedEqualizerSlider *equalizer_slider = UI_SKINNED_EQUALIZER_SLIDER(widget);
+
+    if (equalizer_slider->event_window != NULL)
+        gdk_window_show (equalizer_slider->event_window);
 
-    widget->style = gtk_style_attach(widget->style, widget->window);
-    gdk_window_set_user_data(widget->window, widget);
+    if (GTK_WIDGET_CLASS (parent_class)->map)
+        (* GTK_WIDGET_CLASS (parent_class)->map) (widget);
+}
+
+static void ui_skinned_equalizer_slider_unmap (GtkWidget *widget)
+{
+    UiSkinnedEqualizerSlider *equalizer_slider = UI_SKINNED_EQUALIZER_SLIDER(widget);
+
+    if (equalizer_slider->event_window != NULL)
+        gdk_window_hide (equalizer_slider->event_window);
+
+    if (GTK_WIDGET_CLASS (parent_class)->unmap)
+        (* GTK_WIDGET_CLASS (parent_class)->unmap) (widget);
 }
 
 static void ui_skinned_equalizer_slider_size_request(GtkWidget *widget, GtkRequisition *requisition) {
@@ -192,7 +235,8 @@
     widget->allocation.x *= (priv->scaled ? config.scale_factor : 1);
     widget->allocation.y *= (priv->scaled ? config.scale_factor : 1);
     if (GTK_WIDGET_REALIZED (widget))
-        gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
+        if (equalizer_slider->event_window)
+            gdk_window_move_resize(equalizer_slider->event_window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
 
     equalizer_slider->x = widget->allocation.x/(priv->scaled ? config.scale_factor : 1);
     equalizer_slider->y = widget->allocation.y/(priv->scaled ? config.scale_factor : 1);
@@ -222,7 +266,10 @@
     else
         skin_draw_pixbuf(widget, aud_active_skin, obj, priv->skin_index, 0, 164, 1, priv->position, 11, 11);
 
-    ui_skinned_widget_draw(widget, obj, priv->width, priv->height, priv->scaled);
+    ui_skinned_widget_draw_with_coordinates(widget, obj, priv->width, priv->height,
+                                            widget->allocation.x,
+                                            widget->allocation.y,
+                                            priv->scaled);
 
     g_object_unref(obj);
 
--- a/src/skins/ui_skinned_equalizer_slider.h	Sun Aug 10 12:34:29 2008 +0900
+++ b/src/skins/ui_skinned_equalizer_slider.h	Tue Aug 12 15:50:01 2008 +0200
@@ -42,6 +42,7 @@
 
 struct _UiSkinnedEqualizerSlider {
     GtkWidget   widget;
+    GdkWindow   *event_window;
     gint        x, y;
 };
 
--- a/src/skins/ui_skinned_horizontal_slider.c	Sun Aug 10 12:34:29 2008 +0900
+++ b/src/skins/ui_skinned_horizontal_slider.c	Tue Aug 12 15:50:01 2008 +0200
@@ -52,6 +52,9 @@
 static void ui_skinned_horizontal_slider_init               (UiSkinnedHorizontalSlider *horizontal_slider);
 static void ui_skinned_horizontal_slider_destroy            (GtkObject *object);
 static void ui_skinned_horizontal_slider_realize            (GtkWidget *widget);
+static void ui_skinned_horizontal_slider_unrealize          (GtkWidget *widget);
+static void ui_skinned_horizontal_slider_map                (GtkWidget *widget);
+static void ui_skinned_horizontal_slider_unmap              (GtkWidget *widget); 
 static void ui_skinned_horizontal_slider_size_request       (GtkWidget *widget, GtkRequisition *requisition);
 static void ui_skinned_horizontal_slider_size_allocate      (GtkWidget *widget, GtkAllocation *allocation);
 static gboolean ui_skinned_horizontal_slider_expose         (GtkWidget *widget, GdkEventExpose *event);
@@ -96,6 +99,9 @@
     object_class->destroy = ui_skinned_horizontal_slider_destroy;
 
     widget_class->realize = ui_skinned_horizontal_slider_realize;
+    widget_class->unrealize = ui_skinned_horizontal_slider_unrealize;
+    widget_class->map = ui_skinned_horizontal_slider_map;
+    widget_class->unmap = ui_skinned_horizontal_slider_unmap; 
     widget_class->expose_event = ui_skinned_horizontal_slider_expose;
     widget_class->size_request = ui_skinned_horizontal_slider_size_request;
     widget_class->size_allocate = ui_skinned_horizontal_slider_size_allocate;
@@ -127,6 +133,9 @@
 
 static void ui_skinned_horizontal_slider_init(UiSkinnedHorizontalSlider *horizontal_slider) {
     horizontal_slider->pressed = FALSE;
+
+    horizontal_slider->event_window = NULL;
+    GTK_WIDGET_SET_FLAGS(horizontal_slider, GTK_NO_WINDOW);
 }
 
 GtkWidget* ui_skinned_horizontal_slider_new(GtkWidget *fixed, gint x, gint y, gint w, gint h, gint knx, gint kny,
@@ -181,26 +190,60 @@
     g_return_if_fail (widget != NULL);
     g_return_if_fail (UI_SKINNED_IS_HORIZONTAL_SLIDER(widget));
 
-    GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
+    if (GTK_WIDGET_CLASS (parent_class)->realize)
+        (* GTK_WIDGET_CLASS (parent_class)->realize) (widget); 
     horizontal_slider = UI_SKINNED_HORIZONTAL_SLIDER(widget);
 
     attributes.x = widget->allocation.x;
     attributes.y = widget->allocation.y;
     attributes.width = widget->allocation.width;
     attributes.height = widget->allocation.height;
-    attributes.wclass = GDK_INPUT_OUTPUT;
+    attributes.wclass = GDK_INPUT_ONLY;
     attributes.window_type = GDK_WINDOW_CHILD;
     attributes.event_mask = gtk_widget_get_events(widget);
-    attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | 
+    attributes.event_mask |= GDK_BUTTON_PRESS_MASK | 
                              GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK;
-    attributes.visual = gtk_widget_get_visual(widget);
-    attributes.colormap = gtk_widget_get_colormap(widget);
+
+    attributes_mask = GDK_WA_X | GDK_WA_Y;
+    horizontal_slider->event_window = gdk_window_new(widget->window, &attributes, attributes_mask);
+
+    gdk_window_set_user_data(horizontal_slider->event_window, widget);
+}
+
+static void ui_skinned_horizontal_slider_unrealize(GtkWidget *widget) {
+    UiSkinnedHorizontalSlider *horizontal_slider = UI_SKINNED_HORIZONTAL_SLIDER(widget);
+
+   if ( horizontal_slider->event_window != NULL )
+    {
+        gdk_window_set_user_data( horizontal_slider->event_window , NULL );
+        gdk_window_destroy( horizontal_slider->event_window );
+        horizontal_slider->event_window = NULL;
+    }
 
-    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);
+    if (GTK_WIDGET_CLASS (parent_class)->unrealize)
+        (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
+}
+
+static void ui_skinned_horizontal_slider_map (GtkWidget *widget)
+{
+    UiSkinnedHorizontalSlider *horizontal_slider = UI_SKINNED_HORIZONTAL_SLIDER(widget);
+
+    if (horizontal_slider->event_window != NULL)
+        gdk_window_show (horizontal_slider->event_window);
 
-    widget->style = gtk_style_attach(widget->style, widget->window);
-    gdk_window_set_user_data(widget->window, widget);
+    if (GTK_WIDGET_CLASS (parent_class)->map)
+        (* GTK_WIDGET_CLASS (parent_class)->map) (widget);
+}
+
+static void ui_skinned_horizontal_slider_unmap (GtkWidget *widget)
+{
+    UiSkinnedHorizontalSlider *horizontal_slider = UI_SKINNED_HORIZONTAL_SLIDER(widget);
+
+    if (horizontal_slider->event_window != NULL)
+        gdk_window_hide (horizontal_slider->event_window);
+
+    if (GTK_WIDGET_CLASS (parent_class)->unmap)
+        (* GTK_WIDGET_CLASS (parent_class)->unmap) (widget);
 }
 
 static void ui_skinned_horizontal_slider_size_request(GtkWidget *widget, GtkRequisition *requisition) {
@@ -224,7 +267,8 @@
     priv->height = ceil(allocation->height/(priv->scaled ? config.scale_factor : 1));
 
     if (GTK_WIDGET_REALIZED (widget))
-        gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
+        if (horizontal_slider->event_window)
+            gdk_window_move_resize(horizontal_slider->event_window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
 
     horizontal_slider->x = ceil(widget->allocation.x/(priv->scaled ? config.scale_factor : 1));
     horizontal_slider->y = ceil(widget->allocation.y/(priv->scaled ? config.scale_factor : 1));
@@ -263,7 +307,10 @@
                          ((priv->height - priv->knob_height) / 2),
                          priv->knob_width, priv->knob_height);
 
-    ui_skinned_widget_draw(widget, obj, priv->width, priv->height, priv->scaled);
+    ui_skinned_widget_draw_with_coordinates(widget, obj, priv->width, priv->height,
+                                            widget->allocation.x,
+                                            widget->allocation.y,
+                                            priv->scaled);
 
     g_object_unref(obj);
 
--- a/src/skins/ui_skinned_horizontal_slider.h	Sun Aug 10 12:34:29 2008 +0900
+++ b/src/skins/ui_skinned_horizontal_slider.h	Tue Aug 12 15:50:01 2008 +0200
@@ -43,6 +43,7 @@
 
 struct _UiSkinnedHorizontalSlider {
     GtkWidget   widget;
+    GdkWindow   *event_window;
     gboolean    pressed;
     gint        x, y;
     gint        knob_nx, knob_ny, knob_px, knob_py;
--- a/src/skins/ui_skinned_menurow.c	Sun Aug 10 12:34:29 2008 +0900
+++ b/src/skins/ui_skinned_menurow.c	Tue Aug 12 15:50:01 2008 +0200
@@ -39,6 +39,9 @@
 static void ui_skinned_menurow_init               (UiSkinnedMenurow *menurow);
 static void ui_skinned_menurow_destroy            (GtkObject *object);
 static void ui_skinned_menurow_realize            (GtkWidget *widget);
+static void ui_skinned_menurow_unrealize          (GtkWidget *widget);
+static void ui_skinned_menurow_map                (GtkWidget *widget);
+static void ui_skinned_menurow_unmap              (GtkWidget *widget);
 static void ui_skinned_menurow_size_request       (GtkWidget *widget, GtkRequisition *requisition);
 static void ui_skinned_menurow_size_allocate      (GtkWidget *widget, GtkAllocation *allocation);
 static gboolean ui_skinned_menurow_expose         (GtkWidget *widget, GdkEventExpose *event);
@@ -84,6 +87,9 @@
     object_class->destroy = ui_skinned_menurow_destroy;
 
     widget_class->realize = ui_skinned_menurow_realize;
+    widget_class->unrealize = ui_skinned_menurow_unrealize;
+    widget_class->map = ui_skinned_menurow_map;
+    widget_class->unmap = ui_skinned_menurow_unmap;
     widget_class->expose_event = ui_skinned_menurow_expose;
     widget_class->size_request = ui_skinned_menurow_size_request;
     widget_class->size_allocate = ui_skinned_menurow_size_allocate;
@@ -116,6 +122,9 @@
 static void ui_skinned_menurow_init(UiSkinnedMenurow *menurow) {
     menurow->scale_selected = config.scaled;
     menurow->always_selected = config.always_on_top;
+
+    menurow->event_window = NULL;
+    GTK_WIDGET_SET_FLAGS(menurow, GTK_NO_WINDOW);
 }
 
 GtkWidget* ui_skinned_menurow_new(GtkWidget *fixed, gint x, gint y, gint nx, gint ny, gint sx, gint sy, SkinPixmapId si) {
@@ -160,27 +169,60 @@
     g_return_if_fail (widget != NULL);
     g_return_if_fail (UI_SKINNED_IS_MENUROW(widget));
 
-    GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
+    if (GTK_WIDGET_CLASS (parent_class)->realize)
+        (* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
     menurow = UI_SKINNED_MENUROW(widget);
 
     attributes.x = widget->allocation.x;
     attributes.y = widget->allocation.y;
     attributes.width = widget->allocation.width;
     attributes.height = widget->allocation.height;
-    attributes.wclass = GDK_INPUT_OUTPUT;
+    attributes.wclass = GDK_INPUT_ONLY;
     attributes.window_type = GDK_WINDOW_CHILD;
     attributes.event_mask = gtk_widget_get_events(widget);
-    attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | 
+    attributes.event_mask |= GDK_BUTTON_PRESS_MASK |
                              GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK;
-    attributes.visual = gtk_widget_get_visual(widget);
-    attributes.colormap = gtk_widget_get_colormap(widget);
+
+    attributes_mask = GDK_WA_X | GDK_WA_Y;
+    menurow->event_window = gdk_window_new(widget->window, &attributes, attributes_mask);
+
+    gdk_window_set_user_data(menurow->event_window, widget);
+}
+
+static void ui_skinned_menurow_unrealize(GtkWidget *widget) {
+    UiSkinnedMenurow *menurow = UI_SKINNED_MENUROW(widget);
+
+    if ( menurow->event_window != NULL )
+    {
+        gdk_window_set_user_data( menurow->event_window , NULL );
+        gdk_window_destroy( menurow->event_window );
+        menurow->event_window = NULL;
+    }
 
-    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);
+    if (GTK_WIDGET_CLASS (parent_class)->unrealize)
+        (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
+}
+
+static void ui_skinned_menurow_map (GtkWidget *widget)
+{
+    UiSkinnedMenurow *menurow = UI_SKINNED_MENUROW(widget);
+
+    if (menurow->event_window != NULL)
+        gdk_window_show (menurow->event_window);
 
-    widget->style = gtk_style_attach(widget->style, widget->window);
+    if (GTK_WIDGET_CLASS (parent_class)->map)
+        (* GTK_WIDGET_CLASS (parent_class)->map) (widget);
+}
 
-    gdk_window_set_user_data(widget->window, widget);
+static void ui_skinned_menurow_unmap (GtkWidget *widget)
+{
+    UiSkinnedMenurow *menurow = UI_SKINNED_MENUROW(widget);
+
+    if (menurow->event_window != NULL)
+        gdk_window_hide (menurow->event_window);
+
+    if (GTK_WIDGET_CLASS (parent_class)->unmap)
+        (* GTK_WIDGET_CLASS (parent_class)->unmap) (widget);
 }
 
 static void ui_skinned_menurow_size_request(GtkWidget *widget, GtkRequisition *requisition) {
@@ -197,7 +239,8 @@
     widget->allocation.x *= (menurow->scaled ? config.scale_factor : 1);
     widget->allocation.y *= (menurow->scaled ? config.scale_factor : 1);
     if (GTK_WIDGET_REALIZED (widget))
-        gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
+        if (menurow->event_window)
+            gdk_window_move_resize(menurow->event_window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
 
     menurow->x = widget->allocation.x/(menurow->scaled ? config.scale_factor : 1);
     menurow->y = widget->allocation.y/(menurow->scaled ? config.scale_factor : 1);
@@ -236,7 +279,10 @@
                              menurow->sx + 24, menurow->sy + 26, 0, 26, 8, 8);
     }
 
-    ui_skinned_widget_draw(widget, obj, menurow->width, menurow->height, menurow->scaled);
+    ui_skinned_widget_draw_with_coordinates(widget, obj, menurow->width, menurow->height,
+                                            widget->allocation.x,
+                                            widget->allocation.y,
+                                            menurow->scaled);
 
     g_object_unref(obj);
 
--- a/src/skins/ui_skinned_menurow.h	Sun Aug 10 12:34:29 2008 +0900
+++ b/src/skins/ui_skinned_menurow.h	Tue Aug 12 15:50:01 2008 +0200
@@ -49,6 +49,7 @@
 struct _UiSkinnedMenurow {
     GtkWidget        widget;
 
+    GdkWindow        *event_window;
     gint             x, y, width, height;
     gboolean         scaled;
     gint             nx, ny;
--- a/src/skins/ui_skinned_monostereo.c	Sun Aug 10 12:34:29 2008 +0900
+++ b/src/skins/ui_skinned_monostereo.c	Tue Aug 12 15:50:01 2008 +0200
@@ -93,6 +93,8 @@
 static void ui_skinned_monostereo_init(UiSkinnedMonoStereo *monostereo) {
     monostereo->width = 56;
     monostereo->height = 12;
+
+    GTK_WIDGET_SET_FLAGS(monostereo, GTK_NO_WINDOW);
 }
 
 GtkWidget* ui_skinned_monostereo_new(GtkWidget *fixed, gint x, gint y, SkinPixmapId si) {
@@ -121,33 +123,8 @@
 }
 
 static void ui_skinned_monostereo_realize(GtkWidget *widget) {
-    UiSkinnedMonoStereo *monostereo;
-    GdkWindowAttr attributes;
-    gint attributes_mask;
-
-    g_return_if_fail (widget != NULL);
-    g_return_if_fail (UI_SKINNED_IS_MONOSTEREO(widget));
-
-    GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
-    monostereo = UI_SKINNED_MONOSTEREO(widget);
-
-    attributes.x = widget->allocation.x;
-    attributes.y = widget->allocation.y;
-    attributes.width = widget->allocation.width;
-    attributes.height = widget->allocation.height;
-    attributes.wclass = GDK_INPUT_OUTPUT;
-    attributes.window_type = GDK_WINDOW_CHILD;
-    attributes.event_mask = gtk_widget_get_events(widget);
-    attributes.event_mask |= GDK_EXPOSURE_MASK;
-    attributes.visual = gtk_widget_get_visual(widget);
-    attributes.colormap = gtk_widget_get_colormap(widget);
-
-    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);
-
-    widget->style = gtk_style_attach(widget->style, widget->window);
-
-    gdk_window_set_user_data(widget->window, widget);
+    if (GTK_WIDGET_CLASS (parent_class)->realize)
+        (* GTK_WIDGET_CLASS (parent_class)->realize) (widget); 
 }
 
 static void ui_skinned_monostereo_size_request(GtkWidget *widget, GtkRequisition *requisition) {
@@ -163,8 +140,6 @@
     widget->allocation = *allocation;
     widget->allocation.x *= (monostereo->scaled ? config.scale_factor : 1);
     widget->allocation.y *= (monostereo->scaled ? config.scale_factor : 1);
-    if (GTK_WIDGET_REALIZED (widget))
-        gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
 
     monostereo->x = widget->allocation.x/(monostereo->scaled ? config.scale_factor : 1);
     monostereo->y = widget->allocation.y/(monostereo->scaled ? config.scale_factor : 1);
@@ -197,7 +172,10 @@
         break;
     }
 
-    ui_skinned_widget_draw(widget, obj, monostereo->width, monostereo->height, monostereo->scaled);
+    ui_skinned_widget_draw_with_coordinates(widget, obj, monostereo->width, monostereo->height,
+                                            widget->allocation.x,
+                                            widget->allocation.y, 
+                                            monostereo->scaled);
 
     g_object_unref(obj);
 
--- a/src/skins/ui_skinned_number.c	Sun Aug 10 12:34:29 2008 +0900
+++ b/src/skins/ui_skinned_number.c	Tue Aug 12 15:50:01 2008 +0200
@@ -43,6 +43,9 @@
 static void ui_skinned_number_init               (UiSkinnedNumber *number);
 static void ui_skinned_number_destroy            (GtkObject *object);
 static void ui_skinned_number_realize            (GtkWidget *widget);
+static void ui_skinned_number_unrealize          (GtkWidget *widget);
+static void ui_skinned_number_map                (GtkWidget *widget);
+static void ui_skinned_number_unmap              (GtkWidget *widget); 
 static void ui_skinned_number_size_request       (GtkWidget *widget, GtkRequisition *requisition);
 static void ui_skinned_number_size_allocate      (GtkWidget *widget, GtkAllocation *allocation);
 static gboolean ui_skinned_number_expose         (GtkWidget *widget, GdkEventExpose *event);
@@ -82,6 +85,9 @@
     object_class->destroy = ui_skinned_number_destroy;
 
     widget_class->realize = ui_skinned_number_realize;
+    widget_class->unrealize = ui_skinned_number_unrealize;
+    widget_class->map = ui_skinned_number_map;
+    widget_class->unmap = ui_skinned_number_unmap; 
     widget_class->expose_event = ui_skinned_number_expose;
     widget_class->size_request = ui_skinned_number_size_request;
     widget_class->size_allocate = ui_skinned_number_size_allocate;
@@ -97,6 +103,9 @@
 static void ui_skinned_number_init(UiSkinnedNumber *number) {
     number->width = 9;
     number->height = 13;
+
+    number->event_window = NULL;
+    GTK_WIDGET_SET_FLAGS(number, GTK_NO_WINDOW);
 }
 
 GtkWidget* ui_skinned_number_new(GtkWidget *fixed, gint x, gint y, SkinPixmapId si) {
@@ -134,26 +143,59 @@
     g_return_if_fail (widget != NULL);
     g_return_if_fail (UI_SKINNED_IS_NUMBER(widget));
 
-    GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
+    if (GTK_WIDGET_CLASS (parent_class)->realize)
+        (* GTK_WIDGET_CLASS (parent_class)->realize) (widget); 
     number = UI_SKINNED_NUMBER(widget);
 
     attributes.x = widget->allocation.x;
     attributes.y = widget->allocation.y;
     attributes.width = widget->allocation.width;
     attributes.height = widget->allocation.height;
-    attributes.wclass = GDK_INPUT_OUTPUT;
+    attributes.wclass = GDK_INPUT_ONLY;
     attributes.window_type = GDK_WINDOW_CHILD;
     attributes.event_mask = gtk_widget_get_events(widget);
-    attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
-    attributes.visual = gtk_widget_get_visual(widget);
-    attributes.colormap = gtk_widget_get_colormap(widget);
+    attributes.event_mask |= GDK_BUTTON_PRESS_MASK;
+
+    attributes_mask = GDK_WA_X | GDK_WA_Y;
+    number->event_window = gdk_window_new (widget->window, &attributes, attributes_mask); 
+
+    gdk_window_set_user_data(number->event_window, widget);
+}
+
+static void ui_skinned_number_unrealize(GtkWidget *widget) {
+    UiSkinnedNumber *number = UI_SKINNED_NUMBER(widget);
+
+    if ( number->event_window != NULL )
+    {
+        gdk_window_set_user_data( number->event_window , NULL );
+        gdk_window_destroy( number->event_window );
+        number->event_window = NULL;
+    }
 
-    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);
+    if (GTK_WIDGET_CLASS (parent_class)->unrealize)
+        (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
+}
+
+static void ui_skinned_number_map (GtkWidget *widget)
+{
+    UiSkinnedNumber *number = UI_SKINNED_NUMBER (widget);
+
+    if (number->event_window != NULL)
+        gdk_window_show (number->event_window);
 
-    widget->style = gtk_style_attach(widget->style, widget->window);
+    if (GTK_WIDGET_CLASS (parent_class)->map)
+        (* GTK_WIDGET_CLASS (parent_class)->map) (widget);
+}
 
-    gdk_window_set_user_data(widget->window, widget);
+static void ui_skinned_number_unmap (GtkWidget *widget)
+{
+    UiSkinnedNumber *number = UI_SKINNED_NUMBER (widget);
+
+    if (number->event_window != NULL)
+        gdk_window_hide (number->event_window);
+
+    if (GTK_WIDGET_CLASS (parent_class)->unmap)
+        (* GTK_WIDGET_CLASS (parent_class)->unmap) (widget);
 }
 
 static void ui_skinned_number_size_request(GtkWidget *widget, GtkRequisition *requisition) {
@@ -170,7 +212,8 @@
     widget->allocation.x *= (number->scaled ? config.scale_factor: 1 );
     widget->allocation.y *= (number->scaled ? config.scale_factor: 1 );
     if (GTK_WIDGET_REALIZED (widget))
-        gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
+        if (number->event_window)
+            gdk_window_move_resize(number->event_window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
 
     number->x = widget->allocation.x/(number->scaled ? config.scale_factor : 1);
     number->y = widget->allocation.y/(number->scaled ? config.scale_factor : 1);
@@ -194,7 +237,10 @@
                      number->skin_index, number->num * 9, 0,
                      0, 0, number->width, number->height);
 
-    ui_skinned_widget_draw(widget, obj, number->width, number->height, number->scaled);
+    ui_skinned_widget_draw_with_coordinates(widget, obj, number->width, number->height,
+                                            widget->allocation.x,
+                                            widget->allocation.y,
+                                            number->scaled);
 
     g_object_unref(obj);
 
--- a/src/skins/ui_skinned_number.h	Sun Aug 10 12:34:29 2008 +0900
+++ b/src/skins/ui_skinned_number.h	Tue Aug 12 15:50:01 2008 +0200
@@ -38,6 +38,7 @@
 struct _UiSkinnedNumber {
     GtkWidget        widget;
 
+    GdkWindow        *event_window;
     gint             x, y, width, height;
     gint             num;
     gboolean         scaled;
--- a/src/skins/ui_skinned_playstatus.c	Sun Aug 10 12:34:29 2008 +0900
+++ b/src/skins/ui_skinned_playstatus.c	Tue Aug 12 15:50:01 2008 +0200
@@ -95,6 +95,8 @@
 static void ui_skinned_playstatus_init(UiSkinnedPlaystatus *playstatus) {
     playstatus->width = 11;
     playstatus->height = 9;
+
+    GTK_WIDGET_SET_FLAGS(playstatus, GTK_NO_WINDOW);
 }
 
 GtkWidget* ui_skinned_playstatus_new(GtkWidget *fixed, gint x, gint y) {
@@ -123,33 +125,8 @@
 }
 
 static void ui_skinned_playstatus_realize(GtkWidget *widget) {
-    UiSkinnedPlaystatus *playstatus;
-    GdkWindowAttr attributes;
-    gint attributes_mask;
-
-    g_return_if_fail (widget != NULL);
-    g_return_if_fail (UI_SKINNED_IS_PLAYSTATUS(widget));
-
-    GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
-    playstatus = UI_SKINNED_PLAYSTATUS(widget);
-
-    attributes.x = widget->allocation.x;
-    attributes.y = widget->allocation.y;
-    attributes.width = widget->allocation.width;
-    attributes.height = widget->allocation.height;
-    attributes.wclass = GDK_INPUT_OUTPUT;
-    attributes.window_type = GDK_WINDOW_CHILD;
-    attributes.event_mask = gtk_widget_get_events(widget);
-    attributes.event_mask |= GDK_EXPOSURE_MASK;
-    attributes.visual = gtk_widget_get_visual(widget);
-    attributes.colormap = gtk_widget_get_colormap(widget);
-
-    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);
-
-    widget->style = gtk_style_attach(widget->style, widget->window);
-
-    gdk_window_set_user_data(widget->window, widget);
+    if (GTK_WIDGET_CLASS (parent_class)->realize)
+        (* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
 }
 
 static void ui_skinned_playstatus_size_request(GtkWidget *widget, GtkRequisition *requisition) {
@@ -165,8 +142,6 @@
     widget->allocation = *allocation;
     widget->allocation.x *= (playstatus->scaled ? config.scale_factor : 1);
     widget->allocation.y *= (playstatus->scaled ? config.scale_factor : 1);
-    if (GTK_WIDGET_REALIZED (widget))
-        gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
 
     playstatus->x = widget->allocation.x/(playstatus->scaled ? config.scale_factor : 1);
     playstatus->y = widget->allocation.y/(playstatus->scaled ? config.scale_factor : 1);
@@ -203,7 +178,10 @@
         break;
     }
 
-    ui_skinned_widget_draw(widget, obj, playstatus->width, playstatus->height, playstatus->scaled);
+    ui_skinned_widget_draw_with_coordinates(widget, obj, playstatus->width, playstatus->height,
+                                            widget->allocation.x,
+                                            widget->allocation.y,
+                                            playstatus->scaled);
 
     g_object_unref(obj);