[caribou: 20/23] Connects to text location instead of cursor location with get_character_extents



commit 514869041344f128521f60c616e1f019d3158b1b
Author: Nohemi Fernandez <nf68 cornell edu>
Date:   Wed Aug 10 13:54:54 2011 -0500

    Connects to text location instead of cursor location with get_character_extents

 modules/gtk3/caribou-gtk-module.vala |    4 +---
 modules/gtk3/vapi-fixes.vapi         |    9 +++++++++
 2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/modules/gtk3/caribou-gtk-module.vala b/modules/gtk3/caribou-gtk-module.vala
index 4c92348..b6cc358 100644
--- a/modules/gtk3/caribou-gtk-module.vala
+++ b/modules/gtk3/caribou-gtk-module.vala
@@ -90,9 +90,7 @@ namespace Caribou {
 
                 if (object is Atk.Text) {
                     caret_offset = ((Atk.Text) object).get_caret_offset ();
-                    ((Atk.Text) object).get_range_extents (0, caret_offset, Atk.CoordType.SCREEN, cursor_rect);
-
-                    x = cursor_rect.x; y  = cursor_rect.y; w = cursor_rect.width; h = cursor_rect.height;
+                    Atk.get_character_extents ((Atk.Text) object, caret_offset, out x, out y, out w, out h, Atk.CoordType.SCREEN);
                 }
                 else {
                     if (current_window != null)
diff --git a/modules/gtk3/vapi-fixes.vapi b/modules/gtk3/vapi-fixes.vapi
index deec3f6..f88804e 100644
--- a/modules/gtk3/vapi-fixes.vapi
+++ b/modules/gtk3/vapi-fixes.vapi
@@ -1,4 +1,5 @@
 using Gdk;
+using Atk;
 
 [CCode (cprefix = "Gdk", lower_case_cprefix = "gdk_", cheader_filename = "gdk/gdk.h")]
 
@@ -18,3 +19,11 @@ namespace Gdk {
     public void window_get_user_data (Gdk.Window window,
 									  out void* data);
 }
+
+[CCode (cprefix = "Atk", lower_case_cprefix = "atk_", gir_namespace = "Atk", gir_version = "1.0")]
+
+namespace Atk {
+    [CCode (cname = "atk_text_get_character_extents")]
+    public void get_character_extents (Atk.Text text, int offset, out int x, out int y,
+                                                      out int w, out int h, Atk.CoordType coord);
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]