From d7cb94614d93ca364cc3095bd6489a516b7da7c6 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 12 Apr 2004 19:40:22 +0000 Subject: [PATCH] Typo fix. 2004-04-12 Matthias Clasen * gtk/gtktreeview.c (gtk_tree_view_get_cell_area): Typo fix. * gtk/gtkentrycompletion.c (gtk_entry_completion_init): Don't add a shadow inside the scrolled window, add it around the vbox. * gtk/gtkentryprivate.h: * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): Return a boolean indicating whether the popup is positioned above or below. Scroll the completions to the beginning or the end, depending on the positioning. * gtk/gtkentry.c (gtk_entry_completion_key_press): Make keynav wrap around in the entry completion popup, and allow GDK_UP to enter the popup. (#137440) 2004-04-12 Matthias Clasen * gtk/gtkentry.c (gtk_entry_size_request): Make sure the style is there before using it. --- ChangeLog | 22 ++++++++++++++++++++++ ChangeLog.pre-2-10 | 22 ++++++++++++++++++++++ ChangeLog.pre-2-4 | 22 ++++++++++++++++++++++ ChangeLog.pre-2-6 | 22 ++++++++++++++++++++++ ChangeLog.pre-2-8 | 22 ++++++++++++++++++++++ gtk/gtkentry.c | 27 ++++++++++++++++++--------- gtk/gtkentrycompletion.c | 35 +++++++++++++++++++++++++++++------ gtk/gtkentryprivate.h | 5 ++++- gtk/gtktreeview.c | 2 +- 9 files changed, 162 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 297c999fc..cdfa77e7e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2004-04-12 Matthias Clasen + + * gtk/gtktreeview.c (gtk_tree_view_get_cell_area): Typo fix. + + * gtk/gtkentrycompletion.c (gtk_entry_completion_init): Don't add + a shadow inside the scrolled window, add it around the vbox. + + * gtk/gtkentryprivate.h: + * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): + Return a boolean indicating whether the popup is positioned above + or below. Scroll the completions to the beginning or the end, + depending on the positioning. + + * gtk/gtkentry.c (gtk_entry_completion_key_press): Make keynav + wrap around in the entry completion popup, and allow GDK_UP to + enter the popup. (#137440) + +2004-04-12 Matthias Clasen + + * gtk/gtkentry.c (gtk_entry_size_request): Make sure the style is + there before using it. + Sun Apr 11 15:08:45 2004 Jonathan Blandford * gtk/gtktreeprivate.h: Moved search entries into priv data. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 297c999fc..cdfa77e7e 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,25 @@ +2004-04-12 Matthias Clasen + + * gtk/gtktreeview.c (gtk_tree_view_get_cell_area): Typo fix. + + * gtk/gtkentrycompletion.c (gtk_entry_completion_init): Don't add + a shadow inside the scrolled window, add it around the vbox. + + * gtk/gtkentryprivate.h: + * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): + Return a boolean indicating whether the popup is positioned above + or below. Scroll the completions to the beginning or the end, + depending on the positioning. + + * gtk/gtkentry.c (gtk_entry_completion_key_press): Make keynav + wrap around in the entry completion popup, and allow GDK_UP to + enter the popup. (#137440) + +2004-04-12 Matthias Clasen + + * gtk/gtkentry.c (gtk_entry_size_request): Make sure the style is + there before using it. + Sun Apr 11 15:08:45 2004 Jonathan Blandford * gtk/gtktreeprivate.h: Moved search entries into priv data. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 297c999fc..cdfa77e7e 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,25 @@ +2004-04-12 Matthias Clasen + + * gtk/gtktreeview.c (gtk_tree_view_get_cell_area): Typo fix. + + * gtk/gtkentrycompletion.c (gtk_entry_completion_init): Don't add + a shadow inside the scrolled window, add it around the vbox. + + * gtk/gtkentryprivate.h: + * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): + Return a boolean indicating whether the popup is positioned above + or below. Scroll the completions to the beginning or the end, + depending on the positioning. + + * gtk/gtkentry.c (gtk_entry_completion_key_press): Make keynav + wrap around in the entry completion popup, and allow GDK_UP to + enter the popup. (#137440) + +2004-04-12 Matthias Clasen + + * gtk/gtkentry.c (gtk_entry_size_request): Make sure the style is + there before using it. + Sun Apr 11 15:08:45 2004 Jonathan Blandford * gtk/gtktreeprivate.h: Moved search entries into priv data. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 297c999fc..cdfa77e7e 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,25 @@ +2004-04-12 Matthias Clasen + + * gtk/gtktreeview.c (gtk_tree_view_get_cell_area): Typo fix. + + * gtk/gtkentrycompletion.c (gtk_entry_completion_init): Don't add + a shadow inside the scrolled window, add it around the vbox. + + * gtk/gtkentryprivate.h: + * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): + Return a boolean indicating whether the popup is positioned above + or below. Scroll the completions to the beginning or the end, + depending on the positioning. + + * gtk/gtkentry.c (gtk_entry_completion_key_press): Make keynav + wrap around in the entry completion popup, and allow GDK_UP to + enter the popup. (#137440) + +2004-04-12 Matthias Clasen + + * gtk/gtkentry.c (gtk_entry_size_request): Make sure the style is + there before using it. + Sun Apr 11 15:08:45 2004 Jonathan Blandford * gtk/gtktreeprivate.h: Moved search entries into priv data. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 297c999fc..cdfa77e7e 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,25 @@ +2004-04-12 Matthias Clasen + + * gtk/gtktreeview.c (gtk_tree_view_get_cell_area): Typo fix. + + * gtk/gtkentrycompletion.c (gtk_entry_completion_init): Don't add + a shadow inside the scrolled window, add it around the vbox. + + * gtk/gtkentryprivate.h: + * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): + Return a boolean indicating whether the popup is positioned above + or below. Scroll the completions to the beginning or the end, + depending on the positioning. + + * gtk/gtkentry.c (gtk_entry_completion_key_press): Make keynav + wrap around in the entry completion popup, and allow GDK_UP to + enter the popup. (#137440) + +2004-04-12 Matthias Clasen + + * gtk/gtkentry.c (gtk_entry_size_request): Make sure the style is + there before using it. + Sun Apr 11 15:08:45 2004 Jonathan Blandford * gtk/gtktreeprivate.h: Moved search entries into priv data. diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 3f0c4f441..05d37711a 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -1127,6 +1127,7 @@ gtk_entry_size_request (GtkWidget *widget, gint xborder, yborder; PangoContext *context; + gtk_widget_ensure_style (widget); context = gtk_widget_get_pango_context (widget); metrics = pango_context_get_metrics (context, widget->style->font_desc, @@ -1134,7 +1135,7 @@ gtk_entry_size_request (GtkWidget *widget, entry->ascent = pango_font_metrics_get_ascent (metrics); entry->descent = pango_font_metrics_get_descent (metrics); - + get_borders (entry, &xborder, &yborder); xborder += INNER_BORDER; @@ -4703,19 +4704,23 @@ gtk_entry_completion_key_press (GtkWidget *widget, if (event->keyval == GDK_Up || event->keyval == GDK_KP_Up) { - completion->priv->current_selected--; - if (completion->priv->current_selected < -1) - completion->priv->current_selected = -1; + if (completion->priv->current_selected < 0) + completion->priv->current_selected = matches + actions - 1; + else + completion->priv->current_selected--; } else if (event->keyval == GDK_Down || event->keyval == GDK_KP_Down) { - completion->priv->current_selected++; - if (completion->priv->current_selected > matches + actions - 1) - completion->priv->current_selected = matches + actions - 1; + if (completion->priv->current_selected < matches + actions - 1) + completion->priv->current_selected++; + else + completion->priv->current_selected = -1; } else if (event->keyval == GDK_Page_Up) { - if (completion->priv->current_selected <= 0) + if (completion->priv->current_selected < 0) + completion->priv->current_selected = matches + actions - 1; + else if (completion->priv->current_selected == 0) completion->priv->current_selected = -1; else if (completion->priv->current_selected < matches) { @@ -4740,7 +4745,11 @@ gtk_entry_completion_key_press (GtkWidget *widget, if (completion->priv->current_selected > matches - 1) completion->priv->current_selected = matches - 1; } - else + else if (completion->priv->current_selected == matches + actions - 1) + { + completion->priv->current_selected = -1; + } + else { completion->priv->current_selected += 14; if (completion->priv->current_selected > matches + actions - 1) diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c index 3ce0ac07a..34fcb7a69 100644 --- a/gtk/gtkentrycompletion.c +++ b/gtk/gtkentrycompletion.c @@ -24,6 +24,7 @@ #include "gtkintl.h" #include "gtkcellrenderertext.h" +#include "gtkframe.h" #include "gtktreeselection.h" #include "gtktreeview.h" #include "gtkscrolledwindow.h" @@ -254,6 +255,7 @@ gtk_entry_completion_init (GtkEntryCompletion *completion) GtkCellRenderer *cell; GtkTreeSelection *sel; GtkEntryCompletionPrivate *priv; + GtkWidget *popup_frame; /* yes, also priv, need to keep the code readable */ priv = completion->priv = GTK_ENTRY_COMPLETION_GET_PRIVATE (completion); @@ -286,7 +288,7 @@ gtk_entry_completion_init (GtkEntryCompletion *completion) GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (priv->scrolled_window), - GTK_SHADOW_ETCHED_IN); + GTK_SHADOW_NONE); /* a nasty hack to get the completions treeview to size nicely */ gtk_widget_set_size_request (GTK_SCROLLED_WINDOW (priv->scrolled_window)->vscrollbar, -1, 0); @@ -323,8 +325,14 @@ gtk_entry_completion_init (GtkEntryCompletion *completion) G_CALLBACK (gtk_entry_completion_popup_button_press), completion); + popup_frame = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (popup_frame), + GTK_SHADOW_ETCHED_IN); + gtk_widget_show (popup_frame); + gtk_container_add (GTK_CONTAINER (priv->popup_window), popup_frame); + priv->vbox = gtk_vbox_new (FALSE, 0); - gtk_container_add (GTK_CONTAINER (priv->popup_window), priv->vbox); + gtk_container_add (GTK_CONTAINER (popup_frame), priv->vbox); gtk_container_add (GTK_CONTAINER (priv->scrolled_window), priv->tree_view); gtk_box_pack_start (GTK_BOX (priv->vbox), priv->scrolled_window, @@ -1086,7 +1094,7 @@ get_borders (GtkEntry *entry, } /* some nasty size requisition */ -gint +gboolean _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion) { gint x, y; @@ -1095,6 +1103,8 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion) gint monitor_num; GdkRectangle monitor; GtkRequisition popup_req; + GtkTreePath *path; + gboolean above; gdk_window_get_origin (completion->priv->entry->window, &x, &y); get_borders (GTK_ENTRY (completion->priv->entry), &x_border, &y_border); @@ -1151,13 +1161,24 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion) x = monitor.x + monitor.width - popup_req.width; if (y + height + popup_req.height <= monitor.y + monitor.height) - y += height; + { + y += height; + above = FALSE; + path = gtk_tree_path_new_from_indices (0, -1); + } else - y -= popup_req.height; + { + y -= popup_req.height; + above = TRUE; + path = gtk_tree_path_new_from_indices (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->filter_model), NULL) - 1, -1); + } + + gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (completion->priv->tree_view), path, NULL, FALSE, 0.0, 0.0); + gtk_tree_path_free (path); gtk_window_move (GTK_WINDOW (completion->priv->popup_window), x, y); - return height; + return above; } void @@ -1169,6 +1190,8 @@ _gtk_entry_completion_popup (GtkEntryCompletion *completion) if (GTK_WIDGET_MAPPED (completion->priv->popup_window)) return; + completion->priv->may_wrap = TRUE; + column = gtk_tree_view_get_column (GTK_TREE_VIEW (completion->priv->action_view), 0); renderers = gtk_tree_view_column_get_cell_renderers (column); gtk_widget_ensure_style (completion->priv->tree_view); diff --git a/gtk/gtkentryprivate.h b/gtk/gtkentryprivate.h index a4dd01155..7816c8784 100644 --- a/gtk/gtkentryprivate.h +++ b/gtk/gtkentryprivate.h @@ -56,9 +56,12 @@ struct _GtkEntryCompletionPrivate gulong completion_timeout; gulong changed_id; gulong key_press_id; + gulong key_release_id; + + gboolean may_wrap; }; -gint _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion); +gboolean _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion); void _gtk_entry_completion_popup (GtkEntryCompletion *completion); void _gtk_entry_completion_popdown (GtkEntryCompletion *completion); diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index a435faea7..65bc59e7e 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -10725,7 +10725,7 @@ gtk_tree_view_get_path_at_pos (GtkTreeView *tree_view, * gtk_tree_view_get_cell_area: * @tree_view: a #GtkTreeView * @path: a #GtkTreePath for the row, or %NULL to get only horizontal coordinates - * @column: a #GtkTreeViewColumn for the column, or %NULL to get only vertical coordiantes + * @column: a #GtkTreeViewColumn for the column, or %NULL to get only vertical coordinates * @rect: rectangle to fill with cell rect * * Fills the bounding rectangle in tree window coordinates for the cell at the -- 2.43.2