Re: [gtk-list] Re: Selection behavior in entries (RFC)



I'm sorry. I posted a wrong patch. following may be correct.

( this patch introdues yet another selection behavior in entries )


                                  -Takashi Matsuda
                                   matsu@arch.comp.kyutech.ac.jp


--- gtkentry.c.old	Fri Oct 31 14:27:12 1997
+++ gtkentry.c	Fri Nov 21 14:25:30 1997
@@ -719,8 +719,20 @@
     {
       if (event->button == 2)
 	{
-	  if (entry->selection_start_pos == entry->selection_end_pos)
-	    entry->current_pos = gtk_entry_position (entry, event->x + entry->scroll_offset);
+	  gint current_pos;
+
+	  current_pos = gtk_entry_position (entry, event->x + entry->scroll_offset);
+	  if ((entry->selection_start_pos == entry->selection_end_pos) ||
+	      entry->have_selection )
+	    entry->current_pos = current_pos;
+	  else if ((entry->selection_start_pos >= current_pos) ||
+	           (entry->selection_end_pos <= current_pos))
+	    {
+	      entry->current_pos = current_pos;
+	      entry->selection_start_pos = 0;
+	      entry->selection_end_pos = 0;
+	    }
+	    
 	  gtk_selection_convert (widget, GDK_SELECTION_PRIMARY,
 				 GDK_TARGET_STRING, event->time);
 	}



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