Small patch for gtktextdisplay.c



Hi.

The following patch removes the assertion in gtktextdisplay.c in
gtk_text_layout_draw() that x_offset and y_offset must be >= 0. It also
sets a clip rectangle for the cursor being drawn so that it's properly
clipped if the line of text with the cursor on it is being clipped.
These are both necessary for the canvas text item. Ok to commit?

Joe


Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.1963
diff -u -r1.1963 ChangeLog
--- ChangeLog	2001/05/16 18:51:04	1.1963
+++ ChangeLog	2001/05/17 00:09:35
@@ -1,3 +1,9 @@
+2001-05-16  Joe Shaw  <joe ximian com>
+
+	* gtk/gtktextdisplay.c (gtk_text_layout_draw): Remove the assertions
+	that x_offset and y_offset must be >= 0. Clip the cursor being drawn
+	if it is only partially onscreen.
+
 Sun May 13 12:01:12 2001  Owen Taylor  <otaylor redhat com>
 
 	* autogen.sh (have_automake): Require libtool-1.4,
Index: gtk/gtktextdisplay.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktextdisplay.c,v
retrieving revision 1.23
diff -u -r1.23 gtktextdisplay.c
--- gtk/gtktextdisplay.c	2001/04/24 12:24:34	1.23
+++ gtk/gtktextdisplay.c	2001/05/17 00:09:35
@@ -698,8 +698,6 @@
   g_return_if_fail (layout->default_style != NULL);
   g_return_if_fail (layout->buffer != NULL);
   g_return_if_fail (drawable != NULL);
-  g_return_if_fail (x_offset >= 0);
-  g_return_if_fail (y_offset >= 0);
   g_return_if_fail (width >= 0);
   g_return_if_fail (height >= 0);
 
@@ -794,11 +792,13 @@
               else
                 gc = widget->style->text_gc[GTK_STATE_NORMAL];
 
+              gdk_gc_set_clip_rectangle(gc, &clip);
               gdk_draw_line (drawable, gc,
                              line_display->x_offset + cursor->x - x_offset,
                              current_y + line_display->top_margin + cursor->y,
                              line_display->x_offset + cursor->x - x_offset,
                              current_y + line_display->top_margin + cursor->y + cursor->height - 1);
+              gdk_gc_set_clip_rectangle(gc, NULL);
 
               cursor_list = cursor_list->next;
             }


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