diff options
author | Owen Taylor <otaylor@redhat.com> | 2001-06-14 20:41:44 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2001-06-14 20:41:44 +0000 |
commit | 22491fd6a4ee247bf49988db49250a6e3c278bf0 (patch) | |
tree | 9048fa10acb725e3e08e526eba21f69998cd93b5 /gtk | |
parent | 7d1a049bc39000840d2989f38e0ac444958d8740 (diff) | |
download | gtk+-22491fd6a4ee247bf49988db49250a6e3c278bf0.tar.gz |
Add missing gdk_rectangle_get_type() prototype.
Mon Jun 11 18:15:16 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h: Add missing gdk_rectangle_get_type() prototype.
* gtk/gtk[hv]scale.c: Include math.h, stdlib.h
* gdk/gdkpango.h gtk/gtkclist.c gtk/gtkentry.c gtk/gtkmain.[ch]
gtk/gtkspinbutton.c gtk/gtkstyle.c gtk/gtktextbuffer.c
gtk/gtktextdisplay.c gtk/gtktextiter.[ch]
gtk/gtktextlayout.c gtk/gtktexttag.[ch] gtk/gtkwidget.c: Adapt
to recent changes in Pango.
* tests/testgtk.c: Set language tags with gtk_label_set_markup()
to test whether the basic engine honors them.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkclist.c | 6 | ||||
-rw-r--r-- | gtk/gtkentry.c | 12 | ||||
-rw-r--r-- | gtk/gtkhscale.c | 2 | ||||
-rw-r--r-- | gtk/gtkmain.c | 6 | ||||
-rw-r--r-- | gtk/gtkmain.h | 8 | ||||
-rw-r--r-- | gtk/gtkspinbutton.c | 12 | ||||
-rw-r--r-- | gtk/gtkstyle.c | 2 | ||||
-rw-r--r-- | gtk/gtktextbuffer.c | 7 | ||||
-rw-r--r-- | gtk/gtktextdisplay.c | 4 | ||||
-rw-r--r-- | gtk/gtktextiter.c | 8 | ||||
-rw-r--r-- | gtk/gtktextiter.h | 10 | ||||
-rw-r--r-- | gtk/gtktextlayout.c | 14 | ||||
-rw-r--r-- | gtk/gtktexttag.c | 17 | ||||
-rw-r--r-- | gtk/gtktexttag.h | 2 | ||||
-rw-r--r-- | gtk/gtkvscale.c | 2 | ||||
-rw-r--r-- | gtk/gtkwidget.c | 6 |
16 files changed, 58 insertions, 60 deletions
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index a6352ae216..76581eb1a3 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -3027,11 +3027,11 @@ gtk_clist_set_row_height (GtkCList *clist, PangoContext *context = gtk_widget_get_pango_context (widget); PangoFontMetrics metrics; PangoFont *font = pango_context_load_font (context, widget->style->font_desc); - gchar *lang = pango_context_get_lang (context); - pango_font_get_metrics (font, lang, &metrics); + pango_font_get_metrics (font, + pango_context_get_language (context), + &metrics); - g_free (lang); g_object_unref (G_OBJECT (font)); if (!GTK_CLIST_ROW_HEIGHT_SET(clist)) diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index c7544817f4..60234f85f3 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -1036,8 +1036,8 @@ gtk_entry_size_request (GtkWidget *widget, GtkEntry *entry; PangoFontMetrics metrics; PangoFont *font; - gchar *lang; gint xborder, yborder; + PangoContext *context; g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_ENTRY (widget)); @@ -1047,11 +1047,11 @@ gtk_entry_size_request (GtkWidget *widget, /* hackish for now, get metrics */ - font = pango_context_load_font (gtk_widget_get_pango_context (widget), - widget->style->font_desc); - lang = pango_context_get_lang (gtk_widget_get_pango_context (widget)); - pango_font_get_metrics (font, lang, &metrics); - g_free (lang); + context = gtk_widget_get_pango_context (widget); + font = pango_context_load_font (context, widget->style->font_desc); + pango_font_get_metrics (font, + pango_context_get_language (context), + &metrics); g_object_unref (G_OBJECT (font)); diff --git a/gtk/gtkhscale.c b/gtk/gtkhscale.c index ebd37861e4..e940d50428 100644 --- a/gtk/gtkhscale.c +++ b/gtk/gtkhscale.c @@ -24,7 +24,9 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ +#include <math.h> #include <stdio.h> +#include <stdlib.h> #include "gtkhscale.h" #include "gtksignal.h" #include "gtkintl.h" diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 689cea9b2f..94b5e4b57e 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -598,10 +598,11 @@ gtk_set_locale (void) * * Return value: the default language as an allocated string, must be freed **/ -gchar* +PangoLanguage * gtk_get_default_language (void) { gchar *lang; + PangoLanguage *result; gchar *p; lang = g_strdup (setlocale (LC_CTYPE, NULL)); @@ -612,6 +613,9 @@ gtk_get_default_language (void) if (p) *p = '\0'; + result = pango_language_from_string (lang); + g_free (lang); + return lang; } diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h index 083b0ba98b..1d7e5d2ce7 100644 --- a/gtk/gtkmain.h +++ b/gtk/gtkmain.h @@ -106,11 +106,9 @@ gboolean gtk_init_check_abi_check (int *argc, #ifndef GTK_DISABLE_DEPRECATED void gtk_exit (gint error_code); #endif /* GTK_DISABLE_DEPRECATED */ -gchar* gtk_set_locale (void); -gchar* gtk_get_default_language (void); -gint gtk_events_pending (void); - - +gchar * gtk_set_locale (void); +PangoLanguage *gtk_get_default_language (void); +gint gtk_events_pending (void); /* The following is the event func GTK+ registers with GDK * we expose it mainly to allow filtering of events between diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 76cea643e0..90bc385115 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -567,19 +567,19 @@ gtk_spin_button_size_request (GtkWidget *widget, if (entry->width_chars < 0) { + PangoContext *context; PangoFontMetrics metrics; PangoFont *font; - gchar *lang; gint width; gint w; int string_len; - - font = pango_context_load_font (gtk_widget_get_pango_context (widget), + context = gtk_widget_get_pango_context (widget); + font = pango_context_load_font (context, widget->style->font_desc); - lang = pango_context_get_lang (gtk_widget_get_pango_context (widget)); - pango_font_get_metrics (font, lang, &metrics); - g_free (lang); + pango_font_get_metrics (font, + pango_context_get_language (context), + &metrics); g_object_unref (G_OBJECT (font)); /* Get max of MIN_SPIN_BUTTON_WIDTH, size of upper, size of lower */ diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index e0c526ecd9..87ad7f8d54 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -4076,7 +4076,7 @@ get_insensitive_layout (PangoLayout *layout) if (run) { - tmp_list = run->item->extra_attrs; + tmp_list = run->item->analysis.extra_attrs; while (tmp_list != NULL) { diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c index 961fbf0633..3a0a3d3f38 100644 --- a/gtk/gtktextbuffer.c +++ b/gtk/gtktextbuffer.c @@ -3248,7 +3248,6 @@ compute_log_attrs (const GtkTextIter *iter, gchar *paragraph; gint char_len, byte_len; PangoLogAttr *attrs = NULL; - gchar *lang; start = *iter; end = *iter; @@ -3267,14 +3266,10 @@ compute_log_attrs (const GtkTextIter *iter, attrs = g_new (PangoLogAttr, char_len); - lang = gtk_text_iter_get_language (&start); - pango_get_log_attrs (paragraph, byte_len, -1, - lang, + gtk_text_iter_get_language (&start), attrs); - g_free (lang); - g_free (paragraph); return attrs; diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c index c06c7cb487..0053f1b2ec 100644 --- a/gtk/gtktextdisplay.c +++ b/gtk/gtktextdisplay.c @@ -191,7 +191,7 @@ get_shape_extents (PangoLayoutRun *run, PangoRectangle *ink_rect, PangoRectangle *logical_rect) { - GSList *tmp_list = run->item->extra_attrs; + GSList *tmp_list = run->item->analysis.extra_attrs; while (tmp_list) { @@ -653,7 +653,7 @@ static void get_item_properties (PangoItem *item, GtkTextAppearance **appearance) { - GSList *tmp_list = item->extra_attrs; + GSList *tmp_list = item->analysis.extra_attrs; *appearance = NULL; diff --git a/gtk/gtktextiter.c b/gtk/gtktextiter.c index ae7dfecf11..af947d105e 100644 --- a/gtk/gtktextiter.c +++ b/gtk/gtktextiter.c @@ -1379,17 +1379,17 @@ gtk_text_iter_editable (const GtkTextIter *iter, * * Return value: language in effect at @iter **/ -gchar* +PangoLanguage * gtk_text_iter_get_language (const GtkTextIter *iter) { GtkTextAttributes *values; - gchar *retval; - + PangoLanguage *retval; + values = gtk_text_attributes_new (); gtk_text_iter_get_attributes (iter, values); - retval = g_strdup (values->language); + retval = values->language; gtk_text_attributes_unref (values); diff --git a/gtk/gtktextiter.h b/gtk/gtktextiter.h index 174be5d99a..c3ea8516d7 100644 --- a/gtk/gtktextiter.h +++ b/gtk/gtktextiter.h @@ -142,11 +142,11 @@ gboolean gtk_text_iter_is_cursor_position (const GtkTextIter *iter); gint gtk_text_iter_get_chars_in_line (const GtkTextIter *iter); gint gtk_text_iter_get_bytes_in_line (const GtkTextIter *iter); -gboolean gtk_text_iter_get_attributes (const GtkTextIter *iter, - GtkTextAttributes *values); -gchar* gtk_text_iter_get_language (const GtkTextIter *iter); -gboolean gtk_text_iter_is_end (const GtkTextIter *iter); -gboolean gtk_text_iter_is_start (const GtkTextIter *iter); +gboolean gtk_text_iter_get_attributes (const GtkTextIter *iter, + GtkTextAttributes *values); +PangoLanguage* gtk_text_iter_get_language (const GtkTextIter *iter); +gboolean gtk_text_iter_is_end (const GtkTextIter *iter); +gboolean gtk_text_iter_is_start (const GtkTextIter *iter); /* * Moving around the buffer diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index 2aef53e598..603c47af92 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -1492,7 +1492,7 @@ add_cursor (GtkTextLayout *layout, static gboolean is_shape (PangoLayoutRun *run) { - GSList *tmp_list = run->item->extra_attrs; + GSList *tmp_list = run->item->analysis.extra_attrs; while (tmp_list) { @@ -1582,6 +1582,7 @@ add_preedit_attrs (GtkTextLayout *layout, PangoAttribute *insert_attr; GSList *extra_attrs = NULL; GSList *tmp_list; + PangoLanguage *language; gint start, end; pango_attr_iterator_range (iter, &start, &end); @@ -1590,7 +1591,7 @@ add_preedit_attrs (GtkTextLayout *layout, end = layout->preedit_len; pango_attr_iterator_get_font (iter, &style->font, - &font_desc, &extra_attrs); + &font_desc, &language, &extra_attrs); tmp_list = extra_attrs; while (tmp_list) @@ -1631,6 +1632,15 @@ add_preedit_attrs (GtkTextLayout *layout, pango_attr_list_insert (attrs, insert_attr); + if (language) + { + insert_attr = pango_attr_language_new (language); + insert_attr->start_index = start + offset; + insert_attr->end_index = end + offset; + + pango_attr_list_insert (attrs, insert_attr); + } + add_generic_attrs (layout, &appearance, end - start, attrs, start + offset, size_only, TRUE); diff --git a/gtk/gtktexttag.c b/gtk/gtktexttag.c index c149c4edad..104339f29a 100644 --- a/gtk/gtktexttag.c +++ b/gtk/gtktexttag.c @@ -1088,7 +1088,7 @@ gtk_text_tag_set_property (GObject *object, case PROP_LANGUAGE: text_tag->language_set = TRUE; - text_tag->values->language = g_strdup (g_value_get_string (value)); + text_tag->values->language = pango_language_from_string (g_value_get_string (value)); g_object_notify (G_OBJECT (text_tag), "language_set"); break; @@ -1425,7 +1425,7 @@ gtk_text_tag_get_property (GObject *object, break; case PROP_LANGUAGE: - g_value_set_string (value, tag->values->language); + g_value_set_string (value, pango_language_to_string (tag->values->language)); break; case PROP_TABS: @@ -1818,9 +1818,6 @@ gtk_text_attributes_copy_values (GtkTextAttributes *src, if (dest->appearance.fg_stipple) gdk_bitmap_unref (dest->appearance.fg_stipple); - if (dest->language) - g_free (dest->language); - if (dest->font.family_name) g_free (dest->font.family_name); @@ -1832,7 +1829,7 @@ gtk_text_attributes_copy_values (GtkTextAttributes *src, if (src->tabs) dest->tabs = pango_tab_array_copy (src->tabs); - dest->language = g_strdup (src->language); + dest->language = src->language; dest->font.family_name = g_strdup (src->font.family_name); @@ -1882,9 +1879,6 @@ gtk_text_attributes_unref (GtkTextAttributes *values) if (values->tabs) pango_tab_array_free (values->tabs); - if (values->language) - g_free (values->language); - if (values->font.family_name) g_free (values->font.family_name); @@ -2059,10 +2053,7 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest, dest->bg_full_height = vals->bg_full_height; if (tag->language_set) - { - g_free (dest->language); - dest->language = g_strdup (vals->language); - } + dest->language = vals->language; ++n; } diff --git a/gtk/gtktexttag.h b/gtk/gtktexttag.h index f75a1760b0..10b7bb2980 100644 --- a/gtk/gtktexttag.h +++ b/gtk/gtktexttag.h @@ -170,7 +170,7 @@ struct _GtkTextAttributes * GTK_WRAPMODE_NONE, GTK_WRAPMODE_WORD */ - gchar *language; + PangoLanguage *language; /* hide the text */ guint invisible : 1; diff --git a/gtk/gtkvscale.c b/gtk/gtkvscale.c index 2dca2cc99e..ae18dfa025 100644 --- a/gtk/gtkvscale.c +++ b/gtk/gtkvscale.c @@ -24,7 +24,9 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ +#include <math.h> #include <stdio.h> +#include <stdlib.h> #include "gtkvscale.h" #include "gtksignal.h" #include "gtkintl.h" diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 790476875e..c6ba8adc1a 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -3989,7 +3989,6 @@ PangoContext * gtk_widget_create_pango_context (GtkWidget *widget) { PangoContext *context; - char *lang; g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); @@ -4000,10 +3999,7 @@ gtk_widget_create_pango_context (GtkWidget *widget) gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR ? PANGO_DIRECTION_LTR : PANGO_DIRECTION_RTL); pango_context_set_font_description (context, widget->style->font_desc); - - lang = gtk_get_default_language (); - pango_context_set_lang (context, lang); - g_free (lang); + pango_context_set_language (context, gtk_get_default_language ()); return context; } |