summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2010-11-09 08:15:06 -0500
committerMatthias Clasen <mclasen@redhat.com>2010-11-09 08:15:06 -0500
commit88366ad5fe4a8a20a41cb73585ca7e1eb3ffca87 (patch)
tree169eea9fa30741099cc2040579c2bed36fbfa0d3
parentf114efcd1053f4eacc7b362e1b6d71b5a6c69fb4 (diff)
downloadgtk+-88366ad5fe4a8a20a41cb73585ca7e1eb3ffca87.tar.gz
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.
-rw-r--r--gtk/gtk.symbols1
-rw-r--r--gtk/gtkcellrenderer.c2
-rw-r--r--gtk/gtkcellrenderer.h12
-rw-r--r--modules/other/gail/gailtextcell.c20
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);