diff options
-rw-r--r-- | ChangeLog | 32 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 32 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 32 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 32 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 32 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 32 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 32 | ||||
-rw-r--r-- | gtk/gtktext.c | 104 | ||||
-rw-r--r-- | gtk/gtkwindow.c | 56 |
9 files changed, 330 insertions, 54 deletions
@@ -1,3 +1,35 @@ +Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkwindow.c (gtk_window_move_resize): Don't request + a new size from the WM if we asked for the same size + before and our request was rejected. + + * gtk/gtkwindow.c (gtk_window_configure_event): If + in response to a request, we get a configure event + with unchanged dimensions, send a synthetic expose + since ForgetGravity won't expose our window. + +Mon Sep 14 14:28:24 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktext.c (adjust_adj): Change the way we + set the adjustments on resize so that it tries to + keep the beginning of the text in approximately + the same place. + + Removed assertion that the above change made invalid. + +Thu Sep 10 22:19:35 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktext.c: - Save first_cut_pixels when switching + sizes, so that if we switch to the _same_ size, + we don't move lines around. + + - Make sure that the text area always has a size of at + least 1x1, then do all computations when realized. + + - When fetching lines in recompute_geometry, make + sure we fetch enough lines to cover the screen. + Mon Sep 14 21:47:35 CDT 1998 Shawn T. Amundson <amundson@gtk.org> * gdk/gdkimage.c: changed g_new()s to malloc()s and diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 57f1c16d7..0d8c3bf6a 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,35 @@ +Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkwindow.c (gtk_window_move_resize): Don't request + a new size from the WM if we asked for the same size + before and our request was rejected. + + * gtk/gtkwindow.c (gtk_window_configure_event): If + in response to a request, we get a configure event + with unchanged dimensions, send a synthetic expose + since ForgetGravity won't expose our window. + +Mon Sep 14 14:28:24 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktext.c (adjust_adj): Change the way we + set the adjustments on resize so that it tries to + keep the beginning of the text in approximately + the same place. + + Removed assertion that the above change made invalid. + +Thu Sep 10 22:19:35 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktext.c: - Save first_cut_pixels when switching + sizes, so that if we switch to the _same_ size, + we don't move lines around. + + - Make sure that the text area always has a size of at + least 1x1, then do all computations when realized. + + - When fetching lines in recompute_geometry, make + sure we fetch enough lines to cover the screen. + Mon Sep 14 21:47:35 CDT 1998 Shawn T. Amundson <amundson@gtk.org> * gdk/gdkimage.c: changed g_new()s to malloc()s and diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 57f1c16d7..0d8c3bf6a 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,35 @@ +Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkwindow.c (gtk_window_move_resize): Don't request + a new size from the WM if we asked for the same size + before and our request was rejected. + + * gtk/gtkwindow.c (gtk_window_configure_event): If + in response to a request, we get a configure event + with unchanged dimensions, send a synthetic expose + since ForgetGravity won't expose our window. + +Mon Sep 14 14:28:24 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktext.c (adjust_adj): Change the way we + set the adjustments on resize so that it tries to + keep the beginning of the text in approximately + the same place. + + Removed assertion that the above change made invalid. + +Thu Sep 10 22:19:35 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktext.c: - Save first_cut_pixels when switching + sizes, so that if we switch to the _same_ size, + we don't move lines around. + + - Make sure that the text area always has a size of at + least 1x1, then do all computations when realized. + + - When fetching lines in recompute_geometry, make + sure we fetch enough lines to cover the screen. + Mon Sep 14 21:47:35 CDT 1998 Shawn T. Amundson <amundson@gtk.org> * gdk/gdkimage.c: changed g_new()s to malloc()s and diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 57f1c16d7..0d8c3bf6a 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,35 @@ +Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkwindow.c (gtk_window_move_resize): Don't request + a new size from the WM if we asked for the same size + before and our request was rejected. + + * gtk/gtkwindow.c (gtk_window_configure_event): If + in response to a request, we get a configure event + with unchanged dimensions, send a synthetic expose + since ForgetGravity won't expose our window. + +Mon Sep 14 14:28:24 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktext.c (adjust_adj): Change the way we + set the adjustments on resize so that it tries to + keep the beginning of the text in approximately + the same place. + + Removed assertion that the above change made invalid. + +Thu Sep 10 22:19:35 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktext.c: - Save first_cut_pixels when switching + sizes, so that if we switch to the _same_ size, + we don't move lines around. + + - Make sure that the text area always has a size of at + least 1x1, then do all computations when realized. + + - When fetching lines in recompute_geometry, make + sure we fetch enough lines to cover the screen. + Mon Sep 14 21:47:35 CDT 1998 Shawn T. Amundson <amundson@gtk.org> * gdk/gdkimage.c: changed g_new()s to malloc()s and diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 57f1c16d7..0d8c3bf6a 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,35 @@ +Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkwindow.c (gtk_window_move_resize): Don't request + a new size from the WM if we asked for the same size + before and our request was rejected. + + * gtk/gtkwindow.c (gtk_window_configure_event): If + in response to a request, we get a configure event + with unchanged dimensions, send a synthetic expose + since ForgetGravity won't expose our window. + +Mon Sep 14 14:28:24 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktext.c (adjust_adj): Change the way we + set the adjustments on resize so that it tries to + keep the beginning of the text in approximately + the same place. + + Removed assertion that the above change made invalid. + +Thu Sep 10 22:19:35 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktext.c: - Save first_cut_pixels when switching + sizes, so that if we switch to the _same_ size, + we don't move lines around. + + - Make sure that the text area always has a size of at + least 1x1, then do all computations when realized. + + - When fetching lines in recompute_geometry, make + sure we fetch enough lines to cover the screen. + Mon Sep 14 21:47:35 CDT 1998 Shawn T. Amundson <amundson@gtk.org> * gdk/gdkimage.c: changed g_new()s to malloc()s and diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 57f1c16d7..0d8c3bf6a 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,35 @@ +Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkwindow.c (gtk_window_move_resize): Don't request + a new size from the WM if we asked for the same size + before and our request was rejected. + + * gtk/gtkwindow.c (gtk_window_configure_event): If + in response to a request, we get a configure event + with unchanged dimensions, send a synthetic expose + since ForgetGravity won't expose our window. + +Mon Sep 14 14:28:24 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktext.c (adjust_adj): Change the way we + set the adjustments on resize so that it tries to + keep the beginning of the text in approximately + the same place. + + Removed assertion that the above change made invalid. + +Thu Sep 10 22:19:35 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktext.c: - Save first_cut_pixels when switching + sizes, so that if we switch to the _same_ size, + we don't move lines around. + + - Make sure that the text area always has a size of at + least 1x1, then do all computations when realized. + + - When fetching lines in recompute_geometry, make + sure we fetch enough lines to cover the screen. + Mon Sep 14 21:47:35 CDT 1998 Shawn T. Amundson <amundson@gtk.org> * gdk/gdkimage.c: changed g_new()s to malloc()s and diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 57f1c16d7..0d8c3bf6a 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,35 @@ +Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkwindow.c (gtk_window_move_resize): Don't request + a new size from the WM if we asked for the same size + before and our request was rejected. + + * gtk/gtkwindow.c (gtk_window_configure_event): If + in response to a request, we get a configure event + with unchanged dimensions, send a synthetic expose + since ForgetGravity won't expose our window. + +Mon Sep 14 14:28:24 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktext.c (adjust_adj): Change the way we + set the adjustments on resize so that it tries to + keep the beginning of the text in approximately + the same place. + + Removed assertion that the above change made invalid. + +Thu Sep 10 22:19:35 1998 Owen Taylor <otaylor@redhat.com> + + * gtk/gtktext.c: - Save first_cut_pixels when switching + sizes, so that if we switch to the _same_ size, + we don't move lines around. + + - Make sure that the text area always has a size of at + least 1x1, then do all computations when realized. + + - When fetching lines in recompute_geometry, make + sure we fetch enough lines to cover the screen. + Mon Sep 14 21:47:35 CDT 1998 Shawn T. Amundson <amundson@gtk.org> * gdk/gdkimage.c: changed g_new()s to malloc()s and diff --git a/gtk/gtktext.c b/gtk/gtktext.c index aa67e407e..83088c7cf 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -580,6 +580,7 @@ gtk_text_init (GtkText *text) text->tab_stops = g_list_prepend (text->tab_stops, (void*)8); text->line_start_cache = NULL; + text->first_cut_pixels = 0; text->line_wrap = TRUE; text->word_wrap = FALSE; @@ -884,6 +885,7 @@ gtk_text_forward_delete (GtkText *text, compute_lines_pixels (text, nchars, &old_lines, &old_height); } + /* FIXME, or resizing after deleting will be odd */ if (text->point.index < text->first_line_start_index) { if (text->point.index + nchars >= text->first_line_start_index) @@ -1092,8 +1094,8 @@ gtk_text_realize (GtkWidget *widget) attributes.x = (widget->style->klass->xthickness + TEXT_BORDER_ROOM); attributes.y = (widget->style->klass->ythickness + TEXT_BORDER_ROOM); - attributes.width = widget->allocation.width - attributes.x * 2; - attributes.height = widget->allocation.height - attributes.y * 2; + attributes.width = MAX (1, (gint)widget->allocation.width - (gint)attributes.x * 2); + attributes.height = MAX (1, (gint)widget->allocation.height - (gint)attributes.y * 2); text->text_area = gdk_window_new (widget->window, &attributes, attributes_mask); gdk_window_set_user_data (text->text_area, text); @@ -1192,8 +1194,7 @@ gtk_text_realize (GtkWidget *widget) if (editable->selection_start_pos != editable->selection_end_pos) gtk_editable_claim_selection (editable, TRUE, GDK_CURRENT_TIME); - if ((widget->allocation.width > 1) || (widget->allocation.height > 1)) - recompute_geometry (text); + recompute_geometry (text); } static void @@ -1211,8 +1212,7 @@ gtk_text_style_set (GtkWidget *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); + recompute_geometry (text); } if (text->current_font) @@ -1431,10 +1431,10 @@ gtk_text_size_allocate (GtkWidget *widget, gdk_window_move_resize (text->text_area, widget->style->klass->xthickness + TEXT_BORDER_ROOM, widget->style->klass->ythickness + TEXT_BORDER_ROOM, - widget->allocation.width - (widget->style->klass->xthickness + - TEXT_BORDER_ROOM) * 2, - widget->allocation.height - (widget->style->klass->ythickness + - TEXT_BORDER_ROOM) * 2); + MAX (1, (gint)widget->allocation.width - (gint)(widget->style->klass->xthickness + + (gint)TEXT_BORDER_ROOM) * 2), + MAX (1, (gint)widget->allocation.height - (gint)(widget->style->klass->ythickness + + (gint)TEXT_BORDER_ROOM) * 2)); #ifdef USE_XIM if (editable->ic && (gdk_ic_get_style (editable->ic) & GDK_IM_PREEDIT_POSITION)) @@ -2065,11 +2065,8 @@ 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)) + /* Just ignore it if we haven't been size-allocated and realized yet */ + if (text->line_start_cache == NULL) return; if (adjustment == text->hadj) @@ -3536,8 +3533,6 @@ find_cursor (GtkText* text, gboolean scroll) { find_line_containing_point (text, text->cursor_mark.index, scroll); - g_assert (text->cursor_mark.index >= text->first_line_start_index); - if (text->current_line) find_cursor_at_line (text, &CACHE_DATA(text->current_line), @@ -4098,12 +4093,27 @@ adjust_adj (GtkText* text, GtkAdjustment* adj) static gint set_vertical_scroll_iterator (GtkText* text, LineParams* lp, void* data) { - gint *pixel_count = (gint*) data; + SetVerticalScrollData *svdata = (SetVerticalScrollData *) data; - if (text->first_line_start_index == lp->start.index) - text->vadj->value = (float) *pixel_count; + if ((text->first_line_start_index >= lp->start.index) && + (text->first_line_start_index <= lp->end.index)) + { + svdata->mark = lp->start; - *pixel_count += LINE_HEIGHT (*lp); + if (text->first_line_start_index == lp->start.index) + { + text->first_onscreen_ver_pixel = svdata->pixel_height + text->first_cut_pixels; + } + else + { + text->first_onscreen_ver_pixel = svdata->pixel_height; + text->first_cut_pixels = 0; + } + + text->vadj->value = (float) text->first_onscreen_ver_pixel; + } + + svdata->pixel_height += LINE_HEIGHT (*lp); return FALSE; } @@ -4114,9 +4124,6 @@ set_vertical_scroll_find_iterator (GtkText* text, LineParams* lp, void* data) SetVerticalScrollData *svdata = (SetVerticalScrollData *) data; gint return_val; - if (svdata->last_didnt_wrap) - svdata->last_line_start = lp->start.index; - if (svdata->pixel_height <= (gint) text->vadj->value && svdata->pixel_height + LINE_HEIGHT(*lp) > (gint) text->vadj->value) { @@ -4124,7 +4131,7 @@ set_vertical_scroll_find_iterator (GtkText* text, LineParams* lp, void* data) text->first_cut_pixels = (gint)text->vadj->value - svdata->pixel_height; text->first_onscreen_ver_pixel = svdata->pixel_height; - text->first_line_start_index = svdata->last_line_start; + text->first_line_start_index = lp->start.index; return_val = TRUE; } @@ -4135,11 +4142,6 @@ set_vertical_scroll_find_iterator (GtkText* text, LineParams* lp, void* data) return_val = FALSE; } - if (!lp->wraps) - svdata->last_didnt_wrap = TRUE; - else - svdata->last_didnt_wrap = FALSE; - return return_val; } @@ -4149,12 +4151,12 @@ set_vertical_scroll (GtkText* text) GtkPropertyMark mark = find_mark (text, 0); SetVerticalScrollData data; gint height; - gint pixel_count = 0; gint orig_value; - line_params_iterate (text, &mark, NULL, FALSE, &pixel_count, set_vertical_scroll_iterator); + data.pixel_height = 0; + line_params_iterate (text, &mark, NULL, FALSE, &data, set_vertical_scroll_iterator); - text->vadj->upper = (float) pixel_count; + text->vadj->upper = (float) data.pixel_height; orig_value = (gint) text->vadj->value; gdk_window_get_size (text->text_area, NULL, &height); @@ -4166,7 +4168,6 @@ set_vertical_scroll (GtkText* text) text->vadj->value = MAX (text->vadj->value, 0.0); text->last_ver_value = (gint)text->vadj->value; - text->first_cut_pixels = 0; gtk_signal_emit_by_name (GTK_OBJECT (text->vadj), "changed"); @@ -4179,13 +4180,9 @@ set_vertical_scroll (GtkText* text) line_params_iterate (text, &mark, NULL, FALSE, &data, set_vertical_scroll_find_iterator); - - return data.mark; - } - else - { - return find_mark (text, text->first_line_start_index); } + + return data.mark; } static void @@ -4448,7 +4445,8 @@ find_line_params (GtkText* text, ch_width = find_char_width (text, &lp.end, &tab_mark); - if (ch_width + lp.pixel_width > max_display_pixels) + if ((ch_width + lp.pixel_width > max_display_pixels) && + (lp.end.index > lp.start.index)) { lp.wraps = 1; @@ -5104,12 +5102,30 @@ recompute_geometry (GtkText* text) decrement_mark (&mark); gdk_window_get_size (text->text_area, &width, &height); - + + /* Fetch an entire line, to make sure that we get all the text + * we backed over above, in addition to enough text to fill up + * the space vertically + */ + new_lines = fetch_lines (text, &mark, NULL, - FetchLinesPixels, - height + text->first_cut_pixels); + FetchLinesCount, + 1); + + mark = CACHE_DATA (g_list_last (new_lines)).end; + if (!LAST_INDEX (text, mark)) + { + advance_mark (&mark); + + new_lines = g_list_concat (new_lines, + fetch_lines (text, + &mark, + NULL, + FetchLinesPixels, + height + text->first_cut_pixels)); + } /* Now work forward to the actual first onscreen line */ diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 01ca00e2f..6c44b79b9 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -689,6 +689,7 @@ gtk_window_configure_event (GtkWidget *widget, { GtkWindow *window; GtkAllocation allocation; + gboolean need_expose = FALSE; g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE); @@ -698,9 +699,21 @@ gtk_window_configure_event (GtkWidget *widget, /* If the window was merely moved, do nothing */ if ((widget->allocation.width == event->width) && - (widget->allocation.height == event->height) && - (window->resize_count == 0)) - return FALSE; + (widget->allocation.height == event->height)) + { + if (window->resize_count == 0) /* The window was merely moved */ + return FALSE; + else + { + /* We asked for a new size, which was rejected, so the + * WM sent us a synthetic configure event. We won't + * get the expose event we would normally get (since + * we have ForgetGravity), so we need to fake it. + */ + need_expose = TRUE; + } + } + window->handling_resize = TRUE; @@ -719,6 +732,21 @@ gtk_window_configure_event (GtkWidget *widget, if (window->resize_count > 0) window->resize_count -= 1; + if (need_expose) + { + GdkEvent temp_event; + temp_event.type = GDK_EXPOSE; + temp_event.expose.window = widget->window; + temp_event.expose.send_event = TRUE; + temp_event.expose.area.x = 0; + temp_event.expose.area.y = 0; + temp_event.expose.area.width = event->width; + temp_event.expose.area.height = event->height; + temp_event.expose.count = 0; + + gtk_widget_event (widget, &temp_event); + } + window->handling_resize = FALSE; return FALSE; @@ -991,6 +1019,7 @@ gtk_window_move_resize (GtkWindow *window) gint screen_width; gint screen_height; gboolean needed_resize; + gboolean size_changed; g_return_if_fail (window != NULL); g_return_if_fail (GTK_IS_WINDOW (window)); @@ -1003,8 +1032,10 @@ gtk_window_move_resize (GtkWindow *window) height = widget->requisition.height; gtk_widget_size_request (widget, &widget->requisition); - if ((width != widget->requisition.width || - height != widget->requisition.height)) + size_changed = ((width != widget->requisition.width) || + (height != widget->requisition.height)); + + if (size_changed) { gboolean saved_use_upos; @@ -1077,11 +1108,16 @@ gtk_window_move_resize (GtkWindow *window) gdk_window_get_geometry (widget->window, NULL, NULL, &width, &height, NULL); - if ((window->auto_shrink && - ((width != widget->requisition.width) || - (height != widget->requisition.height))) || - (width < widget->requisition.width) || - (height < widget->requisition.height)) + /* As an optimization, we don't try to get a new size from the + * window manager if we asked for the same size last time and + * didn't get it */ + + if (size_changed && + (((window->auto_shrink && + ((width != widget->requisition.width) || + (height != widget->requisition.height)))) || + ((width < widget->requisition.width) || + (height < widget->requisition.height)))) { window->resize_count += 1; if ((x != -1) && (y != -1)) |