diff options
author | Owen Taylor <otaylor@gtk.org> | 1998-05-10 02:46:20 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 1998-05-10 02:46:20 +0000 |
commit | f75d8b0c23e8ea8cd31afd8ac16aa85324aa4ff5 (patch) | |
tree | 3fc54e99797c9aea92f56c3b0104f0537ab112e4 /gtk/gtktext.c | |
parent | aab3106abd20dfc51a3d3132d98c9f269ef20ee0 (diff) | |
download | gtk+-f75d8b0c23e8ea8cd31afd8ac16aa85324aa4ff5.tar.gz |
Try to figure out if this is Digital Unix and we need -std1 to get the
Sat May 9 20:11:20 1998 Owen Taylor <otaylor@gtk.org>
* configure.in (LIBS): Try to figure out if this
is Digital Unix and we need -std1 to get the
right prototypes.
Sat May 9 20:08:12 1998 Owen Taylor <otaylor@gtk.org>
* glib/gmem.c: Experimentally restore GMemChunk
to its primeval state - where mem areas are
freed incrementally instead of searching the tree
every time a mem area is completely empty. Also,
always keep one mem chunk around. (Reduced calls
to malloc() a lot, but doesn't really improve
performance significiantly)
Fri May 8 21:31:50 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkwidget.c (gtk_widget_queue_draw): Free the
draw-queue when we are done.
(gtk_widget_queue_draw/_queu_resize): Always return
FALSE and avoid having two idles at the same time.
Fri May 8 21:04:00 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtktext.c: Various fixes to make sure cache
lines are freed if line_start_cache doesn't point to the
beginning of the cache.
Thu May 7 09:44:22 1998 Owen Taylor <otaylor@gtk.org>
* style_set improvements for GtkText and GtkEntry
Tue May 5 19:49:27 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkpixmap.c: Patches from Gordon Matzigkeit
to speed things up and remove code duplication.
Reintegrated buffer overflow patches, and added
some extra paranoia.
Tue May 5 17:04:14 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdk.c (gdk_event_translate): A guint * was
being passed where X expected a Keysym *, and
keysyms are long's on Alpha Linux. This was causing
segfaults in Xlib, apparently because of alignment.
(Bug located by Juergen Haas <haas@forwiss.uni-passau.de>)
Tue May 5 19:11:27 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkdrawingarea.c (gtk_drawing_area_realize): Always
set GDK_EXPOSURE_MASK for DrawingAreas
Tue May 5 14:32:37 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkwidget.[ch]: removed gtk_widge_propagate_default_style
(superceded by RC file reparsing capabilities)
* gtk/gtkwindow.c: Add handling for _GDK_READ_RFCILES client
events. (Shouldn't be sent to the InputOnly leader, which
it is now by gdk_event_send_clientmessage_toall
* gtk/testgtk.c: Added extra button to rcfiles test
to send out _GDK_READ_RCFILES events.
Tue May 5 11:03:00 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkselection.c (gtk_selection_clear): Fixed
reversed conditionals that caused segfault on some
platforms.
Tue May 5 00:44:47 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcontainer.c (gtk_container_set_focus_[hv]adjustment):
cast to GTK_OBJECT for gtk_object_ref.
Diffstat (limited to 'gtk/gtktext.c')
-rw-r--r-- | gtk/gtktext.c | 71 |
1 files changed, 59 insertions, 12 deletions
diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 843fa465c2..69b533c29a 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -161,6 +161,8 @@ static void gtk_text_init (GtkText *text); static void gtk_text_destroy (GtkObject *object); static void gtk_text_realize (GtkWidget *widget); static void gtk_text_unrealize (GtkWidget *widget); +static void gtk_text_style_set (GtkWidget *widget, + GtkStyle *previous_style); static void gtk_text_draw_focus (GtkWidget *widget); static void gtk_text_size_request (GtkWidget *widget, GtkRequisition *requisition); @@ -458,6 +460,7 @@ gtk_text_class_init (GtkTextClass *class) widget_class->realize = gtk_text_realize; widget_class->unrealize = gtk_text_unrealize; + widget_class->style_set = gtk_text_style_set; widget_class->draw_focus = gtk_text_draw_focus; widget_class->size_request = gtk_text_size_request; widget_class->size_allocate = gtk_text_size_allocate; @@ -1052,6 +1055,29 @@ gtk_text_realize (GtkWidget *widget) recompute_geometry (text); } +static void +gtk_text_style_set (GtkWidget *widget, + GtkStyle *previous_style) +{ + GtkText *text; + + g_return_if_fail (widget != NULL); + g_return_if_fail (GTK_IS_TEXT (widget)); + + text = GTK_TEXT (widget); + if (GTK_WIDGET_REALIZED (widget)) + { + gdk_window_set_background (widget->window, &widget->style->base[GTK_STATE_NORMAL]); + gdk_window_set_background (text->text_area, &widget->style->base[GTK_STATE_NORMAL]); + + if ((widget->allocation.width > 1) || (widget->allocation.height > 1)) + recompute_geometry (text); + } + + if (GTK_WIDGET_DRAWABLE (widget)) + gdk_window_clear (widget->window); +} + static void gtk_text_unrealize (GtkWidget *widget) { @@ -1888,6 +1914,13 @@ gtk_text_adjustment (GtkAdjustment *adjustment, g_return_if_fail (text != NULL); g_return_if_fail (GTK_IS_TEXT (text)); + /* Just ignore it if we haven't been size-allocated yet, or + * if something weird has happened */ + if ((text->line_start_cache == NULL) || + (GTK_WIDGET (text)->allocation.height <= 1) || + (GTK_WIDGET (text)->allocation.width <= 1)) + return; + if (adjustment == text->hadj) { g_warning ("horizontal scrolling not implemented"); @@ -2958,8 +2991,11 @@ find_line_containing_point (GtkText* text, guint point, if (scroll) { lph = pixel_height_of (text, cache->next); - - while (lph > height || lph == 0) + + /* Scroll the bottom of the line is on screen, or until + * the line is the first onscreen line. + */ + while (cache->next != text->line_start_cache && lph > height) { TEXT_SHOW_LINE (text, cache, "cache"); TEXT_SHOW_LINE (text, cache->next, "cache->next"); @@ -3196,6 +3232,14 @@ free_cache (GtkText* text) { GList* cache = text->line_start_cache; + if (cache) + { + while (cache->prev) + cache = cache->prev; + + text->line_start_cache = cache; + } + for (; cache; cache = cache->next) g_mem_chunk_free (params_mem_chunk, cache->data); @@ -3207,26 +3251,29 @@ free_cache (GtkText* text) static GList* remove_cache_line (GtkText* text, GList* member) { + GList *list; + if (member == text->line_start_cache) { if (text->line_start_cache) text->line_start_cache = text->line_start_cache->next; - return text->line_start_cache; } - else - { - GList *list = member->prev; - list->next = list->next->next; + if (member->prev) + { + list = member->prev; + + list->next = member->next; if (list->next) list->next->prev = list; + } - member->next = NULL; - g_mem_chunk_free (params_mem_chunk, member->data); - g_list_free (member); + list = member->next; + + g_mem_chunk_free (params_mem_chunk, member->data); + g_list_free_1 (member); - return list->next; - } + return list; } /**********************************************************************/ |