Commit 22491fd6 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

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.
parent 7d1a049b
...@@ -126,6 +126,8 @@ void gdk_rectangle_union (GdkRectangle *src1, ...@@ -126,6 +126,8 @@ void gdk_rectangle_union (GdkRectangle *src1,
GdkRectangle *src2, GdkRectangle *src2,
GdkRectangle *dest); GdkRectangle *dest);
GType gdk_rectangle_get_type (void);
#define GDK_TYPE_RECTANGLE (gdk_rectangle_get_type ()) #define GDK_TYPE_RECTANGLE (gdk_rectangle_get_type ())
/* Conversion functions between wide char and multibyte strings. /* Conversion functions between wide char and multibyte strings.
......
...@@ -452,7 +452,7 @@ gdk_pango_get_item_properties (PangoItem *item, ...@@ -452,7 +452,7 @@ gdk_pango_get_item_properties (PangoItem *item,
PangoRectangle *ink_rect, PangoRectangle *ink_rect,
PangoRectangle *logical_rect) PangoRectangle *logical_rect)
{ {
GSList *tmp_list = item->extra_attrs; GSList *tmp_list = item->analysis.extra_attrs;
if (strikethrough) if (strikethrough)
*strikethrough = FALSE; *strikethrough = FALSE;
......
...@@ -3027,11 +3027,11 @@ gtk_clist_set_row_height (GtkCList *clist, ...@@ -3027,11 +3027,11 @@ gtk_clist_set_row_height (GtkCList *clist,
PangoContext *context = gtk_widget_get_pango_context (widget); PangoContext *context = gtk_widget_get_pango_context (widget);
PangoFontMetrics metrics; PangoFontMetrics metrics;
PangoFont *font = pango_context_load_font (context, widget->style->font_desc); 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)); g_object_unref (G_OBJECT (font));
if (!GTK_CLIST_ROW_HEIGHT_SET(clist)) if (!GTK_CLIST_ROW_HEIGHT_SET(clist))
......
...@@ -1036,8 +1036,8 @@ gtk_entry_size_request (GtkWidget *widget, ...@@ -1036,8 +1036,8 @@ gtk_entry_size_request (GtkWidget *widget,
GtkEntry *entry; GtkEntry *entry;
PangoFontMetrics metrics; PangoFontMetrics metrics;
PangoFont *font; PangoFont *font;
gchar *lang;
gint xborder, yborder; gint xborder, yborder;
PangoContext *context;
g_return_if_fail (widget != NULL); g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_ENTRY (widget)); g_return_if_fail (GTK_IS_ENTRY (widget));
...@@ -1047,11 +1047,11 @@ gtk_entry_size_request (GtkWidget *widget, ...@@ -1047,11 +1047,11 @@ gtk_entry_size_request (GtkWidget *widget,
/* hackish for now, get metrics /* hackish for now, get metrics
*/ */
font = pango_context_load_font (gtk_widget_get_pango_context (widget), context = gtk_widget_get_pango_context (widget);
widget->style->font_desc); 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,
pango_font_get_metrics (font, lang, &metrics); pango_context_get_language (context),
g_free (lang); &metrics);
g_object_unref (G_OBJECT (font)); g_object_unref (G_OBJECT (font));
......
...@@ -24,7 +24,9 @@ ...@@ -24,7 +24,9 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include "gtkhscale.h" #include "gtkhscale.h"
#include "gtksignal.h" #include "gtksignal.h"
#include "gtkintl.h" #include "gtkintl.h"
......
...@@ -598,10 +598,11 @@ gtk_set_locale (void) ...@@ -598,10 +598,11 @@ gtk_set_locale (void)
* *
* Return value: the default language as an allocated string, must be freed * Return value: the default language as an allocated string, must be freed
**/ **/
gchar* PangoLanguage *
gtk_get_default_language (void) gtk_get_default_language (void)
{ {
gchar *lang; gchar *lang;
PangoLanguage *result;
gchar *p; gchar *p;
lang = g_strdup (setlocale (LC_CTYPE, NULL)); lang = g_strdup (setlocale (LC_CTYPE, NULL));
...@@ -612,6 +613,9 @@ gtk_get_default_language (void) ...@@ -612,6 +613,9 @@ gtk_get_default_language (void)
if (p) if (p)
*p = '\0'; *p = '\0';
result = pango_language_from_string (lang);
g_free (lang);
return lang; return lang;
} }
......
...@@ -106,11 +106,9 @@ gboolean gtk_init_check_abi_check (int *argc, ...@@ -106,11 +106,9 @@ gboolean gtk_init_check_abi_check (int *argc,
#ifndef GTK_DISABLE_DEPRECATED #ifndef GTK_DISABLE_DEPRECATED
void gtk_exit (gint error_code); void gtk_exit (gint error_code);
#endif /* GTK_DISABLE_DEPRECATED */ #endif /* GTK_DISABLE_DEPRECATED */
gchar* gtk_set_locale (void); gchar * gtk_set_locale (void);
gchar* gtk_get_default_language (void); PangoLanguage *gtk_get_default_language (void);
gint gtk_events_pending (void); gint gtk_events_pending (void);
/* The following is the event func GTK+ registers with GDK /* The following is the event func GTK+ registers with GDK
* we expose it mainly to allow filtering of events between * we expose it mainly to allow filtering of events between
......
...@@ -567,19 +567,19 @@ gtk_spin_button_size_request (GtkWidget *widget, ...@@ -567,19 +567,19 @@ gtk_spin_button_size_request (GtkWidget *widget,
if (entry->width_chars < 0) if (entry->width_chars < 0)
{ {
PangoContext *context;
PangoFontMetrics metrics; PangoFontMetrics metrics;
PangoFont *font; PangoFont *font;
gchar *lang;
gint width; gint width;
gint w; gint w;
int string_len; int string_len;
context = gtk_widget_get_pango_context (widget);
font = pango_context_load_font (gtk_widget_get_pango_context (widget), font = pango_context_load_font (context,
widget->style->font_desc); widget->style->font_desc);
lang = pango_context_get_lang (gtk_widget_get_pango_context (widget)); pango_font_get_metrics (font,
pango_font_get_metrics (font, lang, &metrics); pango_context_get_language (context),
g_free (lang); &metrics);
g_object_unref (G_OBJECT (font)); g_object_unref (G_OBJECT (font));
/* Get max of MIN_SPIN_BUTTON_WIDTH, size of upper, size of lower */ /* Get max of MIN_SPIN_BUTTON_WIDTH, size of upper, size of lower */
......
...@@ -4076,7 +4076,7 @@ get_insensitive_layout (PangoLayout *layout) ...@@ -4076,7 +4076,7 @@ get_insensitive_layout (PangoLayout *layout)
if (run) if (run)
{ {
tmp_list = run->item->extra_attrs; tmp_list = run->item->analysis.extra_attrs;
while (tmp_list != NULL) while (tmp_list != NULL)
{ {
......
...@@ -3248,7 +3248,6 @@ compute_log_attrs (const GtkTextIter *iter, ...@@ -3248,7 +3248,6 @@ compute_log_attrs (const GtkTextIter *iter,
gchar *paragraph; gchar *paragraph;
gint char_len, byte_len; gint char_len, byte_len;
PangoLogAttr *attrs = NULL; PangoLogAttr *attrs = NULL;
gchar *lang;
start = *iter; start = *iter;
end = *iter; end = *iter;
...@@ -3267,14 +3266,10 @@ compute_log_attrs (const GtkTextIter *iter, ...@@ -3267,14 +3266,10 @@ compute_log_attrs (const GtkTextIter *iter,
attrs = g_new (PangoLogAttr, char_len); attrs = g_new (PangoLogAttr, char_len);
lang = gtk_text_iter_get_language (&start);
pango_get_log_attrs (paragraph, byte_len, -1, pango_get_log_attrs (paragraph, byte_len, -1,
lang, gtk_text_iter_get_language (&start),
attrs); attrs);
g_free (lang);
g_free (paragraph); g_free (paragraph);
return attrs; return attrs;
......
...@@ -191,7 +191,7 @@ get_shape_extents (PangoLayoutRun *run, ...@@ -191,7 +191,7 @@ get_shape_extents (PangoLayoutRun *run,
PangoRectangle *ink_rect, PangoRectangle *ink_rect,
PangoRectangle *logical_rect) PangoRectangle *logical_rect)
{ {
GSList *tmp_list = run->item->extra_attrs; GSList *tmp_list = run->item->analysis.extra_attrs;
while (tmp_list) while (tmp_list)
{ {
...@@ -653,7 +653,7 @@ static void ...@@ -653,7 +653,7 @@ static void
get_item_properties (PangoItem *item, get_item_properties (PangoItem *item,
GtkTextAppearance **appearance) GtkTextAppearance **appearance)
{ {
GSList *tmp_list = item->extra_attrs; GSList *tmp_list = item->analysis.extra_attrs;
*appearance = NULL; *appearance = NULL;
......
...@@ -1379,17 +1379,17 @@ gtk_text_iter_editable (const GtkTextIter *iter, ...@@ -1379,17 +1379,17 @@ gtk_text_iter_editable (const GtkTextIter *iter,
* *
* Return value: language in effect at @iter * Return value: language in effect at @iter
**/ **/
gchar* PangoLanguage *
gtk_text_iter_get_language (const GtkTextIter *iter) gtk_text_iter_get_language (const GtkTextIter *iter)
{ {
GtkTextAttributes *values; GtkTextAttributes *values;
gchar *retval; PangoLanguage *retval;
values = gtk_text_attributes_new (); values = gtk_text_attributes_new ();
gtk_text_iter_get_attributes (iter, values); gtk_text_iter_get_attributes (iter, values);
retval = g_strdup (values->language); retval = values->language;
gtk_text_attributes_unref (values); gtk_text_attributes_unref (values);
......
...@@ -142,11 +142,11 @@ gboolean gtk_text_iter_is_cursor_position (const GtkTextIter *iter); ...@@ -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_chars_in_line (const GtkTextIter *iter);
gint gtk_text_iter_get_bytes_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, gboolean gtk_text_iter_get_attributes (const GtkTextIter *iter,
GtkTextAttributes *values); GtkTextAttributes *values);
gchar* gtk_text_iter_get_language (const GtkTextIter *iter); PangoLanguage* gtk_text_iter_get_language (const GtkTextIter *iter);
gboolean gtk_text_iter_is_end (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_is_start (const GtkTextIter *iter);
/* /*
* Moving around the buffer * Moving around the buffer
......
...@@ -1492,7 +1492,7 @@ add_cursor (GtkTextLayout *layout, ...@@ -1492,7 +1492,7 @@ add_cursor (GtkTextLayout *layout,
static gboolean static gboolean
is_shape (PangoLayoutRun *run) is_shape (PangoLayoutRun *run)
{ {
GSList *tmp_list = run->item->extra_attrs; GSList *tmp_list = run->item->analysis.extra_attrs;
while (tmp_list) while (tmp_list)
{ {
...@@ -1582,6 +1582,7 @@ add_preedit_attrs (GtkTextLayout *layout, ...@@ -1582,6 +1582,7 @@ add_preedit_attrs (GtkTextLayout *layout,
PangoAttribute *insert_attr; PangoAttribute *insert_attr;
GSList *extra_attrs = NULL; GSList *extra_attrs = NULL;
GSList *tmp_list; GSList *tmp_list;
PangoLanguage *language;
gint start, end; gint start, end;
pango_attr_iterator_range (iter, &start, &end); pango_attr_iterator_range (iter, &start, &end);
...@@ -1590,7 +1591,7 @@ add_preedit_attrs (GtkTextLayout *layout, ...@@ -1590,7 +1591,7 @@ add_preedit_attrs (GtkTextLayout *layout,
end = layout->preedit_len; end = layout->preedit_len;
pango_attr_iterator_get_font (iter, &style->font, pango_attr_iterator_get_font (iter, &style->font,
&font_desc, &extra_attrs); &font_desc, &language, &extra_attrs);
tmp_list = extra_attrs; tmp_list = extra_attrs;
while (tmp_list) while (tmp_list)
...@@ -1631,6 +1632,15 @@ add_preedit_attrs (GtkTextLayout *layout, ...@@ -1631,6 +1632,15 @@ add_preedit_attrs (GtkTextLayout *layout,
pango_attr_list_insert (attrs, insert_attr); 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, add_generic_attrs (layout, &appearance, end - start,
attrs, start + offset, attrs, start + offset,
size_only, TRUE); size_only, TRUE);
......
...@@ -1088,7 +1088,7 @@ gtk_text_tag_set_property (GObject *object, ...@@ -1088,7 +1088,7 @@ gtk_text_tag_set_property (GObject *object,
case PROP_LANGUAGE: case PROP_LANGUAGE:
text_tag->language_set = TRUE; 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"); g_object_notify (G_OBJECT (text_tag), "language_set");
break; break;
...@@ -1425,7 +1425,7 @@ gtk_text_tag_get_property (GObject *object, ...@@ -1425,7 +1425,7 @@ gtk_text_tag_get_property (GObject *object,
break; break;
case PROP_LANGUAGE: case PROP_LANGUAGE:
g_value_set_string (value, tag->values->language); g_value_set_string (value, pango_language_to_string (tag->values->language));
break; break;
case PROP_TABS: case PROP_TABS:
...@@ -1818,9 +1818,6 @@ gtk_text_attributes_copy_values (GtkTextAttributes *src, ...@@ -1818,9 +1818,6 @@ gtk_text_attributes_copy_values (GtkTextAttributes *src,
if (dest->appearance.fg_stipple) if (dest->appearance.fg_stipple)
gdk_bitmap_unref (dest->appearance.fg_stipple); gdk_bitmap_unref (dest->appearance.fg_stipple);
if (dest->language)
g_free (dest->language);
if (dest->font.family_name) if (dest->font.family_name)
g_free (dest->font.family_name); g_free (dest->font.family_name);
...@@ -1832,7 +1829,7 @@ gtk_text_attributes_copy_values (GtkTextAttributes *src, ...@@ -1832,7 +1829,7 @@ gtk_text_attributes_copy_values (GtkTextAttributes *src,
if (src->tabs) if (src->tabs)
dest->tabs = pango_tab_array_copy (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); dest->font.family_name = g_strdup (src->font.family_name);
...@@ -1882,9 +1879,6 @@ gtk_text_attributes_unref (GtkTextAttributes *values) ...@@ -1882,9 +1879,6 @@ gtk_text_attributes_unref (GtkTextAttributes *values)
if (values->tabs) if (values->tabs)
pango_tab_array_free (values->tabs); pango_tab_array_free (values->tabs);
if (values->language)
g_free (values->language);
if (values->font.family_name) if (values->font.family_name)
g_free (values->font.family_name); g_free (values->font.family_name);
...@@ -2059,10 +2053,7 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest, ...@@ -2059,10 +2053,7 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest,
dest->bg_full_height = vals->bg_full_height; dest->bg_full_height = vals->bg_full_height;
if (tag->language_set) if (tag->language_set)
{ dest->language = vals->language;
g_free (dest->language);
dest->language = g_strdup (vals->language);
}
++n; ++n;
} }
......
...@@ -170,7 +170,7 @@ struct _GtkTextAttributes ...@@ -170,7 +170,7 @@ struct _GtkTextAttributes
* GTK_WRAPMODE_NONE, GTK_WRAPMODE_WORD * GTK_WRAPMODE_NONE, GTK_WRAPMODE_WORD
*/ */
gchar *language; PangoLanguage *language;
/* hide the text */ /* hide the text */
guint invisible : 1; guint invisible : 1;
......
...@@ -24,7 +24,9 @@ ...@@ -24,7 +24,9 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include "gtkvscale.h" #include "gtkvscale.h"
#include "gtksignal.h" #include "gtksignal.h"
#include "gtkintl.h" #include "gtkintl.h"
......
...@@ -3989,7 +3989,6 @@ PangoContext * ...@@ -3989,7 +3989,6 @@ PangoContext *
gtk_widget_create_pango_context (GtkWidget *widget) gtk_widget_create_pango_context (GtkWidget *widget)
{ {
PangoContext *context; PangoContext *context;
char *lang;
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
...@@ -4000,10 +3999,7 @@ gtk_widget_create_pango_context (GtkWidget *widget) ...@@ -4000,10 +3999,7 @@ gtk_widget_create_pango_context (GtkWidget *widget)
gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR ? gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR ?
PANGO_DIRECTION_LTR : PANGO_DIRECTION_RTL); PANGO_DIRECTION_LTR : PANGO_DIRECTION_RTL);
pango_context_set_font_description (context, widget->style->font_desc); pango_context_set_font_description (context, widget->style->font_desc);
pango_context_set_language (context, gtk_get_default_language ());
lang = gtk_get_default_language ();
pango_context_set_lang (context, lang);
g_free (lang);
return context; return context;
} }
......
...@@ -2105,9 +2105,14 @@ void create_labels (void) ...@@ -2105,9 +2105,14 @@ void create_labels (void)
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
frame = gtk_frame_new ("Internationalized Label"); frame = gtk_frame_new ("Internationalized Label");
label = gtk_label_new ("French (Français) Bonjour, Salut\n" label = gtk_label_new (NULL);
"Korean (한글) 안녕하세요, 안녕하십니까\n" gtk_label_set_markup (GTK_LABEL (label),
"Russian (Русский) Здравствуйте!"); "French (Français) Bonjour, Salut\n"
"Korean (한글) 안녕하세요, 안녕하십니까\n"
"Russian (Русский) Здравствуйте!\n"
"Chinese (Simplified) <span lang=\"zh-cn\">元气 开发</span>\n"
"Chinese (Traditional) <span lang=\"zh-tw\">元氣 開發</span>\n"
"Japanese <span lang=\"ja\">元気 開発</span>");
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_container_add (GTK_CONTAINER (frame), label); gtk_container_add (GTK_CONTAINER (frame), label);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment