diff --git a/ChangeLog b/ChangeLog index 121233f246..65683a6728 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +Sun May 10 00:16:44 1998 Owen Taylor + + * gtk.m4: Work around inability of HP/UX to + sscanf from a readonly string. + +Sat May 9 23:14:39 1998 Owen Taylor + + * gdk/gdk.c: Fixed one more XLookupString location. (For KeyRelease) + +Fri May 8 21:31:50 1998 Owen Taylor + + * 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 + + * 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. + 1998-05-06 Federico Mena Quintero * gtk/gtkclist.c (draw_row): Fixed incorrect painting of row diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 121233f246..65683a6728 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,26 @@ +Sun May 10 00:16:44 1998 Owen Taylor + + * gtk.m4: Work around inability of HP/UX to + sscanf from a readonly string. + +Sat May 9 23:14:39 1998 Owen Taylor + + * gdk/gdk.c: Fixed one more XLookupString location. (For KeyRelease) + +Fri May 8 21:31:50 1998 Owen Taylor + + * 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 + + * 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. + 1998-05-06 Federico Mena Quintero * gtk/gtkclist.c (draw_row): Fixed incorrect painting of row diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 121233f246..65683a6728 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,26 @@ +Sun May 10 00:16:44 1998 Owen Taylor + + * gtk.m4: Work around inability of HP/UX to + sscanf from a readonly string. + +Sat May 9 23:14:39 1998 Owen Taylor + + * gdk/gdk.c: Fixed one more XLookupString location. (For KeyRelease) + +Fri May 8 21:31:50 1998 Owen Taylor + + * 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 + + * 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. + 1998-05-06 Federico Mena Quintero * gtk/gtkclist.c (draw_row): Fixed incorrect painting of row diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 121233f246..65683a6728 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,26 @@ +Sun May 10 00:16:44 1998 Owen Taylor + + * gtk.m4: Work around inability of HP/UX to + sscanf from a readonly string. + +Sat May 9 23:14:39 1998 Owen Taylor + + * gdk/gdk.c: Fixed one more XLookupString location. (For KeyRelease) + +Fri May 8 21:31:50 1998 Owen Taylor + + * 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 + + * 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. + 1998-05-06 Federico Mena Quintero * gtk/gtkclist.c (draw_row): Fixed incorrect painting of row diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 121233f246..65683a6728 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,26 @@ +Sun May 10 00:16:44 1998 Owen Taylor + + * gtk.m4: Work around inability of HP/UX to + sscanf from a readonly string. + +Sat May 9 23:14:39 1998 Owen Taylor + + * gdk/gdk.c: Fixed one more XLookupString location. (For KeyRelease) + +Fri May 8 21:31:50 1998 Owen Taylor + + * 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 + + * 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. + 1998-05-06 Federico Mena Quintero * gtk/gtkclist.c (draw_row): Fixed incorrect painting of row diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 121233f246..65683a6728 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,26 @@ +Sun May 10 00:16:44 1998 Owen Taylor + + * gtk.m4: Work around inability of HP/UX to + sscanf from a readonly string. + +Sat May 9 23:14:39 1998 Owen Taylor + + * gdk/gdk.c: Fixed one more XLookupString location. (For KeyRelease) + +Fri May 8 21:31:50 1998 Owen Taylor + + * 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 + + * 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. + 1998-05-06 Federico Mena Quintero * gtk/gtkclist.c (draw_row): Fixed incorrect painting of row diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 121233f246..65683a6728 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,26 @@ +Sun May 10 00:16:44 1998 Owen Taylor + + * gtk.m4: Work around inability of HP/UX to + sscanf from a readonly string. + +Sat May 9 23:14:39 1998 Owen Taylor + + * gdk/gdk.c: Fixed one more XLookupString location. (For KeyRelease) + +Fri May 8 21:31:50 1998 Owen Taylor + + * 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 + + * 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. + 1998-05-06 Federico Mena Quintero * gtk/gtkclist.c (draw_row): Fixed incorrect painting of row diff --git a/gdk/gdk.c b/gdk/gdk.c index 7541af3c7b..6725e2699c 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -1844,9 +1844,10 @@ gdk_event_translate (GdkEvent *event, case KeyRelease: /* Lookup the string corresponding to the given keysym. */ + keysym = GDK_VoidSymbol; charcount = XLookupString (&xevent->xkey, buf, 16, - (KeySym*) &event->key.keyval, - &compose); + &keysym, &compose); + event->key.keyval = keysym; /* Print debugging info. */ diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c index 2f2cdea4c0..94a7e845fd 100644 --- a/gdk/gdkpixmap.c +++ b/gdk/gdkpixmap.c @@ -299,12 +299,16 @@ gdk_pixmap_skip_string (gchar *buffer) return &buffer[index]; } +/* Xlib crashed ince at a color name lengths around 125 */ +#define MAX_COLOR_LEN 120 + gchar* gdk_pixmap_extract_color (gchar *buffer) { - gint counter, finished = FALSE, numnames; + gint counter, numnames; gchar *ptr = NULL, ch, temp[128]; - gchar color[128], *retcol; + gchar color[MAX_COLOR_LEN], *retcol; + gint space; counter = 0; while (ptr == NULL) @@ -321,9 +325,6 @@ gdk_pixmap_extract_color (gchar *buffer) counter++; } - if (ptr == NULL) - return NULL; - ptr = gdk_pixmap_skip_whitespaces (ptr); if (ptr[0] == 0) @@ -337,18 +338,29 @@ gdk_pixmap_extract_color (gchar *buffer) color[0] = 0; numnames = 0; - while (finished == FALSE) + space = MAX_COLOR_LEN - 1; + while (space > 0) { sscanf (ptr, "%127s", temp); - if ((gint)ptr[0] == 0 || strcmp ("s", temp) == 0 || strcmp ("m", temp) == 0 || - strcmp ("g", temp) == 0 || strcmp ("g4", temp) == 0) - finished = TRUE; + if (((gint)ptr[0] == 0) || + (strcmp ("s", temp) == 0) || (strcmp ("m", temp) == 0) || + (strcmp ("g", temp) == 0) || (strcmp ("g4", temp) == 0)) + { + break; + } else { if (numnames > 0) - strcat (color, " "); - strcat (color, temp); + { + space -= 1; + strcat (color, " "); + } + if (space > 0) + { + strncat (color, temp, space); + space -= MIN (space, strlen (temp)); + } ptr = gdk_pixmap_skip_string (ptr); ptr = gdk_pixmap_skip_whitespaces (ptr); numnames++; @@ -359,7 +371,6 @@ gdk_pixmap_extract_color (gchar *buffer) return retcol; } - GdkPixmap* gdk_pixmap_colormap_create_from_xpm (GdkWindow *window, GdkColormap *colormap, diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c index 7541af3c7b..6725e2699c 100644 --- a/gdk/x11/gdkmain-x11.c +++ b/gdk/x11/gdkmain-x11.c @@ -1844,9 +1844,10 @@ gdk_event_translate (GdkEvent *event, case KeyRelease: /* Lookup the string corresponding to the given keysym. */ + keysym = GDK_VoidSymbol; charcount = XLookupString (&xevent->xkey, buf, 16, - (KeySym*) &event->key.keyval, - &compose); + &keysym, &compose); + event->key.keyval = keysym; /* Print debugging info. */ diff --git a/gdk/x11/gdkpixmap-x11.c b/gdk/x11/gdkpixmap-x11.c index 2f2cdea4c0..94a7e845fd 100644 --- a/gdk/x11/gdkpixmap-x11.c +++ b/gdk/x11/gdkpixmap-x11.c @@ -299,12 +299,16 @@ gdk_pixmap_skip_string (gchar *buffer) return &buffer[index]; } +/* Xlib crashed ince at a color name lengths around 125 */ +#define MAX_COLOR_LEN 120 + gchar* gdk_pixmap_extract_color (gchar *buffer) { - gint counter, finished = FALSE, numnames; + gint counter, numnames; gchar *ptr = NULL, ch, temp[128]; - gchar color[128], *retcol; + gchar color[MAX_COLOR_LEN], *retcol; + gint space; counter = 0; while (ptr == NULL) @@ -321,9 +325,6 @@ gdk_pixmap_extract_color (gchar *buffer) counter++; } - if (ptr == NULL) - return NULL; - ptr = gdk_pixmap_skip_whitespaces (ptr); if (ptr[0] == 0) @@ -337,18 +338,29 @@ gdk_pixmap_extract_color (gchar *buffer) color[0] = 0; numnames = 0; - while (finished == FALSE) + space = MAX_COLOR_LEN - 1; + while (space > 0) { sscanf (ptr, "%127s", temp); - if ((gint)ptr[0] == 0 || strcmp ("s", temp) == 0 || strcmp ("m", temp) == 0 || - strcmp ("g", temp) == 0 || strcmp ("g4", temp) == 0) - finished = TRUE; + if (((gint)ptr[0] == 0) || + (strcmp ("s", temp) == 0) || (strcmp ("m", temp) == 0) || + (strcmp ("g", temp) == 0) || (strcmp ("g4", temp) == 0)) + { + break; + } else { if (numnames > 0) - strcat (color, " "); - strcat (color, temp); + { + space -= 1; + strcat (color, " "); + } + if (space > 0) + { + strncat (color, temp, space); + space -= MIN (space, strlen (temp)); + } ptr = gdk_pixmap_skip_string (ptr); ptr = gdk_pixmap_skip_whitespaces (ptr); numnames++; @@ -359,7 +371,6 @@ gdk_pixmap_extract_color (gchar *buffer) return retcol; } - GdkPixmap* gdk_pixmap_colormap_create_from_xpm (GdkWindow *window, GdkColormap *colormap, diff --git a/gtk.m4 b/gtk.m4 index 463c436777..44594bdd76 100644 --- a/gtk.m4 +++ b/gtk.m4 @@ -61,10 +61,13 @@ int main () { int major, minor, micro; + char *tmp_version; system ("touch conf.gtktest"); - if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) { + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_gtk_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 88c4430568..b85c71290a 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -1896,6 +1896,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"); @@ -2933,8 +2940,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"); @@ -3171,6 +3181,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); @@ -3182,26 +3200,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); - - return list->next; } + + list = member->next; + + g_mem_chunk_free (params_mem_chunk, member->data); + g_list_free_1 (member); + + return list; } /**********************************************************************/ diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 4e66b1d3d1..aca314ff73 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -1558,8 +1558,12 @@ static gint gtk_widget_idle_draw (void *data) { GSList *node; + GSList *draw_queue; - node = gtk_widget_redraw_queue; + draw_queue = node = gtk_widget_redraw_queue; + /* We set this gtk_widget_redraw_queue to NULL first, in case anybody + * calls queue_draw recursively + */ gtk_widget_redraw_queue = NULL; while (node) { @@ -1567,7 +1571,9 @@ gtk_widget_idle_draw (void *data) node = node->next; } - return gtk_widget_redraw_queue != NULL; + g_slist_free (draw_queue); + + return FALSE; } void @@ -1628,7 +1634,7 @@ gtk_widget_idle_sizer (void *data) } g_slist_free (free_slist); - return gtk_widget_resize_queue != NULL; + return FALSE; } void