# HG changeset patch # User William Pitcock # Date 1183283288 18000 # Node ID 09c216d437b22b2b97b4e2d5bb6ef590c468d303 # Parent 3c66c8d03c534692d1606ed3ed79634e227f7bd2 Backed out changeset 3c66c8d03c534692d1606ed3ed79634e227f7bd2 As implemented, this diff breaks the UI. diff -r 3c66c8d03c53 -r 09c216d437b2 src/audacious/ui_playlist.c --- a/src/audacious/ui_playlist.c Sat Jun 30 21:20:49 2007 +0200 +++ b/src/audacious/ui_playlist.c Sun Jul 01 04:48:08 2007 -0500 @@ -665,7 +665,7 @@ widget_move_relative(WIDGET(playlistwin_slider), dx, 0); widget_resize_relative(WIDGET(playlistwin_slider), 0, dy); - UI_SKINNED_TEXTBOX(playlistwin_sinfo)->weight += dx; + ui_skinned_textbox_resize_relative(playlistwin_sinfo, dx, 0); playlistwin_update_sinfo(playlist_get_active()); ui_skinned_button_move_relative(playlistwin_shade, dx, 0); diff -r 3c66c8d03c53 -r 09c216d437b2 src/audacious/ui_skinned_textbox.c --- a/src/audacious/ui_skinned_textbox.c Sat Jun 30 21:20:49 2007 +0200 +++ b/src/audacious/ui_skinned_textbox.c Sun Jul 01 04:48:08 2007 -0500 @@ -48,6 +48,7 @@ struct _UiSkinnedTextboxPrivate { GtkWidget *image; GdkGC *gc; + gint w; SkinPixmapId skin_index; GtkWidget *fixed; gboolean double_size; @@ -268,7 +269,7 @@ textbox->x = x; textbox->y = y; priv->gc = gc; - textbox->weight = w; + priv->w = w; priv->scroll_allowed = allow_scroll; priv->scroll_enabled = TRUE; priv->skin_index = si; @@ -279,7 +280,7 @@ priv->fixed = fixed; priv->double_size = FALSE; - gtk_widget_set_size_request(widget, textbox->weight, textbox->height); + gtk_widget_set_size_request(widget, priv->w, textbox->height); gtk_fixed_put(GTK_FIXED(priv->fixed), widget, textbox->x, textbox->y); } @@ -305,12 +306,12 @@ textbox->x = widget->allocation.x/(priv->double_size ? 2 : 1); textbox->y = widget->allocation.y/(priv->double_size ? 2 : 1); - if (textbox->weight != widget->allocation.width) { - textbox->weight = widget->allocation.width; + if (priv->w != widget->allocation.width) { + priv->w = widget->allocation.width; if (priv->pixmap_text) g_free(priv->pixmap_text); priv->pixmap_text = NULL; priv->offset = 0; - textbox->redraw = TRUE; + ui_skinned_textbox_redraw(textbox); } } @@ -323,7 +324,7 @@ if (event->button == 1) { if (priv->scroll_allowed) { - if ((priv->pixmap_width > textbox->weight) && priv->is_scrollable) { + if ((priv->pixmap_width > priv->w) && priv->is_scrollable) { priv->is_dragging = TRUE; textbox->redraw = TRUE; priv->drag_off = priv->offset; @@ -360,17 +361,16 @@ if (priv->is_dragging) { if (priv->scroll_allowed && - priv->pixmap_width > textbox->weight) { + priv->pixmap_width > priv->w) { priv->offset = priv->drag_off - (event->x - priv->drag_x); while (priv->offset < 0) priv->offset = 0; - while (priv->offset > (priv->pixmap_width - textbox->weight)) - priv->offset = (priv->pixmap_width - textbox->weight); + while (priv->offset > (priv->pixmap_width - priv->w)) + priv->offset = (priv->pixmap_width - priv->w); - textbox->redraw = TRUE; - ui_skinned_textbox_paint(textbox); + ui_skinned_textbox_redraw(textbox); } } @@ -386,7 +386,7 @@ UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (textbox); priv->double_size = !priv->double_size; - gtk_widget_set_size_request(widget, textbox->weight*(1+priv->double_size), textbox->height*(1+priv->double_size)); + gtk_widget_set_size_request(widget, priv->w*(1+priv->double_size), textbox->height*(1+priv->double_size)); gtk_widget_set_uposition(widget, textbox->x*(1+priv->double_size), textbox->y*(1+priv->double_size)); textbox->redraw = TRUE; @@ -410,21 +410,21 @@ priv->skin_id = skin_get_id(); textbox_generate_pixmap(textbox); } - obj = gdk_pixmap_new(NULL, textbox->weight, textbox->height, gdk_rgb_get_visual()->depth); + obj = gdk_pixmap_new(NULL, priv->w, textbox->height, gdk_rgb_get_visual()->depth); src = priv->pixmap; cw = priv->pixmap_width - priv->offset; - if (cw > textbox->weight) - cw = textbox->weight; + if (cw > priv->w) + cw = priv->w; gdk_draw_drawable(obj, priv->gc, src, priv->offset, 0, 0, 0, cw, textbox->height); - if (cw < textbox->weight) + if (cw < priv->w) gdk_draw_drawable(obj, priv->gc, src, 0, 0, textbox->x + cw, textbox->y, - textbox->weight - cw, textbox->height); + priv->w - cw, textbox->height); if (priv->double_size) { GdkImage *img, *img2x; - img = gdk_drawable_get_image(obj, 0, 0, textbox->weight, textbox->height); + img = gdk_drawable_get_image(obj, 0, 0, priv->w, textbox->height); img2x = create_dblsize_image(img); gtk_image_set(GTK_IMAGE(priv->image), img2x, NULL); g_object_unref(img2x); @@ -440,11 +440,6 @@ static void ui_skinned_textbox_redraw(UiSkinnedTextbox *textbox) { textbox->redraw = TRUE; - gint w, h; - UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (textbox); - gtk_widget_get_size_request(GTK_WIDGET(textbox), &w, &h); - if (w != textbox->weight || h != textbox->height) - gtk_widget_set_size_request(GTK_WIDGET(textbox), textbox->weight, textbox->height); ui_skinned_textbox_paint(textbox); } @@ -457,13 +452,13 @@ gint width; text_get_extents(priv->fontname, textbox->text, &width, NULL, NULL, NULL); - if (width <= textbox->weight) + if (width <= priv->w) return FALSE; else return TRUE; } - if (g_utf8_strlen(textbox->text, -1) * bmp_active_skin->properties.textbox_bitmap_font_width > textbox->weight) + if (g_utf8_strlen(textbox->text, -1) * bmp_active_skin->properties.textbox_bitmap_font_width > priv->w) return TRUE; return FALSE; @@ -545,7 +540,7 @@ text_get_extents(priv->fontname, pixmaptext, &width, NULL, NULL, NULL); - priv->pixmap_width = MAX(width, textbox->weight); + priv->pixmap_width = MAX(width, priv->w); priv->pixmap = gdk_pixmap_new(mainwin->window, priv->pixmap_width, textbox->height, gdk_rgb_get_visual()->depth); @@ -593,7 +588,7 @@ if (priv->scroll_back) priv->offset -= 1; else priv->offset += 1; - if (priv->offset >= (priv->pixmap_width - textbox->weight)) { + if (priv->offset >= (priv->pixmap_width - priv->w)) { priv->scroll_back = TRUE; /* There are 1 million microseconds per second */ //g_usleep(1000000); @@ -637,8 +632,8 @@ * wl is the number of (partial) letters visible. Only makes * sense when using skinned font. */ - wl = textbox->weight / 5; - if (wl * 5 != textbox->weight) + wl = priv->w / 5; + if (wl * 5 != priv->w) wl++; length = g_utf8_strlen(textbox->text, -1); @@ -850,3 +845,9 @@ UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (widget); gtk_fixed_move(GTK_FIXED(priv->fixed), widget, t->x+x, t->y+y); } + +void ui_skinned_textbox_resize_relative(GtkWidget *widget, gint w, gint h) { + UiSkinnedTextbox *t = UI_SKINNED_TEXTBOX(widget); + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (widget); + gtk_widget_set_size_request(widget, priv->w+w, t->height+h); +} diff -r 3c66c8d03c53 -r 09c216d437b2 src/audacious/ui_skinned_textbox.h --- a/src/audacious/ui_skinned_textbox.h Sat Jun 30 21:20:49 2007 +0200 +++ b/src/audacious/ui_skinned_textbox.h Sun Jul 01 04:48:08 2007 -0500 @@ -40,7 +40,7 @@ struct _UiSkinnedTextbox { GtkBin bin; GdkWindow *event_window; - gint x, y, weight, height; + gint x, y, height; gboolean redraw; gchar *text; }; @@ -61,5 +61,6 @@ void ui_skinned_textbox_set_xfont(GtkWidget *widget, gboolean use_xfont, const gchar *fontname); void ui_skinned_textbox_set_scroll(GtkWidget *widget, gboolean scroll); void ui_skinned_textbox_move_relative(GtkWidget *widget, gint x, gint y); +void ui_skinned_textbox_resize_relative(GtkWidget *widget, gint w, gint h); #endif