16416N/A--- nimbus-0.1.1/gtk-engine/nimbus_style.c.orig 2009-04-21 15:59:37.886017000 +0900
16416N/A+++ nimbus-0.1.1/gtk-engine/nimbus_style.c 2009-04-22 17:12:55.140243000 +0900
16416N/A@@ -107,6 +107,19 @@ static void draw_nimbus_box (GtkStyle
16416N/A
16416N/A static GtkStyleClass *parent_class;
16416N/A
16416N/A+static GtkTextDirection
16416N/A+get_direction (GtkWidget *widget)
16416N/A+{
16416N/A+ GtkTextDirection dir;
16416N/A+
16416N/A+ if (widget)
16416N/A+ dir = gtk_widget_get_direction (widget);
16416N/A+ else
16416N/A+ dir = GTK_TEXT_DIR_LTR;
16416N/A+
16416N/A+ return dir;
16416N/A+}
16416N/A+
16416N/A static gboolean check_sane_pixbuf_value (int src_x, int src_y, int width, int height, GdkPixbuf *pixbuf)
16416N/A {
16416N/A /*printf ("checking src_x = %d, int src_y = %d, int width = %d, int height = %d , pixbuf->height = %d, pixbuf->width = %d\n",
16416N/A@@ -353,6 +366,7 @@ draw_arrow (GtkStyle *style,
16416N/A {
16416N/A GList *tmp_list;
16416N/A int vsep_offset = 0;
16416N/A+ int allocation_x, allocation_width;
16416N/A GType researched_type = g_type_from_name ("GtkVSeparator");
16416N/A
16416N/A /* get the vseparator offset if it exists */
16416N/A@@ -371,21 +385,36 @@ draw_arrow (GtkStyle *style,
16416N/A if (tmp_list)
16416N/A g_list_free(tmp_list);
16416N/A
16416N/A+ if (get_direction (widget) == GTK_TEXT_DIR_RTL)
16416N/A+ {
16416N/A+ allocation_x = widget->allocation.x - vsep_offset;
16416N/A+ allocation_width = widget->allocation.width + vsep_offset;
16416N/A+ }
16416N/A+ else
16416N/A+ {
16416N/A+ allocation_x = x - vsep_offset;
16416N/A+ allocation_width = widget->parent->parent->allocation.x + widget->parent->parent->allocation.width - x + vsep_offset;
16416N/A+ }
16416N/A+
16416N/A draw_nimbus_box (style, window, state_type, shadow_type, NULL, widget, "combobox_arrow",
16416N/A rc->arrow_button[state_type],
16416N/A FALSE,
16416N/A- x - vsep_offset,
16416N/A+ allocation_x,
16416N/A widget->parent->parent->allocation.y,
16416N/A- widget->parent->parent->allocation.x + widget->parent->parent->allocation.width - x + vsep_offset,
16416N/A+ allocation_width,
16416N/A widget->parent->parent->allocation.height,
16416N/A NIMBUS_SPIN_NONE, GTK_ORIENTATION_HORIZONTAL);
16416N/A
16416N/A+ if (get_direction (widget) == GTK_TEXT_DIR_RTL)
16416N/A+ allocation_x = (x - vsep_offset) + (allocation_width - vsep_offset - gdk_pixbuf_get_width (rc->combo_arrow[state_type])) / 2;
16416N/A+ else
16416N/A+ allocation_x = (x - vsep_offset) + (widget->parent->parent->allocation.x + widget->parent->parent->allocation.width - x + vsep_offset - gdk_pixbuf_get_width (rc->combo_arrow[state_type])) / 2;
16416N/A if (rc->combo_arrow[state_type])
16416N/A gdk_draw_pixbuf (window,
16416N/A get_clipping_gc (window, area),
16416N/A rc->combo_arrow[state_type],
16416N/A 0,0,
16416N/A- (x - vsep_offset) + (widget->parent->parent->allocation.x + widget->parent->parent->allocation.width - x + vsep_offset - gdk_pixbuf_get_width (rc->combo_arrow[state_type])) / 2,
16416N/A+ allocation_x,
16416N/A widget->parent->parent->allocation.y + (widget->parent->parent->allocation.height - gdk_pixbuf_get_height (rc->combo_arrow[state_type])) / 2 ,
16416N/A gdk_pixbuf_get_width (rc->combo_arrow[state_type]),
16416N/A gdk_pixbuf_get_height (rc->combo_arrow[state_type]),
16416N/A@@ -509,7 +538,10 @@ draw_tab (GtkStyle *style,
16416N/A button_area.width = widget->allocation.width - 2 * border_width;
16416N/A button_area.height = widget->allocation.height - 2 * border_width;
16416N/A
16416N/A- tab_x = button_area.x + button_area.width -
16416N/A+ if (get_direction (widget) == GTK_TEXT_DIR_RTL)
16416N/A+ tab_x = button_area.x;
16416N/A+ else
16416N/A+ tab_x = button_area.x + button_area.width -
16416N/A indicator_size.width - indicator_spacing.right - indicator_spacing.left - widget->style->xthickness;
16416N/A
16416N/A draw_nimbus_box (style, window, state_type, shadow_type, area, widget, "option_arrow",
16416N/A@@ -1115,6 +1147,10 @@ draw_nimbus_box (GtkStyle *style,
16416N/A {
16416N/A gboolean draw_top = TRUE, draw_bottom = TRUE, draw_partial_from_start = TRUE;
16416N/A NimbusData *rc = NIMBUS_RC_STYLE (style->rc_style)->data;
16416N/A+ NimbusGradient *gradient;
16416N/A+ NimbusButtonCorner corners;
16416N/A+ GtkTextDirection direction = get_direction (widget);
16416N/A+ GdkPixbuf *pixbuf;
16416N/A
16416N/A GSList *tmp;
16416N/A int drop_shadow_offset = 1;
16416N/A@@ -1136,61 +1172,133 @@ draw_nimbus_box (GtkStyle *style,
16416N/A tmp = button->gradients;
16416N/A while (tmp)
16416N/A {
16416N/A- nimbus_draw_gradient (window, style, area, (NimbusGradient*)tmp->data,
16416N/A+ gradient = (NimbusGradient*)tmp->data;
16416N/A+ corners = gradient->corners;
16416N/A+
16416N/A+ if ((direction == GTK_TEXT_DIR_RTL) &&
16416N/A+ (gradient->corners & CORNER_TOP_LEFT) &&
16416N/A+ ((gradient->corners & CORNER_TOP_RIGHT) == 0))
16416N/A+ {
16416N/A+ gradient->corners ^= CORNER_TOP_LEFT;
16416N/A+ gradient->corners |= CORNER_TOP_RIGHT;
16416N/A+ }
16416N/A+ else if ((direction == GTK_TEXT_DIR_RTL) &&
16416N/A+ ((gradient->corners & CORNER_TOP_LEFT) == 0) &&
16416N/A+ (gradient->corners & CORNER_TOP_RIGHT))
16416N/A+ {
16416N/A+ gradient->corners |= CORNER_TOP_LEFT;
16416N/A+ gradient->corners ^= CORNER_TOP_RIGHT;
16416N/A+ }
16416N/A+
16416N/A+ if ((direction == GTK_TEXT_DIR_RTL) &&
16416N/A+ (gradient->corners & CORNER_BOTTOM_LEFT) &&
16416N/A+ ((gradient->corners & CORNER_BOTTOM_RIGHT) == NULL))
16416N/A+ {
16416N/A+ gradient->corners ^= CORNER_BOTTOM_LEFT;
16416N/A+ gradient->corners |= CORNER_BOTTOM_RIGHT;
16416N/A+ }
16416N/A+ else if ((direction == GTK_TEXT_DIR_RTL) &&
16416N/A+ ((gradient->corners & CORNER_BOTTOM_LEFT) == NULL) &&
16416N/A+ (gradient->corners & CORNER_BOTTOM_RIGHT))
16416N/A+ {
16416N/A+ gradient->corners |= CORNER_BOTTOM_LEFT;
16416N/A+ gradient->corners ^= CORNER_BOTTOM_RIGHT;
16416N/A+ }
16416N/A+
16416N/A+ nimbus_draw_gradient (window, style, area, gradient,
16416N/A x, y, width, height - drop_shadow_offset,
16416N/A partial_height, draw_partial_from_start,
16416N/A orientation, NO_TAB);
16416N/A+
16416N/A+ gradient->corners = corners;
16416N/A tmp = tmp->next;
16416N/A }
16416N/A
16416N/A- if (button->corner_top_left && draw_top)
16416N/A+ if (direction == GTK_TEXT_DIR_RTL)
16416N/A+ pixbuf = button->corner_top_right ?
16416N/A+ gdk_pixbuf_flip (button->corner_top_right, TRUE) : NULL;
16416N/A+ else
16416N/A+ pixbuf = button->corner_top_left;
16416N/A+
16416N/A+ if (pixbuf && draw_top)
16416N/A gdk_draw_pixbuf (window,
16416N/A get_clipping_gc (window, area),
16416N/A- button->corner_top_left,
16416N/A+ pixbuf,
16416N/A 0,0,
16416N/A x,y,
16416N/A- gdk_pixbuf_get_width (button->corner_top_left),
16416N/A- gdk_pixbuf_get_height (button->corner_top_left),
16416N/A+ gdk_pixbuf_get_width (pixbuf),
16416N/A+ gdk_pixbuf_get_height (pixbuf),
16416N/A GDK_RGB_DITHER_NONE,0,0);
16416N/A
16416N/A- if (button->corner_top_right && draw_top)
16416N/A+ if (pixbuf && direction == GTK_TEXT_DIR_RTL)
16416N/A+ gdk_pixbuf_unref (pixbuf);
16416N/A+
16416N/A+ if (direction == GTK_TEXT_DIR_RTL)
16416N/A+ pixbuf = button->corner_top_left ?
16416N/A+ gdk_pixbuf_flip (button->corner_top_left, TRUE) : NULL;
16416N/A+ else
16416N/A+ pixbuf = button->corner_top_right;
16416N/A+
16416N/A+ if (pixbuf && draw_top)
16416N/A gdk_draw_pixbuf (window,
16416N/A get_clipping_gc (window, area),
16416N/A- button->corner_top_right,
16416N/A+ pixbuf,
16416N/A 0,0,
16416N/A- x+ width - gdk_pixbuf_get_width (button->corner_top_right),
16416N/A+ x+ width - gdk_pixbuf_get_width (pixbuf),
16416N/A y,
16416N/A- gdk_pixbuf_get_width (button->corner_top_right),
16416N/A- gdk_pixbuf_get_height (button->corner_top_right),
16416N/A+ gdk_pixbuf_get_width (pixbuf),
16416N/A+ gdk_pixbuf_get_height (pixbuf),
16416N/A GDK_RGB_DITHER_NONE,0,0);
16416N/A
16416N/A- if (button->corner_bottom_left && draw_bottom)
16416N/A+ if (pixbuf && direction == GTK_TEXT_DIR_RTL)
16416N/A+ gdk_pixbuf_unref (pixbuf);
16416N/A+
16416N/A+ if (direction == GTK_TEXT_DIR_RTL)
16416N/A+ pixbuf = button->corner_bottom_right ?
16416N/A+ gdk_pixbuf_flip (button->corner_bottom_right, TRUE) : NULL;
16416N/A+ else
16416N/A+ pixbuf = button->corner_bottom_left;
16416N/A+
16416N/A+ if (pixbuf && draw_bottom)
16416N/A {
16416N/A- bottom_left_c_w = gdk_pixbuf_get_width (button->corner_bottom_left);
16416N/A+ bottom_left_c_w = gdk_pixbuf_get_width (pixbuf);
16416N/A gdk_draw_pixbuf (window,
16416N/A get_clipping_gc (window, area),
16416N/A- button->corner_bottom_left,
16416N/A+ pixbuf,
16416N/A 0,0,
16416N/A x,
16416N/A- y + height - gdk_pixbuf_get_height (button->corner_bottom_left),
16416N/A+ y + height - gdk_pixbuf_get_height (pixbuf),
16416N/A bottom_left_c_w,
16416N/A- gdk_pixbuf_get_height (button->corner_bottom_left),
16416N/A+ gdk_pixbuf_get_height (pixbuf),
16416N/A GDK_RGB_DITHER_NONE,0,0);
16416N/A }
16416N/A- if (button->corner_bottom_right && draw_bottom)
16416N/A+
16416N/A+ if (pixbuf && direction == GTK_TEXT_DIR_RTL)
16416N/A+ gdk_pixbuf_unref (pixbuf);
16416N/A+
16416N/A+ if (direction == GTK_TEXT_DIR_RTL)
16416N/A+ pixbuf = button->corner_bottom_left ?
16416N/A+ gdk_pixbuf_flip (button->corner_bottom_left, TRUE) : NULL;
16416N/A+ else
16416N/A+ pixbuf = button->corner_bottom_right;
16416N/A+
16416N/A+ if (pixbuf && draw_bottom)
16416N/A {
16416N/A- bottom_right_c_w = gdk_pixbuf_get_width (button->corner_bottom_right);
16416N/A+ bottom_right_c_w = gdk_pixbuf_get_width (pixbuf);
16416N/A gdk_draw_pixbuf (window,
16416N/A get_clipping_gc (window, area),
16416N/A- button->corner_bottom_right,
16416N/A+ pixbuf,
16416N/A 0,0,
16416N/A x+ width - bottom_right_c_w,
16416N/A- y + height - gdk_pixbuf_get_height (button->corner_bottom_right),
16416N/A+ y + height - gdk_pixbuf_get_height (pixbuf),
16416N/A bottom_right_c_w,
16416N/A- gdk_pixbuf_get_height (button->corner_bottom_right),
16416N/A+ gdk_pixbuf_get_height (pixbuf),
16416N/A GDK_RGB_DITHER_NONE,0,0);
16416N/A }
16416N/A
16416N/A+ if (pixbuf && direction == GTK_TEXT_DIR_RTL)
16416N/A+ gdk_pixbuf_unref (pixbuf);
16416N/A+
16416N/A if ((state_type != GTK_STATE_INSENSITIVE) && drop_shadow && draw_bottom)
16416N/A {
16416N/A GdkPixbuf **drop_shadow = NIMBUS_RC_STYLE (style->rc_style)->dark ? rc->dark_drop_shadow : rc->drop_shadow;