drawing cursor with special function



Hi!

What about this patch: it makes gtk use special function for drawing
cursor line, therefore gdk backend has chance to do something special
[like make the line blinking, or move hw cursor in case of
gdk/cursed]. What do you think about it? Could something similar go to
cvs?
								Pavel

Index: gdk/gdkdraw.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkdraw.c,v
retrieving revision 1.22
diff -u -r1.22 gdkdraw.c
--- gdk/gdkdraw.c	2000/12/02 07:51:35	1.22
+++ gdk/gdkdraw.c	2000/12/06 14:22:27
@@ -198,6 +198,28 @@
 }
 
 void
+gdk_draw_cursor_line (GdkDrawable *drawable,
+	       GdkGC       *gc,
+	       gint         x1,
+	       gint         y1,
+	       gint         x2,
+	       gint         y2)
+{
+  GdkSegment segment;
+
+  g_return_if_fail (drawable != NULL);
+  g_return_if_fail (gc != NULL);
+  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
+  g_return_if_fail (GDK_IS_GC (gc));
+
+  segment.x1 = x1;
+  segment.y1 = y1;
+  segment.x2 = x2;
+  segment.y2 = y2;
+  GDK_DRAWABLE_GET_CLASS (drawable)->draw_segments (drawable, gc, &segment, 1);
+}
+
+void
 gdk_draw_rectangle (GdkDrawable *drawable,
 		    GdkGC       *gc,
 		    gint         filled,
Index: gdk/gdkdrawable.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkdrawable.h,v
retrieving revision 1.9
diff -u -r1.9 gdkdrawable.h
--- gdk/gdkdrawable.h	2000/10/24 00:15:12	1.9
+++ gdk/gdkdrawable.h	2000/12/06 14:22:27
@@ -165,6 +165,12 @@
 			 gint              y1,
 			 gint              x2,
 			 gint              y2);
+void gdk_draw_cursor_line(GdkDrawable      *drawable,
+			 GdkGC            *gc,
+			 gint              x1,
+			 gint              y1,
+			 gint              x2,
+			 gint              y2);
 void gdk_draw_rectangle (GdkDrawable      *drawable,
 			 GdkGC            *gc,
 			 gint              filled,
Index: gtk/gtkentry.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkentry.c,v
retrieving revision 1.97
diff -u -r1.97 gtkentry.c
--- gtk/gtkentry.c	2000/12/04 01:15:36	1.97
+++ gtk/gtkentry.c	2000/12/06 14:22:27
@@ -1834,7 +1834,7 @@
 
 	  gtk_entry_get_cursor_locations (entry, &strong_x, &weak_x);
 
-	  gdk_draw_line (entry->text_area, widget->style->bg_gc[GTK_STATE_SELECTED], 
+	  gdk_draw_cursor_line (entry->text_area, widget->style->bg_gc[GTK_STATE_SELECTED], 
 			 xoffset + strong_x, INNER_BORDER,
 			 xoffset + strong_x, text_area_height - INNER_BORDER);
 




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