From 88366ad5fe4a8a20a41cb73585ca7e1eb3ffca87 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 9 Nov 2010 08:15:06 -0500 Subject: [PATCH] Don't export _gtk_cell_renderer_calc_offset This is just a private convenience function, and exporting _-prefixed functions doesn't work with our libtool setup. Just do the 3 line calculation in gail. --- gtk/gtk.symbols | 1 - gtk/gtkcellrenderer.c | 2 +- gtk/gtkcellrenderer.h | 12 ++++++------ modules/other/gail/gailtextcell.c | 20 ++++++++++++-------- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols index 2ef829fc7c..cd88fdaf0b 100644 --- a/gtk/gtk.symbols +++ b/gtk/gtk.symbols @@ -602,7 +602,6 @@ gtk_cell_renderer_set_sensitive gtk_cell_renderer_set_visible gtk_cell_renderer_start_editing gtk_cell_renderer_stop_editing -_gtk_cell_renderer_calc_offset #endif #endif diff --git a/gtk/gtkcellrenderer.c b/gtk/gtkcellrenderer.c index d3a6c028c2..fe8a67b482 100644 --- a/gtk/gtkcellrenderer.c +++ b/gtk/gtkcellrenderer.c @@ -646,7 +646,7 @@ gtk_cell_renderer_get_size (GtkCellRenderer *cell, if (cell_area) _gtk_cell_renderer_calc_offset (cell, cell_area, gtk_widget_get_direction (widget), - request.width, request.height, x_offset, y_offset); + request.width, request.height, x_offset, y_offset); } /** diff --git a/gtk/gtkcellrenderer.h b/gtk/gtkcellrenderer.h index cad58df2a4..d2abd128bd 100644 --- a/gtk/gtkcellrenderer.h +++ b/gtk/gtkcellrenderer.h @@ -242,12 +242,12 @@ void gtk_cell_renderer_stop_editing (GtkCellRenderer *cell, void _gtk_cell_renderer_calc_offset (GtkCellRenderer *cell, - const GdkRectangle *cell_area, - GtkTextDirection direction, - gint width, - gint height, - gint *x_offset, - gint *y_offset); + const GdkRectangle *cell_area, + GtkTextDirection direction, + gint width, + gint height, + gint *x_offset, + gint *y_offset); G_END_DECLS diff --git a/modules/other/gail/gailtextcell.c b/modules/other/gail/gailtextcell.c index 2cbf5bf283..fa07f0e50e 100644 --- a/modules/other/gail/gailtextcell.c +++ b/modules/other/gail/gailtextcell.c @@ -609,10 +609,10 @@ gail_text_cell_get_character_extents (AtkText *text, widget, &min_size, NULL); - _gtk_cell_renderer_calc_offset (GTK_CELL_RENDERER (gtk_renderer), &rendered_rect, - gtk_widget_get_direction (widget), - min_size.width, min_size.height, - &x_offset, &y_offset); + gtk_cell_renderer_calc_offset (GTK_CELL_RENDERER (gtk_renderer), &rendered_rect, + gtk_widget_get_direction (widget), + min_size.width, min_size.height, + &x_offset, &y_offset); layout = create_pango_layout (gtk_renderer, widget); @@ -646,6 +646,8 @@ gail_text_cell_get_offset_at_point (AtkText *text, GdkRectangle rendered_rect; PangoLayout *layout; gchar *renderer_text; + gint width, height; + gfloat xalign, yalign; gint x_offset, y_offset, index; gint xpad, ypad; @@ -675,10 +677,12 @@ gail_text_cell_get_offset_at_point (AtkText *text, gtk_cell_renderer_get_preferred_size (GTK_CELL_RENDERER (gtk_renderer), widget, &min_size, NULL); - _gtk_cell_renderer_calc_offset (GTK_CELL_RENDERER (gtk_renderer), &rendered_rect, - gtk_widget_get_direction (widget), - min_size.width, min_size.height, - &x_offset, &y_offset); + gtk_cell_renderer_get_fixed_size (GTK_CELL_RENDERER (gtk_renderer), &width, &height); + gtk_cell_renderer_get_alignment (GTK_CELL_RENDERER (gtk_renderer), &xalign, &yalign); + if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) + xalign = 1.0 - xalign; + x_offset = MAX (0, xalign * (width - min_size.width)); + y_offset = MAX (0, yalign * (height - min_size.height)); layout = create_pango_layout (gtk_renderer, widget);