static int _get_string_index (GtkEntry *entry, gint x, gint y) { //Declarations int layout_index; int entry_index; int trailing; PangoLayout *layout; //Initalizations layout = gtk_entry_get_layout (GTK_ENTRY (entry)); if (pango_layout_xy_to_index (layout, x * PANGO_SCALE, y * PANGO_SCALE, &layout_index, &trailing)) entry_index = gtk_entry_layout_index_to_text_index (GTK_ENTRY (entry), layout_index); else entry_index = -1; return entry_index; }
static VALUE rg_layout_index_to_text_index(VALUE self, VALUE layout_index) { return INT2NUM(gtk_entry_layout_index_to_text_index(_SELF(self), NUM2INT(layout_index))); }