diff options
18 files changed, 3492 insertions, 0 deletions
diff --git a/openembedded/packages/gtk+/gtk+-2.10.0/automake-lossage.patch b/openembedded/packages/gtk+/gtk+-2.10.0/automake-lossage.patch new file mode 100644 index 0000000000..0d423ddbb9 --- /dev/null +++ b/openembedded/packages/gtk+/gtk+-2.10.0/automake-lossage.patch | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | --- gtk+-2.4.1/docs/tutorial/Makefile.am~ 2003-05-06 22:54:20.000000000 +0100 | ||
| 2 | +++ gtk+-2.4.1/docs/tutorial/Makefile.am 2004-05-08 12:31:41.000000000 +0100 | ||
| 3 | @@ -52,21 +52,5 @@ | ||
| 4 | |||
| 5 | dist-hook: html | ||
| 6 | cp -Rp $(srcdir)/html $(distdir) | ||
| 7 | -else | ||
| 8 | -html: | ||
| 9 | - echo "***" | ||
| 10 | - echo "*** Warning: Tutorial not built" | ||
| 11 | - echo "***" | ||
| 12 | - | ||
| 13 | -pdf: | ||
| 14 | - echo "***" | ||
| 15 | - echo "*** Warning: Tutorial not built" | ||
| 16 | - echo "***" | ||
| 17 | - | ||
| 18 | -dist-hook: | ||
| 19 | - echo "***" | ||
| 20 | - echo "*** Warning: Tutorial not built" | ||
| 21 | - echo "*** DISTRIBUTION IS INCOMPLETE" | ||
| 22 | - echo "***" | ||
| 23 | endif | ||
| 24 | |||
diff --git a/openembedded/packages/gtk+/gtk+-2.10.0/cellrenderer-cairo.patch b/openembedded/packages/gtk+/gtk+-2.10.0/cellrenderer-cairo.patch new file mode 100644 index 0000000000..020f35bb85 --- /dev/null +++ b/openembedded/packages/gtk+/gtk+-2.10.0/cellrenderer-cairo.patch | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | Index: gtkcellrenderer.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvs/gnome/gtk+/gtk/gtkcellrenderer.c,v | ||
| 4 | retrieving revision 1.55 | ||
| 5 | diff -u -r1.55 gtk+-2.10.0/gtk/gtkcellrenderer.c | ||
| 6 | --- gtk+-2.10.0/gtk/gtkcellrenderer.c 14 May 2006 04:25:28 -0000 1.55 | ||
| 7 | +++ gtk+-2.10.0/gtk/gtkcellrenderer.c 30 Jun 2006 10:57:43 -0000 | ||
| 8 | @@ -551,6 +551,7 @@ | ||
| 9 | |||
| 10 | if (cell->cell_background_set && !selected) | ||
| 11 | { | ||
| 12 | +#ifdef USE_CAIRO_INTERNALLY | ||
| 13 | cairo_t *cr = gdk_cairo_create (window); | ||
| 14 | |||
| 15 | gdk_cairo_rectangle (cr, background_area); | ||
| 16 | @@ -558,6 +559,16 @@ | ||
| 17 | cairo_fill (cr); | ||
| 18 | |||
| 19 | cairo_destroy (cr); | ||
| 20 | +#else | ||
| 21 | + GdkGC *gc; | ||
| 22 | + | ||
| 23 | + gc = gdk_gc_new (window); | ||
| 24 | + gdk_gc_set_rgb_fg_color (gc, &priv->cell_background); | ||
| 25 | + gdk_draw_rectangle (window, gc, TRUE, | ||
| 26 | + background_area->x, background_area->y, | ||
| 27 | + background_area->width, background_area->height); | ||
| 28 | + g_object_unref (gc); | ||
| 29 | +#endif | ||
| 30 | } | ||
| 31 | |||
| 32 | GTK_CELL_RENDERER_GET_CLASS (cell)->render (cell, | ||
diff --git a/openembedded/packages/gtk+/gtk+-2.10.0/disable-tooltips.patch b/openembedded/packages/gtk+/gtk+-2.10.0/disable-tooltips.patch new file mode 100644 index 0000000000..d71d839c3c --- /dev/null +++ b/openembedded/packages/gtk+/gtk+-2.10.0/disable-tooltips.patch | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | --- gtk+-2.4.3/gtk/gtktooltips.c.old 2004-07-04 18:52:04.000000000 +0100 | ||
| 2 | +++ gtk+-2.4.3/gtk/gtktooltips.c 2004-07-04 18:52:08.000000000 +0100 | ||
| 3 | @@ -118,7 +118,7 @@ | ||
| 4 | tooltips->tips_data_list = NULL; | ||
| 5 | |||
| 6 | tooltips->delay = DEFAULT_DELAY; | ||
| 7 | - tooltips->enabled = TRUE; | ||
| 8 | + tooltips->enabled = FALSE; | ||
| 9 | tooltips->timer_tag = 0; | ||
| 10 | tooltips->use_sticky_delay = FALSE; | ||
| 11 | tooltips->last_popdown.tv_sec = -1; | ||
diff --git a/openembedded/packages/gtk+/gtk+-2.10.0/entry-cairo.patch b/openembedded/packages/gtk+/gtk+-2.10.0/entry-cairo.patch new file mode 100644 index 0000000000..506b617d8e --- /dev/null +++ b/openembedded/packages/gtk+/gtk+-2.10.0/entry-cairo.patch | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | Index: gtkentry.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvs/gnome/gtk+/gtk/gtkentry.c,v | ||
| 4 | retrieving revision 1.317 | ||
| 5 | diff -u -r1.317 gtk+-2.10.0/gtk/gtkentry.c | ||
| 6 | --- gtk+-2.10.0/gtk/gtkentry.c 29 Jun 2006 09:18:05 -0000 1.317 | ||
| 7 | +++ gtk+-2.10.0/gtk/gtkentry.c 2 Jul 2006 14:14:24 -0000 | ||
| 8 | @@ -3337,7 +3337,9 @@ | ||
| 9 | if (GTK_WIDGET_DRAWABLE (entry)) | ||
| 10 | { | ||
| 11 | PangoLayout *layout = gtk_entry_ensure_layout (entry, TRUE); | ||
| 12 | +#ifdef USE_CAIRO_INTERNALLY | ||
| 13 | cairo_t *cr; | ||
| 14 | +#endif | ||
| 15 | gint x, y; | ||
| 16 | gint start_pos, end_pos; | ||
| 17 | |||
| 18 | @@ -3345,23 +3347,37 @@ | ||
| 19 | |||
| 20 | get_layout_position (entry, &x, &y); | ||
| 21 | |||
| 22 | +#ifdef USE_CAIRO_INTERNALLY | ||
| 23 | cr = gdk_cairo_create (entry->text_area); | ||
| 24 | |||
| 25 | cairo_move_to (cr, x, y); | ||
| 26 | gdk_cairo_set_source_color (cr, &widget->style->text [widget->state]); | ||
| 27 | pango_cairo_show_layout (cr, layout); | ||
| 28 | +#else | ||
| 29 | + gdk_draw_layout (entry->text_area, widget->style->text_gc [widget->state], | ||
| 30 | + x, y, | ||
| 31 | + layout); | ||
| 32 | +#endif | ||
| 33 | |||
| 34 | if (gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start_pos, &end_pos)) | ||
| 35 | { | ||
| 36 | gint *ranges; | ||
| 37 | gint n_ranges, i; | ||
| 38 | PangoRectangle logical_rect; | ||
| 39 | - GdkColor *selection_color, *text_color; | ||
| 40 | GtkBorder inner_border; | ||
| 41 | +#ifdef USE_CAIRO_INTERNALLY | ||
| 42 | + GdkColor *selection_color, *text_color; | ||
| 43 | +#else | ||
| 44 | + GdkGC *selection_gc, *text_gc; | ||
| 45 | + GdkRegion *clip_region; | ||
| 46 | +#endif | ||
| 47 | |||
| 48 | pango_layout_get_pixel_extents (layout, NULL, &logical_rect); | ||
| 49 | gtk_entry_get_pixel_ranges (entry, &ranges, &n_ranges); | ||
| 50 | |||
| 51 | + get_inner_border (entry, &inner_border); | ||
| 52 | + | ||
| 53 | +#ifdef USE_CAIRO_INTERNALLY | ||
| 54 | if (GTK_WIDGET_HAS_FOCUS (entry)) | ||
| 55 | { | ||
| 56 | selection_color = &widget->style->base [GTK_STATE_SELECTED]; | ||
| 57 | @@ -3373,8 +3389,6 @@ | ||
| 58 | text_color = &widget->style->text [GTK_STATE_ACTIVE]; | ||
| 59 | } | ||
| 60 | |||
| 61 | - get_inner_border (entry, &inner_border); | ||
| 62 | - | ||
| 63 | for (i = 0; i < n_ranges; ++i) | ||
| 64 | cairo_rectangle (cr, | ||
| 65 | inner_border.left - entry->scroll_offset + ranges[2 * i], | ||
| 66 | @@ -3390,11 +3404,46 @@ | ||
| 67 | cairo_move_to (cr, x, y); | ||
| 68 | gdk_cairo_set_source_color (cr, text_color); | ||
| 69 | pango_cairo_show_layout (cr, layout); | ||
| 70 | - | ||
| 71 | +#else | ||
| 72 | + if (GTK_WIDGET_HAS_FOCUS (entry)) | ||
| 73 | + { | ||
| 74 | + selection_gc = widget->style->base_gc [GTK_STATE_SELECTED]; | ||
| 75 | + text_gc = widget->style->text_gc [GTK_STATE_SELECTED]; | ||
| 76 | + } | ||
| 77 | + else | ||
| 78 | + { | ||
| 79 | + selection_gc = widget->style->base_gc [GTK_STATE_ACTIVE]; | ||
| 80 | + text_gc = widget->style->text_gc [GTK_STATE_ACTIVE]; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + clip_region = gdk_region_new (); | ||
| 84 | + for (i = 0; i < n_ranges; ++i) | ||
| 85 | + { | ||
| 86 | + GdkRectangle rect; | ||
| 87 | + | ||
| 88 | + rect.x = inner_border.left - entry->scroll_offset + ranges[2 * i]; | ||
| 89 | + rect.y = y; | ||
| 90 | + rect.width = ranges[2 * i + 1]; | ||
| 91 | + rect.height = logical_rect.height; | ||
| 92 | + | ||
| 93 | + gdk_draw_rectangle (entry->text_area, selection_gc, TRUE, | ||
| 94 | + rect.x, rect.y, rect.width, rect.height); | ||
| 95 | + | ||
| 96 | + gdk_region_union_with_rect (clip_region, &rect); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + gdk_gc_set_clip_region (text_gc, clip_region); | ||
| 100 | + gdk_draw_layout (entry->text_area, text_gc, | ||
| 101 | + x, y, | ||
| 102 | + layout); | ||
| 103 | + gdk_gc_set_clip_region (text_gc, NULL); | ||
| 104 | + gdk_region_destroy (clip_region); | ||
| 105 | +#endif | ||
| 106 | g_free (ranges); | ||
| 107 | } | ||
| 108 | - | ||
| 109 | +#ifdef USE_CAIRO_INTERNALLY | ||
| 110 | cairo_destroy (cr); | ||
| 111 | +#endif | ||
| 112 | } | ||
| 113 | } | ||
| 114 | |||
diff --git a/openembedded/packages/gtk+/gtk+-2.10.0/gtk+-handhelds.patch b/openembedded/packages/gtk+/gtk+-2.10.0/gtk+-handhelds.patch new file mode 100644 index 0000000000..4b97373f32 --- /dev/null +++ b/openembedded/packages/gtk+/gtk+-2.10.0/gtk+-handhelds.patch | |||
| @@ -0,0 +1,264 @@ | |||
| 1 | --- gtk+-2.8.6/gtk/gtkrange.c.orig 2005-12-07 21:13:33 +0100 | ||
| 2 | +++ gtk+-2.8.6/gtk/gtkrange.c 2005-12-07 21:21:12 +0100 | ||
| 3 | @@ -186,6 +186,7 @@ | ||
| 4 | static GtkWidgetClass *parent_class = NULL; | ||
| 5 | static guint signals[LAST_SIGNAL]; | ||
| 6 | |||
| 7 | +static GdkAtom recognize_protocols_atom, atom_atom; | ||
| 8 | |||
| 9 | GType | ||
| 10 | gtk_range_get_type (void) | ||
| 11 | @@ -226,6 +227,9 @@ | ||
| 12 | object_class = (GtkObjectClass*) class; | ||
| 13 | widget_class = (GtkWidgetClass*) class; | ||
| 14 | |||
| 15 | + recognize_protocols_atom = gdk_atom_intern ("RECOGNIZE_PROTOCOLS", FALSE); | ||
| 16 | + atom_atom = gdk_atom_intern ("ATOM", FALSE); | ||
| 17 | + | ||
| 18 | parent_class = g_type_class_peek_parent (class); | ||
| 19 | |||
| 20 | gobject_class->set_property = gtk_range_set_property; | ||
| 21 | @@ -860,6 +864,12 @@ | ||
| 22 | &attributes, attributes_mask); | ||
| 23 | gdk_window_set_user_data (range->event_window, range); | ||
| 24 | |||
| 25 | + gdk_property_change (range->event_window, | ||
| 26 | + recognize_protocols_atom, | ||
| 27 | + atom_atom, | ||
| 28 | + 32, GDK_PROP_MODE_REPLACE, | ||
| 29 | + NULL, 0); | ||
| 30 | + | ||
| 31 | widget->style = gtk_style_attach (widget->style, widget->window); | ||
| 32 | } | ||
| 33 | |||
| 34 | @@ -1229,7 +1239,7 @@ | ||
| 35 | |||
| 36 | /* ignore presses when we're already doing something else. */ | ||
| 37 | if (range->layout->grab_location != MOUSE_OUTSIDE) | ||
| 38 | - return FALSE; | ||
| 39 | + return TRUE; | ||
| 40 | |||
| 41 | range->layout->mouse_x = event->x; | ||
| 42 | range->layout->mouse_y = event->y; | ||
| 43 | @@ -1429,7 +1439,7 @@ | ||
| 44 | return TRUE; | ||
| 45 | } | ||
| 46 | |||
| 47 | - return FALSE; | ||
| 48 | + return TRUE; | ||
| 49 | } | ||
| 50 | |||
| 51 | /** | ||
| 52 | --- gtk+-2.8.6/gtk/gtkentry.c.orig 2005-09-02 21:51:06 +0200 | ||
| 53 | +++ gtk+-2.8.6/gtk/gtkentry.c 2005-12-07 21:21:12 +0100 | ||
| 54 | @@ -597,6 +597,15 @@ | ||
| 55 | 0.0, | ||
| 56 | GTK_PARAM_READWRITE)); | ||
| 57 | |||
| 58 | + gtk_widget_class_install_style_property (widget_class, | ||
| 59 | + g_param_spec_int ("min_width", | ||
| 60 | + _("Minimum width"), | ||
| 61 | + _("Minimum width of the entry field"), | ||
| 62 | + 0, | ||
| 63 | + G_MAXINT, | ||
| 64 | + MIN_ENTRY_WIDTH, | ||
| 65 | + G_PARAM_READABLE)); | ||
| 66 | + | ||
| 67 | signals[POPULATE_POPUP] = | ||
| 68 | g_signal_new ("populate_popup", | ||
| 69 | G_OBJECT_CLASS_TYPE (gobject_class), | ||
| 70 | @@ -1227,7 +1236,7 @@ | ||
| 71 | { | ||
| 72 | GtkEntry *entry = GTK_ENTRY (widget); | ||
| 73 | PangoFontMetrics *metrics; | ||
| 74 | - gint xborder, yborder; | ||
| 75 | + gint xborder, yborder, min_width; | ||
| 76 | PangoContext *context; | ||
| 77 | |||
| 78 | gtk_widget_ensure_style (widget); | ||
| 79 | @@ -1243,9 +1252,11 @@ | ||
| 80 | |||
| 81 | xborder += INNER_BORDER; | ||
| 82 | yborder += INNER_BORDER; | ||
| 83 | - | ||
| 84 | + | ||
| 85 | + gtk_widget_style_get (widget, "min_width", &min_width, NULL); | ||
| 86 | + | ||
| 87 | if (entry->width_chars < 0) | ||
| 88 | - requisition->width = MIN_ENTRY_WIDTH + xborder * 2; | ||
| 89 | + requisition->width = min_width + xborder * 2; | ||
| 90 | else | ||
| 91 | { | ||
| 92 | gint char_width = pango_font_metrics_get_approximate_char_width (metrics); | ||
| 93 | --- gtk+-2.8.6/gtk/gtkarrow.c.orig 2005-06-21 17:38:39 +0200 | ||
| 94 | +++ gtk+-2.8.6/gtk/gtkarrow.c 2005-12-07 21:21:12 +0100 | ||
| 95 | @@ -31,7 +31,7 @@ | ||
| 96 | #include "gtkintl.h" | ||
| 97 | #include "gtkalias.h" | ||
| 98 | |||
| 99 | -#define MIN_ARROW_SIZE 15 | ||
| 100 | +#define MIN_ARROW_SIZE 7 | ||
| 101 | |||
| 102 | enum { | ||
| 103 | PROP_0, | ||
| 104 | @@ -55,6 +55,8 @@ | ||
| 105 | guint prop_id, | ||
| 106 | GValue *value, | ||
| 107 | GParamSpec *pspec); | ||
| 108 | +static void gtk_arrow_size_request (GtkWidget *arrow, | ||
| 109 | + GtkRequisition *requisition); | ||
| 110 | |||
| 111 | GType | ||
| 112 | gtk_arrow_get_type (void) | ||
| 113 | @@ -113,6 +115,7 @@ | ||
| 114 | GTK_PARAM_READWRITE)); | ||
| 115 | |||
| 116 | widget_class->expose_event = gtk_arrow_expose; | ||
| 117 | + widget_class->size_request = gtk_arrow_size_request; | ||
| 118 | } | ||
| 119 | |||
| 120 | static void | ||
| 121 | @@ -168,13 +171,18 @@ | ||
| 122 | } | ||
| 123 | |||
| 124 | static void | ||
| 125 | +gtk_arrow_size_request (GtkWidget *arrow, | ||
| 126 | + GtkRequisition *requisition) | ||
| 127 | +{ | ||
| 128 | + requisition->width = MIN_ARROW_SIZE + GTK_MISC (arrow)->xpad * 2; | ||
| 129 | + requisition->height = MIN_ARROW_SIZE + GTK_MISC (arrow)->ypad * 2; | ||
| 130 | +} | ||
| 131 | + | ||
| 132 | +static void | ||
| 133 | gtk_arrow_init (GtkArrow *arrow) | ||
| 134 | { | ||
| 135 | GTK_WIDGET_SET_FLAGS (arrow, GTK_NO_WINDOW); | ||
| 136 | |||
| 137 | - GTK_WIDGET (arrow)->requisition.width = MIN_ARROW_SIZE + GTK_MISC (arrow)->xpad * 2; | ||
| 138 | - GTK_WIDGET (arrow)->requisition.height = MIN_ARROW_SIZE + GTK_MISC (arrow)->ypad * 2; | ||
| 139 | - | ||
| 140 | arrow->arrow_type = GTK_ARROW_RIGHT; | ||
| 141 | arrow->shadow_type = GTK_SHADOW_OUT; | ||
| 142 | } | ||
| 143 | --- gtk+-2.8.6/gtk/gtkcalendar.c.orig 2005-12-07 21:36:14 +0100 | ||
| 144 | +++ gtk+-2.8.6/gtk/gtkcalendar.c 2005-12-07 21:49:21 +0100 | ||
| 145 | @@ -692,6 +692,35 @@ | ||
| 146 | ****************************************/ | ||
| 147 | |||
| 148 | static void | ||
| 149 | +calendar_select_day (GtkCalendar *calendar, guint day) | ||
| 150 | +{ | ||
| 151 | + g_return_if_fail (GTK_IS_CALENDAR (calendar)); | ||
| 152 | + g_return_if_fail (day <= 31); | ||
| 153 | + | ||
| 154 | + /* Deselect the old day */ | ||
| 155 | + if (calendar->selected_day > 0) | ||
| 156 | + { | ||
| 157 | + gint selected_day; | ||
| 158 | + | ||
| 159 | + selected_day = calendar->selected_day; | ||
| 160 | + calendar->selected_day = 0; | ||
| 161 | + if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (calendar))) | ||
| 162 | + calendar_invalidate_day_num (calendar, selected_day); | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + calendar->selected_day = day; | ||
| 166 | + | ||
| 167 | + /* Select the new day */ | ||
| 168 | + if (day != 0) | ||
| 169 | + { | ||
| 170 | + if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (calendar))) | ||
| 171 | + calendar_invalidate_day_num (calendar, day); | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + g_object_notify (G_OBJECT (calendar), "day"); | ||
| 175 | +} | ||
| 176 | + | ||
| 177 | +static void | ||
| 178 | calendar_set_month_next (GtkCalendar *calendar) | ||
| 179 | { | ||
| 180 | gint month_len; | ||
| 181 | @@ -723,10 +752,10 @@ | ||
| 182 | if (month_len < calendar->selected_day) | ||
| 183 | { | ||
| 184 | calendar->selected_day = 0; | ||
| 185 | - gtk_calendar_select_day (calendar, month_len); | ||
| 186 | + calendar_select_day (calendar, month_len); | ||
| 187 | } | ||
| 188 | else | ||
| 189 | - gtk_calendar_select_day (calendar, calendar->selected_day); | ||
| 190 | + calendar_select_day (calendar, calendar->selected_day); | ||
| 191 | |||
| 192 | gtk_widget_queue_draw (GTK_WIDGET (calendar)); | ||
| 193 | } | ||
| 194 | @@ -752,10 +781,10 @@ | ||
| 195 | if (month_len < calendar->selected_day) | ||
| 196 | { | ||
| 197 | calendar->selected_day = 0; | ||
| 198 | - gtk_calendar_select_day (calendar, month_len); | ||
| 199 | + calendar_select_day (calendar, month_len); | ||
| 200 | } | ||
| 201 | else | ||
| 202 | - gtk_calendar_select_day (calendar, calendar->selected_day); | ||
| 203 | + calendar_select_day (calendar, calendar->selected_day); | ||
| 204 | |||
| 205 | gtk_widget_queue_draw (GTK_WIDGET (calendar)); | ||
| 206 | } | ||
| 207 | @@ -784,10 +813,10 @@ | ||
| 208 | if (month_len < calendar->selected_day) | ||
| 209 | { | ||
| 210 | calendar->selected_day = 0; | ||
| 211 | - gtk_calendar_select_day (calendar, month_len); | ||
| 212 | + calendar_select_day (calendar, month_len); | ||
| 213 | } | ||
| 214 | else | ||
| 215 | - gtk_calendar_select_day (calendar, calendar->selected_day); | ||
| 216 | + calendar_select_day (calendar, calendar->selected_day); | ||
| 217 | |||
| 218 | gtk_widget_queue_draw (GTK_WIDGET (calendar)); | ||
| 219 | } | ||
| 220 | @@ -1088,13 +1117,13 @@ | ||
| 221 | if (month_len < calendar->selected_day) | ||
| 222 | { | ||
| 223 | calendar->selected_day = 0; | ||
| 224 | - gtk_calendar_select_day (calendar, month_len); | ||
| 225 | + calendar_select_day (calendar, month_len); | ||
| 226 | } | ||
| 227 | else | ||
| 228 | { | ||
| 229 | if (calendar->selected_day < 0) | ||
| 230 | calendar->selected_day = calendar->selected_day + 1 + month_length[leap (calendar->year)][calendar->month + 1]; | ||
| 231 | - gtk_calendar_select_day (calendar, calendar->selected_day); | ||
| 232 | + calendar_select_day (calendar, calendar->selected_day); | ||
| 233 | } | ||
| 234 | |||
| 235 | gtk_widget_queue_draw (GTK_WIDGET (calendar)); | ||
| 236 | @@ -3285,27 +3314,7 @@ | ||
| 237 | g_return_if_fail (GTK_IS_CALENDAR (calendar)); | ||
| 238 | g_return_if_fail (day <= 31); | ||
| 239 | |||
| 240 | - /* Deselect the old day */ | ||
| 241 | - if (calendar->selected_day > 0) | ||
| 242 | - { | ||
| 243 | - gint selected_day; | ||
| 244 | - | ||
| 245 | - selected_day = calendar->selected_day; | ||
| 246 | - calendar->selected_day = 0; | ||
| 247 | - if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (calendar))) | ||
| 248 | - calendar_invalidate_day_num (calendar, selected_day); | ||
| 249 | - } | ||
| 250 | - | ||
| 251 | - calendar->selected_day = day; | ||
| 252 | - | ||
| 253 | - /* Select the new day */ | ||
| 254 | - if (day != 0) | ||
| 255 | - { | ||
| 256 | - if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (calendar))) | ||
| 257 | - calendar_invalidate_day_num (calendar, day); | ||
| 258 | - } | ||
| 259 | - | ||
| 260 | - g_object_notify (G_OBJECT (calendar), "day"); | ||
| 261 | + calendar_select_day (calendar, day); | ||
| 262 | |||
| 263 | g_signal_emit (calendar, | ||
| 264 | gtk_calendar_signals[DAY_SELECTED_SIGNAL], | ||
diff --git a/openembedded/packages/gtk+/gtk+-2.10.0/gtklabel-resize-patch b/openembedded/packages/gtk+/gtk+-2.10.0/gtklabel-resize-patch new file mode 100644 index 0000000000..df29656343 --- /dev/null +++ b/openembedded/packages/gtk+/gtk+-2.10.0/gtklabel-resize-patch | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | --- gtk+-2.4.3/gtk/gtklabel.c~ 2004-06-11 13:50:34.000000000 +0100 | ||
| 2 | +++ gtk+-2.4.3/gtk/gtklabel.c 2004-07-05 13:33:57.000000000 +0100 | ||
| 3 | @@ -1623,6 +1623,7 @@ | ||
| 4 | |||
| 5 | /* We have to clear the layout, fonts etc. may have changed */ | ||
| 6 | gtk_label_clear_layout (label); | ||
| 7 | + gtk_widget_queue_resize (GTK_WIDGET (label)); | ||
| 8 | } | ||
| 9 | |||
| 10 | static void | ||
diff --git a/openembedded/packages/gtk+/gtk+-2.10.0/gtktreeview-316689.patch b/openembedded/packages/gtk+/gtk+-2.10.0/gtktreeview-316689.patch new file mode 100644 index 0000000000..4e77ddf9f9 --- /dev/null +++ b/openembedded/packages/gtk+/gtk+-2.10.0/gtktreeview-316689.patch | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | diff -u -p -r1.498 gtktreeview.c | ||
| 2 | --- gtk+-2.8.9/gtk/gtktreeview.c 22 Oct 2005 21:08:23 -0000 1.498 | ||
| 3 | +++ gtk+-2.8.9/gtk/gtktreeview.c 24 Oct 2005 22:30:27 -0000 | ||
| 4 | @@ -2098,6 +2098,9 @@ gtk_tree_view_size_allocate (GtkWidget | ||
| 5 | /* now the adjustments and window sizes are in sync, we can sync toprow/dy again */ | ||
| 6 | if (tree_view->priv->height <= tree_view->priv->vadjustment->page_size) | ||
| 7 | gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->vadjustment), 0); | ||
| 8 | + else if (tree_view->priv->vadjustment->value + tree_view->priv->vadjustment->page_size > tree_view->priv->height) | ||
| 9 | + gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->vadjustment), | ||
| 10 | + tree_view->priv->height - tree_view->priv->vadjustment->page_size); | ||
| 11 | else if (gtk_tree_row_reference_valid (tree_view->priv->top_row)) | ||
| 12 | gtk_tree_view_top_row_to_dy (tree_view); | ||
| 13 | else | ||
| 14 | @ -5031,6 +5034,11 @@ validate_visible_area (GtkTreeView *tree | ||
| 15 | * else than zero. we update top_row to be in sync with dy = 0. | ||
| 16 | */ | ||
| 17 | gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->vadjustment), 0); | ||
| 18 | + gtk_tree_view_dy_to_top_row (tree_view); | ||
| 19 | + } | ||
| 20 | + else if (tree_view->priv->vadjustment->value + tree_view->priv->vadjustment->page_size > tree_view->priv->height) | ||
| 21 | + { | ||
| 22 | + gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->vadjustment), tree_view->priv->height - tree_view->priv->vadjustment->page_size); | ||
| 23 | gtk_tree_view_dy_to_top_row (tree_view); | ||
| 24 | } | ||
| 25 | else | ||
diff --git a/openembedded/packages/gtk+/gtk+-2.10.0/hardcoded_libtool.patch b/openembedded/packages/gtk+/gtk+-2.10.0/hardcoded_libtool.patch new file mode 100644 index 0000000000..b2afddcc61 --- /dev/null +++ b/openembedded/packages/gtk+/gtk+-2.10.0/hardcoded_libtool.patch | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | --- gtk+-2.6.0/configure.in.old 2005-01-01 16:23:45.000000000 +0000 | ||
| 2 | +++ gtk+-2.6.0/configure.in 2005-01-01 16:24:03.000000000 +0000 | ||
| 3 | @@ -360,7 +360,7 @@ | ||
| 4 | AC_MSG_CHECKING([Whether to write dependencies into .pc files]) | ||
| 5 | case $enable_explicit_deps in | ||
| 6 | auto) | ||
| 7 | - deplib_check_method=`(./libtool --config; echo eval echo \\$deplib_check_method) | sh` | ||
| 8 | + deplib_check_method=`($host_alias-libtool --config; echo eval echo \\$deplib_check_method) | sh` | ||
| 9 | if test "X$deplib_check_method" = Xnone || test "x$enable_static" = xyes ; then | ||
| 10 | enable_explicit_deps=yes | ||
| 11 | else | ||
| 12 | @@ -688,7 +688,7 @@ | ||
| 13 | dnl Now we check to see if our libtool supports shared lib deps | ||
| 14 | dnl (in a rather ugly way even) | ||
| 15 | if $dynworks; then | ||
| 16 | - pixbuf_libtool_config="${CONFIG_SHELL-/bin/sh} ./libtool --config" | ||
| 17 | + pixbuf_libtool_config="${CONFIG_SHELL-/bin/sh} $host_alias-libtool --config" | ||
| 18 | pixbuf_deplibs_check=`$pixbuf_libtool_config | \ | ||
| 19 | grep '^[[a-z_]]*check[[a-z_]]*_method=[['\''"]]' | \ | ||
| 20 | sed 's/.*[['\''"]]\(.*\)[['\''"]]$/\1/'` | ||
| 21 | @@ -1512,7 +1512,7 @@ | ||
| 22 | # | ||
| 23 | # We are using gmodule-no-export now, but I'm leaving the stripping | ||
| 24 | # code in place for now, since pango and atk still require gmodule. | ||
| 25 | -export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh` | ||
| 26 | +export_dynamic=`($host_alias-libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh` | ||
| 27 | if test -n "$export_dynamic"; then | ||
| 28 | GDK_PIXBUF_DEP_LIBS=`echo $GDK_PIXBUF_DEP_LIBS | sed -e "s/$export_dynamic//"` | ||
| 29 | GDK_PIXBUF_XLIB_DEP_LIBS=`echo $GDK_PIXBUF_XLIB_DEP_LIBS | sed -e "s/$export_dynamic//"` | ||
diff --git a/openembedded/packages/gtk+/gtk+-2.10.0/menu-deactivate.patch b/openembedded/packages/gtk+/gtk+-2.10.0/menu-deactivate.patch new file mode 100644 index 0000000000..29e665fbf3 --- /dev/null +++ b/openembedded/packages/gtk+/gtk+-2.10.0/menu-deactivate.patch | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | --- gtk+-2.4.4/gtk/gtkmenushell.c.old Thu Aug 26 23:45:28 2004 | ||
| 2 | +++ gtk+-2.4.4/gtk/gtkmenushell.c Fri Aug 27 00:13:33 2004 | ||
| 3 | @@ -37,7 +37,7 @@ | ||
| 4 | #include "gtktearoffmenuitem.h" | ||
| 5 | #include "gtkwindow.h" | ||
| 6 | |||
| 7 | -#define MENU_SHELL_TIMEOUT 500 | ||
| 8 | +#define MENU_SHELL_TIMEOUT 2000 | ||
| 9 | |||
| 10 | enum { | ||
| 11 | DEACTIVATE, | ||
| 12 | @@ -156,6 +156,7 @@ | ||
| 13 | static GtkContainerClass *parent_class = NULL; | ||
| 14 | static guint menu_shell_signals[LAST_SIGNAL] = { 0 }; | ||
| 15 | |||
| 16 | +static int last_crossing_time; | ||
| 17 | |||
| 18 | GType | ||
| 19 | gtk_menu_shell_get_type (void) | ||
| 20 | @@ -418,6 +419,7 @@ | ||
| 21 | gtk_grab_add (GTK_WIDGET (menu_shell)); | ||
| 22 | menu_shell->have_grab = TRUE; | ||
| 23 | menu_shell->active = TRUE; | ||
| 24 | + last_crossing_time = 0; | ||
| 25 | } | ||
| 26 | } | ||
| 27 | |||
| 28 | @@ -545,6 +547,13 @@ | ||
| 29 | menu_shell->activate_time = 0; | ||
| 30 | deactivate = FALSE; | ||
| 31 | } | ||
| 32 | + | ||
| 33 | + if (last_crossing_time != 0 | ||
| 34 | + && ((event->time - last_crossing_time) < 500)) | ||
| 35 | + { | ||
| 36 | + last_crossing_time = 0; | ||
| 37 | + deactivate = FALSE; | ||
| 38 | + } | ||
| 39 | |||
| 40 | if (deactivate) | ||
| 41 | { | ||
| 42 | @@ -597,6 +606,8 @@ | ||
| 43 | if (menu_shell->active) | ||
| 44 | { | ||
| 45 | menu_item = gtk_get_event_widget ((GdkEvent*) event); | ||
| 46 | + | ||
| 47 | + last_crossing_time = event->time; | ||
| 48 | |||
| 49 | if (!menu_item || | ||
| 50 | (GTK_IS_MENU_ITEM (menu_item) && | ||
diff --git a/openembedded/packages/gtk+/gtk+-2.10.0/no-demos.patch b/openembedded/packages/gtk+/gtk+-2.10.0/no-demos.patch new file mode 100644 index 0000000000..0145067ad5 --- /dev/null +++ b/openembedded/packages/gtk+/gtk+-2.10.0/no-demos.patch | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | --- gtk+-2.8.6/Makefile.am.orig 2005-12-07 21:30:56 +0100 | ||
| 2 | +++ gtk+-2.8.6/Makefile.am 2005-12-07 21:31:10 +0100 | ||
| 3 | @@ -1,6 +1,6 @@ | ||
| 4 | ## Makefile.am for GTK+ | ||
| 5 | |||
| 6 | -SRC_SUBDIRS = gdk-pixbuf gdk gtk modules demos tests perf contrib | ||
| 7 | +SRC_SUBDIRS = gdk-pixbuf gdk gtk modules tests perf contrib | ||
| 8 | SUBDIRS = po po-properties $(SRC_SUBDIRS) docs m4macros | ||
| 9 | |||
| 10 | # require automake 1.4 | ||
diff --git a/openembedded/packages/gtk+/gtk+-2.10.0/no-xwc.patch b/openembedded/packages/gtk+/gtk+-2.10.0/no-xwc.patch new file mode 100644 index 0000000000..318b150359 --- /dev/null +++ b/openembedded/packages/gtk+/gtk+-2.10.0/no-xwc.patch | |||
| @@ -0,0 +1,179 @@ | |||
| 1 | Index: configure.in | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvs/gnome/gtk+/configure.in,v | ||
| 4 | retrieving revision 1.469.2.22 | ||
| 5 | diff -u -r1.469.2.22 configure.in | ||
| 6 | --- gtk/configure.in 16 Mar 2006 16:39:45 -0000 1.469.2.22 | ||
| 7 | +++ gtk/configure.in 20 Mar 2006 12:07:11 -0000 | ||
| 8 | @@ -1115,6 +1115,8 @@ | ||
| 9 | |||
| 10 | AC_CHECK_FUNCS(XConvertCase XInternAtoms) | ||
| 11 | |||
| 12 | + AC_CHECK_FUNCS(XmbDrawString) | ||
| 13 | + | ||
| 14 | # Generic X11R6 check needed for XIM support; we could | ||
| 15 | # probably use this to replace the above, but we'll | ||
| 16 | # leave the separate checks for XConvertCase and XInternAtoms | ||
| 17 | Index: gdk/x11/gdkdrawable-x11.c | ||
| 18 | =================================================================== | ||
| 19 | RCS file: /cvs/gnome/gtk+/gdk/x11/gdkdrawable-x11.c,v | ||
| 20 | retrieving revision 1.58 | ||
| 21 | diff -u -r1.58 gdkdrawable-x11.c | ||
| 22 | --- gtk/gdk/x11/gdkdrawable-x11.c 15 Aug 2005 19:04:54 -0000 1.58 | ||
| 23 | +++ gtk/gdk/x11/gdkdrawable-x11.c 20 Mar 2006 12:07:12 -0000 | ||
| 24 | @@ -579,12 +579,14 @@ | ||
| 25 | GDK_GC_GET_XGC (gc), x, y, (XChar2b *) text, text_length / 2); | ||
| 26 | } | ||
| 27 | } | ||
| 28 | +#ifdef HAVE_XMBDRAWSTRING | ||
| 29 | else if (font->type == GDK_FONT_FONTSET) | ||
| 30 | { | ||
| 31 | XFontSet fontset = (XFontSet) GDK_FONT_XFONT (font); | ||
| 32 | XmbDrawString (xdisplay, impl->xid, | ||
| 33 | fontset, GDK_GC_GET_XGC (gc), x, y, text, text_length); | ||
| 34 | } | ||
| 35 | +#endif | ||
| 36 | else | ||
| 37 | g_error("undefined font type\n"); | ||
| 38 | } | ||
| 39 | @@ -616,6 +618,7 @@ | ||
| 40 | GDK_GC_GET_XGC (gc), x, y, text_8bit, text_length); | ||
| 41 | g_free (text_8bit); | ||
| 42 | } | ||
| 43 | +#ifdef HAVE_XMBDRAWSTRING | ||
| 44 | else if (font->type == GDK_FONT_FONTSET) | ||
| 45 | { | ||
| 46 | if (sizeof(GdkWChar) == sizeof(wchar_t)) | ||
| 47 | @@ -636,6 +639,7 @@ | ||
| 48 | g_free (text_wchar); | ||
| 49 | } | ||
| 50 | } | ||
| 51 | +#endif | ||
| 52 | else | ||
| 53 | g_error("undefined font type\n"); | ||
| 54 | } | ||
| 55 | Index: gdk/x11/gdkfont-x11.c | ||
| 56 | =================================================================== | ||
| 57 | RCS file: /cvs/gnome/gtk+/gdk/x11/gdkfont-x11.c,v | ||
| 58 | retrieving revision 1.48.2.1 | ||
| 59 | diff -u -r1.48.2.1 gdkfont-x11.c | ||
| 60 | --- gtk/gdk/x11/gdkfont-x11.c 20 Jan 2006 04:39:43 -0000 1.48.2.1 | ||
| 61 | +++ gtk/gdk/x11/gdkfont-x11.c 20 Mar 2006 12:07:12 -0000 | ||
| 62 | @@ -527,10 +527,12 @@ | ||
| 63 | width = XTextWidth16 (xfont, (XChar2b *) text, text_length / 2); | ||
| 64 | } | ||
| 65 | break; | ||
| 66 | +#ifdef HAVE_XMBDRAWSTRING | ||
| 67 | case GDK_FONT_FONTSET: | ||
| 68 | fontset = (XFontSet) private->xfont; | ||
| 69 | width = XmbTextEscapement (fontset, text, text_length); | ||
| 70 | break; | ||
| 71 | +#endif | ||
| 72 | default: | ||
| 73 | width = 0; | ||
| 74 | } | ||
| 75 | @@ -580,6 +582,7 @@ | ||
| 76 | width = 0; | ||
| 77 | } | ||
| 78 | break; | ||
| 79 | +#ifdef HAVE_XMBDRAWSTRING | ||
| 80 | case GDK_FONT_FONTSET: | ||
| 81 | if (sizeof(GdkWChar) == sizeof(wchar_t)) | ||
| 82 | { | ||
| 83 | @@ -597,6 +600,7 @@ | ||
| 84 | g_free (text_wchar); | ||
| 85 | } | ||
| 86 | break; | ||
| 87 | +#endif | ||
| 88 | default: | ||
| 89 | width = 0; | ||
| 90 | } | ||
| 91 | @@ -669,6 +673,7 @@ | ||
| 92 | if (descent) | ||
| 93 | *descent = overall.descent; | ||
| 94 | break; | ||
| 95 | +#ifdef HAVE_XMBDRAWSTRING | ||
| 96 | case GDK_FONT_FONTSET: | ||
| 97 | fontset = (XFontSet) private->xfont; | ||
| 98 | XmbTextExtents (fontset, text, text_length, &ink, &logical); | ||
| 99 | @@ -683,6 +688,7 @@ | ||
| 100 | if (descent) | ||
| 101 | *descent = ink.y + ink.height; | ||
| 102 | break; | ||
| 103 | +#endif | ||
| 104 | } | ||
| 105 | |||
| 106 | } | ||
| 107 | @@ -755,6 +761,7 @@ | ||
| 108 | *descent = overall.descent; | ||
| 109 | break; | ||
| 110 | } | ||
| 111 | +#ifdef HAVE_XMBDRAWSTRING | ||
| 112 | case GDK_FONT_FONTSET: | ||
| 113 | fontset = (XFontSet) private->xfont; | ||
| 114 | |||
| 115 | @@ -782,6 +789,7 @@ | ||
| 116 | if (descent) | ||
| 117 | *descent = ink.y + ink.height; | ||
| 118 | break; | ||
| 119 | +#endif | ||
| 120 | } | ||
| 121 | |||
| 122 | } | ||
| 123 | Index: gdk/x11/gdkim-x11.c | ||
| 124 | =================================================================== | ||
| 125 | RCS file: /cvs/gnome/gtk+/gdk/x11/gdkim-x11.c,v | ||
| 126 | retrieving revision 1.38 | ||
| 127 | diff -u -r1.38 gdkim-x11.c | ||
| 128 | --- gtk/gdk/x11/gdkim-x11.c 16 Mar 2005 03:17:27 -0000 1.38 | ||
| 129 | +++ gtk/gdk/x11/gdkim-x11.c 20 Mar 2006 12:07:12 -0000 | ||
| 130 | @@ -48,6 +48,7 @@ | ||
| 131 | void | ||
| 132 | _gdk_x11_initialize_locale (void) | ||
| 133 | { | ||
| 134 | +#ifdef HAVE_XMBDRAWSTRING | ||
| 135 | wchar_t result; | ||
| 136 | gchar *current_locale; | ||
| 137 | static char *last_locale = NULL; | ||
| 138 | @@ -93,7 +94,8 @@ | ||
| 139 | GDK_NOTE (XIM, | ||
| 140 | g_message ("%s multi-byte string functions.", | ||
| 141 | gdk_use_mb ? "Using" : "Not using")); | ||
| 142 | - | ||
| 143 | +#endif | ||
| 144 | + | ||
| 145 | return; | ||
| 146 | } | ||
| 147 | |||
| 148 | @@ -136,6 +138,7 @@ | ||
| 149 | { | ||
| 150 | gchar *mbstr; | ||
| 151 | |||
| 152 | +#ifdef HAVE_XMBDRAWSTRING | ||
| 153 | if (gdk_use_mb) | ||
| 154 | { | ||
| 155 | GdkDisplay *display = find_a_display (); | ||
| 156 | @@ -178,6 +181,7 @@ | ||
| 157 | XFree (tpr.value); | ||
| 158 | } | ||
| 159 | else | ||
| 160 | +#endif | ||
| 161 | { | ||
| 162 | gint length = 0; | ||
| 163 | gint i; | ||
| 164 | @@ -210,6 +214,7 @@ | ||
| 165 | gint | ||
| 166 | gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max) | ||
| 167 | { | ||
| 168 | +#ifdef HAVE_XMBDRAWSTRING | ||
| 169 | if (gdk_use_mb) | ||
| 170 | { | ||
| 171 | GdkDisplay *display = find_a_display (); | ||
| 172 | @@ -242,6 +247,7 @@ | ||
| 173 | return len_cpy; | ||
| 174 | } | ||
| 175 | else | ||
| 176 | +#endif | ||
| 177 | { | ||
| 178 | gint i; | ||
| 179 | |||
diff --git a/openembedded/packages/gtk+/gtk+-2.10.0/scroll-timings.patch b/openembedded/packages/gtk+/gtk+-2.10.0/scroll-timings.patch new file mode 100644 index 0000000000..a38b21dcc2 --- /dev/null +++ b/openembedded/packages/gtk+/gtk+-2.10.0/scroll-timings.patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | --- gtk+-2.4.4/gtk/gtkrange.c~ 2004-08-23 01:50:22.000000000 +0100 | ||
| 2 | +++ gtk+-2.4.4/gtk/gtkrange.c 2004-08-27 15:48:49.000000000 +0100 | ||
| 3 | @@ -35,9 +35,9 @@ | ||
| 4 | #include "gtkintl.h" | ||
| 5 | #include "gtkscrollbar.h" | ||
| 6 | |||
| 7 | -#define SCROLL_INITIAL_DELAY 250 /* must hold button this long before ... */ | ||
| 8 | -#define SCROLL_LATER_DELAY 100 /* ... it starts repeating at this rate */ | ||
| 9 | -#define UPDATE_DELAY 300 /* Delay for queued update */ | ||
| 10 | +#define SCROLL_INITIAL_DELAY 500 /* must hold button this long before ... */ | ||
| 11 | +#define SCROLL_LATER_DELAY 200 /* ... it starts repeating at this rate */ | ||
| 12 | +#define UPDATE_DELAY 1000 /* Delay for queued update */ | ||
| 13 | |||
| 14 | enum { | ||
| 15 | PROP_0, | ||
diff --git a/openembedded/packages/gtk+/gtk+-2.10.0/single-click.patch b/openembedded/packages/gtk+/gtk+-2.10.0/single-click.patch new file mode 100644 index 0000000000..1bf0db12a8 --- /dev/null +++ b/openembedded/packages/gtk+/gtk+-2.10.0/single-click.patch | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | --- gtk+-2.8.6/gtk/gtkfilesel.c.orig 2005-12-07 21:13:33 +0100 | ||
| 2 | +++ gtk+-2.8.6/gtk/gtkfilesel.c 2005-12-07 21:14:56 +0100 | ||
| 3 | @@ -2461,6 +2461,33 @@ | ||
| 4 | if (fs->last_selected != NULL) | ||
| 5 | g_free (fs->last_selected); | ||
| 6 | |||
| 7 | + // Single-click directory entry | ||
| 8 | + if (new_names->len == 1) | ||
| 9 | + { | ||
| 10 | + GtkTreeView *tree_view; | ||
| 11 | + GtkTreeModel *model; | ||
| 12 | + GtkTreePath *path; | ||
| 13 | + GtkTreeIter iter; | ||
| 14 | + gboolean is_file; | ||
| 15 | + | ||
| 16 | + tree_view = gtk_tree_selection_get_tree_view (selection); | ||
| 17 | + | ||
| 18 | + if (gtk_tree_selection_get_selected (selection, &model, &iter)) | ||
| 19 | + { | ||
| 20 | + path = gtk_tree_model_get_path (model, &iter); | ||
| 21 | + gtk_tree_model_get (model, &iter, ISFILE_COLUMN, &is_file, -1); | ||
| 22 | + | ||
| 23 | + if (!is_file) | ||
| 24 | + { | ||
| 25 | + gtk_file_selection_dir_activate (tree_view, path, | ||
| 26 | + gtk_tree_view_get_column (tree_view, DIR_COLUMN), | ||
| 27 | + user_data); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + gtk_tree_path_free (path); | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | fs->last_selected = g_strdup (g_ptr_array_index (new_names, index)); | ||
| 35 | filename = get_real_filename (fs->last_selected, FALSE); | ||
| 36 | |||
diff --git a/openembedded/packages/gtk+/gtk+-2.10.0/small-gtkfilesel.patch b/openembedded/packages/gtk+/gtk+-2.10.0/small-gtkfilesel.patch new file mode 100644 index 0000000000..20bf4cf366 --- /dev/null +++ b/openembedded/packages/gtk+/gtk+-2.10.0/small-gtkfilesel.patch | |||
| @@ -0,0 +1,267 @@ | |||
| 1 | diff -urNd ../gtk+-2.4.4-r5/gtk+-2.4.4/gtk/gtkfilesel.c gtk+-2.4.4/gtk/gtkfilesel.c | ||
| 2 | --- ../gtk+-2.4.4-r5/gtk+-2.4.4/gtk/gtkfilesel.c 2004-07-10 05:02:10.000000000 +0100 | ||
| 3 | +++ gtk+-2.4.4/gtk/gtkfilesel.c 2004-09-13 13:40:09.000000000 +0100 | ||
| 4 | @@ -68,6 +68,7 @@ | ||
| 5 | #include "gtkprivate.h" | ||
| 6 | #include "gtkscrolledwindow.h" | ||
| 7 | #include "gtkstock.h" | ||
| 8 | +#include "gtksignal.h" | ||
| 9 | #include "gtktreeselection.h" | ||
| 10 | #include "gtktreeview.h" | ||
| 11 | #include "gtkvbox.h" | ||
| 12 | @@ -77,6 +78,7 @@ | ||
| 13 | #include "gtkmessagedialog.h" | ||
| 14 | #include "gtkdnd.h" | ||
| 15 | #include "gtkeventbox.h" | ||
| 16 | +#include "gtkimage.h" | ||
| 17 | |||
| 18 | #undef GTK_DISABLE_DEPRECATED | ||
| 19 | #include "gtkoptionmenu.h" | ||
| 20 | @@ -245,7 +247,8 @@ | ||
| 21 | }; | ||
| 22 | |||
| 23 | enum { | ||
| 24 | - DIR_COLUMN | ||
| 25 | + DIR_COLUMN, | ||
| 26 | + ISFILE_COLUMN | ||
| 27 | }; | ||
| 28 | |||
| 29 | enum { | ||
| 30 | @@ -400,6 +403,12 @@ | ||
| 31 | GtkTreePath *path, | ||
| 32 | GtkTreeViewColumn *column, | ||
| 33 | gpointer user_data); | ||
| 34 | + | ||
| 35 | +static void gtk_file_selection_activate (GtkTreeView *tree_view, | ||
| 36 | + GtkTreePath *path, | ||
| 37 | + GtkTreeViewColumn *column, | ||
| 38 | + gpointer user_data); | ||
| 39 | + | ||
| 40 | static void gtk_file_selection_file_changed (GtkTreeSelection *selection, | ||
| 41 | gpointer user_data); | ||
| 42 | static void gtk_file_selection_dir_activate (GtkTreeView *tree_view, | ||
| 43 | @@ -419,6 +428,7 @@ | ||
| 44 | static void gtk_file_selection_create_dir (GtkWidget *widget, gpointer data); | ||
| 45 | static void gtk_file_selection_delete_file (GtkWidget *widget, gpointer data); | ||
| 46 | static void gtk_file_selection_rename_file (GtkWidget *widget, gpointer data); | ||
| 47 | +static void gtk_file_selection_style_set (GtkWidget *widget, GtkStyle *prev_style); | ||
| 48 | |||
| 49 | static void free_selected_names (GPtrArray *names); | ||
| 50 | |||
| 51 | @@ -578,6 +588,23 @@ | ||
| 52 | G_PARAM_WRITABLE)); | ||
| 53 | object_class->destroy = gtk_file_selection_destroy; | ||
| 54 | widget_class->map = gtk_file_selection_map; | ||
| 55 | + widget_class->style_set = gtk_file_selection_style_set; | ||
| 56 | + | ||
| 57 | + gtk_widget_class_install_style_property (widget_class, | ||
| 58 | + g_param_spec_boolean ("show_fileops_default", | ||
| 59 | + _("Show fileop buttons by default"), | ||
| 60 | + _("Whether file operation buttons are shown by default"), | ||
| 61 | + TRUE, | ||
| 62 | + G_PARAM_READABLE)); | ||
| 63 | + | ||
| 64 | + gtk_widget_class_install_style_property (widget_class, | ||
| 65 | + g_param_spec_int ("border_width", | ||
| 66 | + _("Border width"), | ||
| 67 | + _("Width of border around the main dialog area"), | ||
| 68 | + 0, | ||
| 69 | + G_MAXINT, | ||
| 70 | + 10, | ||
| 71 | + G_PARAM_READABLE)); | ||
| 72 | } | ||
| 73 | |||
| 74 | static void gtk_file_selection_set_property (GObject *object, | ||
| 75 | @@ -649,7 +676,29 @@ | ||
| 76 | gtk_widget_grab_default (widget); | ||
| 77 | return FALSE; | ||
| 78 | } | ||
| 79 | - | ||
| 80 | + | ||
| 81 | +static void | ||
| 82 | +gtk_file_selection_style_set (GtkWidget *filesel, | ||
| 83 | + GtkStyle *prev_style) | ||
| 84 | +{ | ||
| 85 | + gboolean show_fileops; | ||
| 86 | + gint border_width; | ||
| 87 | + | ||
| 88 | + gtk_widget_style_get (filesel, | ||
| 89 | + "show_fileops_default", | ||
| 90 | + &show_fileops, | ||
| 91 | + "border_width", | ||
| 92 | + &border_width, | ||
| 93 | + NULL); | ||
| 94 | + | ||
| 95 | + gtk_container_set_border_width (GTK_CONTAINER (filesel), border_width); | ||
| 96 | + | ||
| 97 | + if (show_fileops) | ||
| 98 | + gtk_file_selection_show_fileop_buttons (GTK_FILE_SELECTION (filesel)); | ||
| 99 | + else | ||
| 100 | + gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION (filesel)); | ||
| 101 | +} | ||
| 102 | + | ||
| 103 | static void | ||
| 104 | gtk_file_selection_init (GtkFileSelection *filesel) | ||
| 105 | { | ||
| 106 | @@ -674,17 +723,15 @@ | ||
| 107 | |||
| 108 | /* The dialog-sized vertical box */ | ||
| 109 | filesel->main_vbox = dialog->vbox; | ||
| 110 | - gtk_container_set_border_width (GTK_CONTAINER (filesel), 10); | ||
| 111 | |||
| 112 | /* The horizontal box containing create, rename etc. buttons */ | ||
| 113 | filesel->button_area = gtk_hbutton_box_new (); | ||
| 114 | gtk_button_box_set_layout (GTK_BUTTON_BOX (filesel->button_area), GTK_BUTTONBOX_START); | ||
| 115 | - gtk_box_set_spacing (GTK_BOX (filesel->button_area), 0); | ||
| 116 | gtk_box_pack_start (GTK_BOX (filesel->main_vbox), filesel->button_area, | ||
| 117 | FALSE, FALSE, 0); | ||
| 118 | gtk_widget_show (filesel->button_area); | ||
| 119 | |||
| 120 | - gtk_file_selection_show_fileop_buttons (filesel); | ||
| 121 | + gtk_file_selection_style_set (GTK_WIDGET (filesel), NULL); | ||
| 122 | |||
| 123 | /* hbox for pulldown menu */ | ||
| 124 | pulldown_hbox = gtk_hbox_new (TRUE, 5); | ||
| 125 | @@ -723,25 +770,32 @@ | ||
| 126 | |||
| 127 | /* The directories list */ | ||
| 128 | |||
| 129 | - model = gtk_list_store_new (1, G_TYPE_STRING); | ||
| 130 | + model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN); /* MA */ | ||
| 131 | filesel->dir_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model)); | ||
| 132 | g_object_unref (model); | ||
| 133 | |||
| 134 | - column = gtk_tree_view_column_new_with_attributes (_("Folders"), | ||
| 135 | + column = gtk_tree_view_column_new_with_attributes (/*_("Folders")*/ NULL, | ||
| 136 | gtk_cell_renderer_text_new (), | ||
| 137 | "text", DIR_COLUMN, | ||
| 138 | NULL); | ||
| 139 | label = gtk_label_new_with_mnemonic (_("Fol_ders")); | ||
| 140 | gtk_label_set_mnemonic_widget (GTK_LABEL (label), filesel->dir_list); | ||
| 141 | gtk_widget_show (label); | ||
| 142 | - gtk_tree_view_column_set_widget (column, label); | ||
| 143 | + | ||
| 144 | + /* gtk_tree_view_column_set_widget (column, label); */ | ||
| 145 | + gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (filesel->dir_list), FALSE); | ||
| 146 | + | ||
| 147 | gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | ||
| 148 | gtk_tree_view_append_column (GTK_TREE_VIEW (filesel->dir_list), column); | ||
| 149 | |||
| 150 | gtk_widget_set_size_request (filesel->dir_list, | ||
| 151 | DIR_LIST_WIDTH, DIR_LIST_HEIGHT); | ||
| 152 | g_signal_connect (filesel->dir_list, "row_activated", | ||
| 153 | - G_CALLBACK (gtk_file_selection_dir_activate), filesel); | ||
| 154 | + G_CALLBACK (gtk_file_selection_activate), filesel); | ||
| 155 | + | ||
| 156 | + g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (filesel->dir_list)), "changed", | ||
| 157 | + G_CALLBACK (gtk_file_selection_file_changed), filesel); | ||
| 158 | + | ||
| 159 | |||
| 160 | /* gtk_clist_column_titles_passive (GTK_CLIST (filesel->dir_list)); */ | ||
| 161 | |||
| 162 | @@ -758,41 +812,6 @@ | ||
| 163 | gtk_widget_show (filesel->dir_list); | ||
| 164 | gtk_widget_show (scrolled_win); | ||
| 165 | |||
| 166 | - /* The files list */ | ||
| 167 | - model = gtk_list_store_new (1, G_TYPE_STRING); | ||
| 168 | - filesel->file_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model)); | ||
| 169 | - g_object_unref (model); | ||
| 170 | - | ||
| 171 | - column = gtk_tree_view_column_new_with_attributes (_("Files"), | ||
| 172 | - gtk_cell_renderer_text_new (), | ||
| 173 | - "text", FILE_COLUMN, | ||
| 174 | - NULL); | ||
| 175 | - label = gtk_label_new_with_mnemonic (_("_Files")); | ||
| 176 | - gtk_label_set_mnemonic_widget (GTK_LABEL (label), filesel->file_list); | ||
| 177 | - gtk_widget_show (label); | ||
| 178 | - gtk_tree_view_column_set_widget (column, label); | ||
| 179 | - gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | ||
| 180 | - gtk_tree_view_append_column (GTK_TREE_VIEW (filesel->file_list), column); | ||
| 181 | - | ||
| 182 | - gtk_widget_set_size_request (filesel->file_list, | ||
| 183 | - FILE_LIST_WIDTH, FILE_LIST_HEIGHT); | ||
| 184 | - g_signal_connect (filesel->file_list, "row_activated", | ||
| 185 | - G_CALLBACK (gtk_file_selection_file_activate), filesel); | ||
| 186 | - g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (filesel->file_list)), "changed", | ||
| 187 | - G_CALLBACK (gtk_file_selection_file_changed), filesel); | ||
| 188 | - | ||
| 189 | - /* gtk_clist_column_titles_passive (GTK_CLIST (filesel->file_list)); */ | ||
| 190 | - | ||
| 191 | - scrolled_win = gtk_scrolled_window_new (NULL, NULL); | ||
| 192 | - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN); | ||
| 193 | - gtk_container_add (GTK_CONTAINER (scrolled_win), filesel->file_list); | ||
| 194 | - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win), | ||
| 195 | - GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); | ||
| 196 | - gtk_container_set_border_width (GTK_CONTAINER (scrolled_win), 0); | ||
| 197 | - gtk_container_add (GTK_CONTAINER (list_container), scrolled_win); | ||
| 198 | - gtk_widget_show (filesel->file_list); | ||
| 199 | - gtk_widget_show (scrolled_win); | ||
| 200 | - | ||
| 201 | /* action area for packing buttons into. */ | ||
| 202 | filesel->action_area = gtk_hbox_new (TRUE, 0); | ||
| 203 | gtk_box_pack_start (GTK_BOX (filesel->main_vbox), filesel->action_area, | ||
| 204 | @@ -2008,6 +2027,23 @@ | ||
| 205 | } | ||
| 206 | |||
| 207 | static void | ||
| 208 | +gtk_file_selection_activate (GtkTreeView *tree_view, | ||
| 209 | + GtkTreePath *path, | ||
| 210 | + GtkTreeViewColumn *column, | ||
| 211 | + gpointer user_data) | ||
| 212 | +{ | ||
| 213 | + GtkTreeModel *model = gtk_tree_view_get_model (tree_view); | ||
| 214 | + GtkTreeIter iter; | ||
| 215 | + gboolean is_file; | ||
| 216 | + | ||
| 217 | + gtk_tree_model_get_iter (model, &iter, path); | ||
| 218 | + gtk_tree_model_get (model, &iter, ISFILE_COLUMN, &is_file, -1); | ||
| 219 | + | ||
| 220 | + if (! is_file) | ||
| 221 | + gtk_file_selection_dir_activate (tree_view, path, column, user_data); | ||
| 222 | +} | ||
| 223 | + | ||
| 224 | +static void | ||
| 225 | gtk_file_selection_file_activate (GtkTreeView *tree_view, | ||
| 226 | GtkTreePath *path, | ||
| 227 | GtkTreeViewColumn *column, | ||
| 228 | @@ -2103,7 +2139,6 @@ | ||
| 229 | PossibleCompletion* poss; | ||
| 230 | GtkTreeIter iter; | ||
| 231 | GtkListStore *dir_model; | ||
| 232 | - GtkListStore *file_model; | ||
| 233 | gchar* filename; | ||
| 234 | gchar* rem_path = rel_path; | ||
| 235 | gchar* sel_text; | ||
| 236 | @@ -2125,10 +2160,8 @@ | ||
| 237 | g_assert (cmpl_state->reference_dir); | ||
| 238 | |||
| 239 | dir_model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (fs->dir_list))); | ||
| 240 | - file_model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (fs->file_list))); | ||
| 241 | |||
| 242 | gtk_list_store_clear (dir_model); | ||
| 243 | - gtk_list_store_clear (file_model); | ||
| 244 | |||
| 245 | /* Set the dir list to include ./ and ../ */ | ||
| 246 | gtk_list_store_append (dir_model, &iter); | ||
| 247 | @@ -2150,13 +2183,17 @@ | ||
| 248 | strcmp (filename, ".." G_DIR_SEPARATOR_S) != 0) | ||
| 249 | { | ||
| 250 | gtk_list_store_append (dir_model, &iter); | ||
| 251 | - gtk_list_store_set (dir_model, &iter, DIR_COLUMN, filename, -1); | ||
| 252 | + gtk_list_store_set (dir_model, &iter, | ||
| 253 | + DIR_COLUMN, filename, | ||
| 254 | + ISFILE_COLUMN, FALSE, -1); | ||
| 255 | } | ||
| 256 | } | ||
| 257 | else | ||
| 258 | { | ||
| 259 | - gtk_list_store_append (file_model, &iter); | ||
| 260 | - gtk_list_store_set (file_model, &iter, DIR_COLUMN, filename, -1); | ||
| 261 | + gtk_list_store_append (dir_model, &iter); | ||
| 262 | + gtk_list_store_set (dir_model, &iter, | ||
| 263 | + DIR_COLUMN, filename, | ||
| 264 | + ISFILE_COLUMN, TRUE, -1); | ||
| 265 | } | ||
| 266 | } | ||
| 267 | |||
diff --git a/openembedded/packages/gtk+/gtk+-2.10.0/spinbutton.patch b/openembedded/packages/gtk+/gtk+-2.10.0/spinbutton.patch new file mode 100644 index 0000000000..8ad7507af0 --- /dev/null +++ b/openembedded/packages/gtk+/gtk+-2.10.0/spinbutton.patch | |||
| @@ -0,0 +1,128 @@ | |||
| 1 | --- gtk+-2.4.3/gtk/gtkspinbutton.c.old 2004-04-22 14:49:27.000000000 +0100 | ||
| 2 | +++ gtk+-2.4.3/gtk/gtkspinbutton.c 2004-06-30 21:48:18.000000000 +0100 | ||
| 3 | @@ -733,7 +733,7 @@ | ||
| 4 | |||
| 5 | spin = GTK_SPIN_BUTTON (widget); | ||
| 6 | arrow_size = spin_button_get_arrow_size (spin); | ||
| 7 | - panel_width = arrow_size + 2 * widget->style->xthickness; | ||
| 8 | + panel_width = (2 * arrow_size) + 4 * widget->style->xthickness; | ||
| 9 | |||
| 10 | widget->allocation = *allocation; | ||
| 11 | |||
| 12 | @@ -866,19 +866,16 @@ | ||
| 13 | { | ||
| 14 | width = spin_button_get_arrow_size (spin_button) + 2 * widget->style->xthickness; | ||
| 15 | |||
| 16 | + y = widget->style->ythickness; | ||
| 17 | + height = widget->requisition.height - (2 * y); | ||
| 18 | + | ||
| 19 | if (arrow_type == GTK_ARROW_UP) | ||
| 20 | { | ||
| 21 | x = 0; | ||
| 22 | - y = 0; | ||
| 23 | - | ||
| 24 | - height = widget->requisition.height / 2; | ||
| 25 | } | ||
| 26 | else | ||
| 27 | { | ||
| 28 | - x = 0; | ||
| 29 | - y = widget->requisition.height / 2; | ||
| 30 | - | ||
| 31 | - height = (widget->requisition.height + 1) / 2; | ||
| 32 | + x = width; | ||
| 33 | } | ||
| 34 | |||
| 35 | if (spin_button_at_limit (spin_button, arrow_type)) | ||
| 36 | @@ -908,32 +905,17 @@ | ||
| 37 | shadow_type = GTK_SHADOW_OUT; | ||
| 38 | } | ||
| 39 | } | ||
| 40 | - | ||
| 41 | + | ||
| 42 | gtk_paint_box (widget->style, spin_button->panel, | ||
| 43 | state_type, shadow_type, | ||
| 44 | NULL, widget, | ||
| 45 | - (arrow_type == GTK_ARROW_UP)? "spinbutton_up" : "spinbutton_down", | ||
| 46 | + NULL, | ||
| 47 | x, y, width, height); | ||
| 48 | |||
| 49 | height = widget->requisition.height; | ||
| 50 | |||
| 51 | - if (arrow_type == GTK_ARROW_DOWN) | ||
| 52 | - { | ||
| 53 | - y = height / 2; | ||
| 54 | - height = height - y - 2; | ||
| 55 | - } | ||
| 56 | - else | ||
| 57 | - { | ||
| 58 | - y = 2; | ||
| 59 | - height = height / 2 - 2; | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | width -= 3; | ||
| 63 | - | ||
| 64 | - if (widget && gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) | ||
| 65 | - x = 2; | ||
| 66 | - else | ||
| 67 | - x = 1; | ||
| 68 | + height -= 3; | ||
| 69 | |||
| 70 | w = width / 2; | ||
| 71 | w -= w % 2 - 1; /* force odd */ | ||
| 72 | @@ -1108,7 +1090,7 @@ | ||
| 73 | if (GTK_ENTRY (widget)->editable) | ||
| 74 | gtk_spin_button_update (spin); | ||
| 75 | |||
| 76 | - if (event->y <= widget->requisition.height / 2) | ||
| 77 | + if (event->x <= (spin_button_get_arrow_size (spin) + widget->style->xthickness)) | ||
| 78 | { | ||
| 79 | if (event->button == 1) | ||
| 80 | start_spinning (spin, GTK_ARROW_UP, spin->adjustment->step_increment); | ||
| 81 | @@ -1143,44 +1125,11 @@ | ||
| 82 | |||
| 83 | arrow_size = spin_button_get_arrow_size (spin); | ||
| 84 | |||
| 85 | - if (event->button == spin->button) | ||
| 86 | - { | ||
| 87 | - int click_child = spin->click_child; | ||
| 88 | + gtk_spin_button_stop_spinning (spin); | ||
| 89 | |||
| 90 | - gtk_spin_button_stop_spinning (spin); | ||
| 91 | - | ||
| 92 | - if (event->button == 3) | ||
| 93 | - { | ||
| 94 | - if (event->y >= 0 && event->x >= 0 && | ||
| 95 | - event->y <= widget->requisition.height && | ||
| 96 | - event->x <= arrow_size + 2 * widget->style->xthickness) | ||
| 97 | - { | ||
| 98 | - if (click_child == GTK_ARROW_UP && | ||
| 99 | - event->y <= widget->requisition.height / 2) | ||
| 100 | - { | ||
| 101 | - gdouble diff; | ||
| 102 | - | ||
| 103 | - diff = spin->adjustment->upper - spin->adjustment->value; | ||
| 104 | - if (diff > EPSILON) | ||
| 105 | - gtk_spin_button_real_spin (spin, diff); | ||
| 106 | - } | ||
| 107 | - else if (click_child == GTK_ARROW_DOWN && | ||
| 108 | - event->y > widget->requisition.height / 2) | ||
| 109 | - { | ||
| 110 | - gdouble diff; | ||
| 111 | - | ||
| 112 | - diff = spin->adjustment->value - spin->adjustment->lower; | ||
| 113 | - if (diff > EPSILON) | ||
| 114 | - gtk_spin_button_real_spin (spin, -diff); | ||
| 115 | - } | ||
| 116 | - } | ||
| 117 | - } | ||
| 118 | - spin_button_redraw (spin); | ||
| 119 | + spin_button_redraw (spin); | ||
| 120 | |||
| 121 | - return TRUE; | ||
| 122 | - } | ||
| 123 | - else | ||
| 124 | - return GTK_WIDGET_CLASS (parent_class)->button_release_event (widget, event); | ||
| 125 | + return TRUE; | ||
| 126 | } | ||
| 127 | |||
| 128 | static gint | ||
diff --git a/openembedded/packages/gtk+/gtk+-2.10.0/style-cairo.patch b/openembedded/packages/gtk+/gtk+-2.10.0/style-cairo.patch new file mode 100644 index 0000000000..197b0a8f45 --- /dev/null +++ b/openembedded/packages/gtk+/gtk+-2.10.0/style-cairo.patch | |||
| @@ -0,0 +1,2193 @@ | |||
| 1 | Index: gtkstyle.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvs/gnome/gtk+/gtk/gtkstyle.c,v | ||
| 4 | retrieving revision 1.193 | ||
| 5 | diff -u -r1.193 gtk+-2.10.0/gtk/gtkstyle.c | ||
| 6 | --- gtk+-2.10.0/gtk/gtkstyle.c 28 May 2006 12:56:26 -0000 1.193 | ||
| 7 | +++ gtk+-2.10.0/gtk/gtkstyle.c 2 Jul 2006 14:15:15 -0000 | ||
| 8 | @@ -37,7 +37,6 @@ | ||
| 9 | #include "gtkthemes.h" | ||
| 10 | #include "gtkiconfactory.h" | ||
| 11 | #include "gtksettings.h" /* _gtk_settings_parse_convert() */ | ||
| 12 | -#include "gtkintl.h" | ||
| 13 | #include "gtkalias.h" | ||
| 14 | |||
| 15 | #define LIGHTNESS_MULT 1.3 | ||
| 16 | @@ -59,6 +58,8 @@ | ||
| 17 | }; | ||
| 18 | |||
| 19 | /* --- prototypes --- */ | ||
| 20 | +static void gtk_style_init (GtkStyle *style); | ||
| 21 | +static void gtk_style_class_init (GtkStyleClass *klass); | ||
| 22 | static void gtk_style_finalize (GObject *object); | ||
| 23 | static void gtk_style_realize (GtkStyle *style, | ||
| 24 | GdkColormap *colormap); | ||
| 25 | @@ -311,6 +312,9 @@ | ||
| 26 | gint width, | ||
| 27 | gint height); | ||
| 28 | |||
| 29 | +void _gtk_style_shade (GdkColor *a, | ||
| 30 | + GdkColor *b, | ||
| 31 | + gdouble k); | ||
| 32 | static void rgb_to_hls (gdouble *r, | ||
| 33 | gdouble *g, | ||
| 34 | gdouble *b); | ||
| 35 | @@ -329,6 +333,128 @@ | ||
| 36 | static const GtkRequisition default_option_indicator_size = { 7, 13 }; | ||
| 37 | static const GtkBorder default_option_indicator_spacing = { 7, 5, 2, 2 }; | ||
| 38 | |||
| 39 | +#define INDICATOR_PART_SIZE 13 | ||
| 40 | + | ||
| 41 | +typedef enum { | ||
| 42 | + CHECK_AA, | ||
| 43 | + CHECK_BASE, | ||
| 44 | + CHECK_BLACK, | ||
| 45 | + CHECK_DARK, | ||
| 46 | + CHECK_LIGHT, | ||
| 47 | + CHECK_MID, | ||
| 48 | + CHECK_TEXT, | ||
| 49 | + CHECK_INCONSISTENT_TEXT, | ||
| 50 | + RADIO_BASE, | ||
| 51 | + RADIO_BLACK, | ||
| 52 | + RADIO_DARK, | ||
| 53 | + RADIO_LIGHT, | ||
| 54 | + RADIO_MID, | ||
| 55 | + RADIO_TEXT, | ||
| 56 | + RADIO_INCONSISTENT_AA, | ||
| 57 | + RADIO_INCONSISTENT_TEXT | ||
| 58 | +} IndicatorPart; | ||
| 59 | + | ||
| 60 | +/* | ||
| 61 | + * Extracted from check-13.png, width=13, height=13 | ||
| 62 | + */ | ||
| 63 | +static const guchar check_black_bits[] = { | ||
| 64 | + 0x00,0x00,0xfe,0x0f,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02, | ||
| 65 | + 0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00}; | ||
| 66 | +static const guchar check_dark_bits[] = { | ||
| 67 | + 0xff,0x1f,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01, | ||
| 68 | + 0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x00}; | ||
| 69 | +static const guchar check_mid_bits[] = { | ||
| 70 | + 0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00, | ||
| 71 | + 0x08,0x00,0x08,0x00,0x08,0x00,0x08,0xfc,0x0f,0x00,0x00,0x00,0x00}; | ||
| 72 | +static const guchar check_light_bits[] = { | ||
| 73 | + 0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00, | ||
| 74 | + 0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0xfe,0x1f,0x00,0x00}; | ||
| 75 | +static const guchar check_text_bits[] = { | ||
| 76 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x03,0x80,0x01,0x80,0x00,0x58, | ||
| 77 | + 0x00,0x60,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
| 78 | +static const guchar check_aa_bits[] = { | ||
| 79 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x58,0x00,0xa0, | ||
| 80 | + 0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
| 81 | +static const guchar check_base_bits[] = { | ||
| 82 | + 0x00,0x00,0x00,0x00,0xfc,0x07,0xfc,0x07,0xfc,0x07,0xfc,0x07,0xfc,0x07,0xfc, | ||
| 83 | + 0x07,0xfc,0x07,0xfc,0x07,0xfc,0x07,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
| 84 | + | ||
| 85 | +/* | ||
| 86 | + * Extracted from check-13-inconsistent.png, width=13, height=13 | ||
| 87 | + */ | ||
| 88 | +static const guchar check_inconsistent_text_bits[] = { | ||
| 89 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x03,0xf8, | ||
| 90 | + 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
| 91 | +#if 0 | ||
| 92 | +/* | ||
| 93 | + * check_inconsistent_aa_bits is currently not used, since it is all zeros. | ||
| 94 | + */ | ||
| 95 | +static const guchar check_inconsistent_aa_bits[] = { | ||
| 96 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
| 97 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
| 98 | +#endif | ||
| 99 | + | ||
| 100 | +/* | ||
| 101 | + * Extracted from radio-13.png, width=13, height=13 | ||
| 102 | + */ | ||
| 103 | +static const guchar radio_black_bits[] = { | ||
| 104 | + 0x00,0x00,0xf0,0x01,0x0c,0x02,0x04,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02, | ||
| 105 | + 0x00,0x02,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x08}; | ||
| 106 | +static const guchar radio_dark_bits[] = { | ||
| 107 | + 0xf0,0x00,0x0c,0x02,0x02,0x04,0x02,0x04,0x01,0x08,0x01,0x08,0x01,0x08,0x01, | ||
| 108 | + 0x08,0x00,0x08,0x02,0x04,0x0c,0x06,0xf0,0x01,0x00,0x00,0x00,0x00}; | ||
| 109 | +static const guchar radio_mid_bits[] = { | ||
| 110 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
| 111 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
| 112 | +static const guchar radio_light_bits[] = { | ||
| 113 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00, | ||
| 114 | + 0x10,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x06,0xe0,0x01,0x00,0x00}; | ||
| 115 | +static const guchar radio_text_bits[] = { | ||
| 116 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0xf0,0x01,0xf0,0x01,0xf0, | ||
| 117 | + 0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
| 118 | +#if 0 | ||
| 119 | +/* | ||
| 120 | + * radio_aa_bits is currently not used, since it is all zeros. | ||
| 121 | + */ | ||
| 122 | +static const guchar radio_aa_bits[] = { | ||
| 123 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
| 124 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
| 125 | +#endif | ||
| 126 | +static const guchar radio_base_bits[] = { | ||
| 127 | + 0x00,0x00,0x00,0x00,0xf0,0x01,0xf8,0x03,0xfc,0x07,0xfc,0x07,0xfc,0x07,0xfc, | ||
| 128 | + 0x07,0xfc,0x07,0xf8,0x03,0xf0,0x01,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
| 129 | + | ||
| 130 | +/* | ||
| 131 | + * Extracted from radio-13.png, width=13, height=13 | ||
| 132 | + */ | ||
| 133 | +static const guchar radio_inconsistent_text_bits[] = { | ||
| 134 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x03,0x00, | ||
| 135 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
| 136 | +static const guchar radio_inconsistent_aa_bits[] = { | ||
| 137 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x03,0x00,0x00,0xf8, | ||
| 138 | + 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
| 139 | + | ||
| 140 | +static struct { | ||
| 141 | + const guchar *bits; | ||
| 142 | + GList *bmap_list; /* list of GdkBitmap */ | ||
| 143 | +} indicator_parts[] = { | ||
| 144 | + { check_aa_bits, NULL }, | ||
| 145 | + { check_base_bits, NULL }, | ||
| 146 | + { check_black_bits, NULL }, | ||
| 147 | + { check_dark_bits, NULL }, | ||
| 148 | + { check_light_bits, NULL }, | ||
| 149 | + { check_mid_bits, NULL }, | ||
| 150 | + { check_text_bits, NULL }, | ||
| 151 | + { check_inconsistent_text_bits, NULL }, | ||
| 152 | + { radio_base_bits, NULL }, | ||
| 153 | + { radio_black_bits, NULL }, | ||
| 154 | + { radio_dark_bits, NULL }, | ||
| 155 | + { radio_light_bits, NULL }, | ||
| 156 | + { radio_mid_bits, NULL }, | ||
| 157 | + { radio_text_bits, NULL }, | ||
| 158 | + { radio_inconsistent_aa_bits, NULL }, | ||
| 159 | + { radio_inconsistent_text_bits, NULL }, | ||
| 160 | +}; | ||
| 161 | #define GTK_GRAY 0xdcdc, 0xdada, 0xd5d5 | ||
| 162 | #define GTK_DARK_GRAY 0xc4c4, 0xc2c2, 0xbdbd | ||
| 163 | #define GTK_LIGHT_GRAY 0xeeee, 0xebeb, 0xe7e7 | ||
| 164 | @@ -353,13 +479,39 @@ | ||
| 165 | static const GdkColor gtk_default_selected_base = { 0, GTK_BLUE }; | ||
| 166 | static const GdkColor gtk_default_active_base = { 0, GTK_VERY_DARK_GRAY }; | ||
| 167 | |||
| 168 | +static gpointer parent_class = NULL; | ||
| 169 | + | ||
| 170 | /* --- signals --- */ | ||
| 171 | static guint realize_signal = 0; | ||
| 172 | static guint unrealize_signal = 0; | ||
| 173 | |||
| 174 | -G_DEFINE_TYPE (GtkStyle, gtk_style, G_TYPE_OBJECT) | ||
| 175 | - | ||
| 176 | /* --- functions --- */ | ||
| 177 | +GType | ||
| 178 | +gtk_style_get_type (void) | ||
| 179 | +{ | ||
| 180 | + static GType style_type = 0; | ||
| 181 | + | ||
| 182 | + if (!style_type) | ||
| 183 | + { | ||
| 184 | + static const GTypeInfo style_info = | ||
| 185 | + { | ||
| 186 | + sizeof (GtkStyleClass), | ||
| 187 | + (GBaseInitFunc) NULL, | ||
| 188 | + (GBaseFinalizeFunc) NULL, | ||
| 189 | + (GClassInitFunc) gtk_style_class_init, | ||
| 190 | + NULL, /* class_finalize */ | ||
| 191 | + NULL, /* class_data */ | ||
| 192 | + sizeof (GtkStyle), | ||
| 193 | + 0, /* n_preallocs */ | ||
| 194 | + (GInstanceInitFunc) gtk_style_init, | ||
| 195 | + }; | ||
| 196 | + | ||
| 197 | + style_type = g_type_register_static (G_TYPE_OBJECT, "GtkStyle", | ||
| 198 | + &style_info, 0); | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + return style_type; | ||
| 202 | +} | ||
| 203 | |||
| 204 | /** | ||
| 205 | * _gtk_style_init_for_settings: | ||
| 206 | @@ -477,6 +629,8 @@ | ||
| 207 | { | ||
| 208 | GObjectClass *object_class = G_OBJECT_CLASS (klass); | ||
| 209 | |||
| 210 | + parent_class = g_type_class_peek_parent (klass); | ||
| 211 | + | ||
| 212 | object_class->finalize = gtk_style_finalize; | ||
| 213 | |||
| 214 | klass->clone = gtk_style_real_clone; | ||
| 215 | @@ -511,6 +665,7 @@ | ||
| 216 | |||
| 217 | g_type_class_add_private (object_class, sizeof (GtkStylePrivate)); | ||
| 218 | |||
| 219 | + | ||
| 220 | /** | ||
| 221 | * GtkStyle::realize: | ||
| 222 | * @style: the object which received the signal | ||
| 223 | @@ -522,7 +677,7 @@ | ||
| 224 | * | ||
| 225 | * Since: 2.4 | ||
| 226 | */ | ||
| 227 | - realize_signal = g_signal_new (I_("realize"), | ||
| 228 | + realize_signal = g_signal_new ("realize", | ||
| 229 | G_TYPE_FROM_CLASS (object_class), | ||
| 230 | G_SIGNAL_RUN_FIRST, | ||
| 231 | G_STRUCT_OFFSET (GtkStyleClass, realize), | ||
| 232 | @@ -540,7 +695,7 @@ | ||
| 233 | * | ||
| 234 | * Since: 2.4 | ||
| 235 | */ | ||
| 236 | - unrealize_signal = g_signal_new (I_("unrealize"), | ||
| 237 | + unrealize_signal = g_signal_new ("unrealize", | ||
| 238 | G_TYPE_FROM_CLASS (object_class), | ||
| 239 | G_SIGNAL_RUN_FIRST, | ||
| 240 | G_STRUCT_OFFSET (GtkStyleClass, unrealize), | ||
| 241 | @@ -602,8 +757,18 @@ | ||
| 242 | } | ||
| 243 | } | ||
| 244 | |||
| 245 | - g_slist_foreach (style->icon_factories, (GFunc) g_object_unref, NULL); | ||
| 246 | - g_slist_free (style->icon_factories); | ||
| 247 | + if (style->icon_factories) | ||
| 248 | + { | ||
| 249 | + GSList *tmp_list = style->icon_factories; | ||
| 250 | + | ||
| 251 | + while (tmp_list) | ||
| 252 | + { | ||
| 253 | + g_object_unref (tmp_list->data); | ||
| 254 | + tmp_list = tmp_list->next; | ||
| 255 | + } | ||
| 256 | + | ||
| 257 | + g_slist_free (style->icon_factories); | ||
| 258 | + } | ||
| 259 | |||
| 260 | g_slist_foreach (priv->color_hashes, (GFunc) g_hash_table_unref, NULL); | ||
| 261 | g_slist_free (priv->color_hashes); | ||
| 262 | @@ -619,7 +784,7 @@ | ||
| 263 | if (style->rc_style) | ||
| 264 | gtk_rc_style_unref (style->rc_style); | ||
| 265 | |||
| 266 | - G_OBJECT_CLASS (gtk_style_parent_class)->finalize (object); | ||
| 267 | + G_OBJECT_CLASS (parent_class)->finalize (object); | ||
| 268 | } | ||
| 269 | |||
| 270 | |||
| 271 | @@ -686,10 +851,6 @@ | ||
| 272 | * it to a particular visual and colormap. The process may | ||
| 273 | * involve the creation of a new style if the style has already | ||
| 274 | * been attached to a window with a different style and colormap. | ||
| 275 | - * | ||
| 276 | - * Since this function may return a new object, you have to use it | ||
| 277 | - * in the following way: | ||
| 278 | - * <literal>style = gtk_style_attach (style, window)</literal> | ||
| 279 | **/ | ||
| 280 | GtkStyle* | ||
| 281 | gtk_style_attach (GtkStyle *style, | ||
| 282 | @@ -766,19 +927,10 @@ | ||
| 283 | return new_style; | ||
| 284 | } | ||
| 285 | |||
| 286 | -/** | ||
| 287 | - * gtk_style_detach: | ||
| 288 | - * @style: a #GtkStyle | ||
| 289 | - * | ||
| 290 | - * Detaches a style from a window. If the style is not attached | ||
| 291 | - * to any windows anymore, it is unrealized. See gtk_style_attach(). | ||
| 292 | - * | ||
| 293 | - */ | ||
| 294 | void | ||
| 295 | gtk_style_detach (GtkStyle *style) | ||
| 296 | { | ||
| 297 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 298 | - g_return_if_fail (style->attach_count > 0); | ||
| 299 | |||
| 300 | style->attach_count -= 1; | ||
| 301 | if (style->attach_count == 0) | ||
| 302 | @@ -833,6 +985,9 @@ | ||
| 303 | gtk_style_realize (GtkStyle *style, | ||
| 304 | GdkColormap *colormap) | ||
| 305 | { | ||
| 306 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 307 | + g_return_if_fail (GDK_IS_COLORMAP (colormap)); | ||
| 308 | + | ||
| 309 | style->colormap = g_object_ref (colormap); | ||
| 310 | style->depth = gdk_colormap_get_visual (colormap)->depth; | ||
| 311 | |||
| 312 | @@ -862,22 +1017,6 @@ | ||
| 313 | return gtk_icon_factory_lookup_default (stock_id); | ||
| 314 | } | ||
| 315 | |||
| 316 | -/** | ||
| 317 | - * gtk_style_lookup_color: | ||
| 318 | - * @style: a #GtkStyle | ||
| 319 | - * @color_name: the name of the logical color to look up | ||
| 320 | - * @color: the #GdkColor to fill in | ||
| 321 | - * | ||
| 322 | - * Looks up @color_name in the style's logical color mappings, | ||
| 323 | - * filling in @color and returning %TRUE if found, otherwise | ||
| 324 | - * returning %FALSE. Do not cache the found mapping, because | ||
| 325 | - * it depends on the #GtkStyle and might change when a theme | ||
| 326 | - * switch occurs. | ||
| 327 | - * | ||
| 328 | - * Return value: %TRUE if the mapping was found. | ||
| 329 | - * | ||
| 330 | - * Since: 2.10 | ||
| 331 | - **/ | ||
| 332 | gboolean | ||
| 333 | gtk_style_lookup_color (GtkStyle *style, | ||
| 334 | const char *color_name, | ||
| 335 | @@ -909,6 +1048,7 @@ | ||
| 336 | return FALSE; | ||
| 337 | } | ||
| 338 | |||
| 339 | + | ||
| 340 | /** | ||
| 341 | * gtk_draw_hline: | ||
| 342 | * @style: a #GtkStyle | ||
| 343 | @@ -1653,8 +1793,19 @@ | ||
| 344 | if (rc_style->ythickness >= 0) | ||
| 345 | style->ythickness = rc_style->ythickness; | ||
| 346 | |||
| 347 | - style->icon_factories = g_slist_copy (rc_style->icon_factories); | ||
| 348 | - g_slist_foreach (style->icon_factories, (GFunc) g_object_ref, NULL); | ||
| 349 | + if (rc_style->icon_factories) | ||
| 350 | + { | ||
| 351 | + GSList *iter; | ||
| 352 | + | ||
| 353 | + style->icon_factories = g_slist_copy (rc_style->icon_factories); | ||
| 354 | + | ||
| 355 | + iter = style->icon_factories; | ||
| 356 | + while (iter != NULL) | ||
| 357 | + { | ||
| 358 | + g_object_ref (iter->data); | ||
| 359 | + iter = g_slist_next (iter); | ||
| 360 | + } | ||
| 361 | + } | ||
| 362 | |||
| 363 | priv->color_hashes = g_slist_copy (_gtk_rc_style_get_color_hashes (rc_style)); | ||
| 364 | g_slist_foreach (priv->color_hashes, (GFunc) g_hash_table_ref, NULL); | ||
| 365 | @@ -1782,7 +1933,7 @@ | ||
| 366 | { | ||
| 367 | _gtk_style_shade (&style->bg[i], &style->light[i], LIGHTNESS_MULT); | ||
| 368 | _gtk_style_shade (&style->bg[i], &style->dark[i], DARKNESS_MULT); | ||
| 369 | - | ||
| 370 | + | ||
| 371 | style->mid[i].red = (style->light[i].red + style->dark[i].red) / 2; | ||
| 372 | style->mid[i].green = (style->light[i].green + style->dark[i].green) / 2; | ||
| 373 | style->mid[i].blue = (style->light[i].blue + style->dark[i].blue) / 2; | ||
| 374 | @@ -2162,6 +2313,57 @@ | ||
| 375 | gdk_drawable_get_size (window, NULL, height); | ||
| 376 | } | ||
| 377 | |||
| 378 | +static GdkBitmap * | ||
| 379 | +get_indicator_for_screen (GdkDrawable *drawable, | ||
| 380 | + IndicatorPart part) | ||
| 381 | + | ||
| 382 | +{ | ||
| 383 | + GdkScreen *screen = gdk_drawable_get_screen (drawable); | ||
| 384 | + GdkBitmap *bitmap; | ||
| 385 | + GList *tmp_list; | ||
| 386 | + | ||
| 387 | + tmp_list = indicator_parts[part].bmap_list; | ||
| 388 | + while (tmp_list) | ||
| 389 | + { | ||
| 390 | + bitmap = tmp_list->data; | ||
| 391 | + | ||
| 392 | + if (gdk_drawable_get_screen (bitmap) == screen) | ||
| 393 | + return bitmap; | ||
| 394 | + | ||
| 395 | + tmp_list = tmp_list->next; | ||
| 396 | + } | ||
| 397 | + | ||
| 398 | + bitmap = gdk_bitmap_create_from_data (drawable, | ||
| 399 | + (gchar *)indicator_parts[part].bits, | ||
| 400 | + INDICATOR_PART_SIZE, INDICATOR_PART_SIZE); | ||
| 401 | + indicator_parts[part].bmap_list = g_list_prepend (indicator_parts[part].bmap_list, bitmap); | ||
| 402 | + | ||
| 403 | + return bitmap; | ||
| 404 | +} | ||
| 405 | + | ||
| 406 | +static void | ||
| 407 | +draw_part (GdkDrawable *drawable, | ||
| 408 | + GdkGC *gc, | ||
| 409 | + GdkRectangle *area, | ||
| 410 | + gint x, | ||
| 411 | + gint y, | ||
| 412 | + IndicatorPart part) | ||
| 413 | +{ | ||
| 414 | + if (area) | ||
| 415 | + gdk_gc_set_clip_rectangle (gc, area); | ||
| 416 | + | ||
| 417 | + gdk_gc_set_ts_origin (gc, x, y); | ||
| 418 | + gdk_gc_set_stipple (gc, get_indicator_for_screen (drawable, part)); | ||
| 419 | + gdk_gc_set_fill (gc, GDK_STIPPLED); | ||
| 420 | + | ||
| 421 | + gdk_draw_rectangle (drawable, gc, TRUE, x, y, INDICATOR_PART_SIZE, INDICATOR_PART_SIZE); | ||
| 422 | + | ||
| 423 | + gdk_gc_set_fill (gc, GDK_SOLID); | ||
| 424 | + | ||
| 425 | + if (area) | ||
| 426 | + gdk_gc_set_clip_rectangle (gc, NULL); | ||
| 427 | +} | ||
| 428 | + | ||
| 429 | static void | ||
| 430 | gtk_default_draw_hline (GtkStyle *style, | ||
| 431 | GdkWindow *window, | ||
| 432 | @@ -2177,6 +2379,9 @@ | ||
| 433 | gint thickness_dark; | ||
| 434 | gint i; | ||
| 435 | |||
| 436 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 437 | + g_return_if_fail (window != NULL); | ||
| 438 | + | ||
| 439 | thickness_light = style->ythickness / 2; | ||
| 440 | thickness_dark = style->ythickness - thickness_light; | ||
| 441 | |||
| 442 | @@ -2231,6 +2436,9 @@ | ||
| 443 | gint thickness_dark; | ||
| 444 | gint i; | ||
| 445 | |||
| 446 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 447 | + g_return_if_fail (window != NULL); | ||
| 448 | + | ||
| 449 | thickness_light = style->xthickness / 2; | ||
| 450 | thickness_dark = style->xthickness - thickness_light; | ||
| 451 | |||
| 452 | @@ -2456,6 +2664,9 @@ | ||
| 453 | gint thickness_dark; | ||
| 454 | gint i; | ||
| 455 | |||
| 456 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 457 | + g_return_if_fail (window != NULL); | ||
| 458 | + | ||
| 459 | if (shadow_type == GTK_SHADOW_IN) | ||
| 460 | { | ||
| 461 | if (detail && (strcmp (detail, "buttondefault") == 0)) | ||
| 462 | @@ -2791,6 +3002,10 @@ | ||
| 463 | gint yadjust; | ||
| 464 | gint i; | ||
| 465 | |||
| 466 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 467 | + g_return_if_fail (window != NULL); | ||
| 468 | + g_return_if_fail (points != NULL); | ||
| 469 | + | ||
| 470 | switch (shadow_type) | ||
| 471 | { | ||
| 472 | case GTK_SHADOW_IN: | ||
| 473 | @@ -2900,7 +3115,7 @@ | ||
| 474 | |||
| 475 | static void | ||
| 476 | draw_arrow (GdkWindow *window, | ||
| 477 | - GdkColor *color, | ||
| 478 | + GdkGC *gc, | ||
| 479 | GdkRectangle *area, | ||
| 480 | GtkArrowType arrow_type, | ||
| 481 | gint x, | ||
| 482 | @@ -2908,44 +3123,34 @@ | ||
| 483 | gint width, | ||
| 484 | gint height) | ||
| 485 | { | ||
| 486 | - cairo_t *cr = gdk_cairo_create (window); | ||
| 487 | - gdk_cairo_set_source_color (cr, color); | ||
| 488 | - | ||
| 489 | + gint i, j; | ||
| 490 | + | ||
| 491 | if (area) | ||
| 492 | - { | ||
| 493 | - gdk_cairo_rectangle (cr, area); | ||
| 494 | - cairo_clip (cr); | ||
| 495 | - } | ||
| 496 | - | ||
| 497 | + gdk_gc_set_clip_rectangle (gc, area); | ||
| 498 | + | ||
| 499 | if (arrow_type == GTK_ARROW_DOWN) | ||
| 500 | { | ||
| 501 | - cairo_move_to (cr, x, y); | ||
| 502 | - cairo_line_to (cr, x + width, y); | ||
| 503 | - cairo_line_to (cr, x + width / 2., y + height); | ||
| 504 | + for (i = 0, j = 0; i < height; i++, j++) | ||
| 505 | + gdk_draw_line (window, gc, x + j, y + i, x + width - j - 1, y + i); | ||
| 506 | } | ||
| 507 | else if (arrow_type == GTK_ARROW_UP) | ||
| 508 | { | ||
| 509 | - cairo_move_to (cr, x, y + height); | ||
| 510 | - cairo_line_to (cr, x + width / 2., y); | ||
| 511 | - cairo_line_to (cr, x + width, y + height); | ||
| 512 | + for (i = height - 1, j = 0; i >= 0; i--, j++) | ||
| 513 | + gdk_draw_line (window, gc, x + j, y + i, x + width - j - 1, y + i); | ||
| 514 | } | ||
| 515 | else if (arrow_type == GTK_ARROW_LEFT) | ||
| 516 | { | ||
| 517 | - cairo_move_to (cr, x + width, y); | ||
| 518 | - cairo_line_to (cr, x + width, y + height); | ||
| 519 | - cairo_line_to (cr, x, y + height / 2.); | ||
| 520 | + for (i = width - 1, j = 0; i >= 0; i--, j++) | ||
| 521 | + gdk_draw_line (window, gc, x + i, y + j, x + i, y + height - j - 1); | ||
| 522 | } | ||
| 523 | else if (arrow_type == GTK_ARROW_RIGHT) | ||
| 524 | { | ||
| 525 | - cairo_move_to (cr, x, y); | ||
| 526 | - cairo_line_to (cr, x + width, y + height / 2.); | ||
| 527 | - cairo_line_to (cr, x, y + height); | ||
| 528 | + for (i = 0, j = 0; i < width; i++, j++) | ||
| 529 | + gdk_draw_line (window, gc, x + i, y + j, x + i, y + height - j - 1); | ||
| 530 | } | ||
| 531 | |||
| 532 | - cairo_close_path (cr); | ||
| 533 | - cairo_fill (cr); | ||
| 534 | - | ||
| 535 | - cairo_destroy (cr); | ||
| 536 | + if (area) | ||
| 537 | + gdk_gc_set_clip_rectangle (gc, NULL); | ||
| 538 | } | ||
| 539 | |||
| 540 | static void | ||
| 541 | @@ -3032,17 +3237,22 @@ | ||
| 542 | gint width, | ||
| 543 | gint height) | ||
| 544 | { | ||
| 545 | + gint original_width, original_x; | ||
| 546 | + | ||
| 547 | sanitize_size (window, &width, &height); | ||
| 548 | |||
| 549 | + original_width = width; | ||
| 550 | + original_x = x; | ||
| 551 | + | ||
| 552 | calculate_arrow_geometry (arrow_type, &x, &y, &width, &height); | ||
| 553 | |||
| 554 | if (detail && strcmp (detail, "menu_scroll_arrow_up") == 0) | ||
| 555 | y++; | ||
| 556 | |||
| 557 | if (state == GTK_STATE_INSENSITIVE) | ||
| 558 | - draw_arrow (window, &style->white, area, arrow_type, | ||
| 559 | + draw_arrow (window, style->white_gc, area, arrow_type, | ||
| 560 | x + 1, y + 1, width, height); | ||
| 561 | - draw_arrow (window, &style->fg[state], area, arrow_type, | ||
| 562 | + draw_arrow (window, style->fg_gc[state], area, arrow_type, | ||
| 563 | x, y, width, height); | ||
| 564 | } | ||
| 565 | |||
| 566 | @@ -3074,6 +3284,9 @@ | ||
| 567 | GdkGC *inner_sw = NULL; | ||
| 568 | GdkGC *inner_se = NULL; | ||
| 569 | |||
| 570 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 571 | + g_return_if_fail (window != NULL); | ||
| 572 | + | ||
| 573 | sanitize_size (window, &width, &height); | ||
| 574 | |||
| 575 | half_width = width / 2; | ||
| 576 | @@ -3191,6 +3404,13 @@ | ||
| 577 | gint y, | ||
| 578 | const gchar *string) | ||
| 579 | { | ||
| 580 | + GdkDisplay *display; | ||
| 581 | + | ||
| 582 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 583 | + g_return_if_fail (window != NULL); | ||
| 584 | + | ||
| 585 | + display = gdk_drawable_get_display (window); | ||
| 586 | + | ||
| 587 | if (area) | ||
| 588 | { | ||
| 589 | gdk_gc_set_clip_rectangle (style->white_gc, area); | ||
| 590 | @@ -3223,8 +3443,8 @@ | ||
| 591 | |||
| 592 | if (widget) | ||
| 593 | gtk_widget_style_get (widget, | ||
| 594 | - "indicator-size", &tmp_size, | ||
| 595 | - "indicator-spacing", &tmp_spacing, | ||
| 596 | + "indicator_size", &tmp_size, | ||
| 597 | + "indicator_spacing", &tmp_spacing, | ||
| 598 | NULL); | ||
| 599 | |||
| 600 | if (tmp_size) | ||
| 601 | @@ -3259,6 +3479,9 @@ | ||
| 602 | { | ||
| 603 | gboolean is_spinbutton_box = FALSE; | ||
| 604 | |||
| 605 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 606 | + g_return_if_fail (window != NULL); | ||
| 607 | + | ||
| 608 | sanitize_size (window, &width, &height); | ||
| 609 | |||
| 610 | if (widget && GTK_IS_SPIN_BUTTON (widget) && detail) | ||
| 611 | @@ -3407,6 +3630,9 @@ | ||
| 612 | GdkGC *gc1; | ||
| 613 | GdkGC *freeme = NULL; | ||
| 614 | |||
| 615 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 616 | + g_return_if_fail (window != NULL); | ||
| 617 | + | ||
| 618 | sanitize_size (window, &width, &height); | ||
| 619 | |||
| 620 | if (detail) | ||
| 621 | @@ -3415,26 +3641,15 @@ | ||
| 622 | { | ||
| 623 | if (!strcmp ("text", detail)) | ||
| 624 | gc1 = style->bg_gc[GTK_STATE_SELECTED]; | ||
| 625 | - else if (!strcmp ("cell_even", detail) || | ||
| 626 | - !strcmp ("cell_odd", detail) || | ||
| 627 | - !strcmp ("cell_even_ruled", detail) || | ||
| 628 | - !strcmp ("cell_even_ruled_sorted", detail)) | ||
| 629 | + else if (!strncmp ("cell_even", detail, strlen ("cell_even")) || | ||
| 630 | + !strncmp ("cell_odd", detail, strlen ("cell_odd"))) | ||
| 631 | { | ||
| 632 | /* This has to be really broken; alex made me do it. -jrb */ | ||
| 633 | if (GTK_WIDGET_HAS_FOCUS (widget)) | ||
| 634 | gc1 = style->base_gc[state_type]; | ||
| 635 | - else | ||
| 636 | - gc1 = style->base_gc[GTK_STATE_ACTIVE]; | ||
| 637 | + else | ||
| 638 | + gc1 = style->base_gc[GTK_STATE_ACTIVE]; | ||
| 639 | } | ||
| 640 | - else if (!strcmp ("cell_odd_ruled", detail) || | ||
| 641 | - !strcmp ("cell_odd_ruled_sorted", detail)) | ||
| 642 | - { | ||
| 643 | - if (GTK_WIDGET_HAS_FOCUS (widget)) | ||
| 644 | - freeme = get_darkened_gc (window, &style->base[state_type], 1); | ||
| 645 | - else | ||
| 646 | - freeme = get_darkened_gc (window, &style->base[GTK_STATE_ACTIVE], 1); | ||
| 647 | - gc1 = freeme; | ||
| 648 | - } | ||
| 649 | else | ||
| 650 | { | ||
| 651 | gc1 = style->bg_gc[state_type]; | ||
| 652 | @@ -3459,7 +3674,7 @@ | ||
| 653 | GdkColor *color = NULL; | ||
| 654 | |||
| 655 | gtk_widget_style_get (widget, | ||
| 656 | - "even-row-color", &color, | ||
| 657 | + "even_row_color", &color, | ||
| 658 | NULL); | ||
| 659 | |||
| 660 | if (color) | ||
| 661 | @@ -3477,7 +3692,7 @@ | ||
| 662 | GdkColor *color; | ||
| 663 | |||
| 664 | gtk_widget_style_get (widget, | ||
| 665 | - "odd-row-color", &color, | ||
| 666 | + "odd_row_color", &color, | ||
| 667 | NULL); | ||
| 668 | |||
| 669 | if (color) | ||
| 670 | @@ -3490,7 +3705,7 @@ | ||
| 671 | else | ||
| 672 | { | ||
| 673 | gtk_widget_style_get (widget, | ||
| 674 | - "even-row-color", &color, | ||
| 675 | + "even_row_color", &color, | ||
| 676 | NULL); | ||
| 677 | |||
| 678 | if (color) | ||
| 679 | @@ -3511,11 +3726,11 @@ | ||
| 680 | |||
| 681 | if (!strcmp ("cell_odd_sorted", detail)) | ||
| 682 | gtk_widget_style_get (widget, | ||
| 683 | - "odd-row-color", &color, | ||
| 684 | + "odd_row_color", &color, | ||
| 685 | NULL); | ||
| 686 | else | ||
| 687 | gtk_widget_style_get (widget, | ||
| 688 | - "even-row-color", &color, | ||
| 689 | + "even_row_color", &color, | ||
| 690 | NULL); | ||
| 691 | |||
| 692 | if (color) | ||
| 693 | @@ -3536,7 +3751,7 @@ | ||
| 694 | GdkColor *color = NULL; | ||
| 695 | |||
| 696 | gtk_widget_style_get (widget, | ||
| 697 | - "odd-row-color", &color, | ||
| 698 | + "odd_row_color", &color, | ||
| 699 | NULL); | ||
| 700 | |||
| 701 | if (color) | ||
| 702 | @@ -3549,7 +3764,7 @@ | ||
| 703 | else | ||
| 704 | { | ||
| 705 | gtk_widget_style_get (widget, | ||
| 706 | - "even-row-color", &color, | ||
| 707 | + "even_row_color", &color, | ||
| 708 | NULL); | ||
| 709 | |||
| 710 | if (color) | ||
| 711 | @@ -3595,6 +3810,21 @@ | ||
| 712 | g_object_unref (freeme); | ||
| 713 | } | ||
| 714 | |||
| 715 | +static GdkGC * | ||
| 716 | +create_aa_gc (GdkWindow *window, GtkStyle *style, GtkStateType state_type) | ||
| 717 | +{ | ||
| 718 | + GdkColor aa_color; | ||
| 719 | + GdkGC *gc = gdk_gc_new (window); | ||
| 720 | + | ||
| 721 | + aa_color.red = (style->fg[state_type].red + style->bg[state_type].red) / 2; | ||
| 722 | + aa_color.green = (style->fg[state_type].green + style->bg[state_type].green) / 2; | ||
| 723 | + aa_color.blue = (style->fg[state_type].blue + style->bg[state_type].blue) / 2; | ||
| 724 | + | ||
| 725 | + gdk_gc_set_rgb_fg_color (gc, &aa_color); | ||
| 726 | + | ||
| 727 | + return gc; | ||
| 728 | +} | ||
| 729 | + | ||
| 730 | static void | ||
| 731 | gtk_default_draw_check (GtkStyle *style, | ||
| 732 | GdkWindow *window, | ||
| 733 | @@ -3608,116 +3838,92 @@ | ||
| 734 | gint width, | ||
| 735 | gint height) | ||
| 736 | { | ||
| 737 | - cairo_t *cr = gdk_cairo_create (window); | ||
| 738 | - enum { BUTTON, MENU, CELL } type = BUTTON; | ||
| 739 | - int exterior_size; | ||
| 740 | - int interior_size; | ||
| 741 | - int pad; | ||
| 742 | - | ||
| 743 | - if (detail) | ||
| 744 | - { | ||
| 745 | - if (strcmp (detail, "cellcheck") == 0) | ||
| 746 | - type = CELL; | ||
| 747 | - else if (strcmp (detail, "check") == 0) | ||
| 748 | - type = MENU; | ||
| 749 | - } | ||
| 750 | - | ||
| 751 | - if (area) | ||
| 752 | + if (detail && strcmp (detail, "cellcheck") == 0) | ||
| 753 | { | ||
| 754 | - gdk_cairo_rectangle (cr, area); | ||
| 755 | - cairo_clip (cr); | ||
| 756 | + if (area) | ||
| 757 | + gdk_gc_set_clip_rectangle (widget->style->base_gc[state_type], area); | ||
| 758 | + gdk_draw_rectangle (window, | ||
| 759 | + widget->style->base_gc[state_type], | ||
| 760 | + TRUE, | ||
| 761 | + x, y, | ||
| 762 | + width, height); | ||
| 763 | + if (area) | ||
| 764 | + { | ||
| 765 | + gdk_gc_set_clip_rectangle (widget->style->base_gc[state_type], NULL); | ||
| 766 | + gdk_gc_set_clip_rectangle (widget->style->text_gc[state_type], area); | ||
| 767 | + } | ||
| 768 | + gdk_draw_rectangle (window, | ||
| 769 | + widget->style->text_gc[state_type], | ||
| 770 | + FALSE, | ||
| 771 | + x, y, | ||
| 772 | + width, height); | ||
| 773 | + if (area) | ||
| 774 | + gdk_gc_set_clip_rectangle (widget->style->text_gc[state_type], NULL); | ||
| 775 | + | ||
| 776 | + x -= (1 + INDICATOR_PART_SIZE - width) / 2; | ||
| 777 | + y -= (((1 + INDICATOR_PART_SIZE - height) / 2) - 1); | ||
| 778 | + if (shadow_type == GTK_SHADOW_IN) | ||
| 779 | + { | ||
| 780 | + draw_part (window, style->text_gc[state_type], area, x, y, CHECK_TEXT); | ||
| 781 | + draw_part (window, style->text_aa_gc[state_type], area, x, y, CHECK_AA); | ||
| 782 | + } | ||
| 783 | + else if (shadow_type == GTK_SHADOW_ETCHED_IN) /* inconsistent */ | ||
| 784 | + { | ||
| 785 | + draw_part (window, style->text_gc[state_type], area, x, y, CHECK_INCONSISTENT_TEXT); | ||
| 786 | + } | ||
| 787 | } | ||
| 788 | - | ||
| 789 | - exterior_size = MIN (width, height); | ||
| 790 | - if (exterior_size % 2 == 0) /* Ensure odd */ | ||
| 791 | - exterior_size -= -1; | ||
| 792 | - | ||
| 793 | - pad = style->xthickness + MAX (1, (exterior_size - 2 * style->xthickness) / 9); | ||
| 794 | - interior_size = MAX (1, exterior_size - 2 * pad); | ||
| 795 | - | ||
| 796 | - if (interior_size < 7) | ||
| 797 | + else | ||
| 798 | { | ||
| 799 | - interior_size = 7; | ||
| 800 | - pad = MAX (0, (exterior_size - interior_size) / 2); | ||
| 801 | - } | ||
| 802 | + GdkGC *free_me = NULL; | ||
| 803 | + | ||
| 804 | + GdkGC *base_gc; | ||
| 805 | + GdkGC *text_gc; | ||
| 806 | + GdkGC *aa_gc; | ||
| 807 | |||
| 808 | - x -= (1 + exterior_size - width) / 2; | ||
| 809 | - y -= (1 + exterior_size - height) / 2; | ||
| 810 | + x -= (1 + INDICATOR_PART_SIZE - width) / 2; | ||
| 811 | + y -= (1 + INDICATOR_PART_SIZE - height) / 2; | ||
| 812 | |||
| 813 | - switch (type) | ||
| 814 | - { | ||
| 815 | - case BUTTON: | ||
| 816 | - case CELL: | ||
| 817 | - if (type == BUTTON) | ||
| 818 | - gdk_cairo_set_source_color (cr, &style->fg[state_type]); | ||
| 819 | + if (detail && strcmp (detail, "check") == 0) /* Menu item */ | ||
| 820 | + { | ||
| 821 | + text_gc = style->fg_gc[state_type]; | ||
| 822 | + base_gc = style->bg_gc[state_type]; | ||
| 823 | + aa_gc = free_me = create_aa_gc (window, style, state_type); | ||
| 824 | + } | ||
| 825 | else | ||
| 826 | - gdk_cairo_set_source_color (cr, &style->text[state_type]); | ||
| 827 | - | ||
| 828 | - cairo_set_line_width (cr, 1.0); | ||
| 829 | - cairo_rectangle (cr, x + 0.5, y + 0.5, exterior_size - 1, exterior_size - 1); | ||
| 830 | - cairo_stroke (cr); | ||
| 831 | + { | ||
| 832 | + if (state_type == GTK_STATE_ACTIVE) | ||
| 833 | + { | ||
| 834 | + text_gc = style->fg_gc[state_type]; | ||
| 835 | + base_gc = style->bg_gc[state_type]; | ||
| 836 | + aa_gc = free_me = create_aa_gc (window, style, state_type); | ||
| 837 | + } | ||
| 838 | + else | ||
| 839 | + { | ||
| 840 | + text_gc = style->text_gc[state_type]; | ||
| 841 | + base_gc = style->base_gc[state_type]; | ||
| 842 | + aa_gc = style->text_aa_gc[state_type]; | ||
| 843 | + } | ||
| 844 | |||
| 845 | - gdk_cairo_set_source_color (cr, &style->base[state_type]); | ||
| 846 | - cairo_rectangle (cr, x + 1, y + 1, exterior_size - 2, exterior_size - 2); | ||
| 847 | - cairo_fill (cr); | ||
| 848 | - break; | ||
| 849 | + draw_part (window, base_gc, area, x, y, CHECK_BASE); | ||
| 850 | + draw_part (window, style->black_gc, area, x, y, CHECK_BLACK); | ||
| 851 | + draw_part (window, style->dark_gc[state_type], area, x, y, CHECK_DARK); | ||
| 852 | + draw_part (window, style->mid_gc[state_type], area, x, y, CHECK_MID); | ||
| 853 | + draw_part (window, style->light_gc[state_type], area, x, y, CHECK_LIGHT); | ||
| 854 | + } | ||
| 855 | |||
| 856 | - case MENU: | ||
| 857 | - break; | ||
| 858 | - } | ||
| 859 | - | ||
| 860 | - switch (type) | ||
| 861 | - { | ||
| 862 | - case BUTTON: | ||
| 863 | - case CELL: | ||
| 864 | - gdk_cairo_set_source_color (cr, &style->text[state_type]); | ||
| 865 | - break; | ||
| 866 | - case MENU: | ||
| 867 | - gdk_cairo_set_source_color (cr, &style->fg[state_type]); | ||
| 868 | - break; | ||
| 869 | - } | ||
| 870 | + if (shadow_type == GTK_SHADOW_IN) | ||
| 871 | + { | ||
| 872 | + draw_part (window, text_gc, area, x, y, CHECK_TEXT); | ||
| 873 | + draw_part (window, aa_gc, area, x, y, CHECK_AA); | ||
| 874 | + } | ||
| 875 | + else if (shadow_type == GTK_SHADOW_ETCHED_IN) /* inconsistent */ | ||
| 876 | + { | ||
| 877 | + draw_part (window, text_gc, area, x, y, CHECK_INCONSISTENT_TEXT); | ||
| 878 | + } | ||
| 879 | |||
| 880 | - if (shadow_type == GTK_SHADOW_IN) | ||
| 881 | - { | ||
| 882 | - cairo_translate (cr, | ||
| 883 | - x + pad, y + pad); | ||
| 884 | - | ||
| 885 | - cairo_scale (cr, interior_size / 7., interior_size / 7.); | ||
| 886 | - | ||
| 887 | - cairo_move_to (cr, 7.0, 0.0); | ||
| 888 | - cairo_line_to (cr, 7.5, 1.0); | ||
| 889 | - cairo_curve_to (cr, 5.3, 2.0, | ||
| 890 | - 4.3, 4.0, | ||
| 891 | - 3.5, 7.0); | ||
| 892 | - cairo_curve_to (cr, 3.0, 5.7, | ||
| 893 | - 1.3, 4.7, | ||
| 894 | - 0.0, 4.7); | ||
| 895 | - cairo_line_to (cr, 0.2, 3.5); | ||
| 896 | - cairo_curve_to (cr, 1.1, 3.5, | ||
| 897 | - 2.3, 4.3, | ||
| 898 | - 3.0, 5.0); | ||
| 899 | - cairo_curve_to (cr, 1.0, 3.9, | ||
| 900 | - 2.4, 4.1, | ||
| 901 | - 3.2, 4.9); | ||
| 902 | - cairo_curve_to (cr, 3.5, 3.1, | ||
| 903 | - 5.2, 2.0, | ||
| 904 | - 7.0, 0.0); | ||
| 905 | - | ||
| 906 | - cairo_fill (cr); | ||
| 907 | - } | ||
| 908 | - else if (shadow_type == GTK_SHADOW_ETCHED_IN) /* inconsistent */ | ||
| 909 | - { | ||
| 910 | - int line_thickness = MAX (1, (3 + interior_size * 2) / 7); | ||
| 911 | - | ||
| 912 | - cairo_rectangle (cr, | ||
| 913 | - x + pad, | ||
| 914 | - y + pad + (1 + interior_size - line_thickness) / 2, | ||
| 915 | - interior_size, | ||
| 916 | - line_thickness); | ||
| 917 | - cairo_fill (cr); | ||
| 918 | + if (free_me) | ||
| 919 | + g_object_unref (free_me); | ||
| 920 | } | ||
| 921 | - | ||
| 922 | - cairo_destroy (cr); | ||
| 923 | } | ||
| 924 | |||
| 925 | static void | ||
| 926 | @@ -3733,111 +3939,96 @@ | ||
| 927 | gint width, | ||
| 928 | gint height) | ||
| 929 | { | ||
| 930 | - cairo_t *cr = gdk_cairo_create (window); | ||
| 931 | - enum { BUTTON, MENU, CELL } type = BUTTON; | ||
| 932 | - int exterior_size; | ||
| 933 | - | ||
| 934 | - if (detail) | ||
| 935 | + if (detail && strcmp (detail, "cellradio") == 0) | ||
| 936 | { | ||
| 937 | - if (strcmp (detail, "radio") == 0) | ||
| 938 | - type = CELL; | ||
| 939 | - else if (strcmp (detail, "option") == 0) | ||
| 940 | - type = MENU; | ||
| 941 | - } | ||
| 942 | - | ||
| 943 | - if (area) | ||
| 944 | - { | ||
| 945 | - gdk_cairo_rectangle (cr, area); | ||
| 946 | - cairo_clip (cr); | ||
| 947 | + if (area) | ||
| 948 | + gdk_gc_set_clip_rectangle (widget->style->fg_gc[state_type], area); | ||
| 949 | + gdk_draw_arc (window, | ||
| 950 | + widget->style->fg_gc[state_type], | ||
| 951 | + FALSE, | ||
| 952 | + x, y, | ||
| 953 | + width, | ||
| 954 | + height, | ||
| 955 | + 0, 360*64); | ||
| 956 | + | ||
| 957 | + if (shadow_type == GTK_SHADOW_IN) | ||
| 958 | + { | ||
| 959 | + gdk_draw_arc (window, | ||
| 960 | + widget->style->fg_gc[state_type], | ||
| 961 | + TRUE, | ||
| 962 | + x + 2, | ||
| 963 | + y + 2, | ||
| 964 | + width - 4, | ||
| 965 | + height - 4, | ||
| 966 | + 0, 360*64); | ||
| 967 | + } | ||
| 968 | + else if (shadow_type == GTK_SHADOW_ETCHED_IN) /* inconsistent */ | ||
| 969 | + { | ||
| 970 | + draw_part (window, widget->style->fg_gc[state_type], | ||
| 971 | + area, x, y, CHECK_INCONSISTENT_TEXT); | ||
| 972 | + } | ||
| 973 | + if (area) | ||
| 974 | + gdk_gc_set_clip_rectangle (widget->style->fg_gc[state_type], NULL); | ||
| 975 | } | ||
| 976 | - | ||
| 977 | - exterior_size = MIN (width, height); | ||
| 978 | - if (exterior_size % 2 == 0) /* Ensure odd */ | ||
| 979 | - exterior_size -= -1; | ||
| 980 | - | ||
| 981 | - x -= (1 + exterior_size - width) / 2; | ||
| 982 | - y -= (1 + exterior_size - height) / 2; | ||
| 983 | - | ||
| 984 | - switch (type) | ||
| 985 | + else | ||
| 986 | { | ||
| 987 | - case BUTTON: | ||
| 988 | - case CELL: | ||
| 989 | - gdk_cairo_set_source_color (cr, &style->base[state_type]); | ||
| 990 | + GdkGC *free_me = NULL; | ||
| 991 | |||
| 992 | - cairo_arc (cr, | ||
| 993 | - x + exterior_size / 2., | ||
| 994 | - y + exterior_size / 2., | ||
| 995 | - (exterior_size - 1) / 2., | ||
| 996 | - 0, 2 * G_PI); | ||
| 997 | + GdkGC *base_gc; | ||
| 998 | + GdkGC *text_gc; | ||
| 999 | + GdkGC *aa_gc; | ||
| 1000 | |||
| 1001 | - cairo_fill_preserve (cr); | ||
| 1002 | + x -= (1 + INDICATOR_PART_SIZE - width) / 2; | ||
| 1003 | + y -= (1 + INDICATOR_PART_SIZE - height) / 2; | ||
| 1004 | |||
| 1005 | - if (type == BUTTON) | ||
| 1006 | - gdk_cairo_set_source_color (cr, &style->fg[state_type]); | ||
| 1007 | + if (detail && strcmp (detail, "option") == 0) /* Menu item */ | ||
| 1008 | + { | ||
| 1009 | + text_gc = style->fg_gc[state_type]; | ||
| 1010 | + base_gc = style->bg_gc[state_type]; | ||
| 1011 | + aa_gc = free_me = create_aa_gc (window, style, state_type); | ||
| 1012 | + } | ||
| 1013 | else | ||
| 1014 | - gdk_cairo_set_source_color (cr, &style->text[state_type]); | ||
| 1015 | - | ||
| 1016 | - cairo_set_line_width (cr, 1.); | ||
| 1017 | - cairo_stroke (cr); | ||
| 1018 | - break; | ||
| 1019 | - | ||
| 1020 | - case MENU: | ||
| 1021 | - break; | ||
| 1022 | - } | ||
| 1023 | - | ||
| 1024 | - switch (type) | ||
| 1025 | - { | ||
| 1026 | - case BUTTON: | ||
| 1027 | - gdk_cairo_set_source_color (cr, &style->text[state_type]); | ||
| 1028 | - break; | ||
| 1029 | - case CELL: | ||
| 1030 | - break; | ||
| 1031 | - case MENU: | ||
| 1032 | - gdk_cairo_set_source_color (cr, &style->fg[state_type]); | ||
| 1033 | - break; | ||
| 1034 | - } | ||
| 1035 | + { | ||
| 1036 | + if (state_type == GTK_STATE_ACTIVE) | ||
| 1037 | + { | ||
| 1038 | + text_gc = style->fg_gc[state_type]; | ||
| 1039 | + base_gc = style->bg_gc[state_type]; | ||
| 1040 | + aa_gc = free_me = create_aa_gc (window, style, state_type); | ||
| 1041 | + } | ||
| 1042 | + else | ||
| 1043 | + { | ||
| 1044 | + text_gc = style->text_gc[state_type]; | ||
| 1045 | + base_gc = style->base_gc[state_type]; | ||
| 1046 | + aa_gc = style->text_aa_gc[state_type]; | ||
| 1047 | + } | ||
| 1048 | |||
| 1049 | - if (shadow_type == GTK_SHADOW_IN) | ||
| 1050 | - { | ||
| 1051 | - int pad = style->xthickness + MAX (1, 2 * (exterior_size - 2 * style->xthickness) / 9); | ||
| 1052 | - int interior_size = MAX (1, exterior_size - 2 * pad); | ||
| 1053 | + draw_part (window, base_gc, area, x, y, RADIO_BASE); | ||
| 1054 | + draw_part (window, style->black_gc, area, x, y, RADIO_BLACK); | ||
| 1055 | + draw_part (window, style->dark_gc[state_type], area, x, y, RADIO_DARK); | ||
| 1056 | + draw_part (window, style->mid_gc[state_type], area, x, y, RADIO_MID); | ||
| 1057 | + draw_part (window, style->light_gc[state_type], area, x, y, RADIO_LIGHT); | ||
| 1058 | + } | ||
| 1059 | |||
| 1060 | - if (interior_size < 5) | ||
| 1061 | + if (shadow_type == GTK_SHADOW_IN) | ||
| 1062 | { | ||
| 1063 | - interior_size = 7; | ||
| 1064 | - pad = MAX (0, (exterior_size - interior_size) / 2); | ||
| 1065 | + draw_part (window, text_gc, area, x, y, RADIO_TEXT); | ||
| 1066 | } | ||
| 1067 | - | ||
| 1068 | - cairo_arc (cr, | ||
| 1069 | - x + pad + interior_size / 2., | ||
| 1070 | - y + pad + interior_size / 2., | ||
| 1071 | - interior_size / 2., | ||
| 1072 | - 0, 2 * G_PI); | ||
| 1073 | - cairo_fill (cr); | ||
| 1074 | - } | ||
| 1075 | - else if (shadow_type == GTK_SHADOW_ETCHED_IN) /* inconsistent */ | ||
| 1076 | - { | ||
| 1077 | - int pad = style->xthickness + MAX (1, (exterior_size - 2 * style->xthickness) / 9); | ||
| 1078 | - int interior_size = MAX (1, exterior_size - 2 * pad); | ||
| 1079 | - int line_thickness; | ||
| 1080 | - | ||
| 1081 | - if (interior_size < 7) | ||
| 1082 | + else if (shadow_type == GTK_SHADOW_ETCHED_IN) /* inconsistent */ | ||
| 1083 | { | ||
| 1084 | - interior_size = 7; | ||
| 1085 | - pad = MAX (0, (exterior_size - interior_size) / 2); | ||
| 1086 | + if (detail && strcmp (detail, "option") == 0) /* Menu item */ | ||
| 1087 | + { | ||
| 1088 | + draw_part (window, text_gc, area, x, y, CHECK_INCONSISTENT_TEXT); | ||
| 1089 | + } | ||
| 1090 | + else | ||
| 1091 | + { | ||
| 1092 | + draw_part (window, text_gc, area, x, y, RADIO_INCONSISTENT_TEXT); | ||
| 1093 | + draw_part (window, aa_gc, area, x, y, RADIO_INCONSISTENT_AA); | ||
| 1094 | + } | ||
| 1095 | } | ||
| 1096 | |||
| 1097 | - line_thickness = MAX (1, (3 + interior_size * 2) / 7); | ||
| 1098 | - | ||
| 1099 | - cairo_rectangle (cr, | ||
| 1100 | - x + pad, | ||
| 1101 | - y + pad + (interior_size - line_thickness) / 2., | ||
| 1102 | - interior_size, | ||
| 1103 | - line_thickness); | ||
| 1104 | - cairo_fill (cr); | ||
| 1105 | + if (free_me) | ||
| 1106 | + g_object_unref (free_me); | ||
| 1107 | } | ||
| 1108 | - | ||
| 1109 | - cairo_destroy (cr); | ||
| 1110 | } | ||
| 1111 | |||
| 1112 | static void | ||
| 1113 | @@ -3869,21 +4060,21 @@ | ||
| 1114 | |||
| 1115 | if (state_type == GTK_STATE_INSENSITIVE) | ||
| 1116 | { | ||
| 1117 | - draw_arrow (window, &style->white, area, | ||
| 1118 | + draw_arrow (window, style->white_gc, area, | ||
| 1119 | GTK_ARROW_UP, x + 1, y + 1, | ||
| 1120 | indicator_size.width, arrow_height); | ||
| 1121 | |||
| 1122 | - draw_arrow (window, &style->white, area, | ||
| 1123 | + draw_arrow (window, style->white_gc, area, | ||
| 1124 | GTK_ARROW_DOWN, x + 1, y + arrow_height + ARROW_SPACE + 1, | ||
| 1125 | indicator_size.width, arrow_height); | ||
| 1126 | } | ||
| 1127 | |||
| 1128 | - draw_arrow (window, &style->fg[state_type], area, | ||
| 1129 | + draw_arrow (window, style->fg_gc[state_type], area, | ||
| 1130 | GTK_ARROW_UP, x, y, | ||
| 1131 | indicator_size.width, arrow_height); | ||
| 1132 | |||
| 1133 | |||
| 1134 | - draw_arrow (window, &style->fg[state_type], area, | ||
| 1135 | + draw_arrow (window, style->fg_gc[state_type], area, | ||
| 1136 | GTK_ARROW_DOWN, x, y + arrow_height + ARROW_SPACE, | ||
| 1137 | indicator_size.width, arrow_height); | ||
| 1138 | } | ||
| 1139 | @@ -3909,6 +4100,9 @@ | ||
| 1140 | GdkGC *gc3 = NULL; | ||
| 1141 | GdkGC *gc4 = NULL; | ||
| 1142 | |||
| 1143 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1144 | + g_return_if_fail (window != NULL); | ||
| 1145 | + | ||
| 1146 | sanitize_size (window, &width, &height); | ||
| 1147 | |||
| 1148 | switch (shadow_type) | ||
| 1149 | @@ -4122,6 +4316,9 @@ | ||
| 1150 | GdkGC *gc3 = NULL; | ||
| 1151 | GdkGC *gc4 = NULL; | ||
| 1152 | |||
| 1153 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1154 | + g_return_if_fail (window != NULL); | ||
| 1155 | + | ||
| 1156 | gtk_style_apply_default_background (style, window, | ||
| 1157 | widget && !GTK_WIDGET_NO_WINDOW (widget), | ||
| 1158 | state_type, area, x, y, width, height); | ||
| 1159 | @@ -4338,6 +4535,9 @@ | ||
| 1160 | GdkGC *gc3 = NULL; | ||
| 1161 | GdkGC *gc4 = NULL; | ||
| 1162 | |||
| 1163 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1164 | + g_return_if_fail (window != NULL); | ||
| 1165 | + | ||
| 1166 | gtk_style_apply_default_background (style, window, | ||
| 1167 | widget && !GTK_WIDGET_NO_WINDOW (widget), | ||
| 1168 | GTK_STATE_NORMAL, area, x, y, width, height); | ||
| 1169 | @@ -4503,10 +4703,12 @@ | ||
| 1170 | gint width, | ||
| 1171 | gint height) | ||
| 1172 | { | ||
| 1173 | - cairo_t *cr; | ||
| 1174 | + GdkPoint points[5]; | ||
| 1175 | + GdkGC *gc; | ||
| 1176 | gboolean free_dash_list = FALSE; | ||
| 1177 | gint line_width = 1; | ||
| 1178 | gint8 *dash_list = "\1\1"; | ||
| 1179 | + gint dash_len; | ||
| 1180 | |||
| 1181 | if (widget) | ||
| 1182 | { | ||
| 1183 | @@ -4518,6 +4720,22 @@ | ||
| 1184 | free_dash_list = TRUE; | ||
| 1185 | } | ||
| 1186 | |||
| 1187 | + sanitize_size (window, &width, &height); | ||
| 1188 | + | ||
| 1189 | + if (detail && !strcmp (detail, "colorwheel_light")) | ||
| 1190 | + gc = style->black_gc; | ||
| 1191 | + else if (detail && !strcmp (detail, "colorwheel_dark")) | ||
| 1192 | + gc = style->white_gc; | ||
| 1193 | + else | ||
| 1194 | + gc = style->fg_gc[state_type]; | ||
| 1195 | + | ||
| 1196 | + gdk_gc_set_line_attributes (gc, line_width, | ||
| 1197 | + dash_list[0] ? GDK_LINE_ON_OFF_DASH : GDK_LINE_SOLID, | ||
| 1198 | + GDK_CAP_BUTT, GDK_JOIN_MITER); | ||
| 1199 | + | ||
| 1200 | + if (area) | ||
| 1201 | + gdk_gc_set_clip_rectangle (gc, area); | ||
| 1202 | + | ||
| 1203 | if (detail && !strcmp (detail, "add-mode")) | ||
| 1204 | { | ||
| 1205 | if (free_dash_list) | ||
| 1206 | @@ -4527,59 +4745,88 @@ | ||
| 1207 | free_dash_list = FALSE; | ||
| 1208 | } | ||
| 1209 | |||
| 1210 | - sanitize_size (window, &width, &height); | ||
| 1211 | + points[0].x = x + line_width / 2; | ||
| 1212 | + points[0].y = y + line_width / 2; | ||
| 1213 | + points[1].x = x + width - line_width + line_width / 2; | ||
| 1214 | + points[1].y = y + line_width / 2; | ||
| 1215 | + points[2].x = x + width - line_width + line_width / 2; | ||
| 1216 | + points[2].y = y + height - line_width + line_width / 2; | ||
| 1217 | + points[3].x = x + line_width / 2; | ||
| 1218 | + points[3].y = y + height - line_width + line_width / 2; | ||
| 1219 | + points[4] = points[0]; | ||
| 1220 | |||
| 1221 | - cr = gdk_cairo_create (window); | ||
| 1222 | - | ||
| 1223 | - if (detail && !strcmp (detail, "colorwheel_light")) | ||
| 1224 | - cairo_set_source_rgb (cr, 0., 0., 0.); | ||
| 1225 | - else if (detail && !strcmp (detail, "colorwheel_dark")) | ||
| 1226 | - cairo_set_source_rgb (cr, 1., 1., 1.); | ||
| 1227 | + if (!dash_list[0]) | ||
| 1228 | + { | ||
| 1229 | + gdk_draw_lines (window, gc, points, 5); | ||
| 1230 | + } | ||
| 1231 | else | ||
| 1232 | - gdk_cairo_set_source_color (cr, &style->fg[state_type]); | ||
| 1233 | - | ||
| 1234 | - cairo_set_line_width (cr, line_width); | ||
| 1235 | - | ||
| 1236 | - if (dash_list[0]) | ||
| 1237 | { | ||
| 1238 | - gint n_dashes = strlen (dash_list); | ||
| 1239 | - gdouble *dashes = g_new (gdouble, n_dashes); | ||
| 1240 | - gdouble total_length = 0; | ||
| 1241 | - gdouble dash_offset; | ||
| 1242 | - gint i; | ||
| 1243 | - | ||
| 1244 | - for (i = 0; i < n_dashes; i++) | ||
| 1245 | + /* We go through all the pain below because the X rasterization | ||
| 1246 | + * rules don't really work right for dashed lines if you | ||
| 1247 | + * want continuity in segments that go between top/right | ||
| 1248 | + * and left/bottom. For instance, a top left corner | ||
| 1249 | + * with a 1-1 dash is drawn as: | ||
| 1250 | + * | ||
| 1251 | + * X X X | ||
| 1252 | + * X | ||
| 1253 | + * | ||
| 1254 | + * X | ||
| 1255 | + * | ||
| 1256 | + * This is because pixels on the top and left boundaries | ||
| 1257 | + * of polygons are drawn, but not on the bottom and right. | ||
| 1258 | + * So, if you have a line going up that turns the corner | ||
| 1259 | + * and goes right, there is a one pixel shift in the pattern. | ||
| 1260 | + * | ||
| 1261 | + * So, to fix this, we drawn the top and right in one call, | ||
| 1262 | + * then the left and bottom in another call, fixing up | ||
| 1263 | + * the dash offset for the second call ourselves to get | ||
| 1264 | + * continuity at the upper left. | ||
| 1265 | + * | ||
| 1266 | + * It's not perfect since we really should have a join at | ||
| 1267 | + * the upper left and lower right instead of two intersecting | ||
| 1268 | + * lines but that's only really apparent for no-dashes, | ||
| 1269 | + * which (for this reason) are done as one polygon and | ||
| 1270 | + * don't to through this code path. | ||
| 1271 | + */ | ||
| 1272 | + | ||
| 1273 | + dash_len = strlen (dash_list); | ||
| 1274 | + | ||
| 1275 | + if (dash_list[0]) | ||
| 1276 | + gdk_gc_set_dashes (gc, 0, dash_list, dash_len); | ||
| 1277 | + | ||
| 1278 | + gdk_draw_lines (window, gc, points, 3); | ||
| 1279 | + | ||
| 1280 | + /* We draw this line one farther over than it is "supposed" to | ||
| 1281 | + * because of another rasterization problem ... if two 1 pixel | ||
| 1282 | + * unjoined lines meet at the lower right, there will be a missing | ||
| 1283 | + * pixel. | ||
| 1284 | + */ | ||
| 1285 | + points[2].x += 1; | ||
| 1286 | + | ||
| 1287 | + if (dash_list[0]) | ||
| 1288 | { | ||
| 1289 | - dashes[i] = dash_list[i]; | ||
| 1290 | - total_length += dash_list[i]; | ||
| 1291 | + gint dash_pixels = 0; | ||
| 1292 | + gint i; | ||
| 1293 | + | ||
| 1294 | + /* Adjust the dash offset for the bottom and left so we | ||
| 1295 | + * match up at the upper left. | ||
| 1296 | + */ | ||
| 1297 | + for (i = 0; i < dash_len; i++) | ||
| 1298 | + dash_pixels += dash_list[i]; | ||
| 1299 | + | ||
| 1300 | + if (dash_len % 2 == 1) | ||
| 1301 | + dash_pixels *= 2; | ||
| 1302 | + | ||
| 1303 | + gdk_gc_set_dashes (gc, dash_pixels - (width + height - 2 * line_width) % dash_pixels, dash_list, dash_len); | ||
| 1304 | } | ||
| 1305 | - | ||
| 1306 | - /* The dash offset here aligns the pattern to integer pixels | ||
| 1307 | - * by starting the dash at the right side of the left border | ||
| 1308 | - * Negative dash offsets in cairo don't work | ||
| 1309 | - * (https://bugs.freedesktop.org/show_bug.cgi?id=2729) | ||
| 1310 | - */ | ||
| 1311 | - dash_offset = - line_width / 2.; | ||
| 1312 | - while (dash_offset < 0) | ||
| 1313 | - dash_offset += total_length; | ||
| 1314 | |||
| 1315 | - cairo_set_dash (cr, dashes, n_dashes, dash_offset); | ||
| 1316 | - g_free (dashes); | ||
| 1317 | + gdk_draw_lines (window, gc, points + 2, 3); | ||
| 1318 | } | ||
| 1319 | |||
| 1320 | - if (area) | ||
| 1321 | - { | ||
| 1322 | - gdk_cairo_rectangle (cr, area); | ||
| 1323 | - cairo_clip (cr); | ||
| 1324 | - } | ||
| 1325 | + gdk_gc_set_line_attributes (gc, 0, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER); | ||
| 1326 | |||
| 1327 | - cairo_rectangle (cr, | ||
| 1328 | - x + line_width / 2., | ||
| 1329 | - y + line_width / 2., | ||
| 1330 | - width - line_width, | ||
| 1331 | - height - line_width); | ||
| 1332 | - cairo_stroke (cr); | ||
| 1333 | - cairo_destroy (cr); | ||
| 1334 | + if (area) | ||
| 1335 | + gdk_gc_set_clip_rectangle (gc, NULL); | ||
| 1336 | |||
| 1337 | if (free_dash_list) | ||
| 1338 | g_free (dash_list); | ||
| 1339 | @@ -4599,6 +4846,9 @@ | ||
| 1340 | gint height, | ||
| 1341 | GtkOrientation orientation) | ||
| 1342 | { | ||
| 1343 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1344 | + g_return_if_fail (window != NULL); | ||
| 1345 | + | ||
| 1346 | sanitize_size (window, &width, &height); | ||
| 1347 | |||
| 1348 | gtk_paint_box (style, window, state_type, shadow_type, | ||
| 1349 | @@ -4627,6 +4877,7 @@ | ||
| 1350 | gint y, | ||
| 1351 | gushort size) | ||
| 1352 | { | ||
| 1353 | + | ||
| 1354 | size = CLAMP (size, 2, 3); | ||
| 1355 | |||
| 1356 | if (size == 2) | ||
| 1357 | @@ -4667,6 +4918,9 @@ | ||
| 1358 | GdkRectangle dest; | ||
| 1359 | gint intersect; | ||
| 1360 | |||
| 1361 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1362 | + g_return_if_fail (window != NULL); | ||
| 1363 | + | ||
| 1364 | sanitize_size (window, &width, &height); | ||
| 1365 | |||
| 1366 | gtk_paint_box (style, window, state_type, shadow_type, area, widget, | ||
| 1367 | @@ -4682,9 +4936,9 @@ | ||
| 1368 | if (state_type == GTK_STATE_SELECTED && widget && !GTK_WIDGET_HAS_FOCUS (widget)) | ||
| 1369 | { | ||
| 1370 | GdkColor unfocused_light; | ||
| 1371 | - | ||
| 1372 | + | ||
| 1373 | _gtk_style_shade (&style->base[GTK_STATE_ACTIVE], &unfocused_light, | ||
| 1374 | - LIGHTNESS_MULT); | ||
| 1375 | + LIGHTNESS_MULT); | ||
| 1376 | |||
| 1377 | light_gc = free_me = gdk_gc_new (window); | ||
| 1378 | gdk_gc_set_rgb_fg_color (light_gc, &unfocused_light); | ||
| 1379 | @@ -4750,6 +5004,72 @@ | ||
| 1380 | } | ||
| 1381 | |||
| 1382 | static void | ||
| 1383 | +create_expander_affine (gdouble affine[6], | ||
| 1384 | + gint degrees, | ||
| 1385 | + gint expander_size, | ||
| 1386 | + gint x, | ||
| 1387 | + gint y) | ||
| 1388 | +{ | ||
| 1389 | + gdouble s, c; | ||
| 1390 | + gdouble width; | ||
| 1391 | + gdouble height; | ||
| 1392 | + | ||
| 1393 | + width = expander_size / 4.0; | ||
| 1394 | + height = expander_size / 2.0; | ||
| 1395 | + | ||
| 1396 | + switch (degrees) | ||
| 1397 | + { | ||
| 1398 | + case 0: | ||
| 1399 | + s = 0.0; | ||
| 1400 | + c = 1.0; | ||
| 1401 | + break; | ||
| 1402 | + case 90: | ||
| 1403 | + s = 1.0; | ||
| 1404 | + c = 0.0; | ||
| 1405 | + break; | ||
| 1406 | + case 180: | ||
| 1407 | + s = 0.0; | ||
| 1408 | + c = -1.0; | ||
| 1409 | + break; | ||
| 1410 | + default: | ||
| 1411 | + s = sin (degrees * G_PI / 180.0); | ||
| 1412 | + c = cos (degrees * G_PI / 180.0); | ||
| 1413 | + break; | ||
| 1414 | + } | ||
| 1415 | + | ||
| 1416 | + affine[0] = c; | ||
| 1417 | + affine[1] = s; | ||
| 1418 | + affine[2] = -s; | ||
| 1419 | + affine[3] = c; | ||
| 1420 | + affine[4] = -width * c - height * -s + x; | ||
| 1421 | + affine[5] = -width * s - height * c + y; | ||
| 1422 | +} | ||
| 1423 | + | ||
| 1424 | +static void | ||
| 1425 | +apply_affine_on_point (double affine[6], GdkPoint *point) | ||
| 1426 | +{ | ||
| 1427 | + gdouble x, y; | ||
| 1428 | + | ||
| 1429 | + x = point->x * affine[0] + point->y * affine[2] + affine[4]; | ||
| 1430 | + y = point->x * affine[1] + point->y * affine[3] + affine[5]; | ||
| 1431 | + | ||
| 1432 | + point->x = floor (x); | ||
| 1433 | + point->y = floor (y); | ||
| 1434 | +} | ||
| 1435 | + | ||
| 1436 | +static void | ||
| 1437 | +gtk_style_draw_polygon_with_gc (GdkWindow *window, GdkGC *gc, gint line_width, | ||
| 1438 | + gboolean do_fill, GdkPoint *points, gint n_points) | ||
| 1439 | +{ | ||
| 1440 | + gdk_gc_set_line_attributes (gc, line_width, | ||
| 1441 | + GDK_LINE_SOLID, | ||
| 1442 | + GDK_CAP_BUTT, GDK_JOIN_MITER); | ||
| 1443 | + | ||
| 1444 | + gdk_draw_polygon (window, gc, do_fill, points, n_points); | ||
| 1445 | + gdk_gc_set_line_attributes (gc, 0, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER); | ||
| 1446 | +} | ||
| 1447 | + | ||
| 1448 | +static void | ||
| 1449 | gtk_default_draw_expander (GtkStyle *style, | ||
| 1450 | GdkWindow *window, | ||
| 1451 | GtkStateType state_type, | ||
| 1452 | @@ -4760,127 +5080,82 @@ | ||
| 1453 | gint y, | ||
| 1454 | GtkExpanderStyle expander_style) | ||
| 1455 | { | ||
| 1456 | -#define DEFAULT_EXPANDER_SIZE 12 | ||
| 1457 | - | ||
| 1458 | gint expander_size; | ||
| 1459 | - gint line_width; | ||
| 1460 | - double vertical_overshoot; | ||
| 1461 | - int diameter; | ||
| 1462 | - double radius; | ||
| 1463 | - double interp; /* interpolation factor for center position */ | ||
| 1464 | - double x_double_horz, y_double_horz; | ||
| 1465 | - double x_double_vert, y_double_vert; | ||
| 1466 | - double x_double, y_double; | ||
| 1467 | + GdkPoint points[3]; | ||
| 1468 | + gint i; | ||
| 1469 | + gint line_width, o; | ||
| 1470 | + gdouble affine[6]; | ||
| 1471 | gint degrees = 0; | ||
| 1472 | |||
| 1473 | - cairo_t *cr = gdk_cairo_create (window); | ||
| 1474 | - | ||
| 1475 | + gtk_widget_style_get (widget, | ||
| 1476 | + "expander-size", &expander_size, | ||
| 1477 | + NULL); | ||
| 1478 | + line_width = MAX (1, expander_size/9); | ||
| 1479 | + | ||
| 1480 | if (area) | ||
| 1481 | { | ||
| 1482 | - gdk_cairo_rectangle (cr, area); | ||
| 1483 | - cairo_clip (cr); | ||
| 1484 | + gdk_gc_set_clip_rectangle (style->fg_gc[GTK_STATE_NORMAL], area); | ||
| 1485 | + gdk_gc_set_clip_rectangle (style->base_gc[GTK_STATE_NORMAL], area); | ||
| 1486 | } | ||
| 1487 | |||
| 1488 | - if (widget && | ||
| 1489 | - gtk_widget_class_find_style_property (GTK_WIDGET_GET_CLASS (widget), | ||
| 1490 | - "expander-size")) | ||
| 1491 | - { | ||
| 1492 | - gtk_widget_style_get (widget, | ||
| 1493 | - "expander-size", &expander_size, | ||
| 1494 | - NULL); | ||
| 1495 | - } | ||
| 1496 | - else | ||
| 1497 | - expander_size = DEFAULT_EXPANDER_SIZE; | ||
| 1498 | - | ||
| 1499 | - line_width = MAX (1, expander_size/9); | ||
| 1500 | + /* a rough estimate of how much the joins of the triangle will overshoot. | ||
| 1501 | + * 2.4 ~ 1 / tan (45 / 2) | ||
| 1502 | + */ | ||
| 1503 | + o = ceil (2.4 * line_width / 2.0); | ||
| 1504 | + points[0].x = line_width / 2; | ||
| 1505 | + points[0].y = o; | ||
| 1506 | + points[1].x = expander_size / 2 + line_width / 2 - o; | ||
| 1507 | + points[1].y = expander_size / 2; | ||
| 1508 | + points[2].x = line_width / 2; | ||
| 1509 | + points[2].y = expander_size - o; | ||
| 1510 | |||
| 1511 | switch (expander_style) | ||
| 1512 | { | ||
| 1513 | case GTK_EXPANDER_COLLAPSED: | ||
| 1514 | degrees = (get_direction (widget) == GTK_TEXT_DIR_RTL) ? 180 : 0; | ||
| 1515 | - interp = 0.0; | ||
| 1516 | break; | ||
| 1517 | case GTK_EXPANDER_SEMI_COLLAPSED: | ||
| 1518 | degrees = (get_direction (widget) == GTK_TEXT_DIR_RTL) ? 150 : 30; | ||
| 1519 | - interp = 0.25; | ||
| 1520 | break; | ||
| 1521 | case GTK_EXPANDER_SEMI_EXPANDED: | ||
| 1522 | degrees = (get_direction (widget) == GTK_TEXT_DIR_RTL) ? 120 : 60; | ||
| 1523 | - interp = 0.75; | ||
| 1524 | break; | ||
| 1525 | case GTK_EXPANDER_EXPANDED: | ||
| 1526 | degrees = 90; | ||
| 1527 | - interp = 1.0; | ||
| 1528 | break; | ||
| 1529 | default: | ||
| 1530 | g_assert_not_reached (); | ||
| 1531 | } | ||
| 1532 | |||
| 1533 | - /* Compute distance that the stroke extends beyonds the end | ||
| 1534 | - * of the triangle we draw. | ||
| 1535 | - */ | ||
| 1536 | - vertical_overshoot = line_width / 2.0 * (1. / tan (G_PI / 8)); | ||
| 1537 | - | ||
| 1538 | - /* For odd line widths, we end the vertical line of the triangle | ||
| 1539 | - * at a half pixel, so we round differently. | ||
| 1540 | - */ | ||
| 1541 | - if (line_width % 2 == 1) | ||
| 1542 | - vertical_overshoot = ceil (0.5 + vertical_overshoot) - 0.5; | ||
| 1543 | - else | ||
| 1544 | - vertical_overshoot = ceil (vertical_overshoot); | ||
| 1545 | - | ||
| 1546 | - /* Adjust the size of the triangle we draw so that the entire stroke fits | ||
| 1547 | - */ | ||
| 1548 | - diameter = MAX (3, expander_size - 2 * vertical_overshoot); | ||
| 1549 | - | ||
| 1550 | - /* If the line width is odd, we want the diameter to be even, | ||
| 1551 | - * and vice versa, so force the sum to be odd. This relationship | ||
| 1552 | - * makes the point of the triangle look right. | ||
| 1553 | - */ | ||
| 1554 | - diameter -= (1 - (diameter + line_width) % 2); | ||
| 1555 | - | ||
| 1556 | - radius = diameter / 2.; | ||
| 1557 | - | ||
| 1558 | - /* Adjust the center so that the stroke is properly aligned with | ||
| 1559 | - * the pixel grid. The center adjustment is different for the | ||
| 1560 | - * horizontal and vertical orientations. For intermediate positions | ||
| 1561 | - * we interpolate between the two. | ||
| 1562 | - */ | ||
| 1563 | - x_double_vert = floor (x - (radius + line_width) / 2.) + (radius + line_width) / 2.; | ||
| 1564 | - y_double_vert = y - 0.5; | ||
| 1565 | - | ||
| 1566 | - x_double_horz = x - 0.5; | ||
| 1567 | - y_double_horz = floor (y - (radius + line_width) / 2.) + (radius + line_width) / 2.; | ||
| 1568 | - | ||
| 1569 | - x_double = x_double_vert * (1 - interp) + x_double_horz * interp; | ||
| 1570 | - y_double = y_double_vert * (1 - interp) + y_double_horz * interp; | ||
| 1571 | - | ||
| 1572 | - cairo_translate (cr, x_double, y_double); | ||
| 1573 | - cairo_rotate (cr, degrees * G_PI / 180); | ||
| 1574 | + create_expander_affine (affine, degrees, expander_size, x, y); | ||
| 1575 | |||
| 1576 | - cairo_move_to (cr, - radius / 2., - radius); | ||
| 1577 | - cairo_line_to (cr, radius / 2., 0); | ||
| 1578 | - cairo_line_to (cr, - radius / 2., radius); | ||
| 1579 | - cairo_close_path (cr); | ||
| 1580 | - | ||
| 1581 | - cairo_set_line_width (cr, line_width); | ||
| 1582 | + for (i = 0; i < 3; i++) | ||
| 1583 | + apply_affine_on_point (affine, &points[i]); | ||
| 1584 | |||
| 1585 | if (state_type == GTK_STATE_PRELIGHT) | ||
| 1586 | - gdk_cairo_set_source_color (cr, | ||
| 1587 | - &style->fg[GTK_STATE_PRELIGHT]); | ||
| 1588 | + { | ||
| 1589 | + gtk_style_draw_polygon_with_gc (window, style->fg_gc[GTK_STATE_PRELIGHT], | ||
| 1590 | + 1, TRUE, points, 3); | ||
| 1591 | + } | ||
| 1592 | else if (state_type == GTK_STATE_ACTIVE) | ||
| 1593 | - gdk_cairo_set_source_color (cr, | ||
| 1594 | - &style->light[GTK_STATE_ACTIVE]); | ||
| 1595 | + { | ||
| 1596 | + gtk_style_draw_polygon_with_gc (window, style->light_gc[GTK_STATE_ACTIVE], | ||
| 1597 | + 1, TRUE, points, 3); | ||
| 1598 | + gtk_style_draw_polygon_with_gc (window, style->fg_gc[GTK_STATE_NORMAL], | ||
| 1599 | + line_width, FALSE, points, 3); | ||
| 1600 | + } | ||
| 1601 | else | ||
| 1602 | - gdk_cairo_set_source_color (cr, | ||
| 1603 | - &style->base[GTK_STATE_NORMAL]); | ||
| 1604 | - | ||
| 1605 | - cairo_fill_preserve (cr); | ||
| 1606 | - | ||
| 1607 | - gdk_cairo_set_source_color (cr, &style->fg[state_type]); | ||
| 1608 | - cairo_stroke (cr); | ||
| 1609 | - | ||
| 1610 | - cairo_destroy (cr); | ||
| 1611 | + { | ||
| 1612 | + gtk_style_draw_polygon_with_gc (window, style->base_gc[GTK_STATE_NORMAL], | ||
| 1613 | + 1, TRUE, points, 3); | ||
| 1614 | + gtk_style_draw_polygon_with_gc (window, style->fg_gc[GTK_STATE_NORMAL], | ||
| 1615 | + line_width, FALSE, points, 3); | ||
| 1616 | + } | ||
| 1617 | + if (area) | ||
| 1618 | + { | ||
| 1619 | + gdk_gc_set_clip_rectangle (style->fg_gc[GTK_STATE_NORMAL], NULL); | ||
| 1620 | + gdk_gc_set_clip_rectangle (style->base_gc[GTK_STATE_NORMAL], NULL); | ||
| 1621 | + } | ||
| 1622 | } | ||
| 1623 | |||
| 1624 | typedef struct _ByteRange ByteRange; | ||
| 1625 | @@ -5046,6 +5321,9 @@ | ||
| 1626 | PangoLayout *layout) | ||
| 1627 | { | ||
| 1628 | GdkGC *gc; | ||
| 1629 | + | ||
| 1630 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1631 | + g_return_if_fail (window != NULL); | ||
| 1632 | |||
| 1633 | gc = use_text ? style->text_gc[state_type] : style->fg_gc[state_type]; | ||
| 1634 | |||
| 1635 | @@ -5087,6 +5365,9 @@ | ||
| 1636 | GdkPoint points[4]; | ||
| 1637 | gint i, j, skip; | ||
| 1638 | |||
| 1639 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1640 | + g_return_if_fail (window != NULL); | ||
| 1641 | + | ||
| 1642 | if (area) | ||
| 1643 | { | ||
| 1644 | gdk_gc_set_clip_rectangle (style->light_gc[state_type], area); | ||
| 1645 | @@ -5390,8 +5671,8 @@ | ||
| 1646 | |||
| 1647 | void | ||
| 1648 | _gtk_style_shade (GdkColor *a, | ||
| 1649 | - GdkColor *b, | ||
| 1650 | - gdouble k) | ||
| 1651 | + GdkColor *b, | ||
| 1652 | + gdouble k) | ||
| 1653 | { | ||
| 1654 | gdouble red; | ||
| 1655 | gdouble green; | ||
| 1656 | @@ -5578,10 +5859,9 @@ | ||
| 1657 | * @style: a #GtkStyle | ||
| 1658 | * @window: a #GdkWindow | ||
| 1659 | * @state_type: a state | ||
| 1660 | - * @area: rectangle to which the output is clipped, or %NULL if the | ||
| 1661 | - * output should not be clipped | ||
| 1662 | - * @widget: the widget (may be %NULL) | ||
| 1663 | - * @detail: a style detail (may be %NULL) | ||
| 1664 | + * @area: rectangle to which the output is clipped | ||
| 1665 | + * @widget: the widget | ||
| 1666 | + * @detail: a style detail | ||
| 1667 | * @x1: the starting x coordinate | ||
| 1668 | * @x2: the ending x coordinate | ||
| 1669 | * @y: the y coordinate | ||
| 1670 | @@ -5602,7 +5882,6 @@ | ||
| 1671 | { | ||
| 1672 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1673 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_hline != NULL); | ||
| 1674 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 1675 | |||
| 1676 | GTK_STYLE_GET_CLASS (style)->draw_hline (style, window, state_type, area, widget, detail, x1, x2, y); | ||
| 1677 | } | ||
| 1678 | @@ -5612,10 +5891,9 @@ | ||
| 1679 | * @style: a #GtkStyle | ||
| 1680 | * @window: a #GdkWindow | ||
| 1681 | * @state_type: a state | ||
| 1682 | - * @area: rectangle to which the output is clipped, or %NULL if the | ||
| 1683 | - * output should not be clipped | ||
| 1684 | - * @widget: the widget (may be %NULL) | ||
| 1685 | - * @detail: a style detail (may be %NULL) | ||
| 1686 | + * @area: rectangle to which the output is clipped | ||
| 1687 | + * @widget: the widget | ||
| 1688 | + * @detail: a style detail | ||
| 1689 | * @y1_: the starting y coordinate | ||
| 1690 | * @y2_: the ending y coordinate | ||
| 1691 | * @x: the x coordinate | ||
| 1692 | @@ -5636,7 +5914,6 @@ | ||
| 1693 | { | ||
| 1694 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1695 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_vline != NULL); | ||
| 1696 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 1697 | |||
| 1698 | GTK_STYLE_GET_CLASS (style)->draw_vline (style, window, state_type, area, widget, detail, y1_, y2_, x); | ||
| 1699 | } | ||
| 1700 | @@ -5647,10 +5924,9 @@ | ||
| 1701 | * @window: a #GdkWindow | ||
| 1702 | * @state_type: a state | ||
| 1703 | * @shadow_type: type of shadow to draw | ||
| 1704 | - * @area: clip rectangle or %NULL if the | ||
| 1705 | - * output should not be clipped | ||
| 1706 | - * @widget: the widget (may be %NULL) | ||
| 1707 | - * @detail: a style detail (may be %NULL) | ||
| 1708 | + * @area: clip rectangle | ||
| 1709 | + * @widget: the widget | ||
| 1710 | + * @detail: a style detail | ||
| 1711 | * @x: x origin of the rectangle | ||
| 1712 | * @y: y origin of the rectangle | ||
| 1713 | * @width: width of the rectangle | ||
| 1714 | @@ -5674,7 +5950,6 @@ | ||
| 1715 | { | ||
| 1716 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1717 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL); | ||
| 1718 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 1719 | |||
| 1720 | GTK_STYLE_GET_CLASS (style)->draw_shadow (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); | ||
| 1721 | } | ||
| 1722 | @@ -5685,10 +5960,9 @@ | ||
| 1723 | * @window: a #GdkWindow | ||
| 1724 | * @state_type: a state | ||
| 1725 | * @shadow_type: type of shadow to draw | ||
| 1726 | - * @area: clip rectangle, or %NULL if the | ||
| 1727 | - * output should not be clipped | ||
| 1728 | - * @widget: the widget (may be %NULL) | ||
| 1729 | - * @detail: a style detail (may be %NULL) | ||
| 1730 | + * @area: clip rectangle | ||
| 1731 | + * @widget: the widget | ||
| 1732 | + * @detail: a style detail | ||
| 1733 | * @points: an array of #GdkPoint<!-- -->s | ||
| 1734 | * @npoints: length of @points | ||
| 1735 | * @fill: %TRUE if the polygon should be filled | ||
| 1736 | @@ -5709,7 +5983,6 @@ | ||
| 1737 | { | ||
| 1738 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1739 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_polygon != NULL); | ||
| 1740 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 1741 | |||
| 1742 | GTK_STYLE_GET_CLASS (style)->draw_polygon (style, window, state_type, shadow_type, area, widget, detail, points, npoints, fill); | ||
| 1743 | } | ||
| 1744 | @@ -5720,10 +5993,9 @@ | ||
| 1745 | * @window: a #GdkWindow | ||
| 1746 | * @state_type: a state | ||
| 1747 | * @shadow_type: the type of shadow to draw | ||
| 1748 | - * @area: clip rectangle, or %NULL if the | ||
| 1749 | - * output should not be clipped | ||
| 1750 | - * @widget: the widget (may be %NULL) | ||
| 1751 | - * @detail: a style detail (may be %NULL) | ||
| 1752 | + * @area: clip rectangle | ||
| 1753 | + * @widget: the widget | ||
| 1754 | + * @detail: a style detail | ||
| 1755 | * @arrow_type: the type of arrow to draw | ||
| 1756 | * @fill: %TRUE if the arrow tip should be filled | ||
| 1757 | * @x: x origin of the rectangle to draw the arrow in | ||
| 1758 | @@ -5751,7 +6023,6 @@ | ||
| 1759 | { | ||
| 1760 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1761 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_arrow != NULL); | ||
| 1762 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 1763 | |||
| 1764 | GTK_STYLE_GET_CLASS (style)->draw_arrow (style, window, state_type, shadow_type, area, widget, detail, arrow_type, fill, x, y, width, height); | ||
| 1765 | } | ||
| 1766 | @@ -5762,10 +6033,9 @@ | ||
| 1767 | * @window: a #GdkWindow | ||
| 1768 | * @state_type: a state | ||
| 1769 | * @shadow_type: the type of shadow to draw | ||
| 1770 | - * @area: clip rectangle, or %NULL if the | ||
| 1771 | - * output should not be clipped | ||
| 1772 | - * @widget: the widget (may be %NULL) | ||
| 1773 | - * @detail: a style detail (may be %NULL) | ||
| 1774 | + * @area: clip rectangle | ||
| 1775 | + * @widget: the widget | ||
| 1776 | + * @detail: a style detail | ||
| 1777 | * @x: x origin of the rectangle to draw the diamond in | ||
| 1778 | * @y: y origin of the rectangle to draw the diamond in | ||
| 1779 | * @width: width of the rectangle to draw the diamond in | ||
| 1780 | @@ -5789,7 +6059,6 @@ | ||
| 1781 | { | ||
| 1782 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1783 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_diamond != NULL); | ||
| 1784 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 1785 | |||
| 1786 | GTK_STYLE_GET_CLASS (style)->draw_diamond (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); | ||
| 1787 | } | ||
| 1788 | @@ -5799,10 +6068,9 @@ | ||
| 1789 | * @style: a #GtkStyle | ||
| 1790 | * @window: a #GdkWindow | ||
| 1791 | * @state_type: a state | ||
| 1792 | - * @area: clip rectangle, or %NULL if the | ||
| 1793 | - * output should not be clipped | ||
| 1794 | - * @widget: the widget (may be %NULL) | ||
| 1795 | - * @detail: a style detail (may be %NULL) | ||
| 1796 | + * @area: clip rectangle | ||
| 1797 | + * @widget: the widget | ||
| 1798 | + * @detail: a style detail | ||
| 1799 | * @x: x origin | ||
| 1800 | * @y: y origin | ||
| 1801 | * @string: the string to draw | ||
| 1802 | @@ -5824,7 +6092,6 @@ | ||
| 1803 | { | ||
| 1804 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1805 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_string != NULL); | ||
| 1806 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 1807 | |||
| 1808 | GTK_STYLE_GET_CLASS (style)->draw_string (style, window, state_type, area, widget, detail, x, y, string); | ||
| 1809 | } | ||
| 1810 | @@ -5835,10 +6102,9 @@ | ||
| 1811 | * @window: a #GdkWindow | ||
| 1812 | * @state_type: a state | ||
| 1813 | * @shadow_type: the type of shadow to draw | ||
| 1814 | - * @area: clip rectangle, or %NULL if the | ||
| 1815 | - * output should not be clipped | ||
| 1816 | - * @widget: the widget (may be %NULL) | ||
| 1817 | - * @detail: a style detail (may be %NULL) | ||
| 1818 | + * @area: clip rectangle | ||
| 1819 | + * @widget: the widget | ||
| 1820 | + * @detail: a style detail | ||
| 1821 | * @x: x origin of the box | ||
| 1822 | * @y: y origin of the box | ||
| 1823 | * @width: the width of the box | ||
| 1824 | @@ -5861,7 +6127,6 @@ | ||
| 1825 | { | ||
| 1826 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1827 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box != NULL); | ||
| 1828 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 1829 | |||
| 1830 | GTK_STYLE_GET_CLASS (style)->draw_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); | ||
| 1831 | } | ||
| 1832 | @@ -5872,10 +6137,9 @@ | ||
| 1833 | * @window: a #GdkWindow | ||
| 1834 | * @state_type: a state | ||
| 1835 | * @shadow_type: the type of shadow to draw | ||
| 1836 | - * @area: clip rectangle, or %NULL if the | ||
| 1837 | - * output should not be clipped | ||
| 1838 | - * @widget: the widget (may be %NULL) | ||
| 1839 | - * @detail: a style detail (may be %NULL) | ||
| 1840 | + * @area: clip rectangle | ||
| 1841 | + * @widget: the widget | ||
| 1842 | + * @detail: a style detail | ||
| 1843 | * @x: x origin of the box | ||
| 1844 | * @y: y origin of the box | ||
| 1845 | * @width: the width of the box | ||
| 1846 | @@ -5898,7 +6162,6 @@ | ||
| 1847 | { | ||
| 1848 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1849 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_flat_box != NULL); | ||
| 1850 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 1851 | |||
| 1852 | GTK_STYLE_GET_CLASS (style)->draw_flat_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); | ||
| 1853 | } | ||
| 1854 | @@ -5909,10 +6172,9 @@ | ||
| 1855 | * @window: a #GdkWindow | ||
| 1856 | * @state_type: a state | ||
| 1857 | * @shadow_type: the type of shadow to draw | ||
| 1858 | - * @area: clip rectangle, or %NULL if the | ||
| 1859 | - * output should not be clipped | ||
| 1860 | - * @widget: the widget (may be %NULL) | ||
| 1861 | - * @detail: a style detail (may be %NULL) | ||
| 1862 | + * @area: clip rectangle | ||
| 1863 | + * @widget: the widget | ||
| 1864 | + * @detail: a style detail | ||
| 1865 | * @x: x origin of the rectangle to draw the check in | ||
| 1866 | * @y: y origin of the rectangle to draw the check in | ||
| 1867 | * @width: the width of the rectangle to draw the check in | ||
| 1868 | @@ -5936,7 +6198,6 @@ | ||
| 1869 | { | ||
| 1870 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1871 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_check != NULL); | ||
| 1872 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 1873 | |||
| 1874 | GTK_STYLE_GET_CLASS (style)->draw_check (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); | ||
| 1875 | } | ||
| 1876 | @@ -5947,10 +6208,9 @@ | ||
| 1877 | * @window: a #GdkWindow | ||
| 1878 | * @state_type: a state | ||
| 1879 | * @shadow_type: the type of shadow to draw | ||
| 1880 | - * @area: clip rectangle, or %NULL if the | ||
| 1881 | - * output should not be clipped | ||
| 1882 | - * @widget: the widget (may be %NULL) | ||
| 1883 | - * @detail: a style detail (may be %NULL) | ||
| 1884 | + * @area: clip rectangle | ||
| 1885 | + * @widget: the widget | ||
| 1886 | + * @detail: a style detail | ||
| 1887 | * @x: x origin of the rectangle to draw the option in | ||
| 1888 | * @y: y origin of the rectangle to draw the option in | ||
| 1889 | * @width: the width of the rectangle to draw the option in | ||
| 1890 | @@ -5974,7 +6234,6 @@ | ||
| 1891 | { | ||
| 1892 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1893 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_option != NULL); | ||
| 1894 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 1895 | |||
| 1896 | GTK_STYLE_GET_CLASS (style)->draw_option (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); | ||
| 1897 | } | ||
| 1898 | @@ -5985,10 +6244,9 @@ | ||
| 1899 | * @window: a #GdkWindow | ||
| 1900 | * @state_type: a state | ||
| 1901 | * @shadow_type: the type of shadow to draw | ||
| 1902 | - * @area: clip rectangle, or %NULL if the | ||
| 1903 | - * output should not be clipped | ||
| 1904 | - * @widget: the widget (may be %NULL) | ||
| 1905 | - * @detail: a style detail (may be %NULL) | ||
| 1906 | + * @area: clip rectangle | ||
| 1907 | + * @widget: the widget | ||
| 1908 | + * @detail: a style detail | ||
| 1909 | * @x: x origin of the rectangle to draw the tab in | ||
| 1910 | * @y: y origin of the rectangle to draw the tab in | ||
| 1911 | * @width: the width of the rectangle to draw the tab in | ||
| 1912 | @@ -6012,7 +6270,6 @@ | ||
| 1913 | { | ||
| 1914 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1915 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_tab != NULL); | ||
| 1916 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 1917 | |||
| 1918 | GTK_STYLE_GET_CLASS (style)->draw_tab (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); | ||
| 1919 | } | ||
| 1920 | @@ -6023,10 +6280,9 @@ | ||
| 1921 | * @window: a #GdkWindow | ||
| 1922 | * @state_type: a state | ||
| 1923 | * @shadow_type: type of shadow to draw | ||
| 1924 | - * @area: clip rectangle, or %NULL if the | ||
| 1925 | - * output should not be clipped | ||
| 1926 | - * @widget: the widget (may be %NULL) | ||
| 1927 | - * @detail: a style detail (may be %NULL) | ||
| 1928 | + * @area: clip rectangle | ||
| 1929 | + * @widget: the widget | ||
| 1930 | + * @detail: a style detail | ||
| 1931 | * @x: x origin of the rectangle | ||
| 1932 | * @y: y origin of the rectangle | ||
| 1933 | * @width: width of the rectangle | ||
| 1934 | @@ -6057,7 +6313,6 @@ | ||
| 1935 | { | ||
| 1936 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1937 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow_gap != NULL); | ||
| 1938 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 1939 | |||
| 1940 | GTK_STYLE_GET_CLASS (style)->draw_shadow_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width); | ||
| 1941 | } | ||
| 1942 | @@ -6069,10 +6324,9 @@ | ||
| 1943 | * @window: a #GdkWindow | ||
| 1944 | * @state_type: a state | ||
| 1945 | * @shadow_type: type of shadow to draw | ||
| 1946 | - * @area: clip rectangle, or %NULL if the | ||
| 1947 | - * output should not be clipped | ||
| 1948 | - * @widget: the widget (may be %NULL) | ||
| 1949 | - * @detail: a style detail (may be %NULL) | ||
| 1950 | + * @area: clip rectangle | ||
| 1951 | + * @widget: the widget | ||
| 1952 | + * @detail: a style detail | ||
| 1953 | * @x: x origin of the rectangle | ||
| 1954 | * @y: y origin of the rectangle | ||
| 1955 | * @width: width of the rectangle | ||
| 1956 | @@ -6102,7 +6356,6 @@ | ||
| 1957 | { | ||
| 1958 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1959 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box_gap != NULL); | ||
| 1960 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 1961 | |||
| 1962 | GTK_STYLE_GET_CLASS (style)->draw_box_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width); | ||
| 1963 | } | ||
| 1964 | @@ -6113,10 +6366,9 @@ | ||
| 1965 | * @window: a #GdkWindow | ||
| 1966 | * @state_type: a state | ||
| 1967 | * @shadow_type: type of shadow to draw | ||
| 1968 | - * @area: clip rectangle, or %NULL if the | ||
| 1969 | - * output should not be clipped | ||
| 1970 | - * @widget: the widget (may be %NULL) | ||
| 1971 | - * @detail: a style detail (may be %NULL) | ||
| 1972 | + * @area: clip rectangle | ||
| 1973 | + * @widget: the widget | ||
| 1974 | + * @detail: a style detail | ||
| 1975 | * @x: x origin of the extension | ||
| 1976 | * @y: y origin of the extension | ||
| 1977 | * @width: width of the extension | ||
| 1978 | @@ -6141,7 +6393,6 @@ | ||
| 1979 | { | ||
| 1980 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 1981 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_extension != NULL); | ||
| 1982 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 1983 | |||
| 1984 | GTK_STYLE_GET_CLASS (style)->draw_extension (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side); | ||
| 1985 | } | ||
| 1986 | @@ -6151,10 +6402,9 @@ | ||
| 1987 | * @style: a #GtkStyle | ||
| 1988 | * @window: a #GdkWindow | ||
| 1989 | * @state_type: a state | ||
| 1990 | - * @area: clip rectangle, or %NULL if the | ||
| 1991 | - * output should not be clipped | ||
| 1992 | - * @widget: the widget (may be %NULL) | ||
| 1993 | - * @detail: a style detail (may be %NULL) | ||
| 1994 | + * @area: clip rectangle | ||
| 1995 | + * @widget: the widget | ||
| 1996 | + * @detail: a style detail | ||
| 1997 | * @x: the x origin of the rectangle around which to draw a focus indicator | ||
| 1998 | * @y: the y origin of the rectangle around which to draw a focus indicator | ||
| 1999 | * @width: the width of the rectangle around which to draw a focus indicator | ||
| 2000 | @@ -6177,30 +6427,10 @@ | ||
| 2001 | { | ||
| 2002 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 2003 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_focus != NULL); | ||
| 2004 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 2005 | |||
| 2006 | GTK_STYLE_GET_CLASS (style)->draw_focus (style, window, state_type, area, widget, detail, x, y, width, height); | ||
| 2007 | } | ||
| 2008 | |||
| 2009 | -/** | ||
| 2010 | - * gtk_paint_slider: | ||
| 2011 | - * @style: a #GtkStyle | ||
| 2012 | - * @window: a #GdkWindow | ||
| 2013 | - * @state_type: a state | ||
| 2014 | - * @shadow_type: a shadow | ||
| 2015 | - * @area: clip rectangle, or %NULL if the | ||
| 2016 | - * output should not be clipped | ||
| 2017 | - * @widget: the widget (may be %NULL) | ||
| 2018 | - * @detail: a style detail (may be %NULL) | ||
| 2019 | - * @x: the x origin of the rectangle in which to draw a slider | ||
| 2020 | - * @y: the y origin of the rectangle in which to draw a slider | ||
| 2021 | - * @width: the width of the rectangle in which to draw a slider | ||
| 2022 | - * @height: the height of the rectangle in which to draw a slider | ||
| 2023 | - * @orientation: the orientation to be used | ||
| 2024 | - * | ||
| 2025 | - * Draws a slider in the given rectangle on @window using the | ||
| 2026 | - * given style and orientation. | ||
| 2027 | - **/ | ||
| 2028 | void | ||
| 2029 | gtk_paint_slider (GtkStyle *style, | ||
| 2030 | GdkWindow *window, | ||
| 2031 | @@ -6217,7 +6447,6 @@ | ||
| 2032 | { | ||
| 2033 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 2034 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_slider != NULL); | ||
| 2035 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 2036 | |||
| 2037 | GTK_STYLE_GET_CLASS (style)->draw_slider (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation); | ||
| 2038 | } | ||
| 2039 | @@ -6228,10 +6457,9 @@ | ||
| 2040 | * @window: a #GdkWindow | ||
| 2041 | * @state_type: a state | ||
| 2042 | * @shadow_type: type of shadow to draw | ||
| 2043 | - * @area: clip rectangle, or %NULL if the | ||
| 2044 | - * output should not be clipped | ||
| 2045 | - * @widget: the widget (may be %NULL) | ||
| 2046 | - * @detail: a style detail (may be %NULL) | ||
| 2047 | + * @area: clip rectangle | ||
| 2048 | + * @widget: the widget | ||
| 2049 | + * @detail: a style detail | ||
| 2050 | * @x: x origin of the handle | ||
| 2051 | * @y: y origin of the handle | ||
| 2052 | * @width: with of the handle | ||
| 2053 | @@ -6256,7 +6484,6 @@ | ||
| 2054 | { | ||
| 2055 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 2056 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_handle != NULL); | ||
| 2057 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 2058 | |||
| 2059 | GTK_STYLE_GET_CLASS (style)->draw_handle (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation); | ||
| 2060 | } | ||
| 2061 | @@ -6266,25 +6493,14 @@ | ||
| 2062 | * @style: a #GtkStyle | ||
| 2063 | * @window: a #GdkWindow | ||
| 2064 | * @state_type: a state | ||
| 2065 | - * @area: clip rectangle, or %NULL if the | ||
| 2066 | - * output should not be clipped | ||
| 2067 | - * @widget: the widget (may be %NULL) | ||
| 2068 | - * @detail: a style detail (may be %NULL) | ||
| 2069 | + * @area: clip rectangle | ||
| 2070 | + * @widget: the widget | ||
| 2071 | + * @detail: a style detail | ||
| 2072 | * @x: the x position to draw the expander at | ||
| 2073 | * @y: the y position to draw the expander at | ||
| 2074 | - * @expander_style: the style to draw the expander in; determines | ||
| 2075 | - * whether the expander is collapsed, expanded, or in an | ||
| 2076 | - * intermediate state. | ||
| 2077 | + * @expander_style: the style to draw the expander in | ||
| 2078 | * | ||
| 2079 | - * Draws an expander as used in #GtkTreeView. @x and @y specify the | ||
| 2080 | - * center the expander. The size of the expander is determined by the | ||
| 2081 | - * "expander-size" style property of @widget. (If widget is not | ||
| 2082 | - * specified or doesn't have an "expander-size" property, an | ||
| 2083 | - * unspecified default size will be used, since the caller doesn't | ||
| 2084 | - * have sufficient information to position the expander, this is | ||
| 2085 | - * likely not useful.) The expander is expander_size pixels tall | ||
| 2086 | - * in the collapsed position and expander_size pixels wide in the | ||
| 2087 | - * expanded position. | ||
| 2088 | + * Draws an expander as used in #GtkTreeView. | ||
| 2089 | **/ | ||
| 2090 | void | ||
| 2091 | gtk_paint_expander (GtkStyle *style, | ||
| 2092 | @@ -6299,34 +6515,16 @@ | ||
| 2093 | { | ||
| 2094 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 2095 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_expander != NULL); | ||
| 2096 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 2097 | |||
| 2098 | GTK_STYLE_GET_CLASS (style)->draw_expander (style, window, state_type, area, | ||
| 2099 | widget, detail, x, y, expander_style); | ||
| 2100 | } | ||
| 2101 | |||
| 2102 | -/** | ||
| 2103 | - * gtk_paint_layout: | ||
| 2104 | - * @style: a #GtkStyle | ||
| 2105 | - * @window: a #GdkWindow | ||
| 2106 | - * @state_type: a state | ||
| 2107 | - * @use_text: whether to use the text or foreground | ||
| 2108 | - * graphics context of @style | ||
| 2109 | - * @area: clip rectangle, or %NULL if the | ||
| 2110 | - * output should not be clipped | ||
| 2111 | - * @widget: the widget (may be %NULL) | ||
| 2112 | - * @detail: a style detail (may be %NULL) | ||
| 2113 | - * @x: x origin | ||
| 2114 | - * @y: y origin | ||
| 2115 | - * @layout: the layout to draw | ||
| 2116 | - * | ||
| 2117 | - * Draws a layout on @window using the given parameters. | ||
| 2118 | - **/ | ||
| 2119 | void | ||
| 2120 | gtk_paint_layout (GtkStyle *style, | ||
| 2121 | GdkWindow *window, | ||
| 2122 | GtkStateType state_type, | ||
| 2123 | - gboolean use_text, | ||
| 2124 | + gboolean use_text, | ||
| 2125 | GdkRectangle *area, | ||
| 2126 | GtkWidget *widget, | ||
| 2127 | const gchar *detail, | ||
| 2128 | @@ -6336,7 +6534,6 @@ | ||
| 2129 | { | ||
| 2130 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 2131 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_layout != NULL); | ||
| 2132 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 2133 | |||
| 2134 | GTK_STYLE_GET_CLASS (style)->draw_layout (style, window, state_type, use_text, area, | ||
| 2135 | widget, detail, x, y, layout); | ||
| 2136 | @@ -6347,10 +6544,9 @@ | ||
| 2137 | * @style: a #GtkStyle | ||
| 2138 | * @window: a #GdkWindow | ||
| 2139 | * @state_type: a state | ||
| 2140 | - * @area: clip rectangle, or %NULL if the | ||
| 2141 | - * output should not be clipped | ||
| 2142 | - * @widget: the widget (may be %NULL) | ||
| 2143 | - * @detail: a style detail (may be %NULL) | ||
| 2144 | + * @area: clip rectangle | ||
| 2145 | + * @widget: the widget | ||
| 2146 | + * @detail: a style detail | ||
| 2147 | * @edge: the edge in which to draw the resize grip | ||
| 2148 | * @x: the x origin of the rectangle in which to draw the resize grip | ||
| 2149 | * @y: the y origin of the rectangle in which to draw the resize grip | ||
| 2150 | @@ -6376,7 +6572,6 @@ | ||
| 2151 | { | ||
| 2152 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
| 2153 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_resize_grip != NULL); | ||
| 2154 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
| 2155 | |||
| 2156 | GTK_STYLE_GET_CLASS (style)->draw_resize_grip (style, window, state_type, | ||
| 2157 | area, widget, detail, | ||
| 2158 | @@ -6414,7 +6609,7 @@ | ||
| 2159 | static GType our_type = 0; | ||
| 2160 | |||
| 2161 | if (our_type == 0) | ||
| 2162 | - our_type = g_boxed_type_register_static (I_("GtkBorder"), | ||
| 2163 | + our_type = g_boxed_type_register_static ("GtkBorder", | ||
| 2164 | (GBoxedCopyFunc) gtk_border_copy, | ||
| 2165 | (GBoxedFreeFunc) gtk_border_free); | ||
| 2166 | |||
| 2167 | @@ -6553,7 +6748,7 @@ | ||
| 2168 | gtk_gc_release (cursor_info->secondary_gc); | ||
| 2169 | |||
| 2170 | g_free (cursor_info); | ||
| 2171 | - g_object_set_data (G_OBJECT (style), I_("gtk-style-cursor-info"), NULL); | ||
| 2172 | + g_object_set_data (G_OBJECT (style), "gtk-style-cursor-info", NULL); | ||
| 2173 | } | ||
| 2174 | } | ||
| 2175 | |||
| 2176 | @@ -6591,7 +6786,7 @@ | ||
| 2177 | if (!cursor_info) | ||
| 2178 | { | ||
| 2179 | cursor_info = g_new (CursorInfo, 1); | ||
| 2180 | - g_object_set_data (G_OBJECT (widget->style), I_("gtk-style-cursor-info"), cursor_info); | ||
| 2181 | + g_object_set_data (G_OBJECT (widget->style), "gtk-style-cursor-info", cursor_info); | ||
| 2182 | cursor_info->primary_gc = NULL; | ||
| 2183 | cursor_info->secondary_gc = NULL; | ||
| 2184 | cursor_info->for_type = G_TYPE_INVALID; | ||
| 2185 | @@ -6655,6 +6850,8 @@ | ||
| 2186 | gfloat cursor_aspect_ratio; | ||
| 2187 | gint offset; | ||
| 2188 | |||
| 2189 | + g_return_if_fail (direction != GTK_TEXT_DIR_NONE); | ||
| 2190 | + | ||
| 2191 | /* When changing the shape or size of the cursor here, | ||
| 2192 | * propagate the changes to gtktextview.c:text_window_invalidate_cursors(). | ||
| 2193 | */ | ||
diff --git a/openembedded/packages/gtk+/gtk+-2.10.0/xsettings.patch b/openembedded/packages/gtk+/gtk+-2.10.0/xsettings.patch new file mode 100644 index 0000000000..b63e262d34 --- /dev/null +++ b/openembedded/packages/gtk+/gtk+-2.10.0/xsettings.patch | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | --- gtk+-2.4.4/gdk/x11/gdkevents-x11.c.old Sun Aug 22 17:14:00 2004 | ||
| 2 | +++ gtk+-2.4.4/gdk/x11/gdkevents-x11.c Sun Aug 22 17:14:00 2004 | ||
| 3 | @@ -2827,10 +2827,9 @@ | ||
| 4 | { | ||
| 5 | GdkScreenX11 *screen = data; | ||
| 6 | |||
| 7 | - if (xsettings_client_process_event (screen->xsettings_client, (XEvent *)xevent)) | ||
| 8 | - return GDK_FILTER_REMOVE; | ||
| 9 | - else | ||
| 10 | - return GDK_FILTER_CONTINUE; | ||
| 11 | + xsettings_client_process_event (screen->xsettings_client, (XEvent *)xevent); | ||
| 12 | + | ||
| 13 | + return GDK_FILTER_CONTINUE; | ||
| 14 | } | ||
| 15 | |||
| 16 | static void | ||
diff --git a/openembedded/packages/gtk+/gtk+_2.10.0.bb b/openembedded/packages/gtk+/gtk+_2.10.0.bb new file mode 100644 index 0000000000..decabf2f80 --- /dev/null +++ b/openembedded/packages/gtk+/gtk+_2.10.0.bb | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | LICENSE = "LGPL" | ||
| 2 | DESCRIPTION = "GTK+ is a multi-platform toolkit for creating graphical user interfaces. Offering a complete \ | ||
| 3 | set of widgets, GTK+ is suitable for projects ranging from small one-off projects to complete application suites." | ||
| 4 | HOMEPAGE = "http://www.gtk.org" | ||
| 5 | SECTION = "libs" | ||
| 6 | PRIORITY = "optional" | ||
| 7 | MAINTAINER = "Jorn Baayen <jorn@openedhand.com>" | ||
| 8 | DEPENDS = "glib-2.0 pango atk jpeg libpng libxext libxcursor gtk-doc libgcrypt cairo" | ||
| 9 | PR = "r1" | ||
| 10 | |||
| 11 | SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.10/gtk+-${PV}.tar.bz2 \ | ||
| 12 | file://cellrenderer-cairo.patch;patch=1 \ | ||
| 13 | file://entry-cairo.patch;patch=1 \ | ||
| 14 | file://style-cairo.patch;patch=1 \ | ||
| 15 | file://no-xwc.patch;patch=1 \ | ||
| 16 | file://automake-lossage.patch;patch=1 \ | ||
| 17 | # file://spinbutton.patch;patch=1 \ | ||
| 18 | # file://hardcoded_libtool.patch;patch=1 \ | ||
| 19 | file://disable-tooltips.patch;patch=1 \ | ||
| 20 | file://gtklabel-resize-patch;patch=1 \ | ||
| 21 | file://gtktreeview-316689.patch;patch=1 \ | ||
| 22 | # file://menu-deactivate.patch;patch=1 \ | ||
| 23 | # file://xsettings.patch;patch=1 \ | ||
| 24 | # file://scroll-timings.patch;patch=1 \ | ||
| 25 | # file://small-gtkfilesel.patch;patch=1 \ | ||
| 26 | # file://migration.patch;patch=1;pnum=0 \ | ||
| 27 | file://no-demos.patch;patch=1" | ||
| 28 | # file://gtk+-handhelds.patch;patch=1 \ | ||
| 29 | # file://single-click.patch;patch=1" | ||
| 30 | |||
| 31 | inherit autotools pkgconfig | ||
| 32 | |||
| 33 | FILES_${PN} = "${bindir}/gdk-pixbuf-query-loaders \ | ||
| 34 | ${bindir}/gtk-query-immodules-2.0 \ | ||
| 35 | ${bindir}/gtk-update-icon-cache \ | ||
| 36 | ${libdir}/lib*.so.* \ | ||
| 37 | ${datadir}/themes ${sysconfdir} \ | ||
| 38 | ${libdir}/gtk-2.0/${LIBV}/engines/libpixmap.so" | ||
| 39 | FILES_${PN}-dev += "${datadir}/gtk-2.0/include ${libdir}/gtk-2.0/include ${bindir}/gdk-pixbuf-csource" | ||
| 40 | |||
| 41 | RRECOMMENDS_${PN} = "glibc-gconv-iso8859-1" | ||
| 42 | |||
| 43 | EXTRA_OECONF = "--without-libtiff --disable-xkb --disable-glibtest --enable-display-migration" | ||
| 44 | # --disable-cruft | ||
| 45 | |||
| 46 | LIBV = "2.4.0" | ||
| 47 | |||
| 48 | do_stage () { | ||
| 49 | oe_libinstall -so -C gtk libgtk-x11-2.0 ${STAGING_LIBDIR} | ||
| 50 | oe_libinstall -so -C gdk libgdk-x11-2.0 ${STAGING_LIBDIR} | ||
| 51 | oe_libinstall -so -C contrib/gdk-pixbuf-xlib libgdk_pixbuf_xlib-2.0 ${STAGING_LIBDIR} | ||
| 52 | oe_libinstall -so -C gdk-pixbuf libgdk_pixbuf-2.0 ${STAGING_LIBDIR} | ||
| 53 | |||
| 54 | autotools_stage_includes | ||
| 55 | |||
| 56 | mkdir -p ${STAGING_LIBDIR}/gtk-2.0/include | ||
| 57 | install -m 0644 gdk/gdkconfig.h ${STAGING_LIBDIR}/gtk-2.0/include/gdkconfig.h | ||
| 58 | |||
| 59 | install -m 0644 m4macros/gtk-2.0.m4 ${STAGING_DATADIR}/aclocal/ | ||
| 60 | } | ||
| 61 | |||
| 62 | do_install_append () { | ||
| 63 | install -d ${D}${sysconfdir}/gtk-2.0 | ||
| 64 | } | ||
| 65 | |||
| 66 | postinst_prologue() { | ||
| 67 | if [ "x$D" != "x" ]; then | ||
| 68 | exit 1 | ||
| 69 | fi | ||
| 70 | |||
| 71 | } | ||
| 72 | |||
| 73 | PACKAGES_DYNAMIC = "gdk-pixbuf-loader-* gtk-immodule-*" | ||
| 74 | |||
| 75 | python populate_packages_prepend () { | ||
| 76 | import os.path | ||
| 77 | |||
| 78 | prologue = bb.data.getVar("postinst_prologue", d, 1) | ||
| 79 | |||
| 80 | gtk_libdir = bb.data.expand('${libdir}/gtk-2.0/${LIBV}', d) | ||
| 81 | loaders_root = os.path.join(gtk_libdir, 'loaders') | ||
| 82 | immodules_root = os.path.join(gtk_libdir, 'immodules') | ||
| 83 | |||
| 84 | do_split_packages(d, loaders_root, '^libpixbufloader-(.*)\.so$', 'gdk-pixbuf-loader-%s', 'GDK pixbuf loader for %s', prologue + 'gdk-pixbuf-query-loaders > /etc/gtk-2.0/gdk-pixbuf.loaders') | ||
| 85 | do_split_packages(d, immodules_root, '^im-(.*)\.so$', 'gtk-immodule-%s', 'GTK input module for %s', prologue + 'gtk-query-immodules > /etc/gtk-2.0/gtk.immodules') | ||
| 86 | |||
| 87 | if (bb.data.getVar('DEBIAN_NAMES', d, 1)): | ||
| 88 | bb.data.setVar('PKG_${PN}', 'libgtk-2.0', d) | ||
| 89 | } | ||
