gail r1345 - in branches/gnome-2-22: . gail



Author: liyuan
Date: Fri Jun  6 03:09:54 2008
New Revision: 1345
URL: http://svn.gnome.org/viewvc/gail?rev=1345&view=rev

Log:
2008-06-06  Li Yuan  <li yuan sun com>

        * gail/gaillabel.c: (gail_label_real_notify_gtk):
        Before emitting "text_caret_moved", change the cursor to the changed
        bound.


Modified:
   branches/gnome-2-22/ChangeLog
   branches/gnome-2-22/gail/gaillabel.c

Modified: branches/gnome-2-22/gail/gaillabel.c
==============================================================================
--- branches/gnome-2-22/gail/gaillabel.c	(original)
+++ branches/gnome-2-22/gail/gaillabel.c	Fri Jun  6 03:09:54 2008
@@ -370,23 +370,35 @@
     }
   else if (strcmp (pspec->name, "cursor-position") == 0)
     {
-      gint start, end;
+      gint start, end, tmp;
       gboolean text_caret_moved = FALSE;
       gboolean selection_changed = FALSE;
-      gboolean is_start = TRUE;
 
       gail_obj = G_OBJECT (atk_obj);
       label = GTK_LABEL (widget);
 
+      if (gail_label->selection_bound != -1 && gail_label->selection_bound < gail_label->cursor_position)
+        {
+          tmp = gail_label->selection_bound;
+          gail_label->selection_bound = gail_label->cursor_position;
+          gail_label->cursor_position = tmp;
+        }
+
       if (gtk_label_get_selection_bounds (label, &start, &end))
         {
           if (start != gail_label->cursor_position ||
               end != gail_label->selection_bound)
             {
               if (end != gail_label->selection_bound)
-                is_start = FALSE;
-              gail_label->selection_bound = end;
-              gail_label->cursor_position = start;
+                {
+                  gail_label->selection_bound = start;
+                  gail_label->cursor_position = end;
+                }
+              else
+                {
+                  gail_label->selection_bound = end;
+                  gail_label->cursor_position = start;
+                }
               text_caret_moved = TRUE;
               if (start != end)
                 selection_changed = TRUE;
@@ -403,10 +415,14 @@
               if (gail_label->selection_bound != -1 && end != gail_label->selection_bound)
                 {
                   text_caret_moved = TRUE;
-                  is_start = FALSE;
+                  gail_label->cursor_position = end;
+                  gail_label->selection_bound = start;
+                }
+              else
+                {
+                  gail_label->cursor_position = start;
+                  gail_label->selection_bound = end;
                 }
-              gail_label->cursor_position = start;
-              gail_label->selection_bound = end;
             }
           else
             {
@@ -420,7 +436,7 @@
         }
         if (text_caret_moved)
           g_signal_emit_by_name (gail_obj, "text_caret_moved", 
-                                 is_start ? gail_label->cursor_position : gail_label->selection_bound);
+                                 gail_label->cursor_position);
         if (selection_changed)
           g_signal_emit_by_name (gail_obj, "text_selection_changed");
 



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